diff options
-rw-r--r-- | res/drawable/gutter_horizontal.xml | 9 | ||||
-rw-r--r-- | res/layout/notification.xml | 24 | ||||
-rw-r--r-- | res/layout/notification_main.xml | 2 | ||||
-rw-r--r-- | res/values/dimens.xml | 1 | ||||
-rw-r--r-- | res/values/styles.xml | 7 | ||||
-rw-r--r-- | src/com/android/launcher3/anim/RoundedRectRevealOutlineProvider.java | 2 | ||||
-rw-r--r-- | src/com/android/launcher3/folder/FolderAnimationManager.java | 10 | ||||
-rw-r--r-- | src/com/android/launcher3/notification/NotificationItemView.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/popup/PopupContainerWithArrow.java | 18 | ||||
-rw-r--r-- | src/com/android/launcher3/shortcuts/ShortcutsItemView.java | 4 |
10 files changed, 68 insertions, 12 deletions
diff --git a/res/drawable/gutter_horizontal.xml b/res/drawable/gutter_horizontal.xml new file mode 100644 index 000000000..95b03df27 --- /dev/null +++ b/res/drawable/gutter_horizontal.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- This "gutter" has a shadow at the top and a subtler shadow on the bottom. --> +<shape xmlns:android="http://schemas.android.com/apk/res/android"> + <gradient android:type="linear" + android:angle="-90" + android:startColor="#ffE0E0E0" + android:centerColor="#ffffffff" + android:endColor="#ffF5F5F5" /> +</shape>
\ No newline at end of file diff --git a/res/layout/notification.xml b/res/layout/notification.xml index 085dfa93c..4a02aa169 100644 --- a/res/layout/notification.xml +++ b/res/layout/notification.xml @@ -28,6 +28,13 @@ android:orientation="vertical" android:clipChildren="false"> + <View + android:id="@+id/gutter_top" + android:layout_width="match_parent" + android:layout_height="4dp" + android:theme="@style/PopupGutter" + android:visibility="gone" /> + <FrameLayout android:id="@+id/header" android:layout_width="match_parent" @@ -35,22 +42,23 @@ android:paddingStart="@dimen/notification_padding_start" android:paddingEnd="@dimen/notification_padding_end" android:background="?attr/popupColorPrimary" - android:elevation="@dimen/notification_elevation"> + android:elevation="@dimen/notification_elevation" + android:layout_below="@id/gutter_top" > <TextView android:id="@+id/notification_text" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" - android:gravity="center_vertical" + android:gravity="bottom" android:text="@string/notifications_header" android:textSize="@dimen/notification_header_text_size" - android:textColor="?android:attr/textColorSecondary" /> + android:textColor="?android:attr/textColorPrimary" /> <TextView android:id="@+id/notification_count" android:layout_width="@dimen/notification_icon_size" android:layout_height="match_parent" android:layout_gravity="end" - android:gravity="center" + android:gravity="bottom|center_horizontal" android:textSize="@dimen/notification_header_count_text_size" android:fontFamily="sans-serif-medium" android:textColor="?android:attr/textColorPrimary" /> @@ -76,6 +84,14 @@ android:layout_height="@dimen/notification_footer_height" android:layout_below="@id/divider" /> + <View + android:id="@+id/gutter_bottom" + android:layout_width="match_parent" + android:layout_height="4dp" + android:theme="@style/PopupGutter" + android:visibility="gone" + android:layout_below="@id/footer" /> + </RelativeLayout> </com.android.launcher3.notification.NotificationItemView> diff --git a/res/layout/notification_main.xml b/res/layout/notification_main.xml index 7a8cf6d5c..f681e8b06 100644 --- a/res/layout/notification_main.xml +++ b/res/layout/notification_main.xml @@ -38,7 +38,7 @@ android:layout_height="wrap_content" android:textAlignment="viewStart" android:fontFamily="sans-serif" - android:textSize="@dimen/notification_main_text_size" + android:textSize="@dimen/notification_main_title_size" android:textColor="?android:attr/textColorPrimary" android:lines="1" android:ellipsize="end" /> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index a4dff7190..980b71483 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -213,6 +213,7 @@ <dimen name="notification_footer_height">32dp</dimen> <dimen name="notification_header_text_size">13sp</dimen> <dimen name="notification_header_count_text_size">12sp</dimen> + <dimen name="notification_main_title_size">16sp</dimen> <dimen name="notification_main_text_size">14sp</dimen> <dimen name="notification_icon_size">24dp</dimen> <dimen name="notification_footer_icon_size">18dp</dimen> diff --git a/res/values/styles.xml b/res/values/styles.xml index d11b00208..813fe8f29 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -140,6 +140,13 @@ <style name="PopupItem"> <item name="android:colorControlHighlight">?attr/popupColorTertiary</item> </style> + <style name="PopupGutter"> + <item name="android:backgroundTintMode">multiply</item> + <item name="android:backgroundTint">?attr/popupColorSecondary</item> + <item name="android:background">@drawable/gutter_horizontal</item> + <item name="android:elevation">@dimen/notification_elevation</item> + <item name="android:outlineProvider">none</item> + </style> <!-- Drop targets --> <style name="DropTargetButtonBase"> diff --git a/src/com/android/launcher3/anim/RoundedRectRevealOutlineProvider.java b/src/com/android/launcher3/anim/RoundedRectRevealOutlineProvider.java index 7c5fa1ced..d01b26c8f 100644 --- a/src/com/android/launcher3/anim/RoundedRectRevealOutlineProvider.java +++ b/src/com/android/launcher3/anim/RoundedRectRevealOutlineProvider.java @@ -56,7 +56,7 @@ public class RoundedRectRevealOutlineProvider extends RevealOutlineAnimation { @Override public boolean shouldRemoveElevationDuringAnimation() { - return true; + return false; } @Override diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java index 3648c60e1..80eb74d66 100644 --- a/src/com/android/launcher3/folder/FolderAnimationManager.java +++ b/src/com/android/launcher3/folder/FolderAnimationManager.java @@ -198,8 +198,14 @@ public class FolderAnimationManager { play(a, getAnimator(mFolder, SCALE_PROPERTY, initialScale, finalScale)); play(a, getAnimator(mFolderBackground, "color", initialColor, finalColor)); play(a, mFolderIcon.mFolderName.createTextAlphaAnimator(!mIsOpening)); - play(a, new RoundedRectRevealOutlineProvider(initialRadius, finalRadius, startRect, - endRect).createRevealAnimator(mFolder, !mIsOpening)); + RoundedRectRevealOutlineProvider outlineProvider = new RoundedRectRevealOutlineProvider( + initialRadius, finalRadius, startRect, endRect) { + @Override + public boolean shouldRemoveElevationDuringAnimation() { + return true; + } + }; + play(a, outlineProvider.createRevealAnimator(mFolder, !mIsOpening)); // Animate the elevation midway so that the shadow is not noticeable in the background. int midDuration = mDuration / 2; diff --git a/src/com/android/launcher3/notification/NotificationItemView.java b/src/com/android/launcher3/notification/NotificationItemView.java index 0b08ef835..0cd5a4c40 100644 --- a/src/com/android/launcher3/notification/NotificationItemView.java +++ b/src/com/android/launcher3/notification/NotificationItemView.java @@ -48,6 +48,7 @@ public class NotificationItemView extends PopupItemView implements LogContainerP private static final Rect sTempRect = new Rect(); + private TextView mHeaderText; private TextView mHeaderCount; private NotificationMainView mMainView; private NotificationFooterLayout mFooter; @@ -70,6 +71,7 @@ public class NotificationItemView extends PopupItemView implements LogContainerP @Override protected void onFinishInflate() { super.onFinishInflate(); + mHeaderText = (TextView) findViewById(R.id.notification_text); mHeaderCount = (TextView) findViewById(R.id.notification_count); mMainView = (NotificationMainView) findViewById(R.id.main_view); mFooter = (NotificationFooterLayout) findViewById(R.id.footer); @@ -106,6 +108,7 @@ public class NotificationItemView extends PopupItemView implements LogContainerP IconPalette.resolveContrastColor(getContext(), palette.dominantColor, Themes.getAttrColor(getContext(), R.attr.popupColorPrimary)); } + mHeaderText.setTextColor(mNotificationHeaderTextColor); mHeaderCount.setTextColor(mNotificationHeaderTextColor); } } diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index 77375fa48..425a08d96 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -285,9 +285,11 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra int roundedCorners = ROUNDED_TOP_CORNERS | ROUNDED_BOTTOM_CORNERS; if (shouldUnroundTopCorners) { roundedCorners &= ~ROUNDED_TOP_CORNERS; + mNotificationItemView.findViewById(R.id.gutter_top).setVisibility(VISIBLE); } if (shouldUnroundBottomCorners) { roundedCorners &= ~ROUNDED_BOTTOM_CORNERS; + mNotificationItemView.findViewById(R.id.gutter_bottom).setVisibility(VISIBLE); } int backgroundColor = Themes.getAttrColor(mLauncher, R.attr.popupColorTertiary); mNotificationItemView.setBackgroundWithCorners(backgroundColor, roundedCorners); @@ -308,9 +310,15 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra } if (itemTypeToPopulate != PopupPopulator.Item.SYSTEM_SHORTCUT_ICON && numNotifications > 0) { + int prevHeight = item.getLayoutParams().height; // Condense shortcuts height when there are notifications. item.getLayoutParams().height = res.getDimensionPixelSize( R.dimen.bg_popup_item_condensed_height); + if (item instanceof DeepShortcutView) { + float iconScale = (float) item.getLayoutParams().height / prevHeight; + ((DeepShortcutView) item).getIconView().setScaleX(iconScale); + ((DeepShortcutView) item).getIconView().setScaleY(iconScale); + } } mShortcutsItemView.addShortcutView(item, itemTypeToPopulate); if (shouldUnroundBottomCorners) { @@ -320,8 +328,7 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra addView(item); } } - int backgroundColor = Themes.getAttrColor(mLauncher, mNotificationItemView == null - ? R.attr.popupColorPrimary : R.attr.popupColorSecondary); + int backgroundColor = Themes.getAttrColor(mLauncher, R.attr.popupColorPrimary); mShortcutsItemView.setBackgroundWithCorners(backgroundColor, shortcutsItemRoundedCorners); if (numNotifications > 0) { mShortcutsItemView.hideShortcuts(mIsAboveIcon, MAX_SHORTCUTS_IF_NOTIFICATIONS); @@ -864,11 +871,14 @@ public class PopupContainerWithArrow extends AbstractFloatingView implements Dra } final ValueAnimator revealAnim = new RoundedRectRevealOutlineProvider( radius, radius, mStartRect, mEndRect).createRevealAnimator(this, true); - revealAnim.setDuration((long) res.getInteger(R.integer.config_popupOpenCloseDuration)); + long revealDuration = (long) res.getInteger(R.integer.config_popupOpenCloseDuration); + revealAnim.setDuration(revealDuration); revealAnim.setInterpolator(new AccelerateDecelerateInterpolator()); // Animate original icon's text back in. - closeAnim.play(mOriginalIcon.createTextAlphaAnimator(true /* fadeIn */)); + Animator fadeText = mOriginalIcon.createTextAlphaAnimator(true /* fadeIn */); + fadeText.setDuration(revealDuration); + closeAnim.play(fadeText); closeAnim.addListener(new AnimatorListenerAdapter() { @Override diff --git a/src/com/android/launcher3/shortcuts/ShortcutsItemView.java b/src/com/android/launcher3/shortcuts/ShortcutsItemView.java index 8785a56f9..f6fffe00b 100644 --- a/src/com/android/launcher3/shortcuts/ShortcutsItemView.java +++ b/src/com/android/launcher3/shortcuts/ShortcutsItemView.java @@ -35,6 +35,7 @@ import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAnimUtils; import com.android.launcher3.R; +import com.android.launcher3.anim.PropertyListBuilder; import com.android.launcher3.anim.RoundedRectRevealOutlineProvider; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.dragndrop.DragView; @@ -280,6 +281,9 @@ public class ShortcutsItemView extends PopupItemView implements View.OnLongClick // Make sure the text and icon stay centered in the shortcut. animation.play(translateYFrom(shortcut.getBubbleText(), heightDiff / 2 * fromDir)); animation.play(translateYFrom(shortcut.getIconView(), heightDiff / 2 * fromDir)); + // Scale icons back up to full size. + animation.play(LauncherAnimUtils.ofPropertyValuesHolder(shortcut.getIconView(), + new PropertyListBuilder().scale(1f).build())); } return animation; } |