Merge "Cleaning up overscroll effect in launcher workspace" into ics-mr1
diff --git a/res/layout-sw600dp/search_bar.xml b/res/layout-sw600dp/search_bar.xml
index d8975b4..b852632 100644
--- a/res/layout-sw600dp/search_bar.xml
+++ b/res/layout-sw600dp/search_bar.xml
@@ -44,7 +44,7 @@
<!-- Voice search icon -->
<com.android.launcher2.HolographicImageView
- style="@style/SearchButton"
+ style="@style/SearchButton.Voice"
android:id="@+id/voice_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/res/values-port/styles.xml b/res/values-port/styles.xml
index d473640..d631d1e 100644
--- a/res/values-port/styles.xml
+++ b/res/values-port/styles.xml
@@ -21,6 +21,7 @@
<!-- QSB -->
<style name="SearchButton.Voice">
<item name="android:paddingLeft">8dp</item>
+ <item name="android:paddingRight">8dp</item>
</style>
<!-- Workspace -->
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index d17125c..b315763 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -99,6 +99,10 @@
<item name="android:paddingLeft">@dimen/toolbar_button_horizontal_padding</item>
<item name="android:paddingRight">@dimen/toolbar_button_horizontal_padding</item>
</style>
+ <style name="SearchButton.Voice">
+ <item name="android:paddingLeft">18dp</item>
+ <item name="android:paddingRight">18dp</item>
+ </style>
<style name="SearchButtonDivider">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index df1d525..2de7d4a 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -490,11 +490,14 @@
heightSize = maxChildHeight + verticalPadding;
}
- updateScrollingIndicatorPosition();
-
setMeasuredDimension(widthSize, heightSize);
- // We can't call getChildOffset/getRelativeChildOffset until we set the measured dimensions
+ // We can't call getChildOffset/getRelativeChildOffset until we set the measured dimensions.
+ // We also wait until we set the measured dimensions before flushing the cache as well, to
+ // ensure that the cache is filled with good values.
+ invalidateCachedOffsets();
+ updateScrollingIndicatorPosition();
+
if (childCount > 0) {
mMaxScrollX = getChildOffset(childCount - 1) - getRelativeChildOffset(childCount - 1);
} else {
@@ -597,7 +600,6 @@
if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) {
mFirstLayout = false;
}
- invalidateCachedOffsets();
}
protected void screenScrolled(int screenCenter) {
@@ -626,11 +628,17 @@
// in accordance with any scroll effects.
mForceScreenScrolled = true;
invalidate();
+ invalidateCachedOffsets();
}
protected void invalidateCachedOffsets() {
int count = getChildCount();
- if (count == 0) return;
+ if (count == 0) {
+ mChildOffsets = null;
+ mChildRelativeOffsets = null;
+ mChildOffsetsWithLayoutScale = null;
+ return;
+ }
mChildOffsets = new int[count];
mChildRelativeOffsets = new int[count];