From 604eb063108fb551bd56b0b648b45d2ef67b97fa Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 14 Sep 2011 17:56:27 -0700 Subject: DO NOT MERGE: Fixing regression where scroll position would be offset when rotated. - Fixes the scrolling issue only in conjunction with framework measure fix - Updating the wallpaper gallery item background Change-Id: I156de59a3eadfdaa61018c0a74ad0614d76cde6d --- res/drawable-hdpi/grid_focused.9.png | Bin 0 -> 200 bytes res/drawable-hdpi/grid_pressed.9.png | Bin 0 -> 184 bytes res/drawable-hdpi/grid_selected.9.png | Bin 0 -> 202 bytes res/drawable-mdpi/grid_focused.9.png | Bin 0 -> 170 bytes res/drawable-mdpi/grid_pressed.9.png | Bin 0 -> 165 bytes res/drawable-mdpi/grid_selected.9.png | Bin 0 -> 165 bytes res/drawable-xhdpi/grid_focused.9.png | Bin 0 -> 193 bytes res/drawable-xhdpi/grid_pressed.9.png | Bin 0 -> 190 bytes res/drawable-xhdpi/grid_selected.9.png | Bin 0 -> 199 bytes res/drawable/wallpaper_gallery_item.xml | 22 ++++++++++++++++++++++ res/layout/wallpaper_item.xml | 1 + src/com/android/launcher2/PagedView.java | 19 ++++++++++--------- 12 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 res/drawable-hdpi/grid_focused.9.png create mode 100644 res/drawable-hdpi/grid_pressed.9.png create mode 100644 res/drawable-hdpi/grid_selected.9.png create mode 100644 res/drawable-mdpi/grid_focused.9.png create mode 100644 res/drawable-mdpi/grid_pressed.9.png create mode 100644 res/drawable-mdpi/grid_selected.9.png create mode 100644 res/drawable-xhdpi/grid_focused.9.png create mode 100644 res/drawable-xhdpi/grid_pressed.9.png create mode 100644 res/drawable-xhdpi/grid_selected.9.png create mode 100644 res/drawable/wallpaper_gallery_item.xml diff --git a/res/drawable-hdpi/grid_focused.9.png b/res/drawable-hdpi/grid_focused.9.png new file mode 100644 index 000000000..cb5aea89a Binary files /dev/null and b/res/drawable-hdpi/grid_focused.9.png differ diff --git a/res/drawable-hdpi/grid_pressed.9.png b/res/drawable-hdpi/grid_pressed.9.png new file mode 100644 index 000000000..548accef6 Binary files /dev/null and b/res/drawable-hdpi/grid_pressed.9.png differ diff --git a/res/drawable-hdpi/grid_selected.9.png b/res/drawable-hdpi/grid_selected.9.png new file mode 100644 index 000000000..02ab90253 Binary files /dev/null and b/res/drawable-hdpi/grid_selected.9.png differ diff --git a/res/drawable-mdpi/grid_focused.9.png b/res/drawable-mdpi/grid_focused.9.png new file mode 100644 index 000000000..c7e6b06da Binary files /dev/null and b/res/drawable-mdpi/grid_focused.9.png differ diff --git a/res/drawable-mdpi/grid_pressed.9.png b/res/drawable-mdpi/grid_pressed.9.png new file mode 100644 index 000000000..09a7e3fbe Binary files /dev/null and b/res/drawable-mdpi/grid_pressed.9.png differ diff --git a/res/drawable-mdpi/grid_selected.9.png b/res/drawable-mdpi/grid_selected.9.png new file mode 100644 index 000000000..a40b05826 Binary files /dev/null and b/res/drawable-mdpi/grid_selected.9.png differ diff --git a/res/drawable-xhdpi/grid_focused.9.png b/res/drawable-xhdpi/grid_focused.9.png new file mode 100644 index 000000000..20d4647df Binary files /dev/null and b/res/drawable-xhdpi/grid_focused.9.png differ diff --git a/res/drawable-xhdpi/grid_pressed.9.png b/res/drawable-xhdpi/grid_pressed.9.png new file mode 100644 index 000000000..73a784b60 Binary files /dev/null and b/res/drawable-xhdpi/grid_pressed.9.png differ diff --git a/res/drawable-xhdpi/grid_selected.9.png b/res/drawable-xhdpi/grid_selected.9.png new file mode 100644 index 000000000..eb0f3dc2f Binary files /dev/null and b/res/drawable-xhdpi/grid_selected.9.png differ diff --git a/res/drawable/wallpaper_gallery_item.xml b/res/drawable/wallpaper_gallery_item.xml new file mode 100644 index 000000000..b7052bd39 --- /dev/null +++ b/res/drawable/wallpaper_gallery_item.xml @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/res/layout/wallpaper_item.xml b/res/layout/wallpaper_item.xml index 0834ce680..bd3fa2bd3 100644 --- a/res/layout/wallpaper_item.xml +++ b/res/layout/wallpaper_item.xml @@ -18,5 +18,6 @@ android:id="@+id/wallpaper_image" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:background="@drawable/wallpaper_gallery_item" android:scaleType="fitXY" android:focusable="true" /> diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index dca4d1448..9a105d104 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -539,15 +539,6 @@ public abstract class PagedView extends ViewGroup { } if (DEBUG) Log.d(TAG, "PagedView.onLayout()"); - if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) { - setHorizontalScrollBarEnabled(false); - int newX = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage); - scrollTo(newX, 0); - mScroller.setFinalX(newX); - setHorizontalScrollBarEnabled(true); - mFirstLayout = false; - } - final int verticalPadding = mPaddingTop + mPaddingBottom; final int childCount = getChildCount(); int childLeft = 0; @@ -578,6 +569,16 @@ public abstract class PagedView extends ViewGroup { childLeft += childWidth + mPageSpacing; } } + + if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) { + setHorizontalScrollBarEnabled(false); + int newX = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage); + scrollTo(newX, 0); + mScroller.setFinalX(newX); + setHorizontalScrollBarEnabled(true); + mFirstLayout = false; + } + if (mFirstLayout && mCurrentPage >= 0 && mCurrentPage < getChildCount()) { mFirstLayout = false; } -- cgit v1.2.3