private static final String THEME_MATERIAL = "material";
private static final String THEME_MATERIAL_LIGHT = "material_light";
+ // Key for whether the user selected network in saved instance state bundle
+ private static final String PARAM_USER_SELECTED_NETWORK = "userSelectedNetwork";
+
// Activity result when pressing the Skip button
private static final int RESULT_SKIP = Activity.RESULT_FIRST_USER;
mAllowSkip = intent.getBooleanExtra(EXTRA_ALLOW_SKIP, true);
// Behave like the user already selected a network if we do not require selection
mUserSelectedNetwork = !intent.getBooleanExtra(EXTRA_REQUIRE_USER_NETWORK_SELECTION, false);
+ }
- refreshConnectionState();
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putBoolean(PARAM_USER_SELECTED_NETWORK, mUserSelectedNetwork);
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Bundle savedInstanceState) {
+ super.onRestoreInstanceState(savedInstanceState);
+ mUserSelectedNetwork = savedInstanceState.getBoolean(PARAM_USER_SELECTED_NETWORK, true);
}
private void refreshConnectionState() {
if (mAutoFinishOnConnection && mUserSelectedNetwork) {
Log.d(TAG, "Auto-finishing with connection");
finishOrNext(Activity.RESULT_OK);
+ // Require a user selection before auto-finishing next time we are here. The user
+ // can either connect to a different network or press "next" to proceed.
+ mUserSelectedNetwork = false;
}
if (mNavigationBar != null) {
mNavigationBar.getNextButton().setText(R.string.setup_wizard_next_button_label);
public void onResume() {
super.onResume();
registerReceiver(mReceiver, mFilter);
+ refreshConnectionState();
}
@Override
return WifiSettingsForSetupWizard.class;
}
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (resultCode == Activity.RESULT_CANCELED) {
- Log.d(TAG, "Back into WifiSetupActivity. Requiring user selection.");
- // Require a user selection before we auto advance again. Or the user can press the
- // next button if there is a valid WiFi connection.
- mUserSelectedNetwork = false;
- }
- super.onActivityResult(requestCode, resultCode, data);
- }
-
/**
* Complete this activity and return the results to the caller. If using WizardManager, this
* will invoke the next scripted action; otherwise, we simply finish.
getWindow().setNavigationBarColor(Color.TRANSPARENT);
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
- refreshConnectionState();
}
@Override