summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornebkat <nebkat@teamhacksung.org>2012-03-17 14:53:08 +0000
committernebkat <nebkat@teamhacksung.org>2012-03-18 12:12:41 +0000
commit6a60a83fc2adbf21408d6533717296dfd525d7de (patch)
treedc33c1c1d6c2dbce2e5e99367569f7cbd5d23cf8
parent7f221ae496b3be70a50a475b01b1f342e6e7e7e5 (diff)
downloadandroid_packages_apps_Trebuchet-6a60a83fc2adbf21408d6533717296dfd525d7de.tar.gz
android_packages_apps_Trebuchet-6a60a83fc2adbf21408d6533717296dfd525d7de.tar.bz2
android_packages_apps_Trebuchet-6a60a83fc2adbf21408d6533717296dfd525d7de.zip
CellLayout: Better Scaling
Change-Id: I49eb2bbb9d49e5bfba1337d99a246fbceb61f86e
-rw-r--r--res/values-sw340dp-land/dimens.xml8
-rw-r--r--res/values-sw340dp-port/dimens.xml8
-rw-r--r--src/com/cyanogenmod/trebuchet/BubbleTextView.java14
-rw-r--r--src/com/cyanogenmod/trebuchet/CellLayout.java8
-rw-r--r--src/com/cyanogenmod/trebuchet/Workspace.java4
5 files changed, 33 insertions, 9 deletions
diff --git a/res/values-sw340dp-land/dimens.xml b/res/values-sw340dp-land/dimens.xml
index b469ac08e..6994a30a6 100644
--- a/res/values-sw340dp-land/dimens.xml
+++ b/res/values-sw340dp-land/dimens.xml
@@ -37,12 +37,12 @@
<dimen name="qsb_bar_height">48dp</dimen>
<!-- height of the bottom row of controls -->
- <dimen name="button_bar_height">80dip</dimen>
+ <dimen name="button_bar_height">64dip</dimen>
<!-- Because portal animations go beyond the bounds of an icon, we need
to make the dock layout slightly larger than the button_bar_height -->
- <dimen name="button_bar_height_top_padding">8dp</dimen>
- <dimen name="button_bar_height_bottom_padding">8dp</dimen>
+ <dimen name="button_bar_height_top_padding">0dp</dimen>
+ <dimen name="button_bar_height_bottom_padding">0dp</dimen>
<dimen name="button_bar_width_left_padding">8dp</dimen>
<dimen name="button_bar_width_right_padding">8dp</dimen>
- <dimen name="button_bar_height_plus_padding">80dp</dimen>
+ <dimen name="button_bar_height_plus_padding">64dp</dimen>
</resources>
diff --git a/res/values-sw340dp-port/dimens.xml b/res/values-sw340dp-port/dimens.xml
index bf7ebc3d5..ec608c2ca 100644
--- a/res/values-sw340dp-port/dimens.xml
+++ b/res/values-sw340dp-port/dimens.xml
@@ -43,14 +43,14 @@
<dimen name="qsb_padding_right">6dp</dimen>
<dimen name="search_bar_height">48dp</dimen>
<!-- height of the bottom row of controls -->
- <dimen name="button_bar_height">80dip</dimen>
+ <dimen name="button_bar_height">64dip</dimen>
<!-- Because portal animations go beyond the bounds of an icon, we need
to make the dock layout slightly larger than the button_bar_height -->
- <dimen name="button_bar_height_top_padding">8dp</dimen>
- <dimen name="button_bar_height_bottom_padding">8dp</dimen>
+ <dimen name="button_bar_height_top_padding">0dp</dimen>
+ <dimen name="button_bar_height_bottom_padding">0dp</dimen>
<dimen name="button_bar_width_left_padding">8dp</dimen>
<dimen name="button_bar_width_right_padding">8dp</dimen>
- <dimen name="button_bar_height_plus_padding">80dp</dimen>
+ <dimen name="button_bar_height_plus_padding">64dp</dimen>
<!-- AppsCustomize -->
<dimen name="apps_customize_pageLayoutPaddingTop">16dp</dimen>
diff --git a/src/com/cyanogenmod/trebuchet/BubbleTextView.java b/src/com/cyanogenmod/trebuchet/BubbleTextView.java
index 0fa3d910f..83ab2aabf 100644
--- a/src/com/cyanogenmod/trebuchet/BubbleTextView.java
+++ b/src/com/cyanogenmod/trebuchet/BubbleTextView.java
@@ -62,6 +62,9 @@ public class BubbleTextView extends TextView {
private boolean mStayPressed;
+ private boolean mTextVisible = true;
+ private CharSequence mVisibleText;
+
public BubbleTextView(Context context) {
super(context);
init();
@@ -314,4 +317,15 @@ public class BubbleTextView extends TextView {
}
return true;
}
+
+ 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 8bb5b567f..0586d296d 100644
--- a/src/com/cyanogenmod/trebuchet/CellLayout.java
+++ b/src/com/cyanogenmod/trebuchet/CellLayout.java
@@ -255,7 +255,6 @@ public class CellLayout extends ViewGroup {
mForegroundRect = new Rect();
mChildren = new CellLayoutChildren(context);
- mChildren.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap);
addView(mChildren);
}
@@ -835,6 +834,11 @@ public class CellLayout extends ViewGroup {
int numWidthGaps = mCountX - 1;
int numHeightGaps = mCountY - 1;
+ if (!LauncherApplication.isScreenLarge()){
+ mCellWidth = mOriginalCellWidth = (widthSpecSize - mPaddingLeft - mPaddingRight) / mCountX;
+ mCellHeight = mOriginalCellHeight = (heightSpecSize - mPaddingTop - mPaddingBottom) / mCountY;
+ }
+
if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) {
int hSpace = widthSpecSize - mPaddingLeft - mPaddingRight;
int vSpace = heightSpecSize - mPaddingTop - mPaddingBottom;
@@ -848,6 +852,8 @@ public class CellLayout extends ViewGroup {
mHeightGap = mOriginalHeightGap;
}
+ mChildren.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 35d1b71b0..9c253692d 100644
--- a/src/com/cyanogenmod/trebuchet/Workspace.java
+++ b/src/com/cyanogenmod/trebuchet/Workspace.java
@@ -574,6 +574,8 @@ public class Workspace extends PagedView
// 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) {
@@ -588,6 +590,8 @@ public class Workspace extends PagedView
// 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) getPageAt(screen);