Merge "Fixing issue where you could click through to next page in AppsCustomize (issue 5501400)" into ics-mr1
diff --git a/res/drawable-sw600dp-hdpi/homescreen_blue_normal_holo.9.png b/res/drawable-sw600dp-hdpi/homescreen_blue_normal_holo.9.png
new file mode 100644
index 0000000..98f7ac8
--- /dev/null
+++ b/res/drawable-sw600dp-hdpi/homescreen_blue_normal_holo.9.png
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/homescreen_blue_strong_holo.9.png b/res/drawable-sw600dp-hdpi/homescreen_blue_strong_holo.9.png
new file mode 100644
index 0000000..0a511f9
--- /dev/null
+++ b/res/drawable-sw600dp-hdpi/homescreen_blue_strong_holo.9.png
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/portal_ring_inner_holo.png b/res/drawable-sw600dp-hdpi/portal_ring_inner_holo.png
index 659c23b..b3be472 100644
--- a/res/drawable-sw600dp-hdpi/portal_ring_inner_holo.png
+++ b/res/drawable-sw600dp-hdpi/portal_ring_inner_holo.png
Binary files differ
diff --git a/res/drawable-xlarge-hdpi/portal_ring_inner_nolip_holo.png b/res/drawable-sw600dp-hdpi/portal_ring_inner_nolip_holo.png
similarity index 100%
rename from res/drawable-xlarge-hdpi/portal_ring_inner_nolip_holo.png
rename to res/drawable-sw600dp-hdpi/portal_ring_inner_nolip_holo.png
Binary files differ
diff --git a/res/drawable-sw600dp-hdpi/portal_ring_outer_holo.png b/res/drawable-sw600dp-hdpi/portal_ring_outer_holo.png
index 8ec67df..bc13a26 100644
--- a/res/drawable-sw600dp-hdpi/portal_ring_outer_holo.png
+++ b/res/drawable-sw600dp-hdpi/portal_ring_outer_holo.png
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/homescreen_blue_normal_holo.9.png b/res/drawable-sw600dp-mdpi/homescreen_blue_normal_holo.9.png
new file mode 100644
index 0000000..3ae4aff
--- /dev/null
+++ b/res/drawable-sw600dp-mdpi/homescreen_blue_normal_holo.9.png
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/homescreen_blue_strong_holo.9.png b/res/drawable-sw600dp-mdpi/homescreen_blue_strong_holo.9.png
new file mode 100644
index 0000000..31148dd
--- /dev/null
+++ b/res/drawable-sw600dp-mdpi/homescreen_blue_strong_holo.9.png
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/portal_ring_inner_holo.png b/res/drawable-sw600dp-mdpi/portal_ring_inner_holo.png
index 8e3dd57..319c074 100644
--- a/res/drawable-sw600dp-mdpi/portal_ring_inner_holo.png
+++ b/res/drawable-sw600dp-mdpi/portal_ring_inner_holo.png
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/portal_ring_inner_nolip_holo.png b/res/drawable-sw600dp-mdpi/portal_ring_inner_nolip_holo.png
similarity index 100%
rename from res/drawable-xlarge-mdpi/portal_ring_inner_nolip_holo.png
rename to res/drawable-sw600dp-mdpi/portal_ring_inner_nolip_holo.png
Binary files differ
diff --git a/res/drawable-sw600dp-mdpi/portal_ring_outer_holo.png b/res/drawable-sw600dp-mdpi/portal_ring_outer_holo.png
index 94e0677..365dcfc 100644
--- a/res/drawable-sw600dp-mdpi/portal_ring_outer_holo.png
+++ b/res/drawable-sw600dp-mdpi/portal_ring_outer_holo.png
Binary files differ
diff --git a/res/drawable-sw600dp-xhdpi/homescreen_blue_normal_holo.9.png b/res/drawable-sw600dp-xhdpi/homescreen_blue_normal_holo.9.png
new file mode 100644
index 0000000..c25b590
--- /dev/null
+++ b/res/drawable-sw600dp-xhdpi/homescreen_blue_normal_holo.9.png
Binary files differ
diff --git a/res/drawable-sw600dp-xhdpi/homescreen_blue_strong_holo.9.png b/res/drawable-sw600dp-xhdpi/homescreen_blue_strong_holo.9.png
new file mode 100644
index 0000000..24ac880
--- /dev/null
+++ b/res/drawable-sw600dp-xhdpi/homescreen_blue_strong_holo.9.png
Binary files differ
diff --git a/res/drawable-sw600dp-xhdpi/portal_ring_inner_holo.png b/res/drawable-sw600dp-xhdpi/portal_ring_inner_holo.png
index a013e5a..d4ce45f 100644
--- a/res/drawable-sw600dp-xhdpi/portal_ring_inner_holo.png
+++ b/res/drawable-sw600dp-xhdpi/portal_ring_inner_holo.png
Binary files differ
diff --git a/res/drawable-xlarge-xhdpi/portal_ring_inner_nolip_holo.png b/res/drawable-sw600dp-xhdpi/portal_ring_inner_nolip_holo.png
similarity index 100%
rename from res/drawable-xlarge-xhdpi/portal_ring_inner_nolip_holo.png
rename to res/drawable-sw600dp-xhdpi/portal_ring_inner_nolip_holo.png
Binary files differ
diff --git a/res/drawable-sw600dp-xhdpi/portal_ring_outer_holo.png b/res/drawable-sw600dp-xhdpi/portal_ring_outer_holo.png
index 7bdaaf3..0106cd6 100644
--- a/res/drawable-sw600dp-xhdpi/portal_ring_outer_holo.png
+++ b/res/drawable-sw600dp-xhdpi/portal_ring_outer_holo.png
Binary files differ
diff --git a/res/drawable-xlarge-hdpi/portal_ring_inner_holo.png b/res/drawable-xlarge-hdpi/portal_ring_inner_holo.png
deleted file mode 100644
index b3be472..0000000
--- a/res/drawable-xlarge-hdpi/portal_ring_inner_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-hdpi/portal_ring_outer_holo.png b/res/drawable-xlarge-hdpi/portal_ring_outer_holo.png
deleted file mode 100644
index bc13a26..0000000
--- a/res/drawable-xlarge-hdpi/portal_ring_outer_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/portal_ring_inner_holo.png b/res/drawable-xlarge-mdpi/portal_ring_inner_holo.png
deleted file mode 100644
index 319c074..0000000
--- a/res/drawable-xlarge-mdpi/portal_ring_inner_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-mdpi/portal_ring_outer_holo.png b/res/drawable-xlarge-mdpi/portal_ring_outer_holo.png
deleted file mode 100644
index 365dcfc..0000000
--- a/res/drawable-xlarge-mdpi/portal_ring_outer_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-xhdpi/portal_ring_inner_holo.png b/res/drawable-xlarge-xhdpi/portal_ring_inner_holo.png
deleted file mode 100644
index d4ce45f..0000000
--- a/res/drawable-xlarge-xhdpi/portal_ring_inner_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xlarge-xhdpi/portal_ring_outer_holo.png b/res/drawable-xlarge-xhdpi/portal_ring_outer_holo.png
deleted file mode 100644
index 0106cd6..0000000
--- a/res/drawable-xlarge-xhdpi/portal_ring_outer_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/apps_customize_pane.xml b/res/layout/apps_customize_pane.xml
index 27f2efe..aaca695 100644
--- a/res/layout/apps_customize_pane.xml
+++ b/res/layout/apps_customize_pane.xml
@@ -50,8 +50,8 @@
android:id="@+id/apps_customize_pane_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
- launcher:cellCountX="@integer/apps_customize_cellCountX"
- launcher:cellCountY="@integer/apps_customize_cellCountY"
+ launcher:maxAppCellCountX="@integer/apps_customize_maxCellCountX"
+ launcher:maxAppCellCountY="@integer/apps_customize_maxCellCountY"
launcher:pageLayoutWidthGap="@dimen/apps_customize_pageLayoutWidthGap"
launcher:pageLayoutHeightGap="@dimen/apps_customize_pageLayoutHeightGap"
launcher:pageLayoutPaddingTop="@dimen/apps_customize_pageLayoutPaddingTop"
diff --git a/res/layout/apps_customize_widget.xml b/res/layout/apps_customize_widget.xml
index 704401a..90883c5 100644
--- a/res/layout/apps_customize_widget.xml
+++ b/res/layout/apps_customize_widget.xml
@@ -63,7 +63,7 @@
</LinearLayout>
<!-- The icon of the widget. -->
- <ImageView
+ <com.android.launcher2.PagedViewWidgetImageView
android:id="@+id/widget_preview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index c4aef8b..89e6773 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -53,8 +53,6 @@
<dimen name="apps_customize_cell_width">80dp</dimen>
<!-- The width can be 76dp because we don't have B padding -->
<dimen name="apps_customize_cell_height">76dp</dimen>
- <integer name="apps_customize_cellCountX">6</integer>
- <integer name="apps_customize_cellCountY">3</integer>
<dimen name="apps_customize_pageLayoutWidthGap">-1dp</dimen>
<dimen name="apps_customize_pageLayoutHeightGap">-1dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingTop">5dp</dimen>
diff --git a/res/values-port/dimens.xml b/res/values-port/dimens.xml
index 799742f..b7e8170 100644
--- a/res/values-port/dimens.xml
+++ b/res/values-port/dimens.xml
@@ -31,8 +31,6 @@
<dimen name="workspace_page_spacing">-1dp</dimen>
<!-- AppsCustomize -->
- <integer name="apps_customize_cellCountX">4</integer>
- <integer name="apps_customize_cellCountY">5</integer>
<dimen name="apps_customize_pageLayoutWidthGap">-1dp</dimen>
<dimen name="apps_customize_pageLayoutHeightGap">-1dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingTop">10dp</dimen>
diff --git a/res/values-sw600dp-land/dimens.xml b/res/values-sw600dp-land/dimens.xml
index 61d993e..f51f6f9 100644
--- a/res/values-sw600dp-land/dimens.xml
+++ b/res/values-sw600dp-land/dimens.xml
@@ -29,12 +29,12 @@
or right while you're dragging. -->
<dimen name="scroll_zone">100dip</dimen>
- <dimen name="apps_customize_pageLayoutWidthGap">28dp</dimen>
+ <dimen name="apps_customize_pageLayoutWidthGap">36dp</dimen>
<dimen name="apps_customize_pageLayoutHeightGap">8dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingTop">20dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingBottom">14dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingLeft">40dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingRight">40dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingLeft">30dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingRight">30dp</dimen>
<integer name="apps_customize_widget_cell_count_x">3</integer>
<integer name="apps_customize_widget_cell_count_y">2</integer>
</resources>
diff --git a/res/values-sw600dp-port/dimens.xml b/res/values-sw600dp-port/dimens.xml
index ebf837d..84f9835 100644
--- a/res/values-sw600dp-port/dimens.xml
+++ b/res/values-sw600dp-port/dimens.xml
@@ -36,8 +36,8 @@
<dimen name="apps_customize_pageLayoutHeightGap">36dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingTop">25dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingBottom">10dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingLeft">10dp</dimen>
- <dimen name="apps_customize_pageLayoutPaddingRight">10dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingLeft">30dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingRight">30dp</dimen>
<integer name="apps_customize_widget_cell_count_x">2</integer>
<integer name="apps_customize_widget_cell_count_y">3</integer>
</resources>
\ No newline at end of file
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 544b970..584734b 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -34,7 +34,7 @@
<!-- AppsCustomize -->
<dimen name="apps_customize_tab_bar_height">56dp</dimen>
<dimen name="apps_customize_cell_width">96dp</dimen>
- <dimen name="apps_customize_cell_height">96dp</dimen>
+ <dimen name="apps_customize_cell_height">98dp</dimen>
<dimen name="apps_customize_widget_cell_width_gap">36dp</dimen>
<dimen name="apps_customize_widget_cell_height_gap">36dp</dimen>
@@ -72,13 +72,6 @@
<dimen name="dragViewOffsetX">0dp</dimen>
<dimen name="dragViewOffsetY">-12dp</dimen>
-<!-- Workspace grid -->
- <!-- Padding applied to AppWidgets -->
- <dimen name="app_widget_padding_left">12dp</dimen>
- <dimen name="app_widget_padding_right">12dp</dimen>
- <dimen name="app_widget_padding_top">4dp</dimen>
- <dimen name="app_widget_padding_bottom">20dp</dimen>
-
<!-- Folders -->
<!-- The size of the image which sits behind the preview of the folder contents -->
<dimen name="folder_preview_size">80dp</dimen>
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index b315763..ec281f9 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -60,7 +60,7 @@
<style name="WorkspaceIcon.Portrait.AppsCustomize">
<item name="android:background">@null</item>
- <item name="android:paddingTop">4dp</item>
+ <item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
@@ -69,7 +69,7 @@
</style>
<style name="WorkspaceIcon.Landscape.AppsCustomize">
<item name="android:background">@null</item>
- <item name="android:paddingTop">4dp</item>
+ <item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item>
<item name="android:drawablePadding">4dp</item>
<item name="android:textSize">13sp</item>
diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
index 6a54265..239bdf5 100644
--- a/res/values-sw720dp-land/dimens.xml
+++ b/res/values-sw720dp-land/dimens.xml
@@ -17,4 +17,10 @@
<resources>
<integer name="apps_customize_widget_cell_count_x">4</integer>
<integer name="apps_customize_widget_cell_count_y">2</integer>
+
+<!-- AppsCustomize -->
+ <dimen name="apps_customize_pageLayoutWidthGap">28dp</dimen>
+ <dimen name="apps_customize_pageLayoutHeightGap">16dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingLeft">16dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingRight">16dp</dimen>
</resources>
\ No newline at end of file
diff --git a/res/values-sw720dp-port/dimens.xml b/res/values-sw720dp-port/dimens.xml
index 22d56d9..2e3f8ef 100644
--- a/res/values-sw720dp-port/dimens.xml
+++ b/res/values-sw720dp-port/dimens.xml
@@ -17,7 +17,14 @@
<resources>
<!-- We can also afford to have a slightly wider portrait layout in
xlarge -->
- <dimen name="apps_customize_pageLayoutWidthGap">36dp</dimen>
<integer name="apps_customize_widget_cell_count_x">3</integer>
<integer name="apps_customize_widget_cell_count_y">3</integer>
+
+<!-- AppsCustomize -->
+ <integer name="apps_customize_maxCellCountX">-1</integer>
+ <integer name="apps_customize_maxCellCountY">7</integer>
+ <dimen name="apps_customize_pageLayoutWidthGap">36dp</dimen>
+ <dimen name="apps_customize_pageLayoutHeightGap">36dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingLeft">24dp</dimen>
+ <dimen name="apps_customize_pageLayoutPaddingRight">24dp</dimen>
</resources>
\ No newline at end of file
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 0373295..5c39b01 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -17,4 +17,8 @@
<resources>
<dimen name="app_widget_preview_padding_left">0dp</dimen>
<dimen name="app_widget_preview_padding_top">10dp</dimen>
+
+<!-- AppsCustomize -->
+ <integer name="apps_customize_maxCellCountX">-1</integer>
+ <integer name="apps_customize_maxCellCountY">-1</integer>
</resources>
\ No newline at end of file
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 5fe1abd..1258562 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -107,10 +107,6 @@
<!-- PagedView specific attributes. These attributes are used to customize
a PagedView view in XML files. -->
<declare-styleable name="PagedView">
- <!-- The number of horizontal cells in a page -->
- <attr name="cellCountX" />
- <!-- The number of vertical cells in a page -->
- <attr name="cellCountY" />
<!-- A spacing override for the icons within a page -->
<attr name="pageLayoutWidthGap" format="dimension" />
<attr name="pageLayoutHeightGap" format="dimension" />
@@ -129,6 +125,10 @@
<!-- AppsCustomizePagedView specific attributes. These attributes are used to
customize an AppsCustomizePagedView in xml files. -->
<declare-styleable name="AppsCustomizePagedView">
+ <!-- Max number of cells of applications horizontally -->
+ <attr name="maxAppCellCountX" format="integer" />
+ <!-- Max number of cells of applications vertically -->
+ <attr name="maxAppCellCountY" format="integer" />
<!-- Horizontal spacing between widgets and wallpapers -->
<attr name="widgetCellWidthGap" format="dimension" />
<!-- Vertical spacing between widgets -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 967ef66..da82809 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -54,6 +54,8 @@
<dimen name="toolbar_external_icon_height">36dp</dimen>
<!-- AllApps/Customize/AppsCustomize -->
+ <integer name="apps_customize_maxCellCountX">-1</integer>
+ <integer name="apps_customize_maxCellCountY">-1</integer>
<!-- The height of the tab bar - if this changes, we should update the
external icon width/height above to compensate -->
<dimen name="apps_customize_tab_bar_height">52dp</dimen>
@@ -106,10 +108,6 @@
<dimen name="dragViewOffsetY">-8dp</dimen>
<!-- Padding applied to AppWidgets -->
- <dimen name="app_widget_padding_left">16dp</dimen>
- <dimen name="app_widget_padding_right">16dp</dimen>
- <dimen name="app_widget_padding_top">16dp</dimen>
- <dimen name="app_widget_padding_bottom">16dp</dimen>
<dimen name="app_widget_preview_padding_left">8dp</dimen>
<dimen name="app_widget_preview_padding_top">8dp</dimen>
diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java
index b7943ec..6d132eb 100644
--- a/src/com/android/launcher2/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher2/AppWidgetResizeFrame.java
@@ -5,9 +5,10 @@
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
+import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
-import android.content.res.Resources;
+import android.graphics.Rect;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.ImageView;
@@ -111,7 +112,8 @@
Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
addView(mBottomHandle, lp);
- Launcher.Padding p = mLauncher.getPaddingForWidget(widgetView.getAppWidgetInfo().provider);
+ Rect p = AppWidgetHostView.getDefaultPaddingForWidget(context,
+ widgetView.getAppWidgetInfo().provider, null);
mWidgetPaddingLeft = p.left;
mWidgetPaddingTop = p.top;
mWidgetPaddingRight = p.right;
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index d734ec1..924349d 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -207,6 +207,7 @@
// Dimens
private int mContentWidth;
private int mAppIconSize;
+ private int mMaxAppCellCountX, mMaxAppCellCountY;
private int mWidgetCountX, mWidgetCountY;
private int mWidgetWidthGap, mWidgetHeightGap;
private final int mWidgetPreviewIconPaddedDimension;
@@ -247,12 +248,9 @@
mAppIconSize = resources.getDimensionPixelSize(R.dimen.app_icon_size);
mDragViewMultiplyColor = resources.getColor(R.color.drag_view_multiply_color);
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, 0, 0);
- // TODO-APPS_CUSTOMIZE: remove these unnecessary attrs after
- mCellCountX = a.getInt(R.styleable.PagedView_cellCountX, 6);
- mCellCountY = a.getInt(R.styleable.PagedView_cellCountY, 4);
- a.recycle();
- a = context.obtainStyledAttributes(attrs, R.styleable.AppsCustomizePagedView, 0, 0);
+ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AppsCustomizePagedView, 0, 0);
+ mMaxAppCellCountX = a.getInt(R.styleable.AppsCustomizePagedView_maxAppCellCountX, -1);
+ mMaxAppCellCountY = a.getInt(R.styleable.AppsCustomizePagedView_maxAppCellCountY, -1);
mWidgetWidthGap =
a.getDimensionPixelSize(R.styleable.AppsCustomizePagedView_widgetCellWidthGap, 0);
mWidgetHeightGap =
@@ -373,6 +371,12 @@
maxCellCountY = (isLandscape ? LauncherModel.getCellCountY() :
LauncherModel.getCellCountX());
}
+ if (mMaxAppCellCountX > -1) {
+ maxCellCountX = Math.min(maxCellCountX, mMaxAppCellCountX);
+ }
+ if (mMaxAppCellCountY > -1) {
+ maxCellCountY = Math.min(maxCellCountY, mMaxAppCellCountY);
+ }
// Now that the data is ready, we can calculate the content width, the number of cells to
// use for each page
@@ -973,7 +977,6 @@
// Generate a preview image if we couldn't load one
if (drawable == null) {
- Resources resources = mLauncher.getResources();
// TODO: This actually uses the apps customize cell layout params, where as we make want
// the Workspace params for more accuracy.
int targetWidth = mWidgetSpacingLayout.estimateCellWidth(cellHSpan);
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 9ffc1d0..2d75493 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -102,9 +102,6 @@
private Drawable mOverScrollRight;
private Rect mBackgroundRect;
private Rect mForegroundRect;
- private Rect mGlowBackgroundRect;
- private float mGlowBackgroundScale;
- private float mGlowBackgroundAlpha;
private int mForegroundPadding;
// If we're actively dragging something over this screen, mIsDragOverlapping is true
@@ -258,9 +255,6 @@
mBackgroundRect = new Rect();
mForegroundRect = new Rect();
- mGlowBackgroundRect = new Rect();
- setHoverScale(1.0f);
- setHoverAlpha(1.0f);
mChildren = new CellLayoutChildren(context);
mChildren.setCellDimensions(mCellWidth, mCellHeight, mWidthGap, mHeightGap);
@@ -351,68 +345,6 @@
return mIsDragOverlapping;
}
- private void updateGlowRect() {
- float marginFraction = (mGlowBackgroundScale - 1.0f) / 2.0f;
- int marginX = (int) (marginFraction * (mBackgroundRect.right - mBackgroundRect.left));
- int marginY = (int) (marginFraction * (mBackgroundRect.bottom - mBackgroundRect.top));
- mGlowBackgroundRect.set(mBackgroundRect.left - marginX, mBackgroundRect.top - marginY,
- mBackgroundRect.right + marginX, mBackgroundRect.bottom + marginY);
- invalidate();
- }
-
- public void setHoverScale(float scaleFactor) {
- if (scaleFactor != mGlowBackgroundScale) {
- mGlowBackgroundScale = scaleFactor;
- updateGlowRect();
- if (getParent() != null) {
- ((View) getParent()).invalidate();
- }
- }
- }
-
- public float getHoverScale() {
- return mGlowBackgroundScale;
- }
-
- public float getHoverAlpha() {
- return mGlowBackgroundAlpha;
- }
-
- public void setHoverAlpha(float alpha) {
- mGlowBackgroundAlpha = alpha;
- invalidate();
- }
-
- void animateDrop() {
- Resources res = getResources();
- float onDropScale = res.getInteger(R.integer.config_screenOnDropScalePercent) / 100.0f;
- ObjectAnimator scaleUp = ObjectAnimator.ofFloat(this, "hoverScale", onDropScale);
- scaleUp.setDuration(res.getInteger(R.integer.config_screenOnDropScaleUpDuration));
- ObjectAnimator scaleDown = ObjectAnimator.ofFloat(this, "hoverScale", 1.0f);
- scaleDown.setDuration(res.getInteger(R.integer.config_screenOnDropScaleDownDuration));
- ObjectAnimator alphaFadeOut = ObjectAnimator.ofFloat(this, "hoverAlpha", 0.0f);
-
- alphaFadeOut.setStartDelay(res.getInteger(R.integer.config_screenOnDropAlphaFadeDelay));
- alphaFadeOut.setDuration(res.getInteger(R.integer.config_screenOnDropAlphaFadeDuration));
-
- AnimatorSet bouncer = new AnimatorSet();
- bouncer.play(scaleUp).before(scaleDown);
- bouncer.play(scaleUp).with(alphaFadeOut);
- bouncer.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- setIsDragOverlapping(true);
- }
- @Override
- public void onAnimationEnd(Animator animation) {
- setIsDragOverlapping(false);
- setHoverScale(1.0f);
- setHoverAlpha(1.0f);
- }
- });
- bouncer.start();
- }
-
@Override
protected void onDraw(Canvas canvas) {
// When we're large, we are either drawn in a "hover" state (ie when dragging an item to
@@ -939,7 +871,6 @@
mBackgroundRect.set(0, 0, w, h);
mForegroundRect.set(mForegroundPadding, mForegroundPadding,
w - 2 * mForegroundPadding, h - 2 * mForegroundPadding);
- updateGlowRect();
}
@Override
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 0e91cd3..664b597 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -29,6 +29,7 @@
import android.app.Dialog;
import android.app.SearchManager;
import android.app.StatusBarManager;
+import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ActivityNotFoundException;
@@ -75,9 +76,9 @@
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
+import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
-import android.view.View.OnLongClickListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
@@ -888,48 +889,12 @@
}
}
- class Padding {
- int left = 0;
- int right = 0;
- int top = 0;
- int bottom = 0;
- }
-
- Padding getPaddingForWidget(ComponentName component) {
- PackageManager packageManager = getPackageManager();
- Padding p = new Padding();
- android.content.pm.ApplicationInfo appInfo;
-
- try {
- appInfo = packageManager.getApplicationInfo(component.getPackageName(), 0);
- } catch (Exception e) {
- // if we can't find the package, return 0 padding
- return p;
- }
-
- if (appInfo.targetSdkVersion >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- Resources r = getResources();
- // The default padding values are private API currently, but will be added in
- // API level 15. The current values are (8, 8, 8, 8).
- p.left = r.getDimensionPixelSize(com.android.internal.
- R.dimen.default_app_widget_padding_left);
- p.right = r.getDimensionPixelSize(com.android.internal.
- R.dimen.default_app_widget_padding_right);
- p.top = r.getDimensionPixelSize(com.android.internal.
- R.dimen.default_app_widget_padding_top);
- p.bottom = r.getDimensionPixelSize(com.android.internal.
- R.dimen.default_app_widget_padding_bottom);
- }
-
- return p;
- }
-
int[] getSpanForWidget(ComponentName component, int minWidth, int minHeight, int[] spanXY) {
if (spanXY == null) {
spanXY = new int[2];
}
- Padding padding = getPaddingForWidget(component);
+ Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(this, component, null);
// We want to account for the extra amount of padding that we are adding to the widget
// to ensure that it gets the full amount of space that it has requested
int requiredWidth = minWidth + padding.left + padding.right;
@@ -2538,8 +2503,6 @@
void addExternalItemToScreen(ItemInfo itemInfo, final CellLayout layout) {
if (!mWorkspace.addExternalItemToScreen(itemInfo, layout)) {
showOutOfSpaceMessage();
- } else {
- layout.animateDrop();
}
}
diff --git a/src/com/android/launcher2/LauncherAppWidgetHostView.java b/src/com/android/launcher2/LauncherAppWidgetHostView.java
index 1a4a45e..71860f3 100644
--- a/src/com/android/launcher2/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher2/LauncherAppWidgetHostView.java
@@ -27,7 +27,6 @@
import android.view.ViewGroup;
import com.android.launcher.R;
-import com.android.launcher2.Launcher.Padding;
/**
* {@inheritDoc}
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 2de7d4a..ad88a89 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -127,6 +127,7 @@
protected boolean mCenterPagesVertically;
protected boolean mAllowOverScroll = true;
protected int mUnboundedScrollX;
+ protected int[] mTempVisiblePagesRange = new int[2];
// parameter that adjusts the layout to be optimized for pages with that scale factor
protected float mLayoutScale = 1.0f;
@@ -701,20 +702,7 @@
return (int) (maxWidth * mLayoutScale + 0.5f);
}
- @Override
- protected void dispatchDraw(Canvas canvas) {
- int halfScreenSize = getMeasuredWidth() / 2;
- int screenCenter = mScrollX + halfScreenSize;
-
- if (screenCenter != mLastScreenCenter || mForceScreenScrolled) {
- screenScrolled(screenCenter);
- mLastScreenCenter = screenCenter;
- mForceScreenScrolled = false;
- }
-
- // Find out which screens are visible; as an optimization we only call draw on them
- // As an optimization, this code assumes that all pages have the same width as the 0th
- // page.
+ protected void getVisiblePages(int[] range) {
final int pageCount = getChildCount();
if (pageCount > 0) {
final int pageWidth = getScaledMeasuredWidth(getPageAt(0));
@@ -731,6 +719,31 @@
rightScreen++;
x += getScaledMeasuredWidth(getPageAt(rightScreen)) + mPageSpacing;
}
+ range[0] = leftScreen;
+ range[1] = rightScreen;
+ } else {
+ range[0] = -1;
+ range[1] = -1;
+ }
+ }
+
+ @Override
+ protected void dispatchDraw(Canvas canvas) {
+ int halfScreenSize = getMeasuredWidth() / 2;
+ int screenCenter = mScrollX + halfScreenSize;
+
+ if (screenCenter != mLastScreenCenter || mForceScreenScrolled) {
+ screenScrolled(screenCenter);
+ mLastScreenCenter = screenCenter;
+ mForceScreenScrolled = false;
+ }
+
+ // Find out which screens are visible; as an optimization we only call draw on them
+ final int pageCount = getChildCount();
+ if (pageCount > 0) {
+ getVisiblePages(mTempVisiblePagesRange);
+ final int leftScreen = mTempVisiblePagesRange[0];
+ final int rightScreen = mTempVisiblePagesRange[1];
final long drawingTime = getDrawingTime();
// Clip to the bounds
@@ -1777,7 +1790,7 @@
updateScrollingIndicatorPosition();
cancelScrollingIndicatorAnimations();
if (immediately) {
- mScrollIndicator.setVisibility(View.GONE);
+ mScrollIndicator.setVisibility(View.INVISIBLE);
mScrollIndicator.setAlpha(0f);
} else {
mScrollIndicatorAnimator = ObjectAnimator.ofFloat(mScrollIndicator, "alpha", 0f);
@@ -1791,7 +1804,7 @@
@Override
public void onAnimationEnd(Animator animation) {
if (!cancelled) {
- mScrollIndicator.setVisibility(View.GONE);
+ mScrollIndicator.setVisibility(View.INVISIBLE);
}
}
});
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 2ef7e29..6266ca2 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -69,7 +69,7 @@
resources.getDimensionPixelSize(R.dimen.apps_customize_cell_height);
mCellCountX = LauncherModel.getCellCountX();
mCellCountY = LauncherModel.getCellCountY();
- mOriginalHeightGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
+ mOriginalWidthGap = mOriginalHeightGap = mWidthGap = mHeightGap = -1;
mMaxGap = resources.getDimensionPixelSize(R.dimen.apps_customize_max_gap);
mChildren = new PagedViewCellLayoutChildren(context);
@@ -294,8 +294,8 @@
}
public void setGap(int widthGap, int heightGap) {
- mWidthGap = widthGap;
- mHeightGap = heightGap;
+ mOriginalWidthGap = mWidthGap = widthGap;
+ mOriginalHeightGap = mHeightGap = heightGap;
mChildren.setGap(widthGap, heightGap);
}
@@ -325,10 +325,9 @@
* Estimates the number of cells that the specified width would take up.
*/
public int estimateCellHSpan(int width) {
- // The space for a page assuming that we want to show half of a column of the previous and
- // next pages is the width - left padding (current & next page) - right padding (previous &
- // current page) - half cell width (for previous and next pages)
- int availWidth = (int) (width - (2 * mPaddingLeft + 2 * mPaddingRight));
+ // We don't show the next/previous pages any more, so we use the full width, minus the
+ // padding
+ int availWidth = width - (mPaddingLeft + mPaddingRight);
// We know that we have to fit N cells with N-1 width gaps, so we just juggle to solve for N
int n = Math.max(1, (availWidth + mWidthGap) / (mCellWidth + mWidthGap));
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index 12c98b2..3eb4db4 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -136,10 +136,13 @@
}
void applyPreview(FastBitmapDrawable preview, int index, boolean scale) {
- final ImageView image = (ImageView) findViewById(R.id.widget_preview);
+ final PagedViewWidgetImageView image =
+ (PagedViewWidgetImageView) findViewById(R.id.widget_preview);
if (preview != null) {
+ image.mAllowRequestLayout = false;
image.setImageDrawable(preview);
image.setScaleType(scale ? ImageView.ScaleType.FIT_START : ImageView.ScaleType.MATRIX);
+ image.mAllowRequestLayout = true;
image.setAlpha(0f);
image.animate()
.alpha(1f)
diff --git a/src/com/android/launcher2/PagedViewWidgetImageView.java b/src/com/android/launcher2/PagedViewWidgetImageView.java
new file mode 100644
index 0000000..844b337
--- /dev/null
+++ b/src/com/android/launcher2/PagedViewWidgetImageView.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package com.android.launcher2;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+
+
+
+class PagedViewWidgetImageView extends ImageView {
+ public boolean mAllowRequestLayout = true;
+
+ public PagedViewWidgetImageView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public void requestLayout() {
+ if (mAllowRequestLayout) {
+ super.requestLayout();
+ }
+ }
+}
diff --git a/src/com/android/launcher2/SearchDropTargetBar.java b/src/com/android/launcher2/SearchDropTargetBar.java
index e90406e..3a7f24b 100644
--- a/src/com/android/launcher2/SearchDropTargetBar.java
+++ b/src/com/android/launcher2/SearchDropTargetBar.java
@@ -119,7 +119,7 @@
mDropTargetBarFadeOutAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- mDropTargetBar.setVisibility(View.GONE);
+ mDropTargetBar.setVisibility(View.INVISIBLE);
mDropTargetBar.setLayerType(View.LAYER_TYPE_NONE, null);
}
});
@@ -136,7 +136,7 @@
mQSBSearchBarFadeOutAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- mQSBSearchBar.setVisibility(View.GONE);
+ mQSBSearchBar.setVisibility(View.INVISIBLE);
}
});
}
@@ -166,7 +166,7 @@
if (animated) {
mQSBSearchBarFadeOutAnim.start();
} else {
- mQSBSearchBar.setVisibility(View.GONE);
+ mQSBSearchBar.setVisibility(View.INVISIBLE);
mQSBSearchBar.setAlpha(0f);
}
mIsSearchBarHidden = true;
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index d3a31c4..b6b90f4 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1241,6 +1241,19 @@
@Override
protected void dispatchDraw(Canvas canvas) {
+ if (mChildrenLayersEnabled) {
+ getVisiblePages(mTempVisiblePagesRange);
+ final int leftScreen = mTempVisiblePagesRange[0];
+ final int rightScreen = mTempVisiblePagesRange[1];
+ if (leftScreen != -1 && rightScreen != -1) {
+ // calling setChildrenLayersEnabled on a view that's not visible/rendered
+ // causes slowdowns on some graphics cards, so we set it here to be sure
+ // it's only called when it's safe (ie when the view will be rendered)
+ for (int i = leftScreen; i <= rightScreen; i++) {
+ ((ViewGroup)getPageAt(i)).setChildrenLayersEnabled(true);
+ }
+ }
+ }
super.dispatchDraw(canvas);
if (mInScrollArea && !LauncherApplication.isScreenLarge()) {
@@ -1345,8 +1358,13 @@
if (enableChildrenLayers != mChildrenLayersEnabled) {
mChildrenLayersEnabled = enableChildrenLayers;
- for (int i = 0; i < getPageCount(); i++) {
- ((ViewGroup)getChildAt(i)).setChildrenLayersEnabled(enableChildrenLayers);
+ // calling setChildrenLayersEnabled on a view that's not visible/rendered
+ // causes slowdowns on some graphics cards, so we only disable it here and leave
+ // the enabling to dispatchDraw
+ if (!enableChildrenLayers) {
+ for (int i = 0; i < getPageCount(); i++) {
+ ((ViewGroup)getChildAt(i)).setChildrenLayersEnabled(false);
+ }
}
}
}
@@ -2960,7 +2978,6 @@
addInScreen(view, container, screen, mTargetCell[0], mTargetCell[1], info.spanX,
info.spanY, insertAtFirst);
cellLayout.onDropChild(view);
- cellLayout.animateDrop();
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) view.getLayoutParams();
cellLayout.getChildrenLayout().measureChild(view);