-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#Resolve conflict with main by adding NetworkFragment instead using i…
…ts utilities on mainActivity#Adding SubscribeNotificationFragment, AddNotificationFragment, PastUserActionsFragment#Convert hard-coded strings as strings.xml resource for make them translatable later#
- Loading branch information
egecan.serbester
committed
Oct 17, 2023
1 parent
ceeeca2
commit dd7cbdf
Showing
32 changed files
with
329 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ui/registration/ChangePasswordFragment.kt → .../authentication/ChangePasswordFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ui/registration/ForgotPasswordFragment.kt → .../authentication/ForgotPasswordFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...platform/ui/registration/LoginFragment.kt → ...atform/ui/authentication/LoginFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...m/ui/registration/RegistrationFragment.kt → ...ui/authentication/RegistrationFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...form/app/src/main/java/com/example/disasterresponseplatform/ui/network/NetworkFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.example.disasterresponseplatform.ui.network | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.Toast | ||
import com.example.disasterresponseplatform.MainActivity | ||
import com.example.disasterresponseplatform.R | ||
import com.example.disasterresponseplatform.databinding.FragmentNetworkBinding | ||
import com.example.disasterresponseplatform.managers.DataResponse | ||
import com.example.disasterresponseplatform.managers.NetworkManager | ||
import com.example.disasterresponseplatform.models.enums.Endpoint | ||
import com.example.disasterresponseplatform.models.enums.RequestType | ||
import retrofit2.Call | ||
import retrofit2.Response | ||
|
||
|
||
class NetworkFragment(val mainActivity: MainActivity) : Fragment() { | ||
|
||
private lateinit var binding: FragmentNetworkBinding | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
binding = FragmentNetworkBinding.inflate(inflater,container,false) | ||
// Inflate the layout for this fragment | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
clickButton() | ||
} | ||
|
||
private fun clickButton(){ | ||
binding.btNetwork.setOnClickListener { | ||
// Handle the button click event | ||
|
||
val networkManager = NetworkManager() | ||
|
||
val headers = mapOf("Authorization" to "Bearer YOUR_TOKEN") | ||
|
||
networkManager.makeRequest( | ||
endpoint = Endpoint.DATA, | ||
requestType = RequestType.GET, // Specify the type of request here | ||
headers = headers, | ||
callback = object : retrofit2.Callback<DataResponse> { | ||
override fun onFailure(call: Call<DataResponse>, t: Throwable) { | ||
Toast.makeText(mainActivity, "Network error: ${t.message}", Toast.LENGTH_SHORT).show() | ||
} | ||
|
||
override fun onResponse(call: Call<DataResponse>, response: Response<DataResponse>) { | ||
if (response.isSuccessful) { | ||
Toast.makeText(mainActivity, "Status Code: ${response.code()}, Successful Response!", Toast.LENGTH_SHORT).show() | ||
} else { | ||
Toast.makeText(mainActivity, "Status Code: ${response.code()}, Error Message: ${response.message()}", Toast.LENGTH_SHORT).show() | ||
} | ||
} | ||
} | ||
) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...a/com/example/disasterresponseplatform/ui/profile/notification/AddNotificationFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.example.disasterresponseplatform.ui.profile.notification | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.example.disasterresponseplatform.R | ||
|
||
|
||
class AddNotificationFragment : Fragment(R.layout.fragment_add_notification) |
44 changes: 44 additions & 0 deletions
44
...example/disasterresponseplatform/ui/profile/notification/SubscribeNotificationFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.example.disasterresponseplatform.ui.profile.notification | ||
|
||
import android.os.Bundle | ||
import androidx.fragment.app.Fragment | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.FragmentTransaction | ||
import com.example.disasterresponseplatform.R | ||
import com.example.disasterresponseplatform.databinding.FragmentSubscribeNotificationBinding | ||
|
||
|
||
class SubscribeNotificationFragment : Fragment() { | ||
|
||
private lateinit var binding: FragmentSubscribeNotificationBinding | ||
private val addNotificationFragment = AddNotificationFragment() | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
binding = FragmentSubscribeNotificationBinding.inflate(inflater,container,false) | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
clickButtons() | ||
} | ||
|
||
private fun clickButtons(){ | ||
binding.btAddNotification.setOnClickListener { | ||
addFragment(addNotificationFragment) | ||
} | ||
} | ||
|
||
private fun addFragment(fragment: Fragment) { | ||
val ft: FragmentTransaction = parentFragmentManager.beginTransaction() | ||
ft.replace(R.id.container, fragment) | ||
ft.addToBackStack(null) | ||
ft.commit() | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
...om/example/disasterresponseplatform/ui/profile/pastUserActions/PastUserActionsFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.example.disasterresponseplatform.ui.profile.pastUserActions | ||
|
||
import androidx.fragment.app.Fragment | ||
import com.example.disasterresponseplatform.R | ||
|
||
class PastUserActionsFragment : Fragment(R.layout.fragment_past_user_actions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...orm/mobile/DisasterResponsePlatform/app/src/main/res/layout/fragment_add_notification.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".ui.profile.notification.AddNotificationFragment"> | ||
|
||
|
||
<TextView | ||
android:id="@+id/tvAddNotification" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="@string/adding_notification_page" | ||
android:textSize="24sp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.