From 86b40541a8f48287fed0663f1e6ac10610523d32 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Tue, 1 Jun 2010 14:48:12 -0700 Subject: [PATCH] Make 2D All Apps work better in landscape and on hdpi. * Correct the density (or, rather, remove the density) of the icons in the cache to ensure they're drawn px-for-px. * Create a new landscape layout for 2DAA that aligns things properly (viz: Home icon at right, padding tuned, 6 columns). * Performance improvement: Make the app grid, icons, and home icon all opaque (by setting a black background) and move the home icon so it doesn't overlap the grid. Change-Id: I961323e9e39cb122cdc694853706e7fcdd10142f --- res/layout-land/all_apps_2d.xml | 63 +++++++++++++++++++++ res/{layout => layout-port}/all_apps_2d.xml | 4 +- res/values/dimens.xml | 4 ++ src/com/android/launcher2/AllApps2D.java | 13 ++++- 4 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 res/layout-land/all_apps_2d.xml rename res/{layout => layout-port}/all_apps_2d.xml (95%) diff --git a/res/layout-land/all_apps_2d.xml b/res/layout-land/all_apps_2d.xml new file mode 100644 index 0000000000..a253b937b5 --- /dev/null +++ b/res/layout-land/all_apps_2d.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + diff --git a/res/layout/all_apps_2d.xml b/res/layout-port/all_apps_2d.xml similarity index 95% rename from res/layout/all_apps_2d.xml rename to res/layout-port/all_apps_2d.xml index 7bbfa91e7f..0607d62cc7 100644 --- a/res/layout/all_apps_2d.xml +++ b/res/layout-port/all_apps_2d.xml @@ -36,7 +36,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="true" - android:layout_marginBottom="28dip" + android:layout_marginBottom="@dimen/button_bar_height" android:layout_marginTop="8dip" android:nextFocusDown="@+id/all_apps_2d_home" android:nextFocusUp="@null" @@ -49,7 +49,7 @@ android:id="@+id/all_apps_2d_home" android:tag="all_apps_2d_home" android:src="@drawable/home_button" - android:background="#00000000" + android:background="#FF000000" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" android:layout_width="wrap_content" diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 26cb7e630d..790f835999 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -24,6 +24,10 @@ button_bar_height changes --> 56dip + + 25dip + 12dip diff --git a/src/com/android/launcher2/AllApps2D.java b/src/com/android/launcher2/AllApps2D.java index 90c87fb18b..86571cfc7c 100644 --- a/src/com/android/launcher2/AllApps2D.java +++ b/src/com/android/launcher2/AllApps2D.java @@ -20,6 +20,8 @@ import android.content.ComponentName; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.BitmapDrawable; +import android.graphics.Bitmap; +import android.graphics.Color; import android.util.AttributeSet; import android.util.Log; import android.view.KeyEvent; @@ -49,6 +51,7 @@ public class AllApps2D DragSource { private static final String TAG = "Launcher.AllApps2D"; + private static final boolean DEBUG = false; private Launcher mLauncher; private DragController mDragController; @@ -100,7 +103,13 @@ public class AllApps2D // } final TextView textView = (TextView) convertView; + if (DEBUG) { + Log.d(TAG, "icon bitmap = " + info.iconBitmap + + " density = " + info.iconBitmap.getDensity()); + } + info.iconBitmap.setDensity(Bitmap.DENSITY_NONE); textView.setCompoundDrawablesWithIntrinsicBounds(null, new BitmapDrawable(info.iconBitmap), null, null); + textView.setBackgroundColor(Color.BLACK); textView.setText(info.title); return convertView; @@ -118,13 +127,15 @@ public class AllApps2D @Override protected void onFinishInflate() { - setBackgroundColor(0xFF000000); + setBackgroundColor(Color.BLACK); try { mGrid = (GridView)findViewWithTag("all_apps_2d_grid"); if (mGrid == null) throw new Resources.NotFoundException(); mGrid.setOnItemClickListener(this); mGrid.setOnItemLongClickListener(this); + mGrid.setBackgroundColor(Color.BLACK); + mGrid.setCacheColorHint(Color.BLACK); ImageButton homeButton = (ImageButton) findViewWithTag("all_apps_2d_home"); if (homeButton == null) throw new Resources.NotFoundException();