diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/myhealth/MyHealthFragment.kt b/app/src/main/java/org/ole/planet/myplanet/ui/myhealth/MyHealthFragment.kt
index c4c73a94c1..3708c5637e 100644
--- a/app/src/main/java/org/ole/planet/myplanet/ui/myhealth/MyHealthFragment.kt
+++ b/app/src/main/java/org/ole/planet/myplanet/ui/myhealth/MyHealthFragment.kt
@@ -102,7 +102,7 @@ class MyHealthFragment : Fragment() {
private fun selectPatient() {
userModelList = mRealm.where(RealmUserModel::class.java).sort("joinDate", Sort.DESCENDING).findAll()
- adapter = UserListArrayAdapter(requireActivity(), android.R.layout.simple_list_item_1, userModelList)
+ adapter = UserListArrayAdapter(requireActivity(), R.layout.list_item, userModelList)
alertHealthListBinding = AlertHealthListBinding.inflate(LayoutInflater.from(context))
alertHealthListBinding.btnAddMember.setOnClickListener {
startActivity(Intent(requireContext(), BecomeMemberActivity::class.java))
@@ -110,16 +110,22 @@ class MyHealthFragment : Fragment() {
setTextWatcher(alertHealthListBinding.etSearch, alertHealthListBinding.btnAddMember, alertHealthListBinding.list)
alertHealthListBinding.list.adapter = adapter
- alertHealthListBinding.list.onItemClickListener = OnItemClickListener { _: AdapterView<*>?, _: View, i: Int, _: Long ->
+ alertHealthListBinding.list.choiceMode = ListView.CHOICE_MODE_SINGLE
+ alertHealthListBinding.list.onItemClickListener = OnItemClickListener { _: AdapterView<*>?, view: View, i: Int, _: Long ->
val selected = alertHealthListBinding.list.adapter.getItem(i) as RealmUserModel
userId = if (selected._id.isNullOrEmpty()) selected.id else selected._id
getHealthRecords(userId)
+ view.isActivated = true
dialog?.dismiss()
}
sortList(alertHealthListBinding.spnSort, alertHealthListBinding.list)
dialog = AlertDialog.Builder(requireActivity())
.setTitle(getString(R.string.select_health_member)).setView(alertHealthListBinding.root)
.setCancelable(false).setNegativeButton(R.string.dismiss, null).create()
+
+ dialog!!.setOnShowListener{
+ dialog!!.window?.setBackgroundDrawableResource(R.color.secondary_bg)
+ }
dialog?.show()
}
diff --git a/app/src/main/res/drawable/list_item_selector.xml b/app/src/main/res/drawable/list_item_selector.xml
new file mode 100644
index 0000000000..abb7be2a29
--- /dev/null
+++ b/app/src/main/res/drawable/list_item_selector.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout/alert_health_list.xml b/app/src/main/res/layout/alert_health_list.xml
index c702b703cd..8317da1b2a 100644
--- a/app/src/main/res/layout/alert_health_list.xml
+++ b/app/src/main/res/layout/alert_health_list.xml
@@ -4,26 +4,33 @@
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:gravity="center"
+ android:background="@color/secondary_bg"
android:orientation="vertical">
+ android:padding="8dp"
+ android:popupBackground="@color/secondary_bg"
+ android:theme="@style/CustomAlertDialog"/>
diff --git a/app/src/main/res/layout/list_item.xml b/app/src/main/res/layout/list_item.xml
new file mode 100644
index 0000000000..5688f375b9
--- /dev/null
+++ b/app/src/main/res/layout/list_item.xml
@@ -0,0 +1,8 @@
+
+
\ No newline at end of file