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
1 changed files with 34 additions and 21 deletions

View File

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