Using GridLayout in AppsCustomize widgets tab.
- Starting to implement new widgets design
- Hiding outlines in phone ui while dragging
- Making the tab bar show only when we have items as well
Change-Id: Ic027f9ba83fc0982f2f92a90412f050a8e248f9c
diff --git a/src/com/android/launcher2/PagedViewGridLayout.java b/src/com/android/launcher2/PagedViewGridLayout.java
index c6d39fd..a2ab763 100644
--- a/src/com/android/launcher2/PagedViewGridLayout.java
+++ b/src/com/android/launcher2/PagedViewGridLayout.java
@@ -19,14 +19,13 @@
import android.content.Context;
import android.view.MotionEvent;
import android.view.View;
-import android.view.View.MeasureSpec;
import android.widget.FrameLayout;
-import android.widget.LinearLayout;
+import android.widget.GridLayout;
/**
* The grid based layout used strictly for the widget/wallpaper tab of the AppsCustomize pane
*/
-public class PagedViewGridLayout extends FrameLayout implements Page {
+public class PagedViewGridLayout extends GridLayout implements Page {
static final String TAG = "PagedViewGridLayout";
private int mCellCountX;
@@ -36,6 +35,7 @@
super(context, null, 0);
mCellCountX = cellCountX;
mCellCountY = cellCountY;
+ setColumnCount(mCellCountX);
}
int getCellCountX() {
@@ -50,9 +50,9 @@
// offset of each page to scroll to before it updates the actual size of each page
// (which can change depending on the content if the contents aren't a fixed size).
// We work around this by having a minimum size on each widget page).
- int widthSpecSize = Math.max(getSuggestedMinimumWidth(),
+ int widthSpecSize = Math.min(getSuggestedMinimumWidth(),
MeasureSpec.getSize(widthMeasureSpec));
- int widthSpecMode = MeasureSpec.AT_MOST;
+ int widthSpecMode = MeasureSpec.EXACTLY;
super.onMeasure(MeasureSpec.makeMeasureSpec(widthSpecSize, widthSpecMode),
heightMeasureSpec);
}