diff options
author | Adam Cohen <adamcohen@google.com> | 2014-02-21 14:09:53 -0800 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2014-02-21 14:37:53 -0800 |
commit | 71e03b9979b5ee4c30daa7eb0a704ec92b38431b (patch) | |
tree | b1e77f84fa954cc3903532bbd4fd52738dd99f03 /src/com/android/launcher3/LauncherClings.java | |
parent | 36c123ec6b74be058702a37e8a01702b505da5c1 (diff) | |
download | android_packages_apps_Trebuchet-71e03b9979b5ee4c30daa7eb0a704ec92b38431b.tar.gz android_packages_apps_Trebuchet-71e03b9979b5ee4c30daa7eb0a704ec92b38431b.tar.bz2 android_packages_apps_Trebuchet-71e03b9979b5ee4c30daa7eb0a704ec92b38431b.zip |
Fix issue where clings didn't appear after set up wizard (issue 13077829)
-> Also removed the db-created as a criteria for showing the clings
(this was a bit problematic in some cases and going forward)
-> Instead, we use database upgrade as a signal to not show the clings.
This is used instead of the above criteria (to prevent old users from
seeing the migration cling and losing their data.)
-> Stripped some old code related to custom clings that's no longer used.
Change-Id: Ib5e5285e5ddbc60e69eb998ee9fd092ae879150d
Diffstat (limited to 'src/com/android/launcher3/LauncherClings.java')
-rw-r--r-- | src/com/android/launcher3/LauncherClings.java | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/com/android/launcher3/LauncherClings.java b/src/com/android/launcher3/LauncherClings.java index 9d2778cfa..894f64da4 100644 --- a/src/com/android/launcher3/LauncherClings.java +++ b/src/com/android/launcher3/LauncherClings.java @@ -41,7 +41,6 @@ class LauncherClings { private static final String FOLDER_CLING_DISMISSED_KEY = "cling_gel.folder.dismissed"; private static final boolean DISABLE_CLINGS = false; - private static final boolean DISABLE_CUSTOM_CLINGS = true; private static final int SHOW_CLING_DURATION = 250; private static final int DISMISS_CLING_DURATION = 200; @@ -196,8 +195,7 @@ class LauncherClings { SharedPreferences sharedPrefs = mLauncher.getSharedPrefs(); return areClingsEnabled() && !sharedPrefs.getBoolean(FIRST_RUN_CLING_DISMISSED_KEY, false) && - !sharedPrefs.getBoolean(MIGRATION_CLING_DISMISSED_KEY, false) && - LauncherAppState.getLauncherProvider().wasNewDbCreated(); + !sharedPrefs.getBoolean(MIGRATION_CLING_DISMISSED_KEY, false); } public void removeFirstRunAndMigrationClings() { @@ -213,24 +211,6 @@ class LauncherClings { */ 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 - if (!DISABLE_CUSTOM_CLINGS) { - if (sharedPrefs.getInt(LauncherProvider.DEFAULT_WORKSPACE_RESOURCE_ID, 0) != 0 && - mLauncher.getResources().getBoolean(R.bool.config_useCustomClings)) { - // Use a custom cling - View cling = mLauncher.findViewById(R.id.workspace_cling); - ViewGroup clingParent = (ViewGroup) cling.getParent(); - int clingIndex = clingParent.indexOfChild(cling); - clingParent.removeViewAt(clingIndex); - View customCling = mInflater.inflate(R.layout.custom_workspace_cling, - clingParent, false); - clingParent.addView(customCling, clingIndex); - customCling.setId(R.id.workspace_cling); - } - } Cling cling = (Cling) mLauncher.findViewById(R.id.first_run_cling); if (cling != null) { String sbHintStr = mLauncher.getFirstRunClingSearchBarHint(); @@ -292,6 +272,7 @@ class LauncherClings { removeCling(R.id.workspace_cling); } } + public Cling showFoldersCling() { SharedPreferences sharedPrefs = mLauncher.getSharedPrefs(); // Enable the clings only if they have not been dismissed before @@ -314,6 +295,14 @@ class LauncherClings { } } + public static void synchonouslyMarkFirstRunClingDismissed(Context ctx) { + SharedPreferences prefs = ctx.getSharedPreferences( + LauncherAppState.getSharedPreferencesKey(),Context.MODE_PRIVATE); + SharedPreferences.Editor editor = prefs.edit(); + editor.putBoolean(LauncherClings.FIRST_RUN_CLING_DISMISSED_KEY, true); + editor.commit(); + } + /** Removes the cling outright from the DragLayer */ private void removeCling(int id) { final View cling = mLauncher.findViewById(id); @@ -453,4 +442,4 @@ class LauncherClings { dismissCling(cling, null, FOLDER_CLING_DISMISSED_KEY, DISMISS_CLING_DURATION, true); } -}
\ No newline at end of file +} |