summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/AllAppsView.java
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2009-11-10 15:06:42 -0800
committerJoe Onorato <joeo@android.com>2009-11-10 19:56:02 -0800
commit3a8820bdbad90642cf5cda4b00a8c92ecb699159 (patch)
treeaedf0fe5f2e6064dd79101df02c862a4cc4f46a9 /src/com/android/launcher2/AllAppsView.java
parent2ca0ae7d7c4d5f6b24a1b3d987813cad9ee4197f (diff)
downloadpackages_apps_trebuchet-3a8820bdbad90642cf5cda4b00a8c92ecb699159.zip
packages_apps_trebuchet-3a8820bdbad90642cf5cda4b00a8c92ecb699159.tar.gz
packages_apps_trebuchet-3a8820bdbad90642cf5cda4b00a8c92ecb699159.tar.bz2
Fix bug 2250457 - Open folder on home screen changes changes the behaviour of the home button
Now, home always goes to the center worksapce screen and back from an app goes to all apps if it was open. Getting that animations smooth took a little bit of work.
Diffstat (limited to 'src/com/android/launcher2/AllAppsView.java')
-rw-r--r--src/com/android/launcher2/AllAppsView.java80
1 files changed, 58 insertions, 22 deletions
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java
index 722213d..a7a1e64 100644
--- a/src/com/android/launcher2/AllAppsView.java
+++ b/src/com/android/launcher2/AllAppsView.java
@@ -112,6 +112,9 @@ public class AllAppsView extends RSSurfaceView
private boolean mShouldGainFocus;
+ private boolean mZoomDirty = false;
+ private float mNextZoom;
+ private boolean mNextAnimate;
static class Defines {
public static final int ALLOC_PARAMS = 0;
@@ -185,7 +188,6 @@ public class AllAppsView extends RSSurfaceView
super.surfaceChanged(holder, format, w, h);
if (mRS == null) {
-
mRS = createRenderScript(true);
mRollo = new RolloRS();
mRollo.mHasSurface = true;
@@ -198,6 +200,7 @@ public class AllAppsView extends RSSurfaceView
gainFocus();
mShouldGainFocus = false;
}
+ mRollo.dirtyCheck();
} else {
mRollo.mHasSurface = true;
mRollo.dirtyCheck();
@@ -572,32 +575,44 @@ public class AllAppsView extends RSSurfaceView
}
/**
- * Zoom to the specifed amount.
+ * Zoom to the specifed level.
*
- * @param amount [0..1] 0 is hidden, 1 is open
+ * @param zoom [0..1] 0 is hidden, 1 is open
*/
- public void zoom(float amount) {
- if (mRollo == null) {
+ public void zoom(float zoom, boolean animate) {
+ cancelLongPress();
+ if (mRollo == null || !mRollo.mHasSurface) {
+ mZoomDirty = true;
+ mNextZoom = zoom;
+ mNextAnimate = animate;
return;
+ } else {
+ mRollo.setZoom(zoom, animate);
}
+ }
- cancelLongPress();
- mRollo.clearSelectedIcon();
- mRollo.setHomeSelected(SELECTED_NONE);
- if (amount > 0.001f) {
- // set in readback, so we're correct even before the next frame
- mRollo.mState.zoomTarget = amount;
+ public boolean isVisible() {
+ if (mZoomDirty) {
+ return mNextZoom > 0.001f;
} else {
- mRollo.mState.zoomTarget = 0;
+ if (mRollo == null) {
+ return false;
+ } else {
+ return mRollo.mMessageProc.mZoom > 0.001f;
+ }
}
- mRollo.mState.save();
}
- public boolean isVisible() {
- if (mRollo == null) {
- return false;
+ public boolean isOpaque() {
+ if (mZoomDirty) {
+ return mNextZoom > 0.999f;
+ } else {
+ if (mRollo == null) {
+ return false;
+ } else {
+ return mRollo.mMessageProc.mZoom > 0.999f;
+ }
}
- return mRollo.mMessageProc.mZoom > 0.001f;
}
/*
@@ -729,7 +744,7 @@ public class AllAppsView extends RSSurfaceView
private Script.Invokable mInvokeMoveTo;
private Script.Invokable mInvokeFling;
private Script.Invokable mInvokeResetWAR;
-
+ private Script.Invokable mInvokeSetZoom;
private ProgramStore mPSIcons;
private ProgramStore mPSText;
@@ -1003,6 +1018,7 @@ public class AllAppsView extends RSSurfaceView
mInvokeFling = sb.addInvokable("fling");
mInvokeMoveTo = sb.addInvokable("moveTo");
mInvokeResetWAR = sb.addInvokable("resetHWWar");
+ mInvokeSetZoom = sb.addInvokable("setZoom");
mScript = sb.create();
mScript.setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
mScript.bindAllocation(mParams.mAlloc, Defines.ALLOC_PARAMS);
@@ -1022,10 +1038,16 @@ public class AllAppsView extends RSSurfaceView
}
void dirtyCheck() {
- if (mAppsDirty && mHasSurface) {
- uploadApps(mAllAppsList);
- saveAppsList();
- mAppsDirty = false;
+ if (mHasSurface) {
+ if (mAppsDirty) {
+ uploadApps(mAllAppsList);
+ saveAppsList();
+ mAppsDirty = false;
+ }
+ if (mZoomDirty) {
+ setZoom(mNextZoom, mNextAnimate);
+ mZoomDirty = false;
+ }
}
}
@@ -1053,6 +1075,20 @@ public class AllAppsView extends RSSurfaceView
saveAppsList();
}
+ private void setZoom(float zoom, boolean animate) {
+ mRollo.clearSelectedIcon();
+ mRollo.setHomeSelected(SELECTED_NONE);
+ if (zoom > 0.001f) {
+ mRollo.mState.zoomTarget = zoom;
+ } else {
+ mRollo.mState.zoomTarget = 0;
+ }
+ mRollo.mState.save();
+ if (!animate) {
+ mRollo.mInvokeSetZoom.execute();
+ }
+ }
+
private void frameBitmapAllocMips(Allocation alloc, int w, int h) {
int black[] = new int[w > h ? w : h];
Allocation.Adapter2D a = alloc.createAdapter2D();