From 477828cc83b60a17eb9b6fc8ee08b4abbc3d2fb1 Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Fri, 20 Sep 2013 12:05:49 -0700 Subject: New folder look / assets -> Restricting the number of items in folders to prevent scrolling (excess items deleted) Change-Id: I4af2590cd5ea7677c875c031f84d4d5bcca3e6e9 --- src/com/android/launcher3/BubbleTextView.java | 25 +++++++++++++++++++++++-- src/com/android/launcher3/Folder.java | 9 ++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) (limited to 'src/com/android/launcher3') diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 7a7a3b61f..54f8846b1 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Rect; import android.graphics.Region; import android.graphics.Region.Op; @@ -55,6 +56,8 @@ public class BubbleTextView extends TextView { private int mPressedOutlineColor; private int mPressedGlowColor; + private int mTextColor; + private boolean mShadowsEnabled = true; private boolean mIsTextVisible; private boolean mBackgroundSizeChanged; @@ -85,6 +88,7 @@ public class BubbleTextView extends TextView { LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.iconTextSize); + setTextColor(getResources().getColor(R.color.workspace_icon_text_color)); } private void init() { @@ -290,6 +294,11 @@ public class BubbleTextView extends TextView { @Override public void draw(Canvas canvas) { + if (!mShadowsEnabled) { + super.draw(canvas); + return; + } + final Drawable background = mBackground; if (background != null) { final int scrollX = getScrollX(); @@ -340,12 +349,24 @@ public class BubbleTextView extends TextView { if (mBackground != null) mBackground.setCallback(null); } + @Override + public void setTextColor(int color) { + mTextColor = color; + super.setTextColor(color); + } + + public void setShadowsEnabled(boolean enabled) { + mShadowsEnabled = enabled; + getPaint().clearShadowLayer(); + invalidate(); + } + public void setTextVisibility(boolean visible) { Resources res = getResources(); if (visible) { - setTextColor(res.getColor(R.color.workspace_icon_text_color)); + super.setTextColor(mTextColor); } else { - setTextColor(res.getColor(android.R.color.transparent)); + super.setTextColor(res.getColor(android.R.color.transparent)); } mIsTextVisible = visible; } diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index 808d85d66..47fc6c3f4 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -143,7 +143,8 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList Resources res = getResources(); mMaxCountX = (int) grid.numColumns; - mMaxCountY = mMaxNumItems = Integer.MAX_VALUE; + mMaxCountY = (int) grid.numRows; + mMaxNumItems = mMaxCountX * mMaxCountY; mInputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); @@ -526,12 +527,14 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList } protected boolean createAndAddShortcut(ShortcutInfo item) { - final TextView textView = - (TextView) mInflater.inflate(R.layout.application, this, false); + final BubbleTextView textView = + (BubbleTextView) mInflater.inflate(R.layout.application, this, false); textView.setCompoundDrawablesWithIntrinsicBounds(null, new FastBitmapDrawable(item.getIcon(mIconCache)), null, null); textView.setText(item.title); textView.setTag(item); + textView.setTextColor(getResources().getColor(R.color.folder_items_text_color)); + textView.setShadowsEnabled(false); textView.setOnClickListener(this); textView.setOnLongClickListener(this); -- cgit v1.2.3