OSDN Git Service

Fixing improper paging of wallpaper providers in customization drawer.
authorWinson Chung <winsonc@google.com>
Mon, 22 Nov 2010 22:34:57 +0000 (14:34 -0800)
committerWinson Chung <winsonc@google.com>
Mon, 22 Nov 2010 22:43:15 +0000 (14:43 -0800)
Change-Id: I3f0323f2e97d4538ae9c35e17738bcbb46b5a2a7

res/layout-xlarge-port/customization_drawer.xml
src/com/android/launcher2/CustomizePagedView.java

index a9e1c0d..d90f3ca 100644 (file)
@@ -19,8 +19,8 @@
 
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    launcher:wallpaperCellSpanX="4"
-    launcher:widgetCellCountX="10"
+    launcher:wallpaperCellSpanX="3"
+    launcher:widgetCellCountX="9"
     launcher:cellCountX="5"
     launcher:cellCountY="3"
     launcher:pageLayoutWidthGap="36dp"
index 92140b1..6db6aa9 100644 (file)
@@ -768,7 +768,10 @@ public class CustomizePagedView extends PagedView
         LinearLayout layout = (LinearLayout) getChildAt(page);
         layout.removeAllViews();
         final int count = mWallpaperList.size();
-        for (int i = 0; i < count; ++i) {
+        final int numItemsPerPage = mMaxWidgetsCellHSpan / mWallpaperCellHSpan;
+        final int startIndex = page * numItemsPerPage;
+        final int endIndex = Math.min(count, startIndex + numItemsPerPage);
+        for (int i = startIndex; i < endIndex; ++i) {
             final ResolveInfo info = mWallpaperList.get(i);
 
             LinearLayout l = (LinearLayout) mInflater.inflate(