summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/setupwizard/setup/WifiSetupPage.java
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2015-01-23 14:04:04 -0800
committercretin45 <cretin45@gmail.com>2015-01-23 14:04:04 -0800
commit1fcde3985e9d62eb22eff0b8eacf1d4832234867 (patch)
treea7b3076149cf0709a0c6df8b0555de8bfbda7e7a /src/com/cyanogenmod/setupwizard/setup/WifiSetupPage.java
parent501a25032dc1783c57a094485f0b7b94c26c9421 (diff)
downloadpackages_apps_SetupWizard-1fcde3985e9d62eb22eff0b8eacf1d4832234867.zip
packages_apps_SetupWizard-1fcde3985e9d62eb22eff0b8eacf1d4832234867.tar.gz
packages_apps_SetupWizard-1fcde3985e9d62eb22eff0b8eacf1d4832234867.tar.bz2
SetupWizard: Add loading fragment if launching into another activity
Also always show the Wi-Fi page Change-Id: I3be39f793403131ea07d071c3d107b1800771e65
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup/WifiSetupPage.java')
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/WifiSetupPage.java31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/WifiSetupPage.java b/src/com/cyanogenmod/setupwizard/setup/WifiSetupPage.java
index 705b932..2d764d6 100644
--- a/src/com/cyanogenmod/setupwizard/setup/WifiSetupPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/WifiSetupPage.java
@@ -17,8 +17,11 @@
package com.cyanogenmod.setupwizard.setup;
import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
+import android.os.Bundle;
import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.SetupWizardApp;
@@ -33,6 +36,19 @@ public class WifiSetupPage extends SetupPage {
}
@Override
+ public Fragment getFragment(FragmentManager fragmentManager, int action) {
+ Fragment fragment = fragmentManager.findFragmentByTag(getKey());
+ if (fragment == null) {
+ Bundle args = new Bundle();
+ args.putString(Page.KEY_PAGE_ARGUMENT, getKey());
+ args.putInt(Page.KEY_PAGE_ACTION, action);
+ fragment = new LoadingFragment();
+ fragment.setArguments(args);
+ }
+ return fragment;
+ }
+
+ @Override
public int getNextButtonTitleResId() {
return R.string.skip;
}
@@ -44,22 +60,23 @@ public class WifiSetupPage extends SetupPage {
@Override
public int getTitleResId() {
- return R.string.existing;
+ return R.string.setup_wifi;
}
@Override
public void doLoadAction(Activity context, int action) {
- if (action == Page.ACTION_PREVIOUS) {
- getCallbacks().onPreviousPage();
- } else {
- SetupWizardUtils.launchWifiSetup(context);
- }
+ super.doLoadAction(context, action);
+ SetupWizardUtils.launchWifiSetup(context);
}
@Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode != SetupWizardApp.REQUEST_CODE_SETUP_WIFI) return false;
- getCallbacks().onNextPage();
+ if (resultCode == Activity.RESULT_OK || resultCode == Activity.RESULT_FIRST_USER) {
+ getCallbacks().onNextPage();
+ } else if (resultCode == Activity.RESULT_CANCELED) {
+ getCallbacks().onPreviousPage();
+ }
return true;
}
}