Merge "Altering homescreen spacing to match design."
This commit is contained in:
commit
4c0505dcc2
8 files changed
+59
-16
No files matched your search
@@ -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" />
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"/>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user