diff options
author | Winson Chung <winsonc@google.com> | 2014-01-15 10:33:02 -0800 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2014-01-15 11:34:54 -0800 |
commit | e43a1e788223ab5a4405c5eeb0133ff57efbc768 (patch) | |
tree | 093a9450720c4c595c3d822daf8e709ce96b80ac /src/com/android/launcher3/LauncherClings.java | |
parent | 44f834133e106550a67ecf246e8bc9d4e1644c56 (diff) | |
download | android_packages_apps_Trebuchet-e43a1e788223ab5a4405c5eeb0133ff57efbc768.tar.gz android_packages_apps_Trebuchet-e43a1e788223ab5a4405c5eeb0133ff57efbc768.tar.bz2 android_packages_apps_Trebuchet-e43a1e788223ab5a4405c5eeb0133ff57efbc768.zip |
Tightening migration conditions. (Bug 11973614)
Change-Id: I6d7417b705227472d035f428cbec933cc6dbf2ce
Diffstat (limited to 'src/com/android/launcher3/LauncherClings.java')
-rw-r--r-- | src/com/android/launcher3/LauncherClings.java | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/src/com/android/launcher3/LauncherClings.java b/src/com/android/launcher3/LauncherClings.java index 85937aa62..42a134fdb 100644 --- a/src/com/android/launcher3/LauncherClings.java +++ b/src/com/android/launcher3/LauncherClings.java @@ -200,14 +200,27 @@ class LauncherClings { } } - /** Shows the first run cling */ - public void showFirstRunCling() { + public boolean shouldShowFirstRunOrMigrationClings() { SharedPreferences sharedPrefs = mLauncher.getSharedPrefs(); - if (isClingsEnabled() && - !sharedPrefs.getBoolean(FIRST_RUN_CLING_DISMISSED_KEY, false) && - !skipCustomClingIfNoAccounts() ) { + return isClingsEnabled() && + !sharedPrefs.getBoolean(FIRST_RUN_CLING_DISMISSED_KEY, false) && + !sharedPrefs.getBoolean(MIGRATION_CLING_DISMISSED_KEY, false); + } + public void removeFirstRunAndMigrationClings() { + removeCling(R.id.first_run_cling); + removeCling(R.id.migration_cling); + } + /** + * Shows the first run cling. + * + * This flow is mutually exclusive with showMigrationCling, and only runs if this Launcher + * package was preinstalled or there is no db to migrate from. + */ + public void showFirstRunCling() { + if (!skipCustomClingIfNoAccounts()) { + SharedPreferences sharedPrefs = mLauncher.getSharedPrefs(); // If we're not using the default workspace layout, replace workspace cling // with a custom workspace cling (usually specified in an overlay) // For now, only do this on tablets @@ -238,22 +251,22 @@ class LauncherClings { } initCling(R.id.first_run_cling, 0, false, true); } else { - removeCling(R.id.first_run_cling); + removeFirstRunAndMigrationClings(); } } + /** + * Shows the migration cling. + * + * This flow is mutually exclusive with showFirstRunCling, and only runs if this Launcher + * package was not preinstalled and there exists a db to migrate from. + */ public void showMigrationCling() { - // Enable the clings only if they have not been dismissed before - if (isClingsEnabled() && !mLauncher.getSharedPrefs().getBoolean( - MIGRATION_CLING_DISMISSED_KEY, false)) { - mLauncher.hideWorkspaceSearchAndHotseat(); + mLauncher.hideWorkspaceSearchAndHotseat(); - Cling c = initCling(R.id.migration_cling, 0, false, true); - c.bringScrimToFront(); - c.bringToFront(); - } else { - removeCling(R.id.migration_cling); - } + Cling c = initCling(R.id.migration_cling, 0, false, true); + c.bringScrimToFront(); + c.bringToFront(); } public void showMigrationWorkspaceCling() { @@ -300,7 +313,6 @@ class LauncherClings { } } - /** Removes the cling outright from the DragLayer */ private void removeCling(int id) { final View cling = mLauncher.findViewById(id); |