summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2010-10-24 13:59:29 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-24 13:59:29 -0700
commit4c0505dcc2686fcb04ec6340869af4ee825dcb98 (patch)
tree98eeda2f44ce6998f68ad5d1a5c56f45a01fbaf7
parent42a9dbce8ab88edb68341f5b34eb266efd7a1561 (diff)
parentece7f5b3b55cab646941123e03589241a61678e2 (diff)
downloadandroid_packages_apps_Trebuchet-4c0505dcc2686fcb04ec6340869af4ee825dcb98.tar.gz
android_packages_apps_Trebuchet-4c0505dcc2686fcb04ec6340869af4ee825dcb98.tar.bz2
android_packages_apps_Trebuchet-4c0505dcc2686fcb04ec6340869af4ee825dcb98.zip
Merge "Altering homescreen spacing to match design."
-rw-r--r--res/layout-xlarge-land/launcher.xml2
-rw-r--r--res/layout-xlarge-land/workspace_screen.xml2
-rw-r--r--res/layout-xlarge-port/workspace_screen.xml10
-rw-r--r--res/values-xlarge-land/dimens.xml4
-rw-r--r--res/values-xlarge-port/dimens.xml21
-rw-r--r--res/values-xlarge/dimens.xml8
-rw-r--r--res/values/attrs.xml6
-rw-r--r--src/com/android/launcher2/CellLayout.java22
8 files changed, 59 insertions, 16 deletions
diff --git a/res/layout-xlarge-land/launcher.xml b/res/layout-xlarge-land/launcher.xml
index 0ef946f9a..f42d72bd4 100644
--- a/res/layout-xlarge-land/launcher.xml
+++ b/res/layout-xlarge-land/launcher.xml
@@ -38,7 +38,7 @@
launcher:defaultScreen="2"
launcher:cellCountX="8"
launcher:cellCountY="7"
- launcher:pageSpacing="64dip">
+ launcher:pageSpacing="32dip">
<include android:id="@+id/cell1" layout="@layout/workspace_screen" />
<include android:id="@+id/cell2" layout="@layout/workspace_screen" />
diff --git a/res/layout-xlarge-land/workspace_screen.xml b/res/layout-xlarge-land/workspace_screen.xml
index f35844371..38dab821d 100644
--- a/res/layout-xlarge-land/workspace_screen.xml
+++ b/res/layout-xlarge-land/workspace_screen.xml
@@ -24,6 +24,8 @@
launcher:cellWidth="@dimen/workspace_cell_width"
launcher:cellHeight="@dimen/workspace_cell_height"
+ launcher:widthGap="@dimen/workspace_width_gap"
+ launcher:heightGap="@dimen/workspace_height_gap"
launcher:yAxisStartPadding="40dip"
launcher:yAxisEndPadding="40dip"
launcher:xAxisStartPadding="40dip"
diff --git a/res/layout-xlarge-port/workspace_screen.xml b/res/layout-xlarge-port/workspace_screen.xml
index 7314e6046..406441d00 100644
--- a/res/layout-xlarge-port/workspace_screen.xml
+++ b/res/layout-xlarge-port/workspace_screen.xml
@@ -24,7 +24,9 @@
launcher:cellWidth="@dimen/workspace_cell_width"
launcher:cellHeight="@dimen/workspace_cell_height"
- launcher:yAxisStartPadding="40dip"
- launcher:yAxisEndPadding="40dip"
- launcher:xAxisStartPadding="40dip"
- launcher:xAxisEndPadding="40dip"/>
+ launcher:widthGap="@dimen/workspace_width_gap"
+ launcher:heightGap="@dimen/workspace_height_gap"
+ launcher:yAxisStartPadding="25dip"
+ launcher:yAxisEndPadding="25dip"
+ launcher:xAxisStartPadding="15dip"
+ launcher:xAxisEndPadding="15dip"/>
diff --git a/res/values-xlarge-land/dimens.xml b/res/values-xlarge-land/dimens.xml
index d1140c08f..f8ebb3f5f 100644
--- a/res/values-xlarge-land/dimens.xml
+++ b/res/values-xlarge-land/dimens.xml
@@ -18,4 +18,8 @@
<!-- the area at the edge of the screen that makes the workspace go left
or right while you're dragging. -->
<dimen name="scroll_zone">160dip</dimen>
+
+ <!-- Width/height gap overrides for the workspace -->
+ <dimen name="workspace_width_gap">16dp</dimen>
+ <dimen name="workspace_height_gap">0dp</dimen>
</resources> \ No newline at end of file
diff --git a/res/values-xlarge-port/dimens.xml b/res/values-xlarge-port/dimens.xml
new file mode 100644
index 000000000..3117df91f
--- /dev/null
+++ b/res/values-xlarge-port/dimens.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+ <!-- Width/height gap overrides for the workspace -->
+ <dimen name="workspace_width_gap">0dp</dimen>
+ <dimen name="workspace_height_gap">16dp</dimen>
+</resources> \ No newline at end of file
diff --git a/res/values-xlarge/dimens.xml b/res/values-xlarge/dimens.xml
index bfab155d6..a84926d07 100644
--- a/res/values-xlarge/dimens.xml
+++ b/res/values-xlarge/dimens.xml
@@ -15,8 +15,12 @@
-->
<resources>
- <dimen name="workspace_cell_width">76dip</dimen>
- <dimen name="workspace_cell_height">76dip</dimen>
+ <dimen name="workspace_cell_width">96dip</dimen>
+ <dimen name="workspace_cell_height">96dip</dimen>
+
+ <!-- Width/height gap overrides for the workspace -->
+ <dimen name="workspace_width_gap">0dp</dimen>
+ <dimen name="workspace_height_gap">0dp</dimen>
<!-- extra horizontal spacing between mini screen thumbnails ie. in all
apps and in customization mode -->
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index a0e2706e0..6189f1c9b 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -53,6 +53,12 @@
<attr name="yAxisStartPadding" format="dimension" />
<!-- Padding to apply at the end of the short axis -->
<attr name="yAxisEndPadding" format="dimension" />
+ <!-- An override for the width and height gap to allow users to specify
+ a specific size for the page using spacing instead of resolving the
+ spacing from the width of the page -->
+ <attr name="widthGap" format="dimension" />
+ <attr name="heightGap" format="dimension" />
+
</declare-styleable>
<!-- PagedViewIcon specific attributes. These attributes are used to customize
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 8631e2cb6..2da5ac3d2 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -144,6 +144,8 @@ public class CellLayout extends ViewGroup implements Dimmable {
mCellWidth = a.getDimensionPixelSize(R.styleable.CellLayout_cellWidth, 10);
mCellHeight = a.getDimensionPixelSize(R.styleable.CellLayout_cellHeight, 10);
+ mWidthGap = a.getDimensionPixelSize(R.styleable.CellLayout_widthGap, -1);
+ mHeightGap = a.getDimensionPixelSize(R.styleable.CellLayout_heightGap, -1);
mLeftPadding =
a.getDimensionPixelSize(R.styleable.CellLayout_xAxisStartPadding, 10);
@@ -734,15 +736,17 @@ public class CellLayout extends ViewGroup implements Dimmable {
int numWidthGaps = mCountX - 1;
int numHeightGaps = mCountY - 1;
- int vSpaceLeft = heightSpecSize - mTopPadding - mBottomPadding - (cellHeight * mCountY);
- mHeightGap = vSpaceLeft / numHeightGaps;
+ if (mWidthGap < 0 || mHeightGap < 0) {
+ int vSpaceLeft = heightSpecSize - mTopPadding - mBottomPadding - (cellHeight * mCountY);
+ mHeightGap = vSpaceLeft / numHeightGaps;
- int hSpaceLeft = widthSpecSize - mLeftPadding - mRightPadding - (cellWidth * mCountX);
- mWidthGap = hSpaceLeft / numWidthGaps;
+ int hSpaceLeft = widthSpecSize - mLeftPadding - mRightPadding - (cellWidth * mCountX);
+ mWidthGap = hSpaceLeft / numWidthGaps;
- // center it around the min gaps
- int minGap = Math.min(mWidthGap, mHeightGap);
- mWidthGap = mHeightGap = minGap;
+ // center it around the min gaps
+ int minGap = Math.min(mWidthGap, mHeightGap);
+ mWidthGap = mHeightGap = minGap;
+ }
int count = getChildCount();
@@ -760,9 +764,9 @@ public class CellLayout extends ViewGroup implements Dimmable {
}
if (widthSpecMode == MeasureSpec.AT_MOST) {
int newWidth = mLeftPadding + mRightPadding + (mCountX * cellWidth) +
- ((mCountX - 1) * minGap);
+ ((mCountX - 1) * mWidthGap);
int newHeight = mTopPadding + mBottomPadding + (mCountY * cellHeight) +
- ((mCountY - 1) * minGap);
+ ((mCountY - 1) * mHeightGap);
setMeasuredDimension(newWidth, newHeight);
} else if (widthSpecMode == MeasureSpec.EXACTLY) {
setMeasuredDimension(widthSpecSize, heightSpecSize);