SetupWizard: Fix regression, only init pages once
Change-Id: I1207cb3975daa752a66eb8e9e40635f9a8009509 (cherry picked from commit 83be05d6ecf435be562f397e98e0ad61e5974ecd)
This commit is contained in:
parent
dbc1ceb8ca
commit
d0389e4e6e
|
@ -257,7 +257,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializePage() {
|
protected void initializePage() {
|
||||||
final Bundle myPageBundle = mPage.getData();
|
|
||||||
String privacy_policy = getString(R.string.services_privacy_policy);
|
String privacy_policy = getString(R.string.services_privacy_policy);
|
||||||
String policySummary = getString(R.string.services_explanation, privacy_policy);
|
String policySummary = getString(R.string.services_explanation, privacy_policy);
|
||||||
SpannableString ss = new SpannableString(policySummary);
|
SpannableString ss = new SpannableString(policySummary);
|
||||||
|
@ -288,11 +287,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||||
TextView metrics = (TextView) mRootView.findViewById(R.id.enable_metrics_summary);
|
TextView metrics = (TextView) mRootView.findViewById(R.id.enable_metrics_summary);
|
||||||
metrics.setText(metricsSpan);
|
metrics.setText(metricsSpan);
|
||||||
mMetrics = (CheckBox) mRootView.findViewById(R.id.enable_metrics_checkbox);
|
mMetrics = (CheckBox) mRootView.findViewById(R.id.enable_metrics_checkbox);
|
||||||
boolean metricsChecked =
|
|
||||||
!myPageBundle.containsKey(KEY_SEND_METRICS) || myPageBundle
|
|
||||||
.getBoolean(KEY_SEND_METRICS);
|
|
||||||
mMetrics.setChecked(metricsChecked);
|
|
||||||
myPageBundle.putBoolean(KEY_SEND_METRICS, metricsChecked);
|
|
||||||
|
|
||||||
mDefaultThemeRow = mRootView.findViewById(R.id.theme);
|
mDefaultThemeRow = mRootView.findViewById(R.id.theme);
|
||||||
if (hideThemeSwitch(getActivity())) {
|
if (hideThemeSwitch(getActivity())) {
|
||||||
|
@ -311,11 +305,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||||
TextView theme = (TextView) mRootView.findViewById(R.id.enable_theme_summary);
|
TextView theme = (TextView) mRootView.findViewById(R.id.enable_theme_summary);
|
||||||
theme.setText(themeSpan);
|
theme.setText(themeSpan);
|
||||||
mDefaultTheme = (CheckBox) mRootView.findViewById(R.id.enable_theme_checkbox);
|
mDefaultTheme = (CheckBox) mRootView.findViewById(R.id.enable_theme_checkbox);
|
||||||
boolean themesChecked =
|
|
||||||
!myPageBundle.containsKey(KEY_APPLY_DEFAULT_THEME) || myPageBundle
|
|
||||||
.getBoolean(KEY_APPLY_DEFAULT_THEME);
|
|
||||||
mDefaultTheme.setChecked(themesChecked);
|
|
||||||
myPageBundle.putBoolean(KEY_APPLY_DEFAULT_THEME, themesChecked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mNavKeysRow = mRootView.findViewById(R.id.nav_keys);
|
mNavKeysRow = mRootView.findViewById(R.id.nav_keys);
|
||||||
|
@ -350,11 +339,6 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||||
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);
|
||||||
boolean smsChecked = myPageBundle.containsKey(KEY_REGISTER_WHISPERPUSH) ?
|
|
||||||
myPageBundle.getBoolean(KEY_REGISTER_WHISPERPUSH) :
|
|
||||||
false;
|
|
||||||
mSecureSms.setChecked(smsChecked);
|
|
||||||
myPageBundle.putBoolean(KEY_REGISTER_WHISPERPUSH, smsChecked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -366,6 +350,36 @@ public class CyanogenSettingsPage extends SetupPage {
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
updateDisableNavkeysOption();
|
updateDisableNavkeysOption();
|
||||||
|
updateMetricsOption();
|
||||||
|
updateThemeOption();
|
||||||
|
updateSmsOption();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateMetricsOption() {
|
||||||
|
final Bundle myPageBundle = mPage.getData();
|
||||||
|
boolean metricsChecked =
|
||||||
|
!myPageBundle.containsKey(KEY_SEND_METRICS) || myPageBundle
|
||||||
|
.getBoolean(KEY_SEND_METRICS);
|
||||||
|
mMetrics.setChecked(metricsChecked);
|
||||||
|
myPageBundle.putBoolean(KEY_SEND_METRICS, metricsChecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDisableNavkeysOption() {
|
private void updateDisableNavkeysOption() {
|
||||||
|
|
|
@ -58,6 +58,7 @@ public abstract class SetupPageFragment extends Fragment {
|
||||||
mRootView = inflater.inflate(getLayoutResource(), container, false);
|
mRootView = inflater.inflate(getLayoutResource(), container, false);
|
||||||
mTitleView = (TextView) mRootView.findViewById(android.R.id.title);
|
mTitleView = (TextView) mRootView.findViewById(android.R.id.title);
|
||||||
mHeaderView = (ViewGroup ) mRootView.findViewById(R.id.header);
|
mHeaderView = (ViewGroup ) mRootView.findViewById(R.id.header);
|
||||||
|
initializePage();
|
||||||
return mRootView;
|
return mRootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +84,6 @@ public abstract class SetupPageFragment extends Fragment {
|
||||||
if (mTitleView != null) {
|
if (mTitleView != null) {
|
||||||
mTitleView.setText(mPage.getTitleResId());
|
mTitleView.setText(mPage.getTitleResId());
|
||||||
}
|
}
|
||||||
initializePage();
|
|
||||||
mCallbacks.onPageLoaded(mPage);
|
mCallbacks.onPageLoaded(mPage);
|
||||||
getActivity().startPostponedEnterTransition();
|
getActivity().startPostponedEnterTransition();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue