OSDN Git Service

WidgetTray UI tweak
authorHyunyoung Song <hyunyoungs@google.com>
Sat, 18 Apr 2015 02:02:30 +0000 (19:02 -0700)
committerHyunyoung Song <hyunyoungs@google.com>
Mon, 20 Apr 2015 02:25:49 +0000 (19:25 -0700)
- 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
res/layout/widgets_view.xml
res/values-sw600dp/dimens.xml
res/values-v17/styles.xml
res/values/dimens.xml
res/values/styles.xml
src/com/android/launcher3/LauncherStateTransitionAnimation.java
src/com/android/launcher3/widget/WidgetCell.java
src/com/android/launcher3/widget/WidgetsContainerView.java

index a5b25aa..f53b74e 100644 (file)
 <com.android.launcher3.widget.WidgetCell
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:launcher="http://schemas.android.com/apk/res-auto"
-
-    android:layout_width="wrap_content"
+    android:layout_width="@dimen/widget_preview_container_width"
     android:layout_height="wrap_content"
     android:layout_weight="1"
+    android:paddingTop="@dimen/widget_preview_padding_top"
     android:orientation="vertical"
     android:background="@drawable/focusable_view_bg"
     android:focusable="true">
 
     <LinearLayout
-        android:layout_width="match_parent"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:paddingTop="@dimen/widget_preview_label_vertical_padding"
         android:paddingBottom="@dimen/widget_preview_label_vertical_padding"
@@ -64,6 +64,7 @@
 
             android:textColor="#FFFFFFFF"
             android:textSize="12sp"
+            android:textAlignment="viewStart"
             android:fontFamily="sans-serif-condensed"
             android:shadowRadius="2.0"
             android:shadowColor="#B0000000" />
     <com.android.launcher3.widget.WidgetImageView
         android:id="@+id/widget_preview"
         style="@style/WidgetImageView"
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_weight="1"
-        android:paddingTop="@dimen/widget_preview_padding_top"
-        android:paddingEnd="@dimen/widget_preview_padding_right"
-        android:paddingRight="@dimen/widget_preview_padding_right"
         android:scaleType="matrix" />
 
 </com.android.launcher3.widget.WidgetCell>
index 8e7ed16..0800f59 100644 (file)
     android:paddingBottom="@dimen/widget_container_inset"
     android:descendantFocusability="afterDescendants">
 
-    <!-- Temporary until finalizing on animation.  -->
-    <include
+    <FrameLayout
         android:id="@+id/widgets_reveal_view"
-        layout="@layout/apps_reveal_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:layout_gravity="center" />
+        android:layout_gravity="center"
+        android:visibility="invisible"
+        android:focusable="false" />
 
     <LinearLayout
-        android:id="@+id/content"
+        android:id="@+id/widgets_content"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:clipChildren="false"
index 13a1f40..9ecd07d 100644 (file)
@@ -25,8 +25,8 @@
 
 <!-- AppsCustomize -->
     <dimen name="widget_preview_label_margin_top">8dp</dimen>
-    <dimen name="widget_preview_label_margin_left">@dimen/widget_preview_padding_left</dimen>
-    <dimen name="widget_preview_label_margin_right">@dimen/widget_preview_padding_right</dimen>
+    <dimen name="widget_preview_label_margin_left">@dimen/widget_preview_label_horizontal_padding</dimen>
+    <dimen name="widget_preview_label_margin_right">@dimen/widget_preview_label_horizontal_padding</dimen>
 
 <!-- Cling -->
     <dimen name="cling_migration_logo_height">400dp</dimen>
index 229375f..3589e80 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <style name="WidgetImageView">
-        <item name="android:paddingStart">@dimen/widget_preview_padding_left</item>
+        <item name="android:paddingStart">@dimen/widget_preview_horizontal_padding</item>
     </style>
 </resources>
index 101b755..cad60fb 100644 (file)
 <!-- Widget tray -->
     <dimen name="widget_container_inset">8dp</dimen>
     <dimen name="widget_preview_size">140dp</dimen>
-    <dimen name="widget_preview_padding_left">16dp</dimen>
-    <dimen name="widget_preview_padding_right">16dp</dimen>
     <dimen name="widget_preview_padding_top">8dp</dimen>
     <dimen name="widget_preview_label_vertical_padding">8dp</dimen>
     <dimen name="widget_preview_label_horizontal_padding">8dp</dimen>
+    <dimen name="widget_preview_horizontal_padding">8dp</dimen>
 
     <dimen name="widget_section_height">52dp</dimen>
     <dimen name="widget_section_icon_padding">8dp</dimen>
 
+    <!-- Equation: widget_preview_size + 2 * widget_preview_padding_horizontal -->
+    <dimen name="widget_preview_container_width">156dp</dimen>
     <dimen name="widget_cell_height">160dp</dimen>
 
     <!-- Padding applied to shortcut previews -->
index 94efebc..16d4cbe 100644 (file)
@@ -92,7 +92,7 @@
 
     <!-- Overridden in device overlays -->
     <style name="WidgetImageView">
-        <item name="android:paddingLeft">@dimen/widget_preview_padding_left</item>
+        <item name="android:paddingLeft">@dimen/widget_preview_horizontal_padding</item>
     </style>
 
 </resources>
index 78272a8..8ba5c60 100644 (file)
@@ -182,8 +182,14 @@ 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,9 +487,15 @@ 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;
             }
index d10c304..1ae75c3 100644 (file)
@@ -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();
         }
index 5aa80a9..292a5de 100644 (file)
@@ -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() {