Fix talkback when tapping on disabled SIM contacts
am: 25251581a3
Change-Id: Ie21fbb611a15d2ec7cd4a22f41afd4fa7ae37d6b
diff --git a/res/layout/fragment_sim_import.xml b/res/layout/fragment_sim_import.xml
index 2da988e..b0eb280 100644
--- a/res/layout/fragment_sim_import.xml
+++ b/res/layout/fragment_sim_import.xml
@@ -63,8 +63,8 @@
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:paddingTop="8dp"
- android:clipToPadding="false"/>
+ android:clipToPadding="false"
+ android:paddingTop="8dp"/>
<android.support.v4.widget.ContentLoadingProgressBar
android:id="@+id/loading_progress"
diff --git a/src/com/android/contacts/SimImportFragment.java b/src/com/android/contacts/SimImportFragment.java
index c43caaa..2bd4bac 100644
--- a/src/com/android/contacts/SimImportFragment.java
+++ b/src/com/android/contacts/SimImportFragment.java
@@ -391,6 +391,12 @@
private void setViewEnabled(ContactListItemView itemView, boolean enabled) {
itemView.getCheckBox().setEnabled(enabled);
itemView.getNameTextView().setEnabled(enabled);
+ // If the checkbox is left to default it's "unchecked" state will be announced when
+ // it is clicked on instead of the snackbar which is not useful.
+ int accessibilityMode = enabled ?
+ View.IMPORTANT_FOR_ACCESSIBILITY_YES :
+ View.IMPORTANT_FOR_ACCESSIBILITY_NO;
+ itemView.getCheckBox().setImportantForAccessibility(accessibilityMode);
}
}