diff options
author | Adam Cohen <adamcohen@google.com> | 2014-02-21 14:09:53 -0800 |
---|---|---|
committer | Danesh Mondegarian <daneshm90@gmail.com> | 2014-06-07 06:59:54 -0700 |
commit | 27d5c94c5c57bfb171f518f1e7cebae33c1c22da (patch) | |
tree | bd62ed53facdd50ccf4388030bba7d9393536004 | |
parent | 953e0828b29215bb96b029ec01e6e6a3ae841b1e (diff) | |
download | android_packages_apps_Trebuchet-27d5c94c5c57bfb171f518f1e7cebae33c1c22da.tar.gz android_packages_apps_Trebuchet-27d5c94c5c57bfb171f518f1e7cebae33c1c22da.tar.bz2 android_packages_apps_Trebuchet-27d5c94c5c57bfb171f518f1e7cebae33c1c22da.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
-rw-r--r-- | res/layout/custom_workspace_cling.xml | 32 | ||||
-rw-r--r-- | res/values/strings.xml | 12 | ||||
-rw-r--r-- | src/com/android/launcher3/LauncherClings.java | 25 | ||||
-rw-r--r-- | src/com/android/launcher3/LauncherProvider.java | 12 |
4 files changed, 14 insertions, 67 deletions
diff --git a/res/layout/custom_workspace_cling.xml b/res/layout/custom_workspace_cling.xml deleted file mode 100644 index 3744f2e4b..000000000 --- a/res/layout/custom_workspace_cling.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2012 The Android Open Source 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. ---> -<!-- dummy layout, to be replaced in overlays --> -<com.android.launcher3.Cling - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" - android:layout_width="match_parent" - android:layout_height="match_parent" - launcher:drawIdentifier="workspace_custom"> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textSize="20dp" - android:textColor="@android:color/holo_blue_light" - android:text="@string/dummy_custom_cling_error_message" - android:gravity="start" - android:layout_gravity="bottom|start" - /> -</com.android.launcher3.Cling> diff --git a/res/values/strings.xml b/res/values/strings.xml index 2c6306a56..9cb6c293b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -252,18 +252,6 @@ s --> <!-- Folder name format --> <string name="folder_name_format">Folder: <xliff:g id="name" example="Games">%1$s</xliff:g></string> - <!-- Strings used in device overlays --> - - <!-- Clings --> - <!-- Dummy string [CHAR_LIMIT=40] --> - <string name="custom_workspace_cling_title_1"></string> - <!-- Dummy string [CHAR_LIMIT=60] --> - <string name="custom_workspace_cling_description_1"></string> - <!-- Dummy string [CHAR_LIMIT=40] --> - <string name="custom_workspace_cling_title_2"></string> - <!-- Dummy string [CHAR_LIMIT=60] --> - <string name="custom_workspace_cling_description_2"></string> - <!-- Debug-only activity name. [DO NOT TRANSLATE] --> <string name="debug_memory_activity">* HPROF</string> diff --git a/src/com/android/launcher3/LauncherClings.java b/src/com/android/launcher3/LauncherClings.java index f996f1f45..e5e0c1621 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 @@ -316,7 +297,7 @@ class LauncherClings { public static void synchonouslyMarkFirstRunClingDismissed(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences( - LauncherAppState.getSharedPreferencesKey(), Context.MODE_PRIVATE); + LauncherAppState.getSharedPreferencesKey(),Context.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(LauncherClings.FIRST_RUN_CLING_DISMISSED_KEY, true); editor.commit(); diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java index fe6e88dda..46bf3882d 100644 --- a/src/com/android/launcher3/LauncherProvider.java +++ b/src/com/android/launcher3/LauncherProvider.java @@ -75,7 +75,7 @@ public class LauncherProvider extends ContentProvider { private static final String DATABASE_NAME = "launcher.db"; - private static final int DATABASE_VERSION = 18; + private static final int DATABASE_VERSION = 19; static final String OLD_AUTHORITY = "com.android.launcher2.settings"; static final String AUTHORITY = ProviderConfig.AUTHORITY; @@ -846,6 +846,16 @@ public class LauncherProvider extends ContentProvider { } } + if (version < 19) { + // We use the db version upgrade here to identify users who may not have seen + // clings yet (because they weren't available), but for whom the clings are now + // available (tablet users). Because one of the possible cling flows (migration) + // is very destructive (wipes out workspaces), we want to prevent this from showing + // until clear data. We do so by marking that the clings have been shown. + LauncherClings.synchonouslyMarkFirstRunClingDismissed(mContext); + version = 19; + } + if (version != DATABASE_VERSION) { Log.w(TAG, "Destroying all old data."); db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES); |