Merge "AOD group notification style" into pi-dev am: b0e503f96d

am: 9c8900ce8d

Change-Id: I69d80674a8c063df363851b275bc7bc6c50f5418
This commit is contained in:
Lucas Dupin
2018-05-10 00:13:44 -07:00
committed by android-build-merger
7 changed files with 52 additions and 22 deletions

View File

@@ -59,7 +59,7 @@
android:singleLine="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:textSize="24sp"
android:textSize="@dimen/notification_ambient_title_text_size"
android:textColor="#ffffffff"
/>
<TextView android:id="@+id/text"
@@ -70,7 +70,7 @@
android:layout_weight="1"
android:gravity="top|center_horizontal"
android:visibility="gone"
android:textSize="16sp"
android:textSize="@dimen/notification_ambient_text_size"
android:textColor="#eeffffff"
android:layout_marginTop="4dp"
android:ellipsize="end"

View File

@@ -374,6 +374,10 @@
<dimen name="notification_title_text_size">14sp</dimen>
<!-- Size of smaller notification text (see TextAppearance.StatusBar.EventContent.Line2, Info, Time) -->
<dimen name="notification_subtext_size">12sp</dimen>
<!-- Size of notification text (see TextAppearance.StatusBar.EventContent) -->
<dimen name="notification_ambient_text_size">16sp</dimen>
<!-- Size of notification text titles (see TextAppearance.StatusBar.EventContent.Title) -->
<dimen name="notification_ambient_title_text_size">24sp</dimen>
<!-- Top padding for notifications in the standard layout. -->
<dimen name="notification_top_pad">10dp</dimen>

View File

@@ -25,7 +25,6 @@
android:id="@+id/notification_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@*android:style/TextAppearance.Material.Notification.Title"
android:singleLine="true"
style="?attr/hybridNotificationTitleStyle"
/>

View File

@@ -623,6 +623,8 @@
<!-- The overflow indicator shown when a group has more notification inside the group than the visible ones. An example is "+ 3" [CHAR LIMIT=5] -->
<string name="notification_group_overflow_indicator">+ <xliff:g id="number" example="3">%s</xliff:g></string>
<!-- The overflow indicator shown when a group has more notification inside the group than the visible ones. An example is "New message, +3" [CHAR LIMIT=7] -->
<string name="notification_group_overflow_indicator_ambient"><xliff:g id="notification_title" example="New message">%s</xliff:g>, +<xliff:g id="overflow" example="+3">%s</xliff:g></string>
<!-- Content description describing how many more notifications are in a group [CHAR LIMIT=NONE] -->
<plurals name="notification_group_overflow_description">

View File

@@ -110,7 +110,6 @@
<item name="android:paddingStart">@*android:dimen/notification_extra_margin_ambient</item>
<item name="android:paddingEnd">@*android:dimen/notification_extra_margin_ambient</item>
<item name="android:orientation">vertical</item>
<item name="android:paddingBottom">23.5dp</item>
</style>
<style name="hybrid_notification">
@@ -119,22 +118,28 @@
</style>
<style name="hybrid_notification_title_ambient">
<item name="android:layout_marginTop">@*android:dimen/notification_header_margin_top_ambient</item>
<item name="android:paddingStart">@*android:dimen/notification_content_margin_start</item>
<item name="android:paddingEnd">@*android:dimen/notification_content_margin_end</item>
<item name="android:textSize">20sp</item>
<item name="android:textAppearance">@*android:style/Notification.Header.Ambient</item>
<item name="android:layout_gravity">top|center_horizontal</item>
<item name="android:textSize">@*android:dimen/notification_ambient_title_text_size</item>
<item name="android:textColor">#ffffffff</item>
</style>
<style name="hybrid_notification_title">
<item name="android:paddingEnd">4dp</item>
<item name="android:textAppearance">@*android:style/TextAppearance.Material.Notification.Title</item>
</style>
<style name="hybrid_notification_text_ambient">
<item name="android:paddingStart">@*android:dimen/notification_content_margin_start</item>
<item name="android:paddingEnd">@*android:dimen/notification_content_margin_end</item>
<item name="android:textSize">16sp</item>
<item name="android:textSize">@*android:dimen/notification_ambient_text_size</item>
<item name="android:textColor">#eeffffff</item>
<item name="android:layout_marginTop">4dp</item>
<item name="android:gravity">top|center_horizontal</item>
<item name="android:ellipsize">end</item>
<item name="android:maxLines">3</item>
</style>
<style name="hybrid_notification_text"

View File

@@ -151,6 +151,17 @@ public class HybridGroupManager {
return reusableView;
}
public TextView bindOverflowNumberAmbient(TextView titleView, Notification notification,
int number) {
String text = mContext.getResources().getString(
R.string.notification_group_overflow_indicator_ambient,
resolveTitle(notification), number);
if (!text.equals(titleView.getText())) {
titleView.setText(text);
}
return titleView;
}
public void setOverflowNumberDark(TextView view, boolean dark, boolean fade, long delay) {
mDozer.setIntensityDark((f)->{
mDarkAmount = f;

View File

@@ -52,7 +52,7 @@ public class NotificationChildrenContainer extends ViewGroup {
private static final int NUMBER_OF_CHILDREN_WHEN_COLLAPSED = 2;
private static final int NUMBER_OF_CHILDREN_WHEN_SYSTEM_EXPANDED = 5;
private static final int NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED = 8;
private static final int NUMBER_OF_CHILDREN_WHEN_AMBIENT = 3;
private static final int NUMBER_OF_CHILDREN_WHEN_AMBIENT = 1;
private static final AnimationProperties ALPHA_FADE_IN = new AnimationProperties() {
private AnimationFilter mAnimationFilter = new AnimationFilter().animateAlpha();
@@ -208,9 +208,9 @@ public class NotificationChildrenContainer extends ViewGroup {
// We need to measure all children even the GONE ones, such that the heights are
// calculated correctly as they are used to calculate how many we can fit on the screen.
boolean isOverflow = i == overflowIndex;
child.setSingleLineWidthIndention(isOverflow && mOverflowNumber != null
? mOverflowNumber.getMeasuredWidth()
: 0);
child.setSingleLineWidthIndention(isOverflow && mOverflowNumber != null &&
!mContainingNotification.isShowingAmbient()
? mOverflowNumber.getMeasuredWidth() : 0);
child.measure(widthMeasureSpec, newHeightSpec);
// layout the divider
View divider = mDividers.get(i);
@@ -394,8 +394,19 @@ public class NotificationChildrenContainer extends ViewGroup {
int childCount = mChildren.size();
int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(true /* likeCollapsed */);
if (childCount > maxAllowedVisibleChildren) {
mOverflowNumber = mHybridGroupManager.bindOverflowNumber(
mOverflowNumber, childCount - maxAllowedVisibleChildren);
int number = childCount - maxAllowedVisibleChildren;
mOverflowNumber = mHybridGroupManager.bindOverflowNumber(mOverflowNumber, number);
if (mContainingNotification.isShowingAmbient()) {
ExpandableNotificationRow overflowView = mChildren.get(0);
HybridNotificationView ambientSingleLineView = overflowView == null ? null
: overflowView.getAmbientSingleLineView();
if (ambientSingleLineView != null) {
mHybridGroupManager.bindOverflowNumberAmbient(
ambientSingleLineView.getTitleView(),
mContainingNotification.getStatusBarNotification().getNotification(),
number);
}
}
if (mGroupOverFlowState == null) {
mGroupOverFlowState = new ViewState();
mNeverAppliedGroupState = true;
@@ -617,16 +628,13 @@ public class NotificationChildrenContainer extends ViewGroup {
}
if (mOverflowNumber != null) {
ExpandableNotificationRow overflowView = mChildren.get(Math.min(
getMaxAllowedVisibleChildren(true /* likeCollpased */), childCount) - 1);
getMaxAllowedVisibleChildren(true /* likeCollapsed */), childCount) - 1);
mGroupOverFlowState.copyFrom(resultState.getViewStateForView(overflowView));
if (mContainingNotification.isShowingAmbient() || !mChildrenExpanded) {
HybridNotificationView alignView = null;
if (mContainingNotification.isShowingAmbient()) {
alignView = overflowView.getAmbientSingleLineView();
} else if (mUserLocked) {
alignView = overflowView.getSingleLineView();
}
if (mContainingNotification.isShowingAmbient()) {
mGroupOverFlowState.alpha = 0.0f;
} else if (!mChildrenExpanded) {
HybridNotificationView alignView = overflowView.getSingleLineView();
if (alignView != null) {
View mirrorView = alignView.getTextView();
if (mirrorView.getVisibility() == GONE) {
@@ -635,9 +643,9 @@ public class NotificationChildrenContainer extends ViewGroup {
if (mirrorView.getVisibility() == GONE) {
mirrorView = alignView;
}
mGroupOverFlowState.alpha = mirrorView.getAlpha();
mGroupOverFlowState.yTranslation += NotificationUtils.getRelativeYOffset(
mirrorView, overflowView);
mGroupOverFlowState.alpha = mirrorView.getAlpha();
}
} else {
mGroupOverFlowState.yTranslation += mNotificationHeaderMargin;
@@ -881,6 +889,7 @@ public class NotificationChildrenContainer extends ViewGroup {
public void notifyShowAmbientChanged() {
updateHeaderVisibility(false);
updateGroupOverflow();
}
private void updateHeaderVisibility(boolean animate) {