diff options
author | nebkat <nebkat@teamhacksung.org> | 2012-03-17 14:53:08 +0000 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-11-19 01:21:04 +0000 |
commit | 2bbba4784c25a56fadb37c44c4e8a9cf8aed0e4f (patch) | |
tree | 2b8af4dd9c9e8e8ef20f944a365e2a8034d18cf2 /src | |
parent | 47d32eef7fce4b79a334b1df49b20456cdde7f83 (diff) | |
download | packages_apps_trebuchet-2bbba4784c25a56fadb37c44c4e8a9cf8aed0e4f.zip packages_apps_trebuchet-2bbba4784c25a56fadb37c44c4e8a9cf8aed0e4f.tar.gz packages_apps_trebuchet-2bbba4784c25a56fadb37c44c4e8a9cf8aed0e4f.tar.bz2 |
CellLayout: Better Scaling
Change-Id: I49eb2bbb9d49e5bfba1337d99a246fbceb61f86e
Diffstat (limited to 'src')
-rw-r--r-- | src/com/cyanogenmod/trebuchet/BubbleTextView.java | 14 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/CellLayout.java | 9 | ||||
-rw-r--r-- | src/com/cyanogenmod/trebuchet/Workspace.java | 4 |
3 files changed, 25 insertions, 2 deletions
diff --git a/src/com/cyanogenmod/trebuchet/BubbleTextView.java b/src/com/cyanogenmod/trebuchet/BubbleTextView.java index 5d8b217..739440b 100644 --- a/src/com/cyanogenmod/trebuchet/BubbleTextView.java +++ b/src/com/cyanogenmod/trebuchet/BubbleTextView.java @@ -61,6 +61,9 @@ public class BubbleTextView extends TextView { private boolean mStayPressed; private CheckLongPressHelper mLongPressHelper; + private boolean mTextVisible = true; + private CharSequence mVisibleText; + public BubbleTextView(Context context) { super(context); init(); @@ -339,4 +342,15 @@ public class BubbleTextView extends TextView { mLongPressHelper.cancelLongPress(); } + + public void setTextVisible(boolean visible) { + if (mTextVisible == visible) return; + mTextVisible = visible; + if (visible) { + setText(mVisibleText); + } else { + mVisibleText = getText(); + setText(""); + } + } } diff --git a/src/com/cyanogenmod/trebuchet/CellLayout.java b/src/com/cyanogenmod/trebuchet/CellLayout.java index c0ae113..b4b6b2e 100644 --- a/src/com/cyanogenmod/trebuchet/CellLayout.java +++ b/src/com/cyanogenmod/trebuchet/CellLayout.java @@ -280,7 +280,6 @@ public class CellLayout extends ViewGroup { mForegroundRect = new Rect(); mShortcutsAndWidgets = new ShortcutAndWidgetContainer(context); - mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap); addView(mShortcutsAndWidgets); } @@ -975,6 +974,11 @@ public class CellLayout extends ViewGroup { int numWidthGaps = mCountX - 1; int numHeightGaps = mCountY - 1; + if (!LauncherApplication.isScreenLarge()){ + mCellWidth = (widthSpecSize - mPaddingLeft - mPaddingRight) / mCountX; + mCellHeight = (heightSpecSize - mPaddingTop - mPaddingBottom) / mCountY; + } + if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) { int hSpace = widthSpecSize - getPaddingLeft() - getPaddingRight(); int vSpace = heightSpecSize - getPaddingTop() - getPaddingBottom(); @@ -982,12 +986,13 @@ public class CellLayout extends ViewGroup { int vFreeSpace = vSpace - (mCountY * mCellHeight); mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0); mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0); - mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap); } else { mWidthGap = mOriginalWidthGap; mHeightGap = mOriginalHeightGap; } + mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap); + // Initial values correspond to widthSpecMode == MeasureSpec.EXACTLY int newWidth = widthSpecSize; int newHeight = heightSpecSize; diff --git a/src/com/cyanogenmod/trebuchet/Workspace.java b/src/com/cyanogenmod/trebuchet/Workspace.java index 0601589..3c63e0d 100644 --- a/src/com/cyanogenmod/trebuchet/Workspace.java +++ b/src/com/cyanogenmod/trebuchet/Workspace.java @@ -584,6 +584,8 @@ public class Workspace extends SmoothPagedView // Hide folder title in the hotseat if (child instanceof FolderIcon) { ((FolderIcon) child).setTextVisible(false); + } else if (child instanceof BubbleTextView) { + ((BubbleTextView) child).setTextVisible(false); } if (screen < 0) { @@ -598,6 +600,8 @@ public class Workspace extends SmoothPagedView // Show folder title if not in the hotseat if (child instanceof FolderIcon) { ((FolderIcon) child).setTextVisible(true); + } else if (child instanceof BubbleTextView) { + ((BubbleTextView) child).setTextVisible(true); } layout = (CellLayout) getChildAt(screen); |