diff options
author | cretin45 <cretin45@gmail.com> | 2015-03-03 12:31:16 -0800 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2015-03-03 12:31:16 -0800 |
commit | c9c13f20c9a86ad23381bef95a100189e0d08bca (patch) | |
tree | 34bea64517a160f258e069c0cbee99fddee2285a /src/com/cyanogenmod/setupwizard/ui | |
parent | 4e192fd22b90a76f8e2b71d23733e8c2b2dae18f (diff) | |
download | packages_apps_SetupWizard-c9c13f20c9a86ad23381bef95a100189e0d08bca.zip packages_apps_SetupWizard-c9c13f20c9a86ad23381bef95a100189e0d08bca.tar.gz packages_apps_SetupWizard-c9c13f20c9a86ad23381bef95a100189e0d08bca.tar.bz2 |
SetupWizard: Add callback for actions to run post finish
Change-Id: Ifa62c94f61afbe33a97a66dc0acb72e303023579
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/ui')
-rw-r--r-- | src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java | 49 |
1 files changed, 34 insertions, 15 deletions
diff --git a/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java b/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java index 7434cad..3f0d6d6 100644 --- a/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java +++ b/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java @@ -47,6 +47,8 @@ import com.cyanogenmod.setupwizard.setup.SetupDataCallbacks; import com.cyanogenmod.setupwizard.util.EnableAccessibilityController; import com.cyanogenmod.setupwizard.util.SetupWizardUtils; +import java.util.ArrayList; + public class SetupWizardActivity extends Activity implements SetupDataCallbacks { @@ -69,6 +71,8 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks private volatile boolean mIsFinishing = false; + private final ArrayList<Runnable> mFinishRunnables = new ArrayList<Runnable>(); + private ThemeManager.ThemeChangeListener mThemeChangeListener = new ThemeManager.ThemeChangeListener() { @Override public void onProgress(int progress) { @@ -274,6 +278,11 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks } @Override + public void addFinishRunnable(Runnable runnable) { + mFinishRunnables.add(runnable); + } + + @Override public void onFinish() { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); Animation fadeOut = AnimationUtils.loadAnimation(this, android.R.anim.fade_out); @@ -313,6 +322,9 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks @Override public void finish() { super.finish(); + for (Runnable runnable : mFinishRunnables) { + runnable.run(); + } overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } @@ -390,21 +402,28 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks } private void finalizeSetup() { - Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); - Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1); + mFinishRunnables.add(new Runnable() { + @Override + public void run() { + Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); + Settings.Secure.putInt(getContentResolver(), + Settings.Secure.USER_SETUP_COMPLETE, 1); + if (mEnableAccessibilityController != null) { + mEnableAccessibilityController.onDestroy(); + } + SetupWizardUtils.disableGMSSetupWizard(SetupWizardActivity.this); + SetupWizardUtils.disableSetupWizard(SetupWizardActivity.this); + final ThemeManager tm = + (ThemeManager) SetupWizardActivity.this.getSystemService(THEME_SERVICE); + tm.removeClient(mThemeChangeListener); + Intent intent = new Intent(Intent.ACTION_MAIN); + intent.addCategory(Intent.CATEGORY_HOME); + startActivity(intent); + final WallpaperManager wallpaperManager = + WallpaperManager.getInstance(SetupWizardActivity.this); + wallpaperManager.forgetLoadedWallpaper(); + } + }); finish(); - if (mEnableAccessibilityController != null) { - mEnableAccessibilityController.onDestroy(); - } - SetupWizardUtils.disableGMSSetupWizard(this); - SetupWizardUtils.disableSetupWizard(this); - final ThemeManager tm = (ThemeManager) this.getSystemService(THEME_SERVICE); - tm.removeClient(mThemeChangeListener); - Intent intent = new Intent(Intent.ACTION_MAIN); - intent.addCategory(Intent.CATEGORY_HOME); - startActivity(intent); - final WallpaperManager wallpaperManager = - WallpaperManager.getInstance(SetupWizardActivity.this); - wallpaperManager.forgetLoadedWallpaper(); } } |