Popup visual changes

am: aa2272f81c

Change-Id: Iea60ed8675d7e71189f0536a85c506f524c97d73
This commit is contained in:
Tony Wickham 2017-06-28 02:55:47 +00:00 committed by android-build-merger
commit b258e1ab3d
10 changed files with 68 additions and 12 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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" />

View File

@ -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>

View File

@ -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">

View File

@ -56,7 +56,7 @@ public class RoundedRectRevealOutlineProvider extends RevealOutlineAnimation {
@Override
public boolean shouldRemoveElevationDuringAnimation() {
return true;
return false;
}
@Override

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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

View File

@ -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;
}