summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDanesh Mondegarian <daneshm90@gmail.com>2014-02-02 02:11:28 -0800
committerAbhisek Devkota <ciwrl@cyanogenmod.com>2014-02-05 02:16:38 +0000
commit20109c489eed6e97803ed5e5745c8c377b0446cb (patch)
tree519756c82c1260c1d7eb2b9b7f11880478ae3fd2 /src
parentdc6e2bafb333b4c0d6311d9c225374f403d105c5 (diff)
downloadandroid_packages_apps_Trebuchet-20109c489eed6e97803ed5e5745c8c377b0446cb.tar.gz
android_packages_apps_Trebuchet-20109c489eed6e97803ed5e5745c8c377b0446cb.tar.bz2
android_packages_apps_Trebuchet-20109c489eed6e97803ed5e5745c8c377b0446cb.zip
Trebuchet : Show cling for allapps overview
This patchset adds a cling for the all apps indicator overview mode as by default it is not very discoverable. PS4: Strings + fixes Change-Id: If7e91a0e123c0fbc4d4f4ed6ef35c1ff7b1abfb1
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/Cling.java41
-rw-r--r--src/com/android/launcher3/Launcher.java31
2 files changed, 63 insertions, 9 deletions
diff --git a/src/com/android/launcher3/Cling.java b/src/com/android/launcher3/Cling.java
index 338b722ab..01a54b4e1 100644
--- a/src/com/android/launcher3/Cling.java
+++ b/src/com/android/launcher3/Cling.java
@@ -18,7 +18,6 @@ package com.android.launcher3;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
-import android.app.ActivityOptions;
import android.content.Context;
import android.content.ComponentName;
import android.content.Intent;
@@ -41,6 +40,7 @@ public class Cling extends FrameLayout implements Insettable, View.OnClickListen
static final String FIRST_RUN_CLING_DISMISSED_KEY = "cling_gel.first_run.dismissed";
static final String WORKSPACE_CLING_DISMISSED_KEY = "cling_gel.workspace.dismissed";
static final String FOLDER_CLING_DISMISSED_KEY = "cling_gel.folder.dismissed";
+ static final String ALL_APPS_CLING_DISMISSED_KEY = "cling_gel.all_apps.dismissed";
private static String FIRST_RUN_PORTRAIT = "first_run_portrait";
private static String FIRST_RUN_LANDSCAPE = "first_run_landscape";
@@ -54,6 +54,8 @@ public class Cling extends FrameLayout implements Insettable, View.OnClickListen
private static String FOLDER_LANDSCAPE = "folder_landscape";
private static String FOLDER_LARGE = "folder_large";
+ private static String ALL_APPS = "all_apps";
+
private static float FIRST_RUN_CIRCLE_BUFFER_DPS = 60;
private static float WORKSPACE_INNER_CIRCLE_RADIUS_DPS = 50;
private static float WORKSPACE_OUTER_CIRCLE_RADIUS_DPS = 60;
@@ -78,6 +80,7 @@ public class Cling extends FrameLayout implements Insettable, View.OnClickListen
private int mBackgroundColor;
private final Rect mInsets = new Rect();
+ private int[] mPosition;
public Cling(Context context) {
this(context, null, 0);
@@ -127,6 +130,13 @@ public class Cling extends FrameLayout implements Insettable, View.OnClickListen
}
}
+ void setPunchThroughForView(View view) {
+ mPosition = new int[2];
+ view.getLocationOnScreen(mPosition);
+ mPosition[0] += view.getWidth() / 2;
+ mPosition[1] += view.getHeight() / 2;
+ }
+
void setFocusedHotseatApp(int drawableId, int appRank, ComponentName cn, String title,
String description) {
// Get the app to draw
@@ -173,7 +183,8 @@ public class Cling extends FrameLayout implements Insettable, View.OnClickListen
if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) ||
mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) ||
mDrawIdentifier.equals(WORKSPACE_LARGE) ||
- mDrawIdentifier.equals(WORKSPACE_CUSTOM)) {
+ mDrawIdentifier.equals(WORKSPACE_CUSTOM) ||
+ mDrawIdentifier.equals(ALL_APPS)) {
View content = getContent();
content.setAlpha(0f);
content.animate()
@@ -300,7 +311,8 @@ public class Cling extends FrameLayout implements Insettable, View.OnClickListen
return (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)
|| mDrawIdentifier.equals(WORKSPACE_LANDSCAPE)
|| mDrawIdentifier.equals(WORKSPACE_LARGE)
- || mDrawIdentifier.equals(WORKSPACE_CUSTOM));
+ || mDrawIdentifier.equals(WORKSPACE_CUSTOM)
+ || mDrawIdentifier.equals(ALL_APPS));
}
@Override
@@ -353,6 +365,9 @@ public class Cling extends FrameLayout implements Insettable, View.OnClickListen
mDrawIdentifier.equals(WORKSPACE_LARGE)) {
mLauncher.dismissWorkspaceCling(null);
return true;
+ } else if (mDrawIdentifier.equals(ALL_APPS)) {
+ mLauncher.dismissAllAppsCling(null);
+ return true;
}
return false;
}
@@ -379,7 +394,8 @@ public class Cling extends FrameLayout implements Insettable, View.OnClickListen
mBackground.draw(canvas);
} else if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) ||
mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) ||
- mDrawIdentifier.equals(WORKSPACE_LARGE)) {
+ mDrawIdentifier.equals(WORKSPACE_LARGE) ||
+ mDrawIdentifier.equals(ALL_APPS)) {
// Initialize the draw buffer (to allow punching through)
eraseBg = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(),
Bitmap.Config.ARGB_8888);
@@ -411,16 +427,23 @@ public class Cling extends FrameLayout implements Insettable, View.OnClickListen
mBubblePaint);
} else if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) ||
mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) ||
- mDrawIdentifier.equals(WORKSPACE_LARGE)) {
+ mDrawIdentifier.equals(WORKSPACE_LARGE) ||
+ mDrawIdentifier.equals(ALL_APPS)) {
int offset = DynamicGrid.pxFromDp(WORKSPACE_CIRCLE_Y_OFFSET_DPS, metrics);
mErasePaint.setAlpha((int) (128));
- eraseCanvas.drawCircle(metrics.widthPixels / 2,
- metrics.heightPixels / 2 - offset,
+ int punchX = metrics.widthPixels / 2;
+ int punchY = metrics.heightPixels / 2 - offset;
+ if (mPosition != null) {
+ punchX = mPosition[0];
+ punchY = mPosition[1];
+ }
+ eraseCanvas.drawCircle(punchX,
+ punchY,
DynamicGrid.pxFromDp(WORKSPACE_OUTER_CIRCLE_RADIUS_DPS, metrics),
mErasePaint);
mErasePaint.setAlpha(0);
- eraseCanvas.drawCircle(metrics.widthPixels / 2,
- metrics.heightPixels / 2 - offset,
+ eraseCanvas.drawCircle(punchX,
+ punchY,
DynamicGrid.pxFromDp(WORKSPACE_INNER_CIRCLE_RADIUS_DPS, metrics),
mErasePaint);
canvas.drawBitmap(eraseBg, 0, 0, null);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index b07943019..d7e9caf7c 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2127,6 +2127,10 @@ public class Launcher extends Activity
return false;
}
+ void enterAllAppsOverviewMode() {
+ mAppsCustomizeContent.enterOverviewMode();
+ }
+
@Override
public boolean onSearchRequested() {
startSearch(null, false, null, true);
@@ -2348,6 +2352,9 @@ public class Launcher extends Activity
@Override
public void onBackPressed() {
if (isAllAppsVisible()) {
+ if (isClingsEnabled()) {
+ dismissAllAppsCling(null);
+ }
if (mAppsCustomizeContent.isInOverviewMode()) {
mAppsCustomizeContent.exitOverviewMode(true);
} else {
@@ -3056,6 +3063,23 @@ public class Launcher extends Activity
AppsCustomizePagedView.ContentType contentType = mAppsCustomizeContent.getContentType();
showAppsCustomizeHelper(animated, springLoaded, contentType);
}
+
+ public void showAllAppsCling() {
+ if (isClingsEnabled() &&
+ !mSharedPrefs.getBoolean(Cling.ALL_APPS_CLING_DISMISSED_KEY, false) &&
+ !skipCustomClingIfNoAccounts() ) {
+ Cling cling = (Cling) findViewById(R.id.all_apps_cling);
+ View pageIndicator = mAppsCustomizeLayout.findViewById(R.id.page_indicator);
+ cling.setPunchThroughForView(pageIndicator);
+ if (cling != null) {
+ cling.bringToFront();
+ }
+ initCling(R.id.all_apps_cling, 0, true, true);
+ } else {
+ removeCling(R.id.all_apps_cling);
+ }
+ }
+
private void showAppsCustomizeHelper(final boolean animated, final boolean springLoaded,
final AppsCustomizePagedView.ContentType contentType) {
if (mStateAnimation != null) {
@@ -3135,6 +3159,8 @@ public class Launcher extends Activity
if (mSearchDropTargetBar != null) {
mSearchDropTargetBar.hideSearchBar(false);
}
+
+ showAllAppsCling();
}
});
@@ -4613,6 +4639,11 @@ public class Launcher extends Activity
dismissCling(cling, null, Cling.FOLDER_CLING_DISMISSED_KEY,
DISMISS_CLING_DURATION, true);
}
+ public void dismissAllAppsCling(View v) {
+ Cling cling = (Cling) findViewById(R.id.all_apps_cling);
+ dismissCling(cling, null, Cling.ALL_APPS_CLING_DISMISSED_KEY,
+ DISMISS_CLING_DURATION, true);
+ }
/**
* To avoid managing preference change listeners for various parts of the