Merge "Change groups to use number in the expander." into sc-dev
This commit is contained in:
@@ -5303,14 +5303,18 @@ public class Notification implements Parcelable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void bindExpandButton(RemoteViews contentView, StandardTemplateParams p) {
|
private void bindExpandButton(RemoteViews contentView, StandardTemplateParams p) {
|
||||||
contentView.setInt(
|
// set default colors
|
||||||
R.id.expand_button, "setDefaultTextColor", getPrimaryTextColor(p));
|
int textColor = getPrimaryTextColor(p);
|
||||||
contentView.setInt(
|
int pillColor = getProtectionColor(p);
|
||||||
R.id.expand_button, "setDefaultPillColor", getProtectionColor(p));
|
contentView.setInt(R.id.expand_button, "setDefaultTextColor", textColor);
|
||||||
contentView.setInt(
|
contentView.setInt(R.id.expand_button, "setDefaultPillColor", pillColor);
|
||||||
R.id.expand_button, "setHighlightTextColor", getBackgroundColor(p));
|
// Use different highlighted colors except when low-priority mode prevents that
|
||||||
contentView.setInt(
|
if (!p.forceDefaultColor) {
|
||||||
R.id.expand_button, "setHighlightPillColor", getAccentColor(p));
|
textColor = getBackgroundColor(p);
|
||||||
|
pillColor = getAccentColor(p);
|
||||||
|
}
|
||||||
|
contentView.setInt(R.id.expand_button, "setHighlightTextColor", textColor);
|
||||||
|
contentView.setInt(R.id.expand_button, "setHighlightPillColor", pillColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindHeaderChronometerAndTime(RemoteViews contentView,
|
private void bindHeaderChronometerAndTime(RemoteViews contentView,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import android.graphics.Rect;
|
|||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
|
|
||||||
import com.android.internal.R;
|
import com.android.internal.R;
|
||||||
@@ -42,7 +42,7 @@ import java.util.ArrayList;
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@RemoteViews.RemoteView
|
@RemoteViews.RemoteView
|
||||||
public class NotificationHeaderView extends FrameLayout {
|
public class NotificationHeaderView extends RelativeLayout {
|
||||||
private final int mHeadingEndMargin;
|
private final int mHeadingEndMargin;
|
||||||
private final int mTouchableHeight;
|
private final int mTouchableHeight;
|
||||||
private OnClickListener mExpandClickListener;
|
private OnClickListener mExpandClickListener;
|
||||||
@@ -159,7 +159,7 @@ public class NotificationHeaderView extends FrameLayout {
|
|||||||
* @param extraMarginEnd extra margin in px
|
* @param extraMarginEnd extra margin in px
|
||||||
*/
|
*/
|
||||||
public void setTopLineExtraMarginEnd(int extraMarginEnd) {
|
public void setTopLineExtraMarginEnd(int extraMarginEnd) {
|
||||||
mTopLineView.setHeaderTextMarginEnd(extraMarginEnd + mHeadingEndMargin);
|
mTopLineView.setHeaderTextMarginEnd(extraMarginEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -181,12 +181,15 @@ public class NotificationHeaderView extends FrameLayout {
|
|||||||
* @return extra margin
|
* @return extra margin
|
||||||
*/
|
*/
|
||||||
public int getTopLineExtraMarginEnd() {
|
public int getTopLineExtraMarginEnd() {
|
||||||
return mTopLineView.getHeaderTextMarginEnd() - mHeadingEndMargin;
|
return mTopLineView.getHeaderTextMarginEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the base margin at the end of the top line view.
|
* Get the base margin at the end of the top line view.
|
||||||
* Add this to {@link #getTopLineExtraMarginEnd()} to get the total margin of the top line.
|
* Add this to {@link #getTopLineExtraMarginEnd()} to get the total margin of the top line.
|
||||||
|
* <p>
|
||||||
|
* NOTE: This method's result is only valid if the expander does not have a number. Currently
|
||||||
|
* only groups headers and conversations have numbers, so this is safe to use by MediaStyle.
|
||||||
*
|
*
|
||||||
* @return base margin
|
* @return base margin
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -220,7 +220,9 @@ public class NotificationExpandButton extends FrameLayout {
|
|||||||
*/
|
*/
|
||||||
@RemotableViewMethod
|
@RemotableViewMethod
|
||||||
public void setNumber(int number) {
|
public void setNumber(int number) {
|
||||||
mNumber = number;
|
if (mNumber != number) {
|
||||||
updateNumber();
|
mNumber = number;
|
||||||
|
updateNumber();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,8 @@
|
|||||||
android:id="@+id/left_icon"
|
android:id="@+id/left_icon"
|
||||||
android:layout_width="@dimen/notification_left_icon_size"
|
android:layout_width="@dimen/notification_left_icon_size"
|
||||||
android:layout_height="@dimen/notification_left_icon_size"
|
android:layout_height="@dimen/notification_left_icon_size"
|
||||||
android:layout_gravity="center_vertical|start"
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginStart="@dimen/notification_left_icon_start"
|
android:layout_marginStart="@dimen/notification_left_icon_start"
|
||||||
android:background="@drawable/notification_large_icon_outline"
|
android:background="@drawable/notification_large_icon_outline"
|
||||||
android:clipToOutline="true"
|
android:clipToOutline="true"
|
||||||
@@ -43,7 +44,8 @@
|
|||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="@dimen/notification_icon_circle_size"
|
android:layout_width="@dimen/notification_icon_circle_size"
|
||||||
android:layout_height="@dimen/notification_icon_circle_size"
|
android:layout_height="@dimen/notification_icon_circle_size"
|
||||||
android:layout_gravity="center_vertical|start"
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginStart="@dimen/notification_icon_circle_start"
|
android:layout_marginStart="@dimen/notification_icon_circle_start"
|
||||||
android:background="@drawable/notification_icon_circle"
|
android:background="@drawable/notification_icon_circle"
|
||||||
android:padding="@dimen/notification_icon_circle_padding"
|
android:padding="@dimen/notification_icon_circle_padding"
|
||||||
@@ -55,10 +57,12 @@
|
|||||||
android:id="@+id/notification_top_line"
|
android:id="@+id/notification_top_line"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_toStartOf="@id/expand_button"
|
||||||
|
android:layout_alignWithParentIfMissing="true"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingEnd="@dimen/notification_heading_margin_end"
|
|
||||||
android:paddingStart="@dimen/notification_content_margin_start"
|
android:paddingStart="@dimen/notification_content_margin_start"
|
||||||
android:theme="@style/Theme.DeviceDefault.Notification"
|
android:theme="@style/Theme.DeviceDefault.Notification"
|
||||||
>
|
>
|
||||||
@@ -71,14 +75,15 @@
|
|||||||
android:id="@+id/alternate_expand_target"
|
android:id="@+id/alternate_expand_target"
|
||||||
android:layout_width="@dimen/notification_content_margin_start"
|
android:layout_width="@dimen/notification_content_margin_start"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="start"
|
android:layout_alignParentStart="true"
|
||||||
android:importantForAccessibility="no"
|
android:importantForAccessibility="no"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<include layout="@layout/notification_expand_button"
|
<include layout="@layout/notification_expand_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical|end"
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</NotificationHeaderView>
|
</NotificationHeaderView>
|
||||||
|
|||||||
@@ -224,7 +224,7 @@
|
|||||||
<dimen name="notification_content_margin_end">16dp</dimen>
|
<dimen name="notification_content_margin_end">16dp</dimen>
|
||||||
|
|
||||||
<!-- The margin on the end of the top-line content views (accommodates the expander) -->
|
<!-- The margin on the end of the top-line content views (accommodates the expander) -->
|
||||||
<dimen name="notification_heading_margin_end">48dp</dimen>
|
<dimen name="notification_heading_margin_end">56dp</dimen>
|
||||||
|
|
||||||
<!-- The margin for text at the end of the image view for media notifications -->
|
<!-- The margin for text at the end of the image view for media notifications -->
|
||||||
<dimen name="notification_media_image_margin_end">72dp</dimen>
|
<dimen name="notification_media_image_margin_end">72dp</dimen>
|
||||||
|
|||||||
@@ -412,6 +412,9 @@
|
|||||||
<!-- Whether or not child notifications that are part of a group will have shadows. -->
|
<!-- Whether or not child notifications that are part of a group will have shadows. -->
|
||||||
<bool name="config_enableShadowOnChildNotifications">true</bool>
|
<bool name="config_enableShadowOnChildNotifications">true</bool>
|
||||||
|
|
||||||
|
<!-- If true, group numbers are shown in the expander instead of via "+N" overflow number -->
|
||||||
|
<bool name="config_showNotificationGroupCountInExpander">true</bool>
|
||||||
|
|
||||||
<!-- Whether or not a view containing child notifications will have a custom background when
|
<!-- Whether or not a view containing child notifications will have a custom background when
|
||||||
it has been expanded to reveal its children. -->
|
it has been expanded to reveal its children. -->
|
||||||
<bool name="config_showGroupNotificationBgWhenExpanded">false</bool>
|
<bool name="config_showGroupNotificationBgWhenExpanded">false</bool>
|
||||||
|
|||||||
@@ -20,10 +20,12 @@ import android.app.Notification;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.service.notification.StatusBarNotification;
|
import android.service.notification.StatusBarNotification;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.NotificationHeaderView;
|
import android.view.NotificationHeaderView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -33,6 +35,7 @@ import android.widget.TextView;
|
|||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.widget.CachingIconView;
|
import com.android.internal.widget.CachingIconView;
|
||||||
|
import com.android.internal.widget.NotificationExpandButton;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.statusbar.CrossFadeHelper;
|
import com.android.systemui.statusbar.CrossFadeHelper;
|
||||||
import com.android.systemui.statusbar.NotificationGroupingUtil;
|
import com.android.systemui.statusbar.NotificationGroupingUtil;
|
||||||
@@ -103,6 +106,8 @@ public class NotificationChildrenContainer extends ViewGroup {
|
|||||||
private ViewGroup mCurrentHeader;
|
private ViewGroup mCurrentHeader;
|
||||||
private boolean mIsConversation;
|
private boolean mIsConversation;
|
||||||
|
|
||||||
|
private boolean mTintWithThemeAccent;
|
||||||
|
private boolean mShowGroupCountInExpander;
|
||||||
private boolean mShowDividersWhenExpanded;
|
private boolean mShowDividersWhenExpanded;
|
||||||
private boolean mHideDividersDuringExpand;
|
private boolean mHideDividersDuringExpand;
|
||||||
private int mTranslationForHeader;
|
private int mTranslationForHeader;
|
||||||
@@ -145,6 +150,10 @@ public class NotificationChildrenContainer extends ViewGroup {
|
|||||||
com.android.internal.R.dimen.notification_content_margin);
|
com.android.internal.R.dimen.notification_content_margin);
|
||||||
mEnableShadowOnChildNotifications =
|
mEnableShadowOnChildNotifications =
|
||||||
res.getBoolean(R.bool.config_enableShadowOnChildNotifications);
|
res.getBoolean(R.bool.config_enableShadowOnChildNotifications);
|
||||||
|
mTintWithThemeAccent =
|
||||||
|
res.getBoolean(com.android.internal.R.bool.config_tintNotificationsWithTheme);
|
||||||
|
mShowGroupCountInExpander =
|
||||||
|
res.getBoolean(R.bool.config_showNotificationGroupCountInExpander);
|
||||||
mShowDividersWhenExpanded =
|
mShowDividersWhenExpanded =
|
||||||
res.getBoolean(R.bool.config_showDividersWhenGroupNotificationExpanded);
|
res.getBoolean(R.bool.config_showDividersWhenGroupNotificationExpanded);
|
||||||
mHideDividersDuringExpand =
|
mHideDividersDuringExpand =
|
||||||
@@ -229,7 +238,6 @@ public class NotificationChildrenContainer extends ViewGroup {
|
|||||||
mNotificationHeader.measure(widthMeasureSpec, headerHeightSpec);
|
mNotificationHeader.measure(widthMeasureSpec, headerHeightSpec);
|
||||||
}
|
}
|
||||||
if (mNotificationHeaderLowPriority != null) {
|
if (mNotificationHeaderLowPriority != null) {
|
||||||
headerHeightSpec = MeasureSpec.makeMeasureSpec(mHeaderHeight, MeasureSpec.EXACTLY);
|
|
||||||
mNotificationHeaderLowPriority.measure(widthMeasureSpec, headerHeightSpec);
|
mNotificationHeaderLowPriority.measure(widthMeasureSpec, headerHeightSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +405,20 @@ public class NotificationChildrenContainer extends ViewGroup {
|
|||||||
mGroupingUtil.updateChildrenAppearance();
|
mGroupingUtil.updateChildrenAppearance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setExpandButtonNumber(NotificationViewWrapper wrapper) {
|
||||||
|
View expandButton = wrapper == null
|
||||||
|
? null : wrapper.getExpandButton();
|
||||||
|
if (expandButton instanceof NotificationExpandButton) {
|
||||||
|
((NotificationExpandButton) expandButton).setNumber(mUntruncatedChildCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateGroupOverflow() {
|
public void updateGroupOverflow() {
|
||||||
|
if (mShowGroupCountInExpander) {
|
||||||
|
setExpandButtonNumber(mNotificationHeaderWrapper);
|
||||||
|
setExpandButtonNumber(mNotificationHeaderWrapperLowPriority);
|
||||||
|
return;
|
||||||
|
}
|
||||||
int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(true /* likeCollapsed */);
|
int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(true /* likeCollapsed */);
|
||||||
if (mUntruncatedChildCount > maxAllowedVisibleChildren) {
|
if (mUntruncatedChildCount > maxAllowedVisibleChildren) {
|
||||||
int number = mUntruncatedChildCount - maxAllowedVisibleChildren;
|
int number = mUntruncatedChildCount - maxAllowedVisibleChildren;
|
||||||
@@ -1201,8 +1222,21 @@ public class NotificationChildrenContainer extends ViewGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onNotificationUpdated() {
|
public void onNotificationUpdated() {
|
||||||
mHybridGroupManager.setOverflowNumberColor(mOverflowNumber,
|
if (mShowGroupCountInExpander) {
|
||||||
mContainingNotification.getNotificationColor());
|
// The overflow number is not used, so its color is irrelevant; skip this
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int color = mContainingNotification.getNotificationColor();
|
||||||
|
if (mTintWithThemeAccent) {
|
||||||
|
// We're using the theme accent, color with the accent color instead of the notif color
|
||||||
|
Resources.Theme theme = new ContextThemeWrapper(mContext,
|
||||||
|
com.android.internal.R.style.Theme_DeviceDefault_DayNight).getTheme();
|
||||||
|
TypedArray ta = theme.obtainStyledAttributes(
|
||||||
|
new int[]{com.android.internal.R.attr.colorAccent});
|
||||||
|
color = ta.getColor(0, color);
|
||||||
|
ta.recycle();
|
||||||
|
}
|
||||||
|
mHybridGroupManager.setOverflowNumberColor(mOverflowNumber, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPositionInLinearLayout(View childInGroup) {
|
public int getPositionInLinearLayout(View childInGroup) {
|
||||||
|
|||||||
Reference in New Issue
Block a user