diff --git a/res/drawable-hdpi/timer.png b/res/drawable-hdpi/timer.png new file mode 100755 index 0000000..359045c Binary files /dev/null and b/res/drawable-hdpi/timer.png differ diff --git a/res/drawable-mdpi/timer.png b/res/drawable-mdpi/timer.png new file mode 100755 index 0000000..be27157 Binary files /dev/null and b/res/drawable-mdpi/timer.png differ diff --git a/res/drawable-xhdpi/timer.png b/res/drawable-xhdpi/timer.png new file mode 100755 index 0000000..fcaa753 Binary files /dev/null and b/res/drawable-xhdpi/timer.png differ diff --git a/res/drawable-xxhdpi/timer.png b/res/drawable-xxhdpi/timer.png new file mode 100755 index 0000000..c10cf8f Binary files /dev/null and b/res/drawable-xxhdpi/timer.png differ diff --git a/res/drawable-xxxhdpi/timer.png b/res/drawable-xxxhdpi/timer.png new file mode 100755 index 0000000..ce844a2 Binary files /dev/null and b/res/drawable-xxxhdpi/timer.png differ diff --git a/res/layout/setup_loading_page.xml b/res/layout/setup_loading_page.xml new file mode 100644 index 0000000..9959095 --- /dev/null +++ b/res/layout/setup_loading_page.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 70767bf..5e1b6c6 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -33,10 +33,11 @@ New Skip anyway Don\'t skip + Loading... Setup is complete Welcome - Connect to Wi-Fi + Select Wi-Fi SIM Card Missing GMS account Choose a SIM for Data diff --git a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java index 3e45ed4..8b808dc 100644 --- a/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java +++ b/src/com/cyanogenmod/setupwizard/setup/GmsAccountPage.java @@ -22,6 +22,8 @@ import android.accounts.AccountManagerFuture; import android.accounts.AuthenticatorException; import android.accounts.OperationCanceledException; import android.app.Activity; +import android.app.Fragment; +import android.app.FragmentManager; import android.content.Context; import android.content.Intent; import android.os.Bundle; @@ -40,6 +42,19 @@ public class GmsAccountPage extends SetupPage { super(context, callbacks); } + @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 String getKey() { return TAG; @@ -47,7 +62,7 @@ public class GmsAccountPage extends SetupPage { @Override public int getTitleResId() { - return R.string.setup_gms_account; + return R.string.loading; } @Override @@ -60,6 +75,7 @@ public class GmsAccountPage extends SetupPage { if (action == Page.ACTION_PREVIOUS) { getCallbacks().onPreviousPage(); } else { + super.doLoadAction(context, action); launchGmsAccountSetup(context); } } diff --git a/src/com/cyanogenmod/setupwizard/setup/LoadingFragment.java b/src/com/cyanogenmod/setupwizard/setup/LoadingFragment.java new file mode 100644 index 0000000..1983806 --- /dev/null +++ b/src/com/cyanogenmod/setupwizard/setup/LoadingFragment.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2015 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.cyanogenmod.setupwizard.setup; + +import com.cyanogenmod.setupwizard.R; +import com.cyanogenmod.setupwizard.ui.SetupPageFragment; + +public class LoadingFragment extends SetupPageFragment { + @Override + protected void initializePage() {} + + @Override + protected int getLayoutResource() { + return R.layout.setup_loading_page; + } +} 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; @@ -32,6 +35,19 @@ public class WifiSetupPage extends SetupPage { super(context, callbacks); } + @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; } } diff --git a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java index e37c996..d0f2006 100644 --- a/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java +++ b/src/com/cyanogenmod/setupwizard/util/SetupWizardUtils.java @@ -57,7 +57,7 @@ public class SetupWizardUtils { intent.putExtra(SetupWizardApp.EXTRA_FIRST_RUN, true); intent.putExtra(SetupWizardApp.EXTRA_ALLOW_SKIP, true); intent.putExtra("theme", "material_light"); - intent.putExtra(SetupWizardApp.EXTRA_AUTO_FINISH, true); + intent.putExtra(SetupWizardApp.EXTRA_AUTO_FINISH, false); context.startActivityForResult(intent, SetupWizardApp.REQUEST_CODE_SETUP_WIFI); }