Merge "Fix issue with missing row/column on workspace"
diff --git a/res/values-xlarge-port/styles.xml b/res/values-xlarge-port/styles.xml
new file mode 100644
index 0000000..2c5f5bb
--- /dev/null
+++ b/res/values-xlarge-port/styles.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+* Copyright (C) 2011 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>
+ <style name="CustomizeTabIndicator.Wide" parent="TabIndicator.Wide">
+ <item name="android:paddingLeft">20dp</item>
+ <item name="android:paddingRight">20dp</item>
+ </style>
+</resources>
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index f195470..62c441f 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -172,7 +172,9 @@
availableHeight -= mPageLayoutPaddingTop + mPageLayoutPaddingBottom;
availableHeight -= cellHeight; // Assume at least one row
- availableHeight -= screenHeight * 0.16f;
+ Resources r = getContext().getResources();
+ float scaleFactor = r.getInteger(R.integer.config_allAppsZoomScaleFactor) / 100f;
+ availableHeight -= screenHeight * scaleFactor;
if (availableHeight > 0) {
return Math.min(mMaxCellCountY,
1 + availableHeight / (cellHeight + mPageLayoutHeightGap));
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 56d6a99..eb92d20 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -271,27 +271,20 @@
// We use this method from Workspace to figure out how many rows/columns Launcher should
// have. We ignore the left/right padding on CellLayout because it turns out in our design
// the padding extends outside the visible screen size, but it looked fine anyway.
- // However, we make sure there's at least enough space for the crosshairs at either
- // edge to be rendered (half the crosshair is sticking out on either side)
int cellWidth = r.getDimensionPixelSize(R.dimen.workspace_cell_width);
int widthGap = r.getDimensionPixelSize(R.dimen.workspace_width_gap_port);
- int crosshairsSize = r.getDrawable(R.drawable.gardening_crosshairs).getIntrinsicWidth();
- return widthGap * (numCells - 1) + cellWidth * numCells + crosshairsSize;
+ return widthGap * (numCells - 1) + cellWidth * numCells;
}
static int heightInLandscape(Resources r, int numCells) {
// We use this method from Workspace to figure out how many rows/columns Launcher should
// have. We ignore the left/right padding on CellLayout because it turns out in our design
// the padding extends outside the visible screen size, but it looked fine anyway.
- // However, we make sure there's at least enough space for the crosshairs at the bottom
- // to be rendered (half the crosshair is sticking out); we don't worry about the top
- // crosshair since it can bleed into the action bar space
int cellHeight = r.getDimensionPixelSize(R.dimen.workspace_cell_height);
int heightGap = r.getDimensionPixelSize(R.dimen.workspace_height_gap_land);
- int crosshairsSize = r.getDrawable(R.drawable.gardening_crosshairs).getIntrinsicHeight();
- return heightGap * (numCells - 1) + cellHeight * numCells + (crosshairsSize + 1) / 2;
+ return heightGap * (numCells - 1) + cellHeight * numCells;
}
public void enableHardwareLayers() {
diff --git a/src/com/android/launcher2/CustomizeTrayTabHost.java b/src/com/android/launcher2/CustomizeTrayTabHost.java
index c6a39b3..5780818 100644
--- a/src/com/android/launcher2/CustomizeTrayTabHost.java
+++ b/src/com/android/launcher2/CustomizeTrayTabHost.java
@@ -84,7 +84,7 @@
.setIndicator(tabView).setContent(contentFactory));
tabView = (TextView) mInflater.inflate(
R.layout.customize_tab_widget_indicator, tabWidget, false);
- tabView.setText(mContext.getString(R.string.applications_tab_label));
+ tabView.setText(mContext.getString(R.string.all_apps_tab_apps));
addTab(newTabSpec(APPLICATIONS_TAG)
.setIndicator(tabView).setContent(contentFactory));
tabView = (TextView) mInflater.inflate(
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 0ae7a59..901ac26 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -211,8 +211,6 @@
}
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- // TODO: currently ignoring padding
-
int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSpecSize = MeasureSpec.getSize(widthMeasureSpec);
@@ -255,10 +253,8 @@
widthGap = heightGap = minGap;
}
- int newWidth = mPaddingLeft + mPaddingRight + (mCellCountX * cellWidth) +
- ((mCellCountX - 1) * widthGap);
- int newHeight = mPaddingTop + mPaddingBottom + (mCellCountY * cellHeight) +
- ((mCellCountY - 1) * heightGap);
+ int newWidth = (mCellCountX * cellWidth) + ((mCellCountX - 1) * widthGap);
+ int newHeight = (mCellCountY * cellHeight) + ((mCellCountY - 1) * heightGap);
final int count = getChildCount();
for (int i = 0; i < count; i++) {
@@ -270,7 +266,8 @@
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
}
- setMeasuredDimension(newWidth, newHeight);
+ setMeasuredDimension(newWidth + mPaddingLeft + mPaddingRight,
+ newHeight + mPaddingTop + mPaddingBottom);
}
int getContentWidth() {
@@ -304,12 +301,8 @@
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
- if (LauncherApplication.isScreenLarge()) {
- child.layout(0, 0, r - l, b - t);
- } else {
- child.layout(mPaddingLeft, mPaddingTop, getMeasuredWidth() - mPaddingRight,
- getMeasuredHeight() - mPaddingBottom);
- }
+ child.layout(mPaddingLeft, mPaddingTop,
+ r - l - mPaddingRight, b - t - mPaddingBottom);
}
}
diff --git a/src/com/android/launcher2/PagedViewCellLayoutChildren.java b/src/com/android/launcher2/PagedViewCellLayoutChildren.java
index 6333f7f..1afdd03 100644
--- a/src/com/android/launcher2/PagedViewCellLayoutChildren.java
+++ b/src/com/android/launcher2/PagedViewCellLayoutChildren.java
@@ -92,8 +92,8 @@
PagedViewCellLayout.LayoutParams lp =
(PagedViewCellLayout.LayoutParams) child.getLayoutParams();
lp.setup(mCellWidth, mCellHeight, mWidthGap, mHeightGap,
- ((ViewGroup)getParent()).getPaddingLeft(),
- ((ViewGroup)getParent()).getPaddingTop());
+ getPaddingLeft(),
+ getPaddingTop());
int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(lp.width,
MeasureSpec.EXACTLY);
@@ -111,18 +111,21 @@
int count = getChildCount();
int offsetX = 0;
- if (mCenterContent) {
+ if (mCenterContent && count > 0) {
// determine the max width of all the rows and center accordingly
- int maxRowWidth = 0;
+ int maxRowX = 0;
+ int minRowX = Integer.MAX_VALUE;
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child.getVisibility() != GONE) {
PagedViewCellLayout.LayoutParams lp =
(PagedViewCellLayout.LayoutParams) child.getLayoutParams();
- maxRowWidth = Math.max(maxRowWidth, lp.x + lp.width);
+ minRowX = Math.min(minRowX, lp.x);
+ maxRowX = Math.max(maxRowX, lp.x + lp.width);
}
}
- offsetX = (getMeasuredWidth() / 2) - (maxRowWidth / 2);
+ int maxRowWidth = maxRowX - minRowX;
+ offsetX = (getMeasuredWidth() - maxRowWidth) / 2;
}
for (int i = 0; i < count; i++) {