From 151b3ae6ada8c2f49ea191a0dfaee5b990afd890 Mon Sep 17 00:00:00 2001 From: Brandon Maxwell Date: Mon, 26 Sep 2016 15:09:51 -0700 Subject: Fixing display option for KO, JA, ZH Names in Korean, Japanese, and Chinese are sorted and displayed by family name. Because of this, we shouldn't show the "Display Options" setting if the device is set for these locales. Other logic in the code will ignore the user set preferences anyway. Bug:30782253 Change-Id: I15ff7328609aea937940fc60c43e6f0c8dfdb5d2 --- .../dialer/settings/DialerSettingsActivity.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java index fbdb4f9f5..dc1e21457 100644 --- a/src/com/android/dialer/settings/DialerSettingsActivity.java +++ b/src/com/android/dialer/settings/DialerSettingsActivity.java @@ -61,10 +61,12 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { @Override public void onBuildHeaders(List
target) { - Header displayOptionsHeader = new Header(); - displayOptionsHeader.titleRes = R.string.display_options_title; - displayOptionsHeader.fragment = DisplayOptionsSettingsFragment.class.getName(); - target.add(displayOptionsHeader); + if (showDisplayOptions()) { + Header displayOptionsHeader = new Header(); + displayOptionsHeader.titleRes = R.string.display_options_title; + displayOptionsHeader.fragment = DisplayOptionsSettingsFragment.class.getName(); + target.add(displayOptionsHeader); + } Header soundSettingsHeader = new Header(); soundSettingsHeader.titleRes = R.string.sounds_and_vibration_title; @@ -127,6 +129,18 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { } } + /** + * Returns {@code true} or {@code false} based on whether the display options setting should be + * shown. For languages such as Chinese, Japanese, or Korean, display options aren't useful + * since contacts are sorted and displayed family name first by default. + * + * @return {@code true} if the display options should be shown, {@code false} otherwise. + */ + private boolean showDisplayOptions() { + return getResources().getBoolean(R.bool.config_display_order_user_changeable) + && getResources().getBoolean(R.bool.config_sort_order_user_changeable); + } + @Override public void onHeaderClick(Header header, int position) { if (header.id == R.id.settings_header_sounds_and_vibration) { -- cgit v1.2.3