Browse Source

提交人:jtm
提交内容:优化

江天明 11 months ago
parent
commit
a105cb0a29

+ 2 - 2
BusinessAuth/src/main/java/com/develop/auth/ui/MemberProfileFragment.kt

@@ -47,7 +47,7 @@ class MemberProfileFragment : CommonBVMFragment<FragmentMemberProfileBinding, Me
             AgeSelectDialog(hostActivity) { index, change ->
                 selectAge = if (index == 0) {
                     0
-                } else if (index == 1){
+                } else if (index == 1) {
                     20
                 } else {
                     index + 19
@@ -60,7 +60,7 @@ class MemberProfileFragment : CommonBVMFragment<FragmentMemberProfileBinding, Me
             UserIconSelectDialog(viewModel).showDialog(childFragmentManager, "UserIcon")
         }
         binding.tvChooseSex.setOnClickListener {
-            GenderSelectDialog {
+            GenderSelectDialog(selectGender) {
                 selectGender = it
                 when (selectGender) {
                     2 -> {

+ 2 - 2
BusinessAuth/src/main/res/layout/fragment_member_profile.xml

@@ -83,7 +83,7 @@
             android:gravity="center_vertical"
             android:paddingHorizontal="@dimen/convert_66px"
             android:text="@string/none"
-            android:textColor="#B1B2B2"
+            android:textColor="@color/black"
             android:textSize="@dimen/convert_30px"
             app:layout_constraintEnd_toStartOf="@+id/tv_choose_age"
             app:layout_constraintStart_toStartOf="parent"
@@ -99,7 +99,7 @@
             android:gravity="center_vertical"
             android:paddingHorizontal="@dimen/convert_66px"
             android:text="0"
-            android:textColor="#B1B2B2"
+            android:textColor="@color/black"
             android:textSize="@dimen/convert_30px"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toEndOf="@+id/tv_choose_sex"

+ 17 - 4
BusinessCommon/src/main/java/com/develop/common/dialog/GenderSelectDialog.kt

@@ -9,6 +9,7 @@ import com.develop.common.databinding.DialogGenderSelectBinding
 
 
 class GenderSelectDialog(
+    private var selectedPos: Int = 0,
     private val onSelect: (male: Int) -> Unit
 ) : FullScreenTransparentDialog() {
 
@@ -28,27 +29,39 @@ class GenderSelectDialog(
         binding.ivCancel.setOnClickListener {
             removeSelf()
         }
+        if (selectedPos==0){
+            binding.tvSelectFemale.isSelected = false
+            binding.tvSelectMale.isSelected = false
+            binding.tvSelectNo.isSelected = true
+        } else if (selectedPos == 1){
+            binding.tvSelectFemale.isSelected = true
+            binding.tvSelectMale.isSelected = false
+            binding.tvSelectNo.isSelected = false
+        } else {
+            binding.tvSelectFemale.isSelected = false
+            binding.tvSelectMale.isSelected = true
+            binding.tvSelectNo.isSelected = false
+        }
 
         binding.tvSelectNo.setOnClickListener {
             binding.tvSelectFemale.isSelected = false
             binding.tvSelectMale.isSelected = false
-            binding.tvSelectNo.isSelected  =true
+            binding.tvSelectNo.isSelected = true
             onSelect(0)
         }
 
         binding.tvSelectMale.setOnClickListener {
             binding.tvSelectFemale.isSelected = false
             binding.tvSelectMale.isSelected = true
-            binding.tvSelectNo.isSelected  =false
+            binding.tvSelectNo.isSelected = false
             onSelect(2)
         }
         binding.tvSelectFemale.setOnClickListener {
             binding.tvSelectFemale.isSelected = true
             binding.tvSelectMale.isSelected = false
-            binding.tvSelectNo.isSelected  =false
+            binding.tvSelectNo.isSelected = false
             onSelect(1)
         }
-        binding.tvSelectNo.isSelected = true
         return binding.root
     }
 }