Loading src/com/android/contacts/common/list/AccountFilterActivity.java +8 −0 Original line number Diff line number Diff line Loading @@ -165,13 +165,21 @@ public class AccountFilterActivity extends Activity implements AdapterView.OnIte @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final ContactListFilterView listFilterView = (ContactListFilterView) view; final ContactListFilter filter = (ContactListFilter) view.getTag(); if (filter == null) return; // Just in case if (filter.filterType == ContactListFilter.FILTER_TYPE_CUSTOM) { final Intent intent = new Intent(this, CustomContactListFilterActivity.class); listFilterView.setActivated(true); // Switching activity has the highest priority. So when we open another activity, the // announcement that indicates an account is checked will be interrupted. This is the // way to overcome -- View.announceForAccessibility(CharSequence text); listFilterView.announceForAccessibility(listFilterView.generateContentDescription()); startActivityForResult(intent, SUBACTIVITY_CUSTOMIZE_FILTER); } else { listFilterView.setActivated(true); listFilterView.announceForAccessibility(listFilterView.generateContentDescription()); final Intent intent = new Intent(); intent.putExtra(KEY_EXTRA_CONTACT_LIST_FILTER, filter); setResult(Activity.RESULT_OK, intent); Loading src/com/android/contacts/common/list/ContactListFilterView.java +18 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.contacts.common.list; import android.content.Context; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.View; Loading Loading @@ -74,6 +75,7 @@ public class ContactListFilterView extends LinearLayout { // properly if the button hasn't been initialized. Log.wtf(TAG, "radio-button cannot be activated because it is null"); } setContentDescription(generateContentDescription()); } public void bindView(AccountTypeManager accountTypes) { Loading Loading @@ -127,6 +129,7 @@ public class ContactListFilterView extends LinearLayout { break; } } setContentDescription(generateContentDescription()); } private void bindView(int iconResource, int textResource) { Loading @@ -139,4 +142,19 @@ public class ContactListFilterView extends LinearLayout { mAccountType.setText(textResource); } String generateContentDescription() { final StringBuilder sb = new StringBuilder(); if (!TextUtils.isEmpty(mAccountType.getText())) { sb.append(mAccountType.getText()); } if (!TextUtils.isEmpty(mAccountUserName.getText())) { if (sb.length() > 0) { sb.append(" "); } sb.append(mAccountUserName.getText()); } return getContext().getString(isActivated() ? R.string.account_filter_view_checked : R.string.account_filter_view_not_checked, sb.toString()); } } Loading
src/com/android/contacts/common/list/AccountFilterActivity.java +8 −0 Original line number Diff line number Diff line Loading @@ -165,13 +165,21 @@ public class AccountFilterActivity extends Activity implements AdapterView.OnIte @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final ContactListFilterView listFilterView = (ContactListFilterView) view; final ContactListFilter filter = (ContactListFilter) view.getTag(); if (filter == null) return; // Just in case if (filter.filterType == ContactListFilter.FILTER_TYPE_CUSTOM) { final Intent intent = new Intent(this, CustomContactListFilterActivity.class); listFilterView.setActivated(true); // Switching activity has the highest priority. So when we open another activity, the // announcement that indicates an account is checked will be interrupted. This is the // way to overcome -- View.announceForAccessibility(CharSequence text); listFilterView.announceForAccessibility(listFilterView.generateContentDescription()); startActivityForResult(intent, SUBACTIVITY_CUSTOMIZE_FILTER); } else { listFilterView.setActivated(true); listFilterView.announceForAccessibility(listFilterView.generateContentDescription()); final Intent intent = new Intent(); intent.putExtra(KEY_EXTRA_CONTACT_LIST_FILTER, filter); setResult(Activity.RESULT_OK, intent); Loading
src/com/android/contacts/common/list/ContactListFilterView.java +18 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.contacts.common.list; import android.content.Context; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.View; Loading Loading @@ -74,6 +75,7 @@ public class ContactListFilterView extends LinearLayout { // properly if the button hasn't been initialized. Log.wtf(TAG, "radio-button cannot be activated because it is null"); } setContentDescription(generateContentDescription()); } public void bindView(AccountTypeManager accountTypes) { Loading Loading @@ -127,6 +129,7 @@ public class ContactListFilterView extends LinearLayout { break; } } setContentDescription(generateContentDescription()); } private void bindView(int iconResource, int textResource) { Loading @@ -139,4 +142,19 @@ public class ContactListFilterView extends LinearLayout { mAccountType.setText(textResource); } String generateContentDescription() { final StringBuilder sb = new StringBuilder(); if (!TextUtils.isEmpty(mAccountType.getText())) { sb.append(mAccountType.getText()); } if (!TextUtils.isEmpty(mAccountUserName.getText())) { if (sb.length() > 0) { sb.append(" "); } sb.append(mAccountUserName.getText()); } return getContext().getString(isActivated() ? R.string.account_filter_view_checked : R.string.account_filter_view_not_checked, sb.toString()); } }