summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2015-03-13 16:18:24 -0700
committercretin45 <cretin45@gmail.com>2015-03-13 16:18:24 -0700
commitbfde63c27cb0ae757ac7b6045062a6b3b1fdda74 (patch)
tree8511604c95e1159bb084f4492fc9e180b0ac5b80 /src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
parent0ed67f547cf59b7aff7a58ab503c15e69c41c97c (diff)
downloadpackages_apps_SetupWizard-bfde63c27cb0ae757ac7b6045062a6b3b1fdda74.zip
packages_apps_SetupWizard-bfde63c27cb0ae757ac7b6045062a6b3b1fdda74.tar.gz
packages_apps_SetupWizard-bfde63c27cb0ae757ac7b6045062a6b3b1fdda74.tar.bz2
SetupWizard: #blamethemes
Themes keep breaking the handle themeConfig flag. This provides a workaround for cases the activity gets torn down during the finish process. Change-Id: I6664ded3dfff5b69c1217f89f25106953cb5f92a
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java')
-rw-r--r--src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java43
1 files changed, 32 insertions, 11 deletions
diff --git a/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java b/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
index 54f851b..a21988d 100644
--- a/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
+++ b/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
@@ -93,6 +93,10 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
}
mNextButton = (Button) findViewById(R.id.next_button);
mPrevButton = (Button) findViewById(R.id.prev_button);
+ if (mSetupData.isFinished()) {
+ mNextButton.setVisibility(View.INVISIBLE);
+ mPrevButton.setVisibility(View.INVISIBLE);
+ }
mSetupData.registerListener(this);
mNextButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -133,9 +137,18 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
| View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
super.onResume();
- mSetupData.onResume();
- onPageTreeChanged();
- enableButtonBar(true);
+ if (mSetupData.isFinished()) {
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ finishSetup();
+ }
+ }, 500);
+ } else {
+ mSetupData.onResume();
+ onPageTreeChanged();
+ enableButtonBar(true);
+ }
}
@Override
@@ -276,17 +289,18 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
final ThemeManager tm = (ThemeManager) getSystemService(Context.THEME_SERVICE);
tm.addClient(this);
mSetupData.finishPages();
- SetupStats.addEvent(SetupStats.Categories.APP_FINISHED, TAG,
- SetupStats.Label.TOTAL_TIME, String.valueOf(
- System.nanoTime() - sLaunchTime));
- setupWizardApp.sendStickyBroadcastAsUser(
- new Intent(SetupWizardApp.ACTION_FINISHED),
- UserHandle.getCallingUserHandle());
}
@Override
public void onFinish(boolean isSuccess) {
- finishSetup();
+ if (isResumed()) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ finishSetup();
+ }
+ });
+ }
}
@Override
@@ -300,6 +314,13 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
@Override
public void finishSetup() {
if (!mIsFinishing) {
+ SetupStats.addEvent(SetupStats.Categories.APP_FINISHED, TAG,
+ SetupStats.Label.TOTAL_TIME, String.valueOf(
+ System.nanoTime() - sLaunchTime));
+ final SetupWizardApp setupWizardApp = (SetupWizardApp)getApplication();
+ setupWizardApp.sendStickyBroadcastAsUser(
+ new Intent(SetupWizardApp.ACTION_FINISHED),
+ UserHandle.getCallingUserHandle());
mIsFinishing = true;
setupRevealImage();
}
@@ -394,10 +415,10 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks,
wallpaperManager.forgetLoadedWallpaper();
}
});
- finish();
for (Runnable runnable : mFinishRunnables) {
runnable.run();
}
+ finish();
SetupWizardUtils.disableSetupWizard(SetupWizardActivity.this);
}
}