summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-09-13 18:08:54 -0700
committerWinson Chung <winsonc@google.com>2011-09-13 18:13:32 -0700
commitae890b85dfbcdef592f4a97cca819922a07a83ca (patch)
tree39a441800dd003510bff406e5eab5ca439b20e22
parent6027705e8c4713daabe63d049d71f9acdf972244 (diff)
downloadandroid_packages_apps_Trebuchet-ae890b85dfbcdef592f4a97cca819922a07a83ca.tar.gz
android_packages_apps_Trebuchet-ae890b85dfbcdef592f4a97cca819922a07a83ca.tar.bz2
android_packages_apps_Trebuchet-ae890b85dfbcdef592f4a97cca819922a07a83ca.zip
Disable fading of side pages on phones. (5270754)
- Fixing small issue with scroll bars not aligning properly. Change-Id: I000c0b7a26d7e6295d131646be81491a357ffdce
-rw-r--r--res/values-land/config.xml2
-rw-r--r--res/values-land/dimens.xml2
-rw-r--r--res/values-port/dimens.xml2
-rw-r--r--res/values-sw340dp-port/config.xml2
-rw-r--r--src/com/android/launcher2/PagedView.java24
5 files changed, 19 insertions, 13 deletions
diff --git a/res/values-land/config.xml b/res/values-land/config.xml
index 07eac4ff3..cbc0a6eda 100644
--- a/res/values-land/config.xml
+++ b/res/values-land/config.xml
@@ -19,7 +19,7 @@
<!-- Whether or not the drop targets drop down as opposed to fade in -->
<bool name="config_useDropTargetDownTransition">false</bool>
<!-- Whether or not to fade the side pages -->
- <bool name="config_workspaceFadeAdjacentScreens">true</bool>
+ <bool name="config_workspaceFadeAdjacentScreens">false</bool>
<!-- Padding applied to AppWidgets -->
<dimen name="app_widget_padding_top">8dp</dimen>
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index da42b8566..52c52f18b 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -31,7 +31,7 @@
really only in spring loaded mode... -->
<dimen name="workspace_top_padding">0dp</dimen>
<dimen name="workspace_bottom_padding">0dp</dimen>
- <dimen name="workspace_page_spacing">8dp</dimen>
+ <dimen name="workspace_page_spacing">-1dp</dimen>
<dimen name="workspace_divider_padding_left">0dp</dimen>
<dimen name="workspace_divider_padding_right">0dp</dimen>
<dimen name="workspace_divider_padding_top">12dp</dimen>
diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml
index 2abd9d722..5632fcd3e 100644
--- a/res/values-port/dimens.xml
+++ b/res/values-port/dimens.xml
@@ -22,7 +22,7 @@
for the portals to look right. -->
<dimen name="workspace_top_padding">2dp</dimen>
<dimen name="workspace_bottom_padding">2dp</dimen>
- <dimen name="workspace_page_spacing">8dp</dimen>
+ <dimen name="workspace_page_spacing">-1dp</dimen>
<integer name="apps_customize_cellCountX">4</integer>
<integer name="apps_customize_cellCountY">5</integer>
diff --git a/res/values-sw340dp-port/config.xml b/res/values-sw340dp-port/config.xml
index d1f308576..d31ee5969 100644
--- a/res/values-sw340dp-port/config.xml
+++ b/res/values-sw340dp-port/config.xml
@@ -17,5 +17,5 @@
<resources>
<!-- Workspace -->
<!-- Whether or not to fade the side pages -->
- <bool name="config_workspaceFadeAdjacentScreens">true</bool>
+ <bool name="config_workspaceFadeAdjacentScreens">false</bool>
</resources>
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 2b5847bde..4fdb198d1 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -475,15 +475,17 @@ public abstract class PagedView extends ViewGroup {
if (heightMode == MeasureSpec.AT_MOST) {
heightSize = maxChildHeight + verticalPadding;
}
+
+ updateScrollingIndicatorPosition();
+
+ setMeasuredDimension(widthSize, heightSize);
+
+ // We can't call getChildOffset/getRelativeChildOffset until we set the measured dimensions
if (childCount > 0) {
mMaxScrollX = getChildOffset(childCount - 1) - getRelativeChildOffset(childCount - 1);
} else {
mMaxScrollX = 0;
}
-
- updateScrollingIndicatorPosition();
-
- setMeasuredDimension(widthSize, heightSize);
}
protected void scrollToNewPageWithoutMovingPages(int newCurrentPage) {
@@ -553,6 +555,11 @@ public abstract class PagedView extends ViewGroup {
if (DEBUG) Log.d(TAG, "getRelativeChildOffset(): " + getMeasuredWidth() + ", "
+ getChildWidth(0));
childLeft = getRelativeChildOffset(0);
+
+ // Calculate the variable page spacing if necessary
+ if (mPageSpacing < 0) {
+ mPageSpacing = ((right - left) - getChildAt(0).getMeasuredWidth()) / 2;
+ }
}
for (int i = 0; i < childCount; i++) {
@@ -1818,16 +1825,15 @@ public abstract class PagedView extends ViewGroup {
if (mScrollIndicator == null) return;
int numPages = getChildCount();
int pageWidth = getMeasuredWidth();
- int maxPageWidth = (numPages * getChildWidth(0)) + ((numPages - 1) * mPageSpacing);
- int maxScrollPosition = maxPageWidth - pageWidth; // n-1 * pageWidth
+ int lastChildIndex = Math.max(0, getChildCount() - 1);
+ int maxScrollX = getChildOffset(lastChildIndex) - getRelativeChildOffset(lastChildIndex);
int trackWidth = pageWidth - mScrollIndicatorPaddingLeft - mScrollIndicatorPaddingRight;
int indicatorWidth = mScrollIndicator.getMeasuredWidth() -
mScrollIndicator.getPaddingLeft() - mScrollIndicator.getPaddingRight();
- float offset = (float) Math.max(0f, Math.min(maxScrollPosition, getScrollX()))
- / maxPageWidth;
+ float offset = Math.max(0f, Math.min(1f, (float) getScrollX() / maxScrollX));
int indicatorSpace = trackWidth / numPages;
- int indicatorPos = (int) (offset * trackWidth) + mScrollIndicatorPaddingLeft;
+ int indicatorPos = (int) (offset * (trackWidth - indicatorSpace)) + mScrollIndicatorPaddingLeft;
if (hasElasticScrollIndicator()) {
if (mScrollIndicator.getMeasuredWidth() != indicatorSpace) {
mScrollIndicator.getLayoutParams().width = indicatorSpace;