summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2012-03-17 14:53:08 +0000
committerRicardo Cerqueira <cyanogenmod@cerqueira.org>2012-08-13 14:23:50 +0100
commitd42723e101ed0f07d8fee3ca307a728188d1b714 (patch)
treeeb777fbb94b5d423f1b631904f50ebab0d5174a0 /src
parenteb9e7bec414b6968e6aa902ce6739614189a0e80 (diff)
downloadandroid_packages_apps_Trebuchet-d42723e101ed0f07d8fee3ca307a728188d1b714.tar.gz
android_packages_apps_Trebuchet-d42723e101ed0f07d8fee3ca307a728188d1b714.tar.bz2
android_packages_apps_Trebuchet-d42723e101ed0f07d8fee3ca307a728188d1b714.zip
CellLayout: Better Scaling
Change-Id: I49eb2bbb9d49e5bfba1337d99a246fbceb61f86e
Diffstat (limited to 'src')
-rw-r--r--src/com/cyanogenmod/trebuchet/BubbleTextView.java14
-rw-r--r--src/com/cyanogenmod/trebuchet/CellLayout.java9
-rw-r--r--src/com/cyanogenmod/trebuchet/Workspace.java4
3 files changed, 25 insertions, 2 deletions
diff --git a/src/com/cyanogenmod/trebuchet/BubbleTextView.java b/src/com/cyanogenmod/trebuchet/BubbleTextView.java
index 7b33a5e1f..405deabd3 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();
@@ -331,4 +334,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 39a51d9b7..f69b8ce47 100644
--- a/src/com/cyanogenmod/trebuchet/CellLayout.java
+++ b/src/com/cyanogenmod/trebuchet/CellLayout.java
@@ -276,7 +276,6 @@ public class CellLayout extends ViewGroup {
mForegroundRect = new Rect();
mShortcutsAndWidgets = new ShortcutAndWidgetContainer(context);
- mShortcutsAndWidgets.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap);
addView(mShortcutsAndWidgets);
}
@@ -932,6 +931,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();
@@ -939,12 +943,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 69b668b93..2aeb17417 100644
--- a/src/com/cyanogenmod/trebuchet/Workspace.java
+++ b/src/com/cyanogenmod/trebuchet/Workspace.java
@@ -590,6 +590,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) {
@@ -604,6 +606,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);