summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-11-08 15:47:17 -0800
committerWinson Chung <winsonc@google.com>2011-11-08 15:54:45 -0800
commit6032e7ed8e6208348a6b3f8bc1a7ecafc7951af8 (patch)
tree8965bff597a779f7f742b9bb23f96094983b8073
parentacec6719208a59ccf32bfd4f46e383c9400945d9 (diff)
downloadandroid_packages_apps_Trebuchet-6032e7ed8e6208348a6b3f8bc1a7ecafc7951af8.tar.gz
android_packages_apps_Trebuchet-6032e7ed8e6208348a6b3f8bc1a7ecafc7951af8.tar.bz2
android_packages_apps_Trebuchet-6032e7ed8e6208348a6b3f8bc1a7ecafc7951af8.zip
Fixing issue where AllApps labels were getting clipped (Bug: 5490118)
- Tweaking the AllApps grid spacing Change-Id: I7eb79edfd170500c1fecd6841e6f022bd40ac250
-rw-r--r--res/layout/apps_customize_pane.xml4
-rw-r--r--res/values-land/dimens.xml2
-rw-r--r--res/values-port/dimens.xml2
-rw-r--r--res/values-sw600dp-land/dimens.xml6
-rw-r--r--res/values-sw600dp-port/dimens.xml4
-rw-r--r--res/values-sw600dp/dimens.xml2
-rw-r--r--res/values-sw600dp/styles.xml4
-rw-r--r--res/values-sw720dp-land/dimens.xml6
-rw-r--r--res/values-sw720dp-port/dimens.xml9
-rw-r--r--res/values-sw720dp/dimens.xml4
-rw-r--r--res/values/attrs.xml8
-rw-r--r--res/values/dimens.xml2
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java16
-rw-r--r--src/com/android/launcher2/PagedViewCellLayout.java13
14 files changed, 50 insertions, 32 deletions
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index 27f2efea6..aaca6952d 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -50,8 +50,8 @@
android:id="@+id/apps_customize_pane_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
- launcher:cellCountX="@integer/apps_customize_cellCountX"
- launcher:cellCountY="@integer/apps_customize_cellCountY"
+ launcher:maxAppCellCountX="@integer/apps_customize_maxCellCountX"
+ launcher:maxAppCellCountY="@integer/apps_customize_maxCellCountY"
launcher:pageLayoutWidthGap="@dimen/apps_customize_pageLayoutWidthGap"
launcher:pageLayoutHeightGap="@dimen/apps_customize_pageLayoutHeightGap"
launcher:pageLayoutPaddingTop="@dimen/apps_customize_pageLayoutPaddingTop"
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index c4aef8ba3..89e6773fc 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -53,8 +53,6 @@
<dimen name="apps_customize_cell_width">80dp</dimen>
<!-- The width can be 76dp because we don't have B padding -->
<dimen name="apps_customize_cell_height">76dp</dimen>
- <integer name="apps_customize_cellCountX">6</integer>
- <integer name="apps_customize_cellCountY">3</integer>
<dimen name="apps_customize_pageLayoutWidthGap">-1dp</dimen>
<dimen name="apps_customize_pageLayoutHeightGap">-1dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingTop">5dp</dimen>
diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml
index 799742f21..b7e8170e1 100644
--- a/res/values-port/dimens.xml
+++ b/res/values-port/dimens.xml
@@ -31,8 +31,6 @@
<dimen name="workspace_page_spacing">-1dp</dimen>
<!-- AppsCustomize -->
- <integer name="apps_customize_cellCountX">4</integer>
- <integer name="apps_customize_cellCountY">5</integer>
<dimen name="apps_customize_pageLayoutWidthGap">-1dp</dimen>
<dimen name="apps_customize_pageLayoutHeightGap">-1dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingTop">10dp</dimen>
diff --git a/res/values-sw600dp-land/dimens.xml b/res/values-sw600dp-land/dimens.xml
index 61d993e31..f51f6f9a4 100644
--- a/res/values-sw600dp-land/dimens.xml
+++ b/res/values-sw600dp-land/dimens.xml
@@ -29,12 +29,12 @@
or right while you're dragging. -->
<dimen name="scroll_zone">100dip</dimen>
- <dimen name="apps_customize_pageLayoutWidthGap">28dp</dimen>
+ <dimen name="apps_customize_pageLayoutWidthGap">36dp</dimen>
<dimen name="apps_customize_pageLayoutHeightGap">8dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingTop">20dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingBottom">14dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingLeft">40dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingRight">40dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingLeft">30dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingRight">30dp</dimen>
<integer name="apps_customize_widget_cell_count_x">3</integer>
<integer name="apps_customize_widget_cell_count_y">2</integer>
</resources>
diff --git a/res/values-sw600dp-port/dimens.xml b/res/values-sw600dp-port/dimens.xml
index ebf837d82..84f983534 100644
--- a/res/values-sw600dp-port/dimens.xml
+++ b/res/values-sw600dp-port/dimens.xml
@@ -36,8 +36,8 @@
<dimen name="apps_customize_pageLayoutHeightGap">36dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingTop">25dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingBottom">10dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingLeft">10dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingRight">10dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingLeft">30dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingRight">30dp</dimen>
<integer name="apps_customize_widget_cell_count_x">2</integer>
<integer name="apps_customize_widget_cell_count_y">3</integer>
</resources> \ No newline at end of file
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 544b970f7..88f3bca24 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -34,7 +34,7 @@
<!-- AppsCustomize -->
<dimen name="apps_customize_tab_bar_height">56dp</dimen>
<dimen name="apps_customize_cell_width">96dp</dimen>
- <dimen name="apps_customize_cell_height">96dp</dimen>
+ <dimen name="apps_customize_cell_height">98dp</dimen>
<dimen name="apps_customize_widget_cell_width_gap">36dp</dimen>
<dimen name="apps_customize_widget_cell_height_gap">36dp</dimen>
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index b315763d2..ec281f993 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -60,7 +60,7 @@
<style name="WorkspaceIcon.Portrait.AppsCustomize">
<item name="android:background">@null</item>
- <item name="android:paddingTop">4dp</item>
+ <item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
@@ -69,7 +69,7 @@
</style>
<style name="WorkspaceIcon.Landscape.AppsCustomize">
<item name="android:background">@null</item>
- <item name="android:paddingTop">4dp</item>
+ <item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:drawablePadding">4dp</item>
<item name="android:textSize">13sp</item>
diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
index 6a54265d9..239bdf5c1 100644
--- a/res/values-sw720dp-land/dimens.xml
+++ b/res/values-sw720dp-land/dimens.xml
@@ -17,4 +17,10 @@
<resources>
<integer name="apps_customize_widget_cell_count_x">4</integer>
<integer name="apps_customize_widget_cell_count_y">2</integer>
+
+<!-- AppsCustomize -->
+ <dimen name="apps_customize_pageLayoutWidthGap">28dp</dimen>
+ <dimen name="apps_customize_pageLayoutHeightGap">16dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingLeft">16dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingRight">16dp</dimen>
</resources> \ No newline at end of file
diff --git a/res/values-sw720dp-port/dimens.xml b/res/values-sw720dp-port/dimens.xml
index 22d56d979..2e3f8ef6f 100644
--- a/res/values-sw720dp-port/dimens.xml
+++ b/res/values-sw720dp-port/dimens.xml
@@ -17,7 +17,14 @@
<resources>
<!-- We can also afford to have a slightly wider portrait layout in
xlarge -->
- <dimen name="apps_customize_pageLayoutWidthGap">36dp</dimen>
<integer name="apps_customize_widget_cell_count_x">3</integer>
<integer name="apps_customize_widget_cell_count_y">3</integer>
+
+<!-- AppsCustomize -->
+ <integer name="apps_customize_maxCellCountX">-1</integer>
+ <integer name="apps_customize_maxCellCountY">7</integer>
+ <dimen name="apps_customize_pageLayoutWidthGap">36dp</dimen>
+ <dimen name="apps_customize_pageLayoutHeightGap">36dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingLeft">24dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingRight">24dp</dimen>
</resources> \ No newline at end of file
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 0373295d4..5c39b01d4 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -17,4 +17,8 @@
<resources>
<dimen name="app_widget_preview_padding_left">0dp</dimen>
<dimen name="app_widget_preview_padding_top">10dp</dimen>
+
+<!-- AppsCustomize -->
+ <integer name="apps_customize_maxCellCountX">-1</integer>
+ <integer name="apps_customize_maxCellCountY">-1</integer>
</resources> \ No newline at end of file
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 800aeaa5c..730e831e9 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -101,10 +101,6 @@
<!-- PagedView specific attributes. These attributes are used to customize
a PagedView view in XML files. -->
<declare-styleable name="PagedView">
- <!-- The number of horizontal cells in a page -->
- <attr name="cellCountX" />
- <!-- The number of vertical cells in a page -->
- <attr name="cellCountY" />
<!-- A spacing override for the icons within a page -->
<attr name="pageLayoutWidthGap" format="dimension" />
<attr name="pageLayoutHeightGap" format="dimension" />
@@ -123,6 +119,10 @@
<!-- AppsCustomizePagedView specific attributes. These attributes are used to
customize an AppsCustomizePagedView in xml files. -->
<declare-styleable name="AppsCustomizePagedView">
+ <!-- Max number of cells of applications horizontally -->
+ <attr name="maxAppCellCountX" format="integer" />
+ <!-- Max number of cells of applications vertically -->
+ <attr name="maxAppCellCountY" format="integer" />
<!-- Horizontal spacing between widgets and wallpapers -->
<attr name="widgetCellWidthGap" format="dimension" />
<!-- Vertical spacing between widgets -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 967ef66f0..7c20d814f 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -54,6 +54,8 @@
<dimen name="toolbar_external_icon_height">36dp</dimen>
<!-- AllApps/Customize/AppsCustomize -->
+ <integer name="apps_customize_maxCellCountX">-1</integer>
+ <integer name="apps_customize_maxCellCountY">-1</integer>
<!-- The height of the tab bar - if this changes, we should update the
external icon width/height above to compensate -->
<dimen name="apps_customize_tab_bar_height">52dp</dimen>
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 9000049d1..6667f7cc1 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -207,6 +207,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Dimens
private int mContentWidth;
private int mAppIconSize;
+ private int mMaxAppCellCountX, mMaxAppCellCountY;
private int mWidgetCountX, mWidgetCountY;
private int mWidgetWidthGap, mWidgetHeightGap;
private final int mWidgetPreviewIconPaddedDimension;
@@ -247,12 +248,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mAppIconSize = resources.getDimensionPixelSize(R.dimen.app_icon_size);
mDragViewMultiplyColor = resources.getColor(R.color.drag_view_multiply_color);
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, 0, 0);
- // TODO-APPS_CUSTOMIZE: remove these unnecessary attrs after
- mCellCountX = a.getInt(R.styleable.PagedView_cellCountX, 6);
- mCellCountY = a.getInt(R.styleable.PagedView_cellCountY, 4);
- a.recycle();
- a = context.obtainStyledAttributes(attrs, R.styleable.AppsCustomizePagedView, 0, 0);
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AppsCustomizePagedView, 0, 0);
+ mMaxAppCellCountX = a.getInt(R.styleable.AppsCustomizePagedView_maxAppCellCountX, -1);
+ mMaxAppCellCountY = a.getInt(R.styleable.AppsCustomizePagedView_maxAppCellCountY, -1);
mWidgetWidthGap =
a.getDimensionPixelSize(R.styleable.AppsCustomizePagedView_widgetCellWidthGap, 0);
mWidgetHeightGap =
@@ -373,6 +371,12 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
maxCellCountY = (isLandscape ? LauncherModel.getCellCountY() :
LauncherModel.getCellCountX());
}
+ if (mMaxAppCellCountX > -1) {
+ maxCellCountX = Math.min(maxCellCountX, mMaxAppCellCountX);
+ }
+ if (mMaxAppCellCountY > -1) {
+ maxCellCountY = Math.min(maxCellCountY, mMaxAppCellCountY);
+ }
// Now that the data is ready, we can calculate the content width, the number of cells to
// use for each page
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 2ef7e296a..6266ca26f 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -69,7 +69,7 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
resources.getDimensionPixelSize(R.dimen.apps_customize_cell_height);
mCellCountX = LauncherModel.getCellCountX();
mCellCountY = LauncherModel.getCellCountY();
- mOriginalHeightGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
+ mOriginalWidthGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
mMaxGap = resources.getDimensionPixelSize(R.dimen.apps_customize_max_gap);
mChildren = new PagedViewCellLayoutChildren(context);
@@ -294,8 +294,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
}
public void setGap(int widthGap, int heightGap) {
- mWidthGap = widthGap;
- mHeightGap = heightGap;
+ mOriginalWidthGap = mWidthGap = widthGap;
+ mOriginalHeightGap = mHeightGap = heightGap;
mChildren.setGap(widthGap, heightGap);
}
@@ -325,10 +325,9 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
* Estimates the number of cells that the specified width would take up.
*/
public int estimateCellHSpan(int width) {
- // The space for a page assuming that we want to show half of a column of the previous and
- // next pages is the width - left padding (current & next page) - right padding (previous &
- // current page) - half cell width (for previous and next pages)
- int availWidth = (int) (width - (2 * mPaddingLeft + 2 * mPaddingRight));
+ // We don't show the next/previous pages any more, so we use the full width, minus the
+ // padding
+ int availWidth = width - (mPaddingLeft + mPaddingRight);
// We know that we have to fit N cells with N-1 width gaps, so we just juggle to solve for N
int n = Math.max(1, (availWidth + mWidthGap) / (mCellWidth + mWidthGap));