diff options
author | twyen <twyen@google.com> | 2018-04-24 14:34:33 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-25 11:45:21 -0700 |
commit | 0a5c34d103dc8701e55035e98e6d9fd6c2caf33e (patch) | |
tree | 5a2abde1030ae51aea7df5a8830cd3f782fcfddb /java/com/android/contacts | |
parent | 66adad0ab9921afcf3aefab270c030ceee9888df (diff) | |
download | android_packages_apps_Dialer-0a5c34d103dc8701e55035e98e6d9fd6c2caf33e.tar.gz android_packages_apps_Dialer-0a5c34d103dc8701e55035e98e6d9fd6c2caf33e.tar.bz2 android_packages_apps_Dialer-0a5c34d103dc8701e55035e98e6d9fd6c2caf33e.zip |
Disable entries in CallingAccountSelector that are not selectable
This CL also unifies the disabled color for primary and secondary text.
The in call UI dialog will be implemented in a followup CL.
TEST=TAP
DEFAULT_VALUE_OK=no server.
Bug: 69675796,72618783
Test: TAP
PiperOrigin-RevId: 194147061
Change-Id: I5be5a45a7df09061a3bf391f6ae2a32d9c73b6e3
Diffstat (limited to 'java/com/android/contacts')
3 files changed, 27 insertions, 9 deletions
diff --git a/java/com/android/contacts/common/res/layout/select_account_list_item.xml b/java/com/android/contacts/common/res/layout/select_account_list_item.xml index 84cb1fd66..bf52d6f09 100644 --- a/java/com/android/contacts/common/res/layout/select_account_list_item.xml +++ b/java/com/android/contacts/common/res/layout/select_account_list_item.xml @@ -54,6 +54,7 @@ android:includeFontPadding="false" android:maxLines="1" android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/dialer_secondary_text_color" android:visibility="gone"/> <TextView android:id="@+id/hint" @@ -62,6 +63,7 @@ android:includeFontPadding="false" android:maxLines="1" android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="@color/dialer_secondary_text_color" android:visibility="gone"/> </LinearLayout> diff --git a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java index e1fdd913b..3ee21ccea 100644 --- a/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java +++ b/java/com/android/contacts/common/widget/SelectPhoneAccountDialogFragment.java @@ -57,7 +57,8 @@ import com.google.common.base.Optional; */ public class SelectPhoneAccountDialogFragment extends DialogFragment { - private static final String ARG_OPTIONS = "options"; + @VisibleForTesting public static final String ARG_OPTIONS = "options"; + private static final String ARG_IS_DEFAULT_CHECKED = "is_default_checked"; private SelectPhoneAccountDialogOptions options = @@ -221,18 +222,30 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment { public void onDialogDismissed(@Nullable String callId) {} } - private static class SelectAccountListAdapter + static class SelectAccountListAdapter extends ArrayAdapter<SelectPhoneAccountDialogOptions.Entry> { private int mResId; + private final SelectPhoneAccountDialogOptions options; SelectAccountListAdapter( Context context, int resource, SelectPhoneAccountDialogOptions options) { super(context, resource, options.getEntriesList()); + this.options = options; mResId = resource; } @Override + public boolean areAllItemsEnabled() { + return false; + } + + @Override + public boolean isEnabled(int position) { + return options.getEntries(position).getEnabled(); + } + + @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); @@ -283,7 +296,10 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment { holder.hintTextView.setVisibility(View.VISIBLE); holder.hintTextView.setText(entry.getHint()); } - + holder.labelTextView.setEnabled(entry.getEnabled()); + holder.numberTextView.setEnabled(entry.getEnabled()); + holder.hintTextView.setEnabled(entry.getEnabled()); + holder.imageView.setImageAlpha(entry.getEnabled() ? 255 : 97 /* 38%*/); return rowView; } @@ -297,7 +313,7 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment { return info.get().getCountryIso().toUpperCase(); } - private static final class ViewHolder { + static final class ViewHolder { TextView labelTextView; TextView numberTextView; diff --git a/java/com/android/contacts/common/widget/select_phone_account_dialog_options.proto b/java/com/android/contacts/common/widget/select_phone_account_dialog_options.proto index 9938f57ae..cc40c64b4 100644 --- a/java/com/android/contacts/common/widget/select_phone_account_dialog_options.proto +++ b/java/com/android/contacts/common/widget/select_phone_account_dialog_options.proto @@ -45,10 +45,10 @@ message SelectPhoneAccountDialogOptions { // The hint to show under the phone account, for example showing the user // the account was selected frequently before. optional string hint = 3; - // Whether the account is actually selectable. Defaults to true Sometimes an - // account will be temporarily unusable, for example the user is already in - // a call so the other SIM cannot be used. Hint should also be set to inform - // the user why the account is unavailable. - optional bool enabled = 4; + // Whether the account is actually selectable. Defaults to true. Sometimes + // an account will be temporarily unusable, for example the user is already + // in a call so the other SIM cannot be used. Hint should also be set to + // inform the user why the account is unavailable. + optional bool enabled = 4 [default = true]; } }
\ No newline at end of file |