summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2015-04-18 02:02:30 (GMT)
committerHyunyoung Song <hyunyoungs@google.com>2015-04-20 02:25:49 (GMT)
commit4cea4c830283e017fc36197cfe9d7ce713aec49d (patch)
tree786e402b2d907cb468ade930ce7a9643ca6b742c
parent7af216ff04b7f0c3852119b476d8f692edfcaaa7 (diff)
downloadandroid_packages_apps_Trebuchet-4cea4c830283e017fc36197cfe9d7ce713aec49d.zip
android_packages_apps_Trebuchet-4cea4c830283e017fc36197cfe9d7ce713aec49d.tar.gz
android_packages_apps_Trebuchet-4cea4c830283e017fc36197cfe9d7ce713aec49d.tar.bz2
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
-rw-r--r--res/layout/widget_cell.xml12
-rw-r--r--res/layout/widgets_view.xml10
-rw-r--r--res/values-sw600dp/dimens.xml4
-rw-r--r--res/values-v17/styles.xml2
-rw-r--r--res/values/dimens.xml5
-rw-r--r--res/values/styles.xml2
-rw-r--r--src/com/android/launcher3/LauncherStateTransitionAnimation.java20
-rw-r--r--src/com/android/launcher3/widget/WidgetCell.java8
-rw-r--r--src/com/android/launcher3/widget/WidgetsContainerView.java2
9 files changed, 37 insertions, 28 deletions
diff --git a/res/layout/widget_cell.xml b/res/layout/widget_cell.xml
index a5b25aa..f53b74e 100644
--- a/res/layout/widget_cell.xml
+++ b/res/layout/widget_cell.xml
@@ -16,16 +16,16 @@
<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" />
@@ -73,12 +74,9 @@
<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>
diff --git a/res/layout/widgets_view.xml b/res/layout/widgets_view.xml
index 8e7ed16..0800f59 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">
- <!-- 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"
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 13a1f40..9ecd07dd 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -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>
diff --git a/res/values-v17/styles.xml b/res/values-v17/styles.xml
index 229375f..3589e80 100644
--- a/res/values-v17/styles.xml
+++ b/res/values-v17/styles.xml
@@ -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>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 101b755..cad60fb 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -81,15 +81,16 @@
<!-- 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 -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 94efebc..16d4cbe 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -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>
diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
index 78272a8..8ba5c60 100644
--- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java
+++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
@@ -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;
}
diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java
index d10c304..1ae75c3 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 5aa80a9..292a5de 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() {