diff options
author | Winson Chung <winsonc@google.com> | 2011-05-09 11:56:34 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-05-09 16:03:19 -0700 |
commit | 4e6a976c2d85f7261ae4318a9ccffd2440f73124 (patch) | |
tree | fdb2e2b157974f2e5260cc02c56b80d7981ab4ca /src/com/android/launcher2/AppsCustomizePagedView.java | |
parent | 63257c110a4ee54d5e8872c471cce254cf613c7a (diff) | |
download | android_packages_apps_Trebuchet-4e6a976c2d85f7261ae4318a9ccffd2440f73124.tar.gz android_packages_apps_Trebuchet-4e6a976c2d85f7261ae4318a9ccffd2440f73124.tar.bz2 android_packages_apps_Trebuchet-4e6a976c2d85f7261ae4318a9ccffd2440f73124.zip |
Adding keyboard focus support for phones.
Change-Id: I2daab961d0727bc5d892db6b50ad0f51fe23873c
Diffstat (limited to 'src/com/android/launcher2/AppsCustomizePagedView.java')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index a1e61714a..0c4867cf1 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -533,8 +533,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen /* * Widgets PagedView implementation */ - private void setupPage(PagedViewExtendedLayout layout) { - layout.setGravity(Gravity.LEFT); + private void setupPage(PagedViewGridLayout layout) { layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop, mPageLayoutPaddingRight, mPageLayoutPaddingBottom); @@ -679,18 +678,17 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen int numWidgetsPerPage = mWidgetCountX * mWidgetCountY; int numPages = (int) Math.ceil(mWidgets.size() / (float) numWidgetsPerPage); for (int i = 0; i < numPages; ++i) { - PagedViewExtendedLayout layout = new PagedViewExtendedLayout(context); + PagedViewGridLayout layout = new PagedViewGridLayout(context, mWidgetCountX, + mWidgetCountY); setupPage(layout); addView(layout); } } public void syncWidgetPageItems(int page) { - Context context = getContext(); - PagedViewExtendedLayout layout = (PagedViewExtendedLayout) getChildAt(page); + PagedViewGridLayout layout = (PagedViewGridLayout) getChildAt(page); layout.removeAllViews(); // Calculate the dimensions of each cell we are giving to each widget - FrameLayout container = new FrameLayout(context); int numWidgetsPerPage = mWidgetCountX * mWidgetCountY; int offset = page * numWidgetsPerPage; int cellWidth = ((mWidgetSpacingLayout.getContentWidth() - mPageLayoutWidthGap @@ -728,15 +726,14 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen widget.setOnTouchListener(this); // Layout each widget - FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(cellWidth, cellHeight); int ix = i % mWidgetCountX; int iy = i / mWidgetCountX; + PagedViewGridLayout.LayoutParams lp = new PagedViewGridLayout.LayoutParams(cellWidth, + cellHeight); lp.leftMargin = (ix * cellWidth) + (ix * mWidgetCellWidthGap); lp.topMargin = (iy * cellHeight) + (iy * mWidgetCellHeightGap); - container.addView(widget, lp); + layout.addView(widget, lp); } - layout.addView(container, new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); } @Override public void syncPages() { |