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 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,6 +372,7 @@ public class CyanogenSettingsPage extends SetupPage {
}
private void updateThemeOption() {
if (!mHideThemeRow) {
final Bundle myPageBundle = mPage.getData();
boolean themesChecked =
!myPageBundle.containsKey(KEY_APPLY_DEFAULT_THEME) || myPageBundle
@ -372,8 +380,10 @@ public class CyanogenSettingsPage extends SetupPage {
mDefaultTheme.setChecked(themesChecked);
myPageBundle.putBoolean(KEY_APPLY_DEFAULT_THEME, themesChecked);
}
}
private void updateSmsOption() {
if (!mHideSmsRow) {
final Bundle myPageBundle = mPage.getData();
boolean smsChecked = myPageBundle.containsKey(KEY_REGISTER_WHISPERPUSH) ?
myPageBundle.getBoolean(KEY_REGISTER_WHISPERPUSH) :
@ -381,8 +391,10 @@ public class CyanogenSettingsPage extends SetupPage {
mSecureSms.setChecked(smsChecked);
myPageBundle.putBoolean(KEY_REGISTER_WHISPERPUSH, smsChecked);
}
}
private void updateDisableNavkeysOption() {
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) ?
@ -390,6 +402,7 @@ public class CyanogenSettingsPage extends SetupPage {
enabled;
mNavKeys.setChecked(checked);
}
}
}
}