From 4cea4c830283e017fc36197cfe9d7ce713aec49d Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Fri, 17 Apr 2015 19:02:30 -0700 Subject: WidgetTray UI tweak - set fixed image view width - fade in when widget bitmap populates - widget dimension is next to the widget name text. - elevation of the widgets content and the reveal view is the same b/19897708 Change-Id: Ia656144412e7d63a491ce67ff15fb58c05d9a9d9 --- res/layout/widget_cell.xml | 12 +++++------- res/layout/widgets_view.xml | 10 +++++----- res/values-sw600dp/dimens.xml | 4 ++-- res/values-v17/styles.xml | 2 +- res/values/dimens.xml | 5 +++-- res/values/styles.xml | 2 +- .../launcher3/LauncherStateTransitionAnimation.java | 20 ++++++++++++++++---- src/com/android/launcher3/widget/WidgetCell.java | 8 +++----- .../launcher3/widget/WidgetsContainerView.java | 2 +- 9 files changed, 37 insertions(+), 28 deletions(-) diff --git a/res/layout/widget_cell.xml b/res/layout/widget_cell.xml index a5b25aadb..f53b74ef8 100644 --- a/res/layout/widget_cell.xml +++ b/res/layout/widget_cell.xml @@ -16,16 +16,16 @@ @@ -73,12 +74,9 @@ diff --git a/res/layout/widgets_view.xml b/res/layout/widgets_view.xml index 8e7ed161a..0800f59aa 100644 --- a/res/layout/widgets_view.xml +++ b/res/layout/widgets_view.xml @@ -25,16 +25,16 @@ android:paddingBottom="@dimen/widget_container_inset" android:descendantFocusability="afterDescendants"> - - + android:layout_gravity="center" + android:visibility="invisible" + android:focusable="false" /> 8dp - @dimen/widget_preview_padding_left - @dimen/widget_preview_padding_right + @dimen/widget_preview_label_horizontal_padding + @dimen/widget_preview_label_horizontal_padding 400dp diff --git a/res/values-v17/styles.xml b/res/values-v17/styles.xml index 229375f85..3589e80ac 100644 --- a/res/values-v17/styles.xml +++ b/res/values-v17/styles.xml @@ -1,6 +1,6 @@ diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 101b7558a..cad60fbae 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -81,15 +81,16 @@ 8dp 140dp - 16dp - 16dp 8dp 8dp 8dp + 8dp 52dp 8dp + + 156dp 160dp diff --git a/res/values/styles.xml b/res/values/styles.xml index 94efebc06..16d4cbeed 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -92,7 +92,7 @@ diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java index 78272a8ec..8ba5c60f3 100644 --- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java +++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java @@ -182,7 +182,13 @@ public class LauncherStateTransitionAnimation { */ public void startAnimationToWidgets(final boolean animated) { final WidgetsContainerView toView = mLauncher.getWidgetsView(); + final Resources res = mLauncher.getResources(); PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() { + @Override + public void onRevealViewVisible(View revealView, View contentView, + View allAppsButtonView) { + revealView.setBackground(res.getDrawable(R.drawable.quantum_panel_dark)); + } @Override public float getMaterialRevealViewFinalAlpha(View revealView) { return 0.3f; @@ -192,8 +198,9 @@ public class LauncherStateTransitionAnimation { return revealView.getMeasuredHeight() / 2; } }; - startAnimationToOverlay(Workspace.State.OVERVIEW_HIDDEN, toView, toView.getContentView(), - toView.getRevealView(), animated, true /* hideSearchBar */, cb); + startAnimationToOverlay(Workspace.State.OVERVIEW_HIDDEN, toView, + toView.getContentView(), toView.getRevealView(), animated, true /* hideSearchBar */, + cb); } /** @@ -386,7 +393,6 @@ public class LauncherStateTransitionAnimation { mStateAnimation.start(); } }; - toView.bringToFront(); toView.setVisibility(View.VISIBLE); toView.post(startAnimRunnable); @@ -481,8 +487,14 @@ public class LauncherStateTransitionAnimation { private void startAnimationToWorkspaceFromWidgets(final Launcher.State fromState, final Workspace.State toWorkspaceState, final boolean animated, final Runnable onCompleteRunnable) { - WidgetsContainerView widgetsView = mLauncher.getWidgetsView(); + final WidgetsContainerView widgetsView = mLauncher.getWidgetsView(); + final Resources res = mLauncher.getResources(); PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() { + @Override + public void onRevealViewVisible(View revealView, View contentView, + View allAppsButtonView) { + revealView.setBackground(res.getDrawable(R.drawable.quantum_panel_dark)); + } @Override public float getMaterialRevealViewFinalYDrift(View revealView) { return revealView.getMeasuredHeight() / 2; diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java index d10c3049e..1ae75c3cc 100644 --- a/src/com/android/launcher3/widget/WidgetCell.java +++ b/src/com/android/launcher3/widget/WidgetCell.java @@ -50,10 +50,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { private static final String TAG = "WidgetCell"; private static final boolean DEBUG = false; - // Temporary preset width and height of the image to keep them aligned. - //private static final int PRESET_PREVIEW_HEIGHT = 480; - //private static final int PRESET_PREVIEW_WIDTH = 480; - + private static final int FADE_IN_DURATION_MS = 70; private int mPresetPreviewSize; private static WidgetCell sShortpressTarget = null; @@ -210,7 +207,8 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { mOriginalImagePadding.right, mOriginalImagePadding.bottom); } - image.setAlpha(1f); + image.setAlpha(0f); + image.animate().alpha(1.0f).setDuration(FADE_IN_DURATION_MS); image.mAllowRequestLayout = true; image.requestLayout(); } diff --git a/src/com/android/launcher3/widget/WidgetsContainerView.java b/src/com/android/launcher3/widget/WidgetsContainerView.java index 5aa80a9e2..292a5de20 100644 --- a/src/com/android/launcher3/widget/WidgetsContainerView.java +++ b/src/com/android/launcher3/widget/WidgetsContainerView.java @@ -126,7 +126,7 @@ public class WidgetsContainerView extends FrameLayout implements Insettable, Vie // public View getContentView() { - return findViewById(R.id.widgets_list_view); + return findViewById(R.id.widgets_content); } public View getRevealView() { -- cgit v1.2.3