mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Merge "Skip custom Play cling if no accounts are set up" into jb-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a4fe21285b
@@ -57,6 +57,7 @@
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.BIND_APPWIDGET" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
|
||||
<uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS" />
|
||||
|
||||
|
||||
@@ -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)};
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user