summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-09-14 17:56:27 -0700
committerWinson Chung <winsonc@google.com>2011-09-15 13:38:54 -0700
commitc3665faf4525de78c64e1a98106e12f1c23810c9 (patch)
treee3c12267dacc91ec4ce0858a06a1f95b82817ce9
parent286f2e1da9f8638b914e0ca1659f36369ee6b501 (diff)
downloadandroid_packages_apps_Trebuchet-c3665faf4525de78c64e1a98106e12f1c23810c9.tar.gz
android_packages_apps_Trebuchet-c3665faf4525de78c64e1a98106e12f1c23810c9.tar.bz2
android_packages_apps_Trebuchet-c3665faf4525de78c64e1a98106e12f1c23810c9.zip
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
-rw-r--r--res/drawable-hdpi/grid_focused.9.pngbin0 -> 200 bytes
-rw-r--r--res/drawable-hdpi/grid_pressed.9.pngbin0 -> 184 bytes
-rw-r--r--res/drawable-hdpi/grid_selected.9.pngbin0 -> 202 bytes
-rw-r--r--res/drawable-mdpi/grid_focused.9.pngbin0 -> 170 bytes
-rw-r--r--res/drawable-mdpi/grid_pressed.9.pngbin0 -> 165 bytes
-rw-r--r--res/drawable-mdpi/grid_selected.9.pngbin0 -> 165 bytes
-rw-r--r--res/drawable-xhdpi/grid_focused.9.pngbin0 -> 193 bytes
-rw-r--r--res/drawable-xhdpi/grid_pressed.9.pngbin0 -> 190 bytes
-rw-r--r--res/drawable-xhdpi/grid_selected.9.pngbin0 -> 199 bytes
-rw-r--r--res/drawable/wallpaper_gallery_item.xml22
-rw-r--r--res/layout/wallpaper_item.xml1
-rw-r--r--src/com/android/launcher2/PagedView.java19
12 files changed, 33 insertions, 9 deletions
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
--- /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 000000000..548accef6
--- /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 000000000..02ab90253
--- /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 000000000..c7e6b06da
--- /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 000000000..09a7e3fbe
--- /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 000000000..a40b05826
--- /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 000000000..20d4647df
--- /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 000000000..73a784b60
--- /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 000000000..eb0f3dc2f
--- /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 000000000..b7052bd39
--- /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 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;
}