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: Id7ff602837dbe1d8a2aaec6ec49b667f11d01bc9
diff --git a/res/drawable-hdpi/grid_focused.9.png b/res/drawable-hdpi/grid_focused.9.png
new file mode 100644
index 0000000..cb5aea8
--- /dev/null
+++ b/res/drawable-hdpi/grid_focused.9.png
Binary files differ
diff --git a/res/drawable-hdpi/grid_pressed.9.png b/res/drawable-hdpi/grid_pressed.9.png
new file mode 100644
index 0000000..548acce
--- /dev/null
+++ b/res/drawable-hdpi/grid_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi/grid_selected.9.png b/res/drawable-hdpi/grid_selected.9.png
new file mode 100644
index 0000000..02ab902
--- /dev/null
+++ b/res/drawable-hdpi/grid_selected.9.png
Binary files differ
diff --git a/res/drawable-mdpi/grid_focused.9.png b/res/drawable-mdpi/grid_focused.9.png
new file mode 100644
index 0000000..c7e6b06
--- /dev/null
+++ b/res/drawable-mdpi/grid_focused.9.png
Binary files differ
diff --git a/res/drawable-mdpi/grid_pressed.9.png b/res/drawable-mdpi/grid_pressed.9.png
new file mode 100644
index 0000000..09a7e3f
--- /dev/null
+++ b/res/drawable-mdpi/grid_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi/grid_selected.9.png b/res/drawable-mdpi/grid_selected.9.png
new file mode 100644
index 0000000..a40b058
--- /dev/null
+++ b/res/drawable-mdpi/grid_selected.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/grid_focused.9.png b/res/drawable-xhdpi/grid_focused.9.png
new file mode 100644
index 0000000..20d4647
--- /dev/null
+++ b/res/drawable-xhdpi/grid_focused.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/grid_pressed.9.png b/res/drawable-xhdpi/grid_pressed.9.png
new file mode 100644
index 0000000..73a784b
--- /dev/null
+++ b/res/drawable-xhdpi/grid_pressed.9.png
Binary files differ
diff --git a/res/drawable-xhdpi/grid_selected.9.png b/res/drawable-xhdpi/grid_selected.9.png
new file mode 100644
index 0000000..eb0f3dc
--- /dev/null
+++ b/res/drawable-xhdpi/grid_selected.9.png
Binary files differ
diff --git a/res/drawable/wallpaper_gallery_item.xml b/res/drawable/wallpaper_gallery_item.xml
new file mode 100644
index 0000000..b7052bd
--- /dev/null
+++ b/res/drawable/wallpaper_gallery_item.xml
@@ -0,0 +1,22 @@
+<?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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_focused="true" android:drawable="@drawable/grid_focused" />
+ <item android:state_pressed="true" android:drawable="@drawable/grid_pressed" />
+ <item android:state_selected="true" android:drawable="@drawable/grid_selected" />
+ <item android:drawable="@android:color/transparent" />
+</selector>
diff --git a/res/layout/wallpaper_item.xml b/res/layout/wallpaper_item.xml
index 0834ce6..bd3fa2b 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 dca4d14..9a105d1 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -539,15 +539,6 @@
}
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 @@
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;
}