1
0
Эх сурвалжийг харах

Fixes for lingering focus state on single and multi choice items.

Aidan Follestad 10 жил өмнө
parent
commit
80c49d1d4b

+ 3 - 1
library/src/main/java/com/afollestad/materialdialogs/MaterialDialog.java

@@ -190,8 +190,10 @@ public class MaterialDialog extends DialogBase implements View.OnClickListener,
             View v = list.getChildAt(i);
             @SuppressLint("WrongViewCast")
             RadioButton rb = (RadioButton) v.findViewById(R.id.control);
-            if (newSelection != i)
+            if (newSelection != i) {
                 rb.setChecked(false);
+                rb.clearFocus();
+            }
         }
     }
 

+ 1 - 2
library/src/main/res/layout/dialog_listitem_multichoice.xml

@@ -6,8 +6,7 @@
     android:layout_height="wrap_content"
     android:clickable="true"
     android:gravity="center_vertical"
-    android:focusable="false"
-    android:focusableInTouchMode="false">
+    android:descendantFocusability="blocksDescendants">
 
     <CheckBox
         android:id="@+id/control"

+ 1 - 2
library/src/main/res/layout/dialog_listitem_singlechoice.xml

@@ -6,8 +6,7 @@
     android:layout_height="wrap_content"
     android:clickable="true"
     android:gravity="center_vertical"
-    android:focusable="false"
-    android:focusableInTouchMode="false">
+    android:descendantFocusability="blocksDescendants">
 
     <RadioButton
         android:id="@+id/control"