diff options
author | Michael Jurka <mikejurka@google.com> | 2012-05-22 22:00:31 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2012-05-22 22:00:31 -0700 |
commit | 974c3864bb438fc924913e0017385f873332d052 (patch) | |
tree | bb5f9b4668f5850a72be09016716a9d0ea6f7212 /src/com/android | |
parent | b6d33ebc41b13cb51d4bc142cbfbf4970aba9426 (diff) | |
download | android_packages_apps_Trebuchet-974c3864bb438fc924913e0017385f873332d052.tar.gz android_packages_apps_Trebuchet-974c3864bb438fc924913e0017385f873332d052.tar.bz2 android_packages_apps_Trebuchet-974c3864bb438fc924913e0017385f873332d052.zip |
Skip custom Play cling if no accounts are set up
Bug: 6519934
Change-Id: Ic796b2fb03201a3c767f92b36edfdb4b2e41e5d4
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/launcher2/Cling.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 17 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/com/android/launcher2/Cling.java b/src/com/android/launcher2/Cling.java index 5cde0b447..c83ee2fde 100644 --- a/src/com/android/launcher2/Cling.java +++ b/src/com/android/launcher2/Cling.java @@ -115,6 +115,10 @@ public class Cling extends FrameLayout { mIsInitialized = false; } + public String getDrawIdentifier() { + return mDrawIdentifier; + } + private int[] getPunchThroughPositions() { if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) { return new int[]{getMeasuredWidth() / 2, getMeasuredHeight() - (mButtonBarHeight / 2)}; diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 84b5003eb..d01de9c77 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -17,6 +17,8 @@ package com.android.launcher2; +import android.accounts.Account; +import android.accounts.AccountManager; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; @@ -3516,10 +3518,23 @@ public final class Launcher extends Activity }); } } + + private boolean skipCustomClingIfNoAccounts() { + Cling cling = (Cling) findViewById(R.id.workspace_cling); + boolean customCling = cling.getDrawIdentifier().equals("workspace_custom"); + if (customCling) { + AccountManager am = AccountManager.get(this); + Account[] accounts = am.getAccountsByType("com.google"); + return accounts.length == 0; + } + return false; + } + public void showFirstRunWorkspaceCling() { // Enable the clings only if they have not been dismissed before if (isClingsEnabled() && - !mSharedPrefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) { + !mSharedPrefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false) && + !skipCustomClingIfNoAccounts() ) { initCling(R.id.workspace_cling, null, false, 0); } else { removeCling(R.id.workspace_cling); |