diff options
author | Daniel Sandler <dsandler@google.com> | 2010-03-03 15:05:19 -0500 |
---|---|---|
committer | Daniel Sandler <dsandler@google.com> | 2010-03-03 15:11:52 -0500 |
commit | c351eb8b6a057366f2878f5201f2106ffce439ed (patch) | |
tree | 2a837b376939f7eb636f4ddc48dafd93644c7bd8 /src/com/android/launcher2 | |
parent | 388f679aa448cb648241b89fefa29614a2e3758b (diff) | |
download | android_packages_apps_Trebuchet-c351eb8b6a057366f2878f5201f2106ffce439ed.tar.gz android_packages_apps_Trebuchet-c351eb8b6a057366f2878f5201f2106ffce439ed.tar.bz2 android_packages_apps_Trebuchet-c351eb8b6a057366f2878f5201f2106ffce439ed.zip |
Hide the workspace when launching AllApps2D.
Boosts performance and squashes some weird focus issues.
(Also: fix builds with AllApps3D)
Change-Id: Id1c4628e119c950dced9d3383993674f3d6b9a1c
Diffstat (limited to 'src/com/android/launcher2')
-rw-r--r-- | src/com/android/launcher2/AllApps2D.java | 32 | ||||
-rw-r--r-- | src/com/android/launcher2/AllAppsView.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 10 |
3 files changed, 33 insertions, 13 deletions
diff --git a/src/com/android/launcher2/AllApps2D.java b/src/com/android/launcher2/AllApps2D.java index 4c7b28c0d..55eb21704 100644 --- a/src/com/android/launcher2/AllApps2D.java +++ b/src/com/android/launcher2/AllApps2D.java @@ -134,19 +134,25 @@ public class AllApps2D protected void onFinishInflate() { setBackgroundColor(0xFF000000); - mGrid = (GridView)findViewById(R.id.all_apps_2d_grid); - mGrid.setOnItemClickListener(this); - mGrid.setOnItemLongClickListener(this); - - setOnKeyListener(this); + try { + mGrid = (GridView)findViewWithTag("all_apps_2d_grid"); + if (mGrid == null) throw new Resources.NotFoundException(); + mGrid.setOnItemClickListener(this); + mGrid.setOnItemLongClickListener(this); + + ImageButton homeButton = (ImageButton) findViewWithTag("all_apps_2d_home"); + if (homeButton == null) throw new Resources.NotFoundException(); + homeButton.setOnClickListener( + new View.OnClickListener() { + public void onClick(View v) { + mLauncher.closeAllApps(true); + } + }); + } catch (Resources.NotFoundException e) { + Log.e(TAG, "Can't find necessary layout elements for AllApps2D"); + } - ImageButton homeButton = (ImageButton) findViewById(R.id.all_apps_2d_home); - homeButton.setOnClickListener( - new View.OnClickListener() { - public void onClick(View v) { - mLauncher.closeAllApps(true); - } - }); + setOnKeyListener(this); } public AllApps2D(Context context, AttributeSet attrs, int defStyle) { @@ -235,6 +241,8 @@ public class AllApps2D } else { mZoom = 1.0f; } + + mLauncher.zoomed(mZoom); } public boolean isVisible() { diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index 46f1d34c9..01a6df4e9 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -51,6 +51,10 @@ import java.util.Comparator; public interface AllAppsView { + public interface Watcher { + public void zoomed(float zoom); + }; + public void setLauncher(Launcher launcher); public void setDragController(DragController dragger); diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 79303d79a..5146ffdd4 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -85,7 +85,7 @@ import java.io.DataInputStream; * Default launcher application. */ public final class Launcher extends Activity - implements View.OnClickListener, OnLongClickListener, LauncherModel.Callbacks { + implements View.OnClickListener, OnLongClickListener, LauncherModel.Callbacks, AllAppsView.Watcher { static final String TAG = "Launcher"; static final boolean LOGD = false; @@ -1685,6 +1685,13 @@ public final class Launcher extends Activity return mAllAppsGrid.isVisible(); } + // AllAppsView.Watcher + public void zoomed(float zoom) { + if (zoom == 1.0f) { + mWorkspace.setVisibility(View.GONE); + } + } + void showAllApps(boolean animated) { mAllAppsGrid.zoom(1.0f, animated); @@ -1732,6 +1739,7 @@ public final class Launcher extends Activity */ void closeAllApps(boolean animated) { if (mAllAppsGrid.isVisible()) { + mWorkspace.setVisibility(View.VISIBLE); mAllAppsGrid.zoom(0.0f, animated); ((View)mAllAppsGrid).setFocusable(false); mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus(); |