SetupWizard: Fix regression for devices without custom default theme

Change-Id: Ia223c1b118dbb68e596ff01cf944bc870a321752
(cherry picked from commit 838248ab868a91948fe5d63a0aba50e6dea13643)
This commit is contained in:
cretin45 2015-03-19 15:05:23 -07:00 committed by Ed Carrigan
parent d0389e4e6e
commit 2a01a24066

View File

@ -218,6 +218,10 @@ public class CyanogenSettingsPage extends SetupPage {
private CheckBox mNavKeys; private CheckBox mNavKeys;
private CheckBox mSecureSms; private CheckBox mSecureSms;
private boolean mHideNavKeysRow = false;
private boolean mHideThemeRow = false;
private boolean mHideSmsRow = false;
private View.OnClickListener mMetricsClickListener = new View.OnClickListener() { private View.OnClickListener mMetricsClickListener = new View.OnClickListener() {
@Override @Override
@ -289,7 +293,8 @@ public class CyanogenSettingsPage extends SetupPage {
mMetrics = (CheckBox) mRootView.findViewById(R.id.enable_metrics_checkbox); mMetrics = (CheckBox) mRootView.findViewById(R.id.enable_metrics_checkbox);
mDefaultThemeRow = mRootView.findViewById(R.id.theme); mDefaultThemeRow = mRootView.findViewById(R.id.theme);
if (hideThemeSwitch(getActivity())) { mHideThemeRow = hideThemeSwitch(getActivity());
if (mHideThemeRow) {
mDefaultThemeRow.setVisibility(View.GONE); mDefaultThemeRow.setVisibility(View.GONE);
} else { } else {
mDefaultThemeRow.setOnClickListener(mDefaultThemeClickListener); mDefaultThemeRow.setOnClickListener(mDefaultThemeClickListener);
@ -316,7 +321,8 @@ public class CyanogenSettingsPage extends SetupPage {
needsNavBar = windowManager.needsNavigationBar(); needsNavBar = windowManager.needsNavigationBar();
} catch (RemoteException e) { } catch (RemoteException e) {
} }
if (hideKeyDisabler(getActivity()) || needsNavBar) { mHideNavKeysRow = hideKeyDisabler(getActivity());
if (mHideNavKeysRow || needsNavBar) {
mNavKeysRow.setVisibility(View.GONE); mNavKeysRow.setVisibility(View.GONE);
} else { } else {
boolean navKeysDisabled = boolean navKeysDisabled =
@ -335,7 +341,8 @@ public class CyanogenSettingsPage extends SetupPage {
0, useSecureSms.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 0, useSecureSms.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
TextView secureSms = (TextView) mRootView.findViewById(R.id.secure_sms_summary); TextView secureSms = (TextView) mRootView.findViewById(R.id.secure_sms_summary);
secureSms.setText(secureSmsSpan); secureSms.setText(secureSmsSpan);
if (hideWhisperPush(getActivity())) { mHideSmsRow = hideWhisperPush(getActivity());
if (mHideSmsRow) {
mSecureSmsRow.setVisibility(View.GONE); mSecureSmsRow.setVisibility(View.GONE);
} }
mSecureSms = (CheckBox) mRootView.findViewById(R.id.secure_sms_checkbox); mSecureSms = (CheckBox) mRootView.findViewById(R.id.secure_sms_checkbox);
@ -365,30 +372,36 @@ public class CyanogenSettingsPage extends SetupPage {
} }
private void updateThemeOption() { private void updateThemeOption() {
final Bundle myPageBundle = mPage.getData(); if (!mHideThemeRow) {
boolean themesChecked = final Bundle myPageBundle = mPage.getData();
!myPageBundle.containsKey(KEY_APPLY_DEFAULT_THEME) || myPageBundle boolean themesChecked =
.getBoolean(KEY_APPLY_DEFAULT_THEME); !myPageBundle.containsKey(KEY_APPLY_DEFAULT_THEME) || myPageBundle
mDefaultTheme.setChecked(themesChecked); .getBoolean(KEY_APPLY_DEFAULT_THEME);
myPageBundle.putBoolean(KEY_APPLY_DEFAULT_THEME, themesChecked); mDefaultTheme.setChecked(themesChecked);
myPageBundle.putBoolean(KEY_APPLY_DEFAULT_THEME, themesChecked);
}
} }
private void updateSmsOption() { private void updateSmsOption() {
final Bundle myPageBundle = mPage.getData(); if (!mHideSmsRow) {
boolean smsChecked = myPageBundle.containsKey(KEY_REGISTER_WHISPERPUSH) ? final Bundle myPageBundle = mPage.getData();
myPageBundle.getBoolean(KEY_REGISTER_WHISPERPUSH) : boolean smsChecked = myPageBundle.containsKey(KEY_REGISTER_WHISPERPUSH) ?
false; myPageBundle.getBoolean(KEY_REGISTER_WHISPERPUSH) :
mSecureSms.setChecked(smsChecked); false;
myPageBundle.putBoolean(KEY_REGISTER_WHISPERPUSH, smsChecked); mSecureSms.setChecked(smsChecked);
myPageBundle.putBoolean(KEY_REGISTER_WHISPERPUSH, smsChecked);
}
} }
private void updateDisableNavkeysOption() { private void updateDisableNavkeysOption() {
boolean enabled = Settings.Secure.getInt(getActivity().getContentResolver(), if (!mHideNavKeysRow) {
Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0) != 0; boolean enabled = Settings.Secure.getInt(getActivity().getContentResolver(),
boolean checked = mPage.getData().containsKey(KEY_ENABLE_NAV_KEYS) ? Settings.Secure.DEV_FORCE_SHOW_NAVBAR, 0) != 0;
mPage.getData().getBoolean(KEY_ENABLE_NAV_KEYS) : boolean checked = mPage.getData().containsKey(KEY_ENABLE_NAV_KEYS) ?
enabled; mPage.getData().getBoolean(KEY_ENABLE_NAV_KEYS) :
mNavKeys.setChecked(checked); enabled;
mNavKeys.setChecked(checked);
}
} }
} }