summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2010-10-20 17:49:27 -0700
committerWinson Chung <winsonc@google.com>2010-10-20 18:39:54 -0700
commitdf4b83dd9d6380ab963c62d1f9d1312efc87cb0f (patch)
treee8fd6a182f7af67fc7779207b4e2fed696f56ce5 /src/com
parentbae3d061cc16ad005302b5eec404c4c0bc3a7421 (diff)
downloadandroid_packages_apps_Trebuchet-df4b83dd9d6380ab963c62d1f9d1312efc87cb0f.tar.gz
android_packages_apps_Trebuchet-df4b83dd9d6380ab963c62d1f9d1312efc87cb0f.tar.bz2
android_packages_apps_Trebuchet-df4b83dd9d6380ab963c62d1f9d1312efc87cb0f.zip
More spacing changes for AllApps.
- Also testing a simple scale of existing icons in lieu of high res icons. Change-Id: Ib9758064536cd1b1704344ea885bccdc93dd3466
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher2/AllAppsPagedView.java3
-rw-r--r--src/com/android/launcher2/CustomizePagedView.java2
-rw-r--r--src/com/android/launcher2/PagedView.java6
-rw-r--r--src/com/android/launcher2/PagedViewCellLayout.java19
-rw-r--r--src/com/android/launcher2/PagedViewIcon.java14
-rw-r--r--src/com/android/launcher2/Workspace.java5
6 files changed, 41 insertions, 8 deletions
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 42101eb4c..5de53d80f 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -358,6 +358,7 @@ public class AllAppsPagedView extends PagedView
layout.setCellCount(mCellCountX, mCellCountY);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
+ layout.setGap(mPageLayoutWidthGap, mPageLayoutHeightGap);
addView(layout);
}
@@ -414,7 +415,7 @@ public class AllAppsPagedView extends PagedView
final int index = i - startIndex;
final ApplicationInfo info = mFilteredApps.get(i);
PagedViewIcon icon = (PagedViewIcon) layout.getChildAt(index);
- icon.applyFromApplicationInfo(info, mPageViewIconCache);
+ icon.applyFromApplicationInfo(info, mPageViewIconCache, true);
PagedViewCellLayout.LayoutParams params =
(PagedViewCellLayout.LayoutParams) icon.getLayoutParams();
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 6b7aa98cb..f832b62bd 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -722,7 +722,7 @@ public class CustomizePagedView extends PagedView
final ApplicationInfo info = mApps.get(i);
PagedViewIcon icon = (PagedViewIcon) mInflater.inflate(
R.layout.all_apps_paged_view_application, layout, false);
- icon.applyFromApplicationInfo(info, mPageViewIconCache);
+ icon.applyFromApplicationInfo(info, mPageViewIconCache, false);
icon.setOnClickListener(this);
icon.setOnLongClickListener(this);
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 39a6af048..4ccc4aeab 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -96,6 +96,8 @@ public abstract class PagedView extends ViewGroup {
protected int mPageLayoutPaddingBottom;
protected int mPageLayoutPaddingLeft;
protected int mPageLayoutPaddingRight;
+ protected int mPageLayoutWidthGap;
+ protected int mPageLayoutHeightGap;
protected int mCellCountX;
protected int mCellCountY;
@@ -184,6 +186,10 @@ public abstract class PagedView extends ViewGroup {
R.styleable.PagedView_pageLayoutPaddingLeft, 10);
mPageLayoutPaddingRight = a.getDimensionPixelSize(
R.styleable.PagedView_pageLayoutPaddingRight, 10);
+ mPageLayoutWidthGap = a.getDimensionPixelSize(
+ R.styleable.PagedView_pageLayoutWidthGap, -1);
+ mPageLayoutHeightGap = a.getDimensionPixelSize(
+ R.styleable.PagedView_pageLayoutHeightGap, -1);
a.recycle();
setHapticFeedbackEnabled(false);
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index b247a065f..0a5a2ec29 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -46,6 +46,8 @@ public class PagedViewCellLayout extends ViewGroup {
private int mCellCountY;
private int mCellWidth;
private int mCellHeight;
+ private int mWidthGap;
+ private int mHeightGap;
private static int sDefaultCellDimensions = 96;
public PagedViewCellLayout(Context context) {
@@ -66,6 +68,7 @@ public class PagedViewCellLayout extends ViewGroup {
mCellCountX = LauncherModel.getCellCountX();
mCellCountY = LauncherModel.getCellCountY();
mHolographicAlpha = 0.0f;
+ mWidthGap = mHeightGap = -1;
}
@Override
@@ -168,12 +171,17 @@ public class PagedViewCellLayout extends ViewGroup {
paddingLeft += ((widthGap - minGap) * (mCellCountX - 1)) / 2;
}
*/
- widthGap = heightGap = minGap;
+ if (mWidthGap > -1 && mHeightGap > -1) {
+ widthGap = mWidthGap;
+ heightGap = mHeightGap;
+ } else {
+ widthGap = heightGap = minGap;
+ }
int newWidth = mPaddingLeft + mPaddingRight + (mCellCountX * cellWidth) +
- ((mCellCountX - 1) * minGap);
+ ((mCellCountX - 1) * widthGap);
int newHeight = mPaddingTop + mPaddingBottom + (mCellCountY * cellHeight) +
- ((mCellCountY - 1) * minGap);
+ ((mCellCountY - 1) * heightGap);
final int count = getChildCount();
for (int i = 0; i < count; i++) {
@@ -252,6 +260,11 @@ public class PagedViewCellLayout extends ViewGroup {
requestLayout();
}
+ public void setGap(int widthGap, int heightGap) {
+ mWidthGap = widthGap;
+ mHeightGap = heightGap;
+ }
+
public void setCellDimensions(int width, int height) {
mCellWidth = width;
mCellHeight = height;
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index 0f7898b27..010c573f1 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -54,6 +54,7 @@ public class PagedViewIcon extends TextView implements Checkable {
private Object mIconCacheKey;
private PagedViewIconCache mIconCache;
+ private int mScaledIconSize;
private int mAlpha;
private int mHolographicAlpha;
@@ -82,6 +83,7 @@ public class PagedViewIcon extends TextView implements Checkable {
mHoloOutlineColor = a.getColor(R.styleable.PagedViewIcon_outlineColor, 0);
mCheckedBlurColor = a.getColor(R.styleable.PagedViewIcon_checkedBlurColor, 0);
mCheckedOutlineColor = a.getColor(R.styleable.PagedViewIcon_checkedOutlineColor, 0);
+ mScaledIconSize = a.getDimensionPixelSize(R.styleable.PagedViewIcon_scaledIconSize, 64);
a.recycle();
if (sHolographicOutlineHelper == null) {
@@ -93,13 +95,21 @@ public class PagedViewIcon extends TextView implements Checkable {
setBackgroundDrawable(null);
}
- public void applyFromApplicationInfo(ApplicationInfo info, PagedViewIconCache cache) {
+ public void applyFromApplicationInfo(ApplicationInfo info, PagedViewIconCache cache,
+ boolean scaleUp) {
mIconCache = cache;
mIconCacheKey = info;
mHolographicOutline = mIconCache.getOutline(mIconCacheKey);
+ Bitmap icon;
+ if (scaleUp) {
+ icon = Bitmap.createScaledBitmap(info.iconBitmap, mScaledIconSize,
+ mScaledIconSize, true);
+ } else {
+ icon = info.iconBitmap;
+ }
setCompoundDrawablesWithIntrinsicBounds(null,
- new FastBitmapDrawable(info.iconBitmap), null, null);
+ new FastBitmapDrawable(icon), null, null);
setText(info.title);
setTag(info);
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index d123374d2..42a6f1b70 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -715,7 +715,10 @@ public class Workspace extends SmoothPagedView
final int screenCount = getChildCount();
float totalWidth = screenCount * scaledPageWidth + (screenCount - 1) * extraScaledSpacing;
- float newY = getResources().getDimension(R.dimen.smallScreenVerticalMargin);
+ boolean isPortrait = getMeasuredHeight() > getMeasuredWidth();
+ float newY = (isPortrait ?
+ getResources().getDimension(R.dimen.smallScreenVerticalMarginPortrait) :
+ getResources().getDimension(R.dimen.smallScreenVerticalMarginLandscape));
float finalAlpha = 1.0f;
float extraShrinkFactor = 1.0f;
if (shrinkPosition == ShrinkPosition.SHRINK_TO_BOTTOM_VISIBLE) {