diff --git a/res/layout/widget_cell.xml b/res/layout/widget_cell.xml index 64ddea1aea..cb1c812cbf 100644 --- a/res/layout/widget_cell.xml +++ b/res/layout/widget_cell.xml @@ -17,13 +17,11 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:launcher="http://schemas.android.com/apk/res-auto" android:layout_width="@dimen/widget_preview_container_width" - android:layout_height="wrap_content" + android:layout_height="@dimen/widget_cell_height" android:layout_weight="1" - android:layout_marginTop="@dimen/widget_preview_padding_top" - android:layout_marginLeft="8dp" - android:layout_marginBottom="8dp" + android:layout_marginRight="@dimen/widget_row_divider" android:orientation="vertical" - android:background="@color/bubble_dark_background" + android:background="@color/widgets_cell_color" android:focusable="true"> @@ -29,24 +28,23 @@ android:layout_height="wrap_content" android:orientation="horizontal" android:focusable="true" - android:background="@drawable/focusable_view_bg" android:descendantFocusability="afterDescendants"> - - - + android:orientation="horizontal" + android:background="@color/widget_text_panel"/> diff --git a/res/values/colors.xml b/res/values/colors.xml index 3a06bd95ac..58a4d4ce13 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -42,4 +42,5 @@ #009688 + #263238 diff --git a/res/values/dimens.xml b/res/values/dimens.xml index da11082719..a57ae89d0c 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -86,12 +86,16 @@ 8dp 8dp - 52dp - 8dp + 56dp + 72dp + 8dp + 16dp 136dp 150dp + 8dp + 1dp 0dp diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java index 0bc7333eca..7c7d982dea 100644 --- a/src/com/android/launcher3/widget/WidgetCell.java +++ b/src/com/android/launcher3/widget/WidgetCell.java @@ -48,7 +48,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { private static final String TAG = "WidgetCell"; private static final boolean DEBUG = false; - private static final int FADE_IN_DURATION_MS = 70; + private static final int FADE_IN_DURATION_MS = 90; private int mPresetPreviewSize; private ImageView mWidgetImage; @@ -104,6 +104,8 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { mWidgetImage.setImageDrawable(null); mWidgetName.setText(null); mWidgetDims.setText(null); + + cancelLoader(false); } /** @@ -140,16 +142,6 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { mWidgetPreviewLoader = loader; } - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - deletePreview(false); - - if (DEBUG) { - Log.d(TAG, String.format("[tag=%s] onDetachedFromWindow", getTagToString())); - } - } - public int[] getPreviewSize() { int[] maxSize = new int[2]; maxSize[0] = mPresetPreviewSize; @@ -219,10 +211,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { return Math.min(size[0], info.spanX * cellWidth); } - - private void deletePreview(boolean recycleImage) { - mWidgetImage.setImageDrawable(null); - + private void cancelLoader(boolean recycleImage) { if (mActiveRequest != null) { mActiveRequest.cancel(recycleImage); mActiveRequest = null; diff --git a/src/com/android/launcher3/widget/WidgetsListAdapter.java b/src/com/android/launcher3/widget/WidgetsListAdapter.java index f6ab21eb41..a5b2aff1b2 100644 --- a/src/com/android/launcher3/widget/WidgetsListAdapter.java +++ b/src/com/android/launcher3/widget/WidgetsListAdapter.java @@ -127,7 +127,6 @@ public class WidgetsListAdapter extends Adapter { // Bind the view in the widget horizontal tray region. for (int i=0; i < infoList.size(); i++) { WidgetCell widget = (WidgetCell) row.getChildAt(i); - widget.reset(); if (getWidgetPreviewLoader() == null) { return; } @@ -158,6 +157,16 @@ public class WidgetsListAdapter extends Adapter { return new WidgetsRowViewHolder(container); } + @Override + public void onViewRecycled(WidgetsRowViewHolder holder) { + ViewGroup row = ((ViewGroup) holder.getContent().findViewById(R.id.widgets_cell_list)); + + for (int i = 0; i < row.getChildCount(); i++) { + WidgetCell widget = (WidgetCell) row.getChildAt(i); + widget.reset(); + } + } + @Override public long getItemId(int pos) { return pos;