From 006b25f88d56ef59c78f376fa2b07a34a2cef6e3 Mon Sep 17 00:00:00 2001 From: Joe Onorato Date: Thu, 3 Sep 2009 11:38:43 -0700 Subject: [PATCH] Always have the AllAppsView visible, but have it draw nothing when it shouldn't be visible. This lets us do clean animations and not wait for GL to spool up. --- res/layout-port/launcher.xml | 1 - res/raw/rollo.c | 7 ++++++- src/com/android/launcher2/AllAppsView.java | 13 +++++++++++++ src/com/android/launcher2/Launcher.java | 9 ++------- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/res/layout-port/launcher.xml b/res/layout-port/launcher.xml index 5b5c37cb38..edfa9f11d8 100644 --- a/res/layout-port/launcher.xml +++ b/res/layout-port/launcher.xml @@ -26,7 +26,6 @@ android:id="@+id/all_apps_view" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:visibility="gone" android:scrollbarStyle="outsideInset" android:drawSelectorOnTop="false" diff --git a/res/raw/rollo.c b/res/raw/rollo.c index 028d537f9d..283d89da8f 100644 --- a/res/raw/rollo.c +++ b/res/raw/rollo.c @@ -33,7 +33,7 @@ #define STATE_SELECTED_ICON_INDEX 9 #define STATE_SELECTED_ICON_TEXTURE 10 -#define STATE_BORDERY0 11 +#define STATE_VISIBLE 11 // Drawing constants, should be parameters ====== #define VIEW_ANGLE 1.28700222f @@ -155,6 +155,11 @@ main(int launchID) // Clear to transparent pfClearColor(0.0f, 0.0f, 0.0f, 0.0f); + // If we're not supposed to be showing, don't do anything. + if (!loadI32(ALLOC_STATE, STATE_VISIBLE)) { + return 0; + } + // icons & labels int iconCount = loadI32(ALLOC_STATE, STATE_ICON_COUNT); int pageCount = count_pages(iconCount); diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index 375fc12c71..9967332dee 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -282,6 +282,18 @@ public class AllAppsView extends RSSurfaceView public void onDropCompleted(View target, boolean success) { } + public void show() { + mRollo.mState.read(); + mRollo.mState.visible = 1; + mRollo.mState.save(); + } + + public void hide(boolean animate) { + mRollo.mState.read(); + mRollo.mState.visible = 0; + mRollo.mState.save(); + } + /* private TouchHandler mScrollHandler = new TouchHandler() { @Override @@ -409,6 +421,7 @@ public class AllAppsView extends RSSurfaceView @AllocationIndex(8) public int startScrollX; @AllocationIndex(9) public int selectedIconIndex = -1; @AllocationIndex(10) public int selectedIconTexture; + @AllocationIndex(11) public int visible; } public RolloRS() { diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 06f106ec1c..9bcb537883 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -1583,7 +1583,7 @@ public final class Launcher extends Activity void showAllAppsDialog() { mAllAppsVisible = true; - mAllAppsGrid.setVisibility(View.VISIBLE); + mAllAppsGrid.show(); mWorkspace.hide(); // TODO: fade these two too @@ -1594,12 +1594,7 @@ public final class Launcher extends Activity void closeAllAppsDialog(boolean animated) { if (mAllAppsVisible) { Log.d(LOG_TAG, "closing all apps"); - if (animated) { - // TODO mDrawer.animateClose(); - mAllAppsGrid.setVisibility(View.GONE); - } else { - mAllAppsGrid.setVisibility(View.GONE); - } + mAllAppsGrid.hide(animated); mAllAppsVisible = false; mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus(); mWorkspace.show();