Media notification updates

- Make text white.
- Adjust padding & metrics to redlines.
- Use different narrow layout when 3 or less notifications with big
  picture.
- Update action ripples.
- Fix progress bar size & fix color for indeterminate progress bar.
- Apply default background in SystemUI when no color is set, so we
  don't end up with white text on white background.

Bug: 15437369
Bug: 16625746
Bug: 15147533
Change-Id: Ie8bd5ad0bbca972685adb50034fff88ea97456bd
This commit is contained in:
Jorim Jaggi
2014-08-29 03:47:31 +02:00
parent 6531ae2fcd
commit 17ee3ec0b8
15 changed files with 259 additions and 278 deletions

View File

@@ -22,7 +22,6 @@ import android.annotation.SdkConstant.SdkConstantType;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
@@ -2624,6 +2623,13 @@ public class Notification implements Parcelable
}
private RemoteViews applyStandardTemplate(int resId) {
return applyStandardTemplate(resId, true /* hasProgress */);
}
/**
* @param hasProgress whether the progress bar should be shown and set
*/
private RemoteViews applyStandardTemplate(int resId, boolean hasProgress) {
RemoteViews contentView = new BuilderRemoteViews(mContext.getPackageName(),
mOriginatingUserId, resId);
@@ -2683,7 +2689,7 @@ public class Notification implements Parcelable
}
} else {
contentView.setViewVisibility(R.id.text2, View.GONE);
if (mProgressMax != 0 || mProgressIndeterminate) {
if (hasProgress && (mProgressMax != 0 || mProgressIndeterminate)) {
contentView.setProgressBar(
R.id.progress, mProgressMax, mProgress, mProgressIndeterminate);
contentView.setViewVisibility(R.id.progress, View.VISIBLE);
@@ -2698,7 +2704,7 @@ public class Notification implements Parcelable
shrinkLine3Text(contentView);
}
if (mWhen != 0 && mShowWhen) {
if (showsTimeOrChronometer()) {
if (mUseChronometer) {
contentView.setViewVisibility(R.id.chronometer, View.VISIBLE);
contentView.setLong(R.id.chronometer, "setBase",
@@ -2731,6 +2737,14 @@ public class Notification implements Parcelable
return contentView;
}
/**
* @return true if the built notification will show the time or the chronometer; false
* otherwise
*/
private boolean showsTimeOrChronometer() {
return mWhen != 0 && mShowWhen;
}
/**
* Logic to find out whether the notification is going to have three lines in the contracted
* layout. This is used to adjust the top padding.
@@ -2740,13 +2754,14 @@ public class Notification implements Parcelable
*/
private boolean hasThreeLines() {
boolean contentTextInLine2 = mSubText != null && mContentText != null;
boolean hasProgress = mStyle == null || mStyle.hasProgress();
// If we have content text in line 2, badge goes into line 2, or line 3 otherwise
boolean badgeInLine3 = getProfileBadgeDrawable() != null && !contentTextInLine2;
boolean hasLine3 = mContentText != null || mContentInfo != null || mNumber > 0
|| badgeInLine3;
boolean hasLine2 = (mSubText != null && mContentText != null) ||
(mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
(hasProgress && mSubText == null
&& (mProgressMax != 0 || mProgressIndeterminate));
return hasLine2 && hasLine3;
}
@@ -3488,6 +3503,15 @@ public class Notification implements Parcelable
checkBuilder();
return mBuilder.build();
}
/**
* @hide
* @return true if the style positions the progress bar on the second line; false if the
* style hides the progress bar
*/
protected boolean hasProgress() {
return true;
}
}
/**
@@ -3885,7 +3909,7 @@ public class Notification implements Parcelable
* @see Notification#bigContentView
*/
public static class MediaStyle extends Style {
static final int MAX_MEDIA_BUTTONS_IN_COMPACT = 2;
static final int MAX_MEDIA_BUTTONS_IN_COMPACT = 3;
static final int MAX_MEDIA_BUTTONS = 5;
private int[] mActionsToShowInCompact = null;
@@ -3899,8 +3923,10 @@ public class Notification implements Parcelable
}
/**
* Request up to 2 actions (by index in the order of addition) to be shown in the compact
* Request up to 3 actions (by index in the order of addition) to be shown in the compact
* notification view.
*
* @param actions the indices of the actions to show in the compact notification view
*/
public MediaStyle setShowActionsInCompactView(int...actions) {
mActionsToShowInCompact = actions;
@@ -3977,6 +4003,9 @@ public class Notification implements Parcelable
RemoteViews button = new RemoteViews(mBuilder.mContext.getPackageName(),
R.layout.notification_material_media_action);
button.setImageViewResource(R.id.action0, action.icon);
button.setDrawableParameters(R.id.action0, false, -1,
0xFFFFFFFF,
PorterDuff.Mode.SRC_ATOP, -1);
if (!tombstone) {
button.setOnClickPendingIntent(R.id.action0, action.actionIntent);
}
@@ -3986,14 +4015,14 @@ public class Notification implements Parcelable
private RemoteViews makeMediaContentView() {
RemoteViews view = mBuilder.applyStandardTemplate(
R.layout.notification_template_material_media);
R.layout.notification_template_material_media, false /* hasProgress */);
final int numActions = mBuilder.mActions.size();
final int N = mActionsToShowInCompact == null
? 0
: Math.min(mActionsToShowInCompact.length, MAX_MEDIA_BUTTONS_IN_COMPACT);
if (N > 0) {
view.removeAllViews(R.id.actions);
view.removeAllViews(com.android.internal.R.id.media_actions);
for (int i = 0; i < N; i++) {
if (i >= numActions) {
throw new IllegalArgumentException(String.format(
@@ -4003,26 +4032,73 @@ public class Notification implements Parcelable
final Action action = mBuilder.mActions.get(mActionsToShowInCompact[i]);
final RemoteViews button = generateMediaActionButton(action);
view.addView(R.id.actions, button);
view.addView(com.android.internal.R.id.media_actions, button);
}
}
styleText(view);
hideRightIcon(view);
return view;
}
private RemoteViews makeMediaBigContentView() {
RemoteViews big = mBuilder.applyStandardTemplate(
R.layout.notification_template_material_big_media);
final int actionCount = Math.min(mBuilder.mActions.size(), MAX_MEDIA_BUTTONS);
RemoteViews big = mBuilder.applyStandardTemplate(getBigLayoutResource(actionCount),
false /* hasProgress */);
final int N = Math.min(mBuilder.mActions.size(), MAX_MEDIA_BUTTONS);
if (N > 0) {
big.removeAllViews(R.id.actions);
for (int i=0; i<N; i++) {
if (actionCount > 0) {
big.removeAllViews(com.android.internal.R.id.media_actions);
for (int i = 0; i < actionCount; i++) {
final RemoteViews button = generateMediaActionButton(mBuilder.mActions.get(i));
big.addView(R.id.actions, button);
big.addView(com.android.internal.R.id.media_actions, button);
}
}
styleText(big);
hideRightIcon(big);
applyTopPadding(big);
big.setViewVisibility(android.R.id.progress, View.GONE);
return big;
}
private int getBigLayoutResource(int actionCount) {
if (actionCount <= 3) {
return R.layout.notification_template_material_big_media_narrow;
} else {
return R.layout.notification_template_material_big_media;
}
}
private void hideRightIcon(RemoteViews contentView) {
contentView.setViewVisibility(R.id.right_icon, View.GONE);
}
/**
* Applies the special text colors for media notifications to all text views.
*/
private void styleText(RemoteViews contentView) {
int primaryColor = mBuilder.mContext.getResources().getColor(
R.color.notification_media_primary_color);
int secondaryColor = mBuilder.mContext.getResources().getColor(
R.color.notification_media_secondary_color);
contentView.setTextColor(R.id.title, primaryColor);
if (mBuilder.showsTimeOrChronometer()) {
if (mBuilder.mUseChronometer) {
contentView.setTextColor(R.id.chronometer, secondaryColor);
} else {
contentView.setTextColor(R.id.time, secondaryColor);
}
}
contentView.setTextColor(R.id.text2, secondaryColor);
contentView.setTextColor(R.id.text, secondaryColor);
contentView.setTextColor(R.id.info, secondaryColor);
}
/**
* @hide
*/
@Override
protected boolean hasProgress() {
return false;
}
}
// When adding a new Style subclass here, don't forget to update

View File

@@ -864,7 +864,7 @@ public class RemoteViews implements Parcelable, Filter {
if (alpha != -1) {
targetDrawable.setAlpha(alpha);
}
if (colorFilter != -1 && filterMode != null) {
if (filterMode != null) {
targetDrawable.setColorFilter(colorFilter, filterMode);
}
if (level != -1) {
@@ -2189,8 +2189,8 @@ public class RemoteViews implements Parcelable, Filter {
* @param alpha Specify an alpha value for the drawable, or -1 to leave
* unchanged.
* @param colorFilter Specify a color for a
* {@link android.graphics.ColorFilter} for this drawable, or -1
* to leave unchanged.
* {@link android.graphics.ColorFilter} for this drawable. This will be ignored if
* {@code mode} is {@code null}.
* @param mode Specify a PorterDuff mode for this drawable, or null to leave
* unchanged.
* @param level Specify the level for the drawable, or -1 to leave

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2014 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/ripple_material_light">
<item android:id="@id/mask"
android:drawable="@drawable/btn_default_mtrl_shape" />
</ripple>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2014 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/ripple_material_dark" />

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@id/background" android:drawable="@color/transparent">
</item>
<item android:id="@id/secondaryProgress">
<scale android:scaleWidth="100%"
android:drawable="@color/notification_media_progress" />
</item>
<item android:id="@id/progress">
<scale android:scaleWidth="100%"
android:drawable="@color/notification_media_progress" />
</item>
</layer-list>

View File

@@ -29,4 +29,5 @@
android:textSize="13sp"
android:singleLine="true"
android:ellipsize="end"
android:background="@drawable/notification_material_action_background"
/>

View File

@@ -16,10 +16,13 @@
-->
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
style="@android:style/Widget.Material.Light.Button.Borderless.Small"
style="@android:style/Widget.Material.Button.Borderless.Small"
android:id="@+id/action0"
android:layout_width="60dp"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:gravity="center"
android:background="@drawable/notification_material_media_action_background"
/>

View File

@@ -15,143 +15,43 @@
~ limitations under the License
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
internal:layout_minHeight="65dp"
internal:layout_maxHeight="unbounded"
android:layout_height="128dp"
android:background="#00000000"
>
<include layout="@layout/notification_template_icon_group"
android:layout_width="@dimen/notification_large_icon_width"
android:layout_height="@dimen/notification_large_icon_height"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_vertical"
android:layout_marginStart="@dimen/notification_large_icon_width"
android:minHeight="@dimen/notification_large_icon_height"
android:orientation="vertical"
android:gravity="top"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/notification_large_icon_width"
android:minHeight="@dimen/notification_large_icon_height"
android:paddingTop="2dp"
android:orientation="vertical"
>
<LinearLayout
android:id="@+id/line1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:orientation="horizontal"
>
<TextView android:id="@+id/title"
android:textAppearance="@style/TextAppearance.Material.Notification.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:layout_weight="1"
/>
<ViewStub android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:visibility="gone"
android:layout="@layout/notification_template_part_time"
/>
<ViewStub android:id="@+id/chronometer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:visibility="gone"
android:layout="@layout/notification_template_part_chronometer"
/>
</LinearLayout>
<TextView android:id="@+id/text2"
android:textAppearance="@style/TextAppearance.Material.Notification.Line2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-2dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:singleLine="true"
android:fadingEdge="horizontal"
android:ellipsize="marquee"
android:visibility="gone"
/>
<TextView android:id="@+id/big_text"
android:textAppearance="@style/TextAppearance.Material.Notification"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:singleLine="false"
android:visibility="gone"
/>
<LinearLayout
android:id="@+id/line3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
android:gravity="center_vertical"
>
<TextView android:id="@+id/text"
android:textAppearance="@style/TextAppearance.Material.Notification"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:singleLine="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
/>
<TextView android:id="@+id/info"
android:textAppearance="@style/TextAppearance.Material.Notification.Info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0"
android:singleLine="true"
android:gravity="center"
android:paddingStart="8dp"
/>
</LinearLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:id="@+id/media_action_area"
android:background="@color/notification_media_action_bg"
>
<LinearLayout
android:id="@+id/actions"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:orientation="horizontal"
>
<!-- media buttons will be added here -->
</LinearLayout>
<ProgressBar
android:id="@android:id/progress"
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_gravity="top"
android:visibility="gone"
style="@style/Widget.Material.Notification.ProgressBar.Media"
/>
</FrameLayout>
<include layout="@layout/notification_template_part_line1" />
<include layout="@layout/notification_template_part_line2" />
<include layout="@layout/notification_template_part_line3" />
</LinearLayout>
<include layout="@layout/notification_template_icon_group"
android:layout_width="@dimen/notification_large_icon_width"
android:layout_height="@dimen/notification_large_icon_height"
/>
</FrameLayout>
<LinearLayout
android:id="@+id/media_actions"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentBottom="true"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:orientation="horizontal"
android:layoutDirection="ltr"
>
<!-- media buttons will be added here -->
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="@id/media_actions"
android:id="@+id/action_divider"
android:background="@drawable/notification_template_divider_media" />
</RelativeLayout>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2014 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
<!-- Layout to be used with only max 3 actions. It has a much larger picture at the left side-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/status_bar_latest_event_content"
android:layout_width="match_parent"
android:layout_height="128dp"
android:background="#00000000"
>
<ImageView android:id="@+id/icon"
android:layout_width="128dp"
android:layout_height="128dp"
android:scaleType="centerCrop"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_toEndOf="@id/icon"
android:minHeight="@dimen/notification_large_icon_height"
android:orientation="vertical"
>
<include layout="@layout/notification_template_part_line1" />
<include layout="@layout/notification_template_part_line2" />
<include layout="@layout/notification_template_part_line3" />
</LinearLayout>
<LinearLayout
android:id="@+id/media_actions"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_toEndOf="@id/icon"
android:layout_alignParentBottom="true"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:orientation="horizontal"
android:layoutDirection="ltr"
>
<!-- media buttons will be added here -->
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_toEndOf="@id/icon"
android:layout_above="@id/media_actions"
android:id="@+id/action_divider"
android:background="@drawable/notification_template_divider_media" />
</RelativeLayout>

View File

@@ -21,6 +21,7 @@
android:layout_width="match_parent"
android:layout_height="64dp"
android:orientation="horizontal"
android:background="#00000000"
internal:layout_minHeight="64dp"
internal:layout_maxHeight="64dp"
>
@@ -36,99 +37,19 @@
android:layout_gravity="fill_vertical"
android:minHeight="@dimen/notification_large_icon_height"
android:orientation="vertical"
android:paddingEnd="8dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:gravity="top"
>
<LinearLayout
android:id="@+id/line1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:layout_marginStart="8dp"
android:orientation="horizontal"
>
<TextView android:id="@+id/title"
android:textAppearance="@style/TextAppearance.Material.Notification.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:layout_weight="1"
/>
<ViewStub android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:visibility="gone"
android:layout="@layout/notification_template_part_time"
/>
<ViewStub android:id="@+id/chronometer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:visibility="gone"
android:layout="@layout/notification_template_part_chronometer"
/>
</LinearLayout>
<TextView android:id="@+id/text2"
android:textAppearance="@style/TextAppearance.Material.Notification.Line2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-2dp"
android:layout_marginStart="8dp"
android:singleLine="true"
android:fadingEdge="horizontal"
android:ellipsize="marquee"
android:visibility="gone"
/>
<ProgressBar
android:id="@android:id/progress"
android:layout_width="match_parent"
android:layout_height="12dp"
android:layout_marginStart="8dp"
android:visibility="gone"
style="@style/Widget.Material.Notification.ProgressBar"
/>
<LinearLayout
android:id="@+id/line3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginStart="8dp"
>
<TextView android:id="@+id/text"
android:textAppearance="@style/TextAppearance.Material.Notification"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:singleLine="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
/>
<TextView android:id="@+id/info"
android:textAppearance="@style/TextAppearance.Material.Notification.Info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0"
android:singleLine="true"
android:gravity="center"
android:paddingStart="8dp"
/>
</LinearLayout>
<include layout="@layout/notification_template_part_line1" />
<include layout="@layout/notification_template_part_line2" />
<include layout="@layout/notification_template_part_line3" />
</LinearLayout>
<LinearLayout
android:id="@+id/actions"
android:id="@+id/media_actions"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="6dp"
android:layout_gravity="center_vertical|end"
android:orientation="horizontal"
android:layoutDirection="ltr"
>
<!-- media buttons will be added here -->
</LinearLayout>

View File

@@ -128,12 +128,13 @@
<drawable name="notification_template_icon_bg">#3333B5E5</drawable>
<drawable name="notification_template_icon_low_bg">#0cffffff</drawable>
<drawable name="notification_template_divider">#29000000</drawable>
<drawable name="notification_template_divider_media">#29ffffff</drawable>
<color name="notification_icon_bg_color">#ff9e9e9e</color>
<color name="notification_action_color_filter">@color/secondary_text_material_light</color>
<color name="notification_media_action_bg">#00000000</color>
<color name="notification_media_progress">#FFFFFFFF</color>
<color name="notification_media_primary_color">@color/primary_text_material_dark</color>
<color name="notification_media_secondary_color">@color/secondary_text_material_dark</color>
<!-- Keyguard colors -->
<color name="keyguard_avatar_frame_color">#ffffffff</color>

View File

@@ -438,10 +438,6 @@ please see styles_device_defaults.xml.
<style name="Widget.Material.Notification.ProgressBar" parent="Widget.Material.Light.ProgressBar.Horizontal" />
<style name="Widget.Material.Notification.ProgressBar.Media">
<item name="progressDrawable">@drawable/notification_material_media_progress</item>
</style>
<!-- Widget Styles -->
<style name="Material"/>

View File

@@ -1716,16 +1716,16 @@
<java-symbol type="layout" name="notification_template_material_inbox" />
<java-symbol type="layout" name="notification_template_material_media" />
<java-symbol type="layout" name="notification_template_material_big_media" />
<java-symbol type="layout" name="notification_template_material_big_media_narrow" />
<java-symbol type="layout" name="notification_template_material_big_text" />
<java-symbol type="layout" name="notification_template_icon_group" />
<java-symbol type="layout" name="notification_material_media_action" />
<java-symbol type="color" name="notification_action_color_filter" />
<java-symbol type="color" name="notification_icon_bg_color" />
<java-symbol type="drawable" name="notification_icon_legacy_bg" />
<java-symbol type="drawable" name="notification_material_media_progress" />
<java-symbol type="color" name="notification_media_action_bg" />
<java-symbol type="color" name="notification_media_progress" />
<java-symbol type="id" name="media_action_area" />
<java-symbol type="color" name="notification_media_primary_color" />
<java-symbol type="color" name="notification_media_secondary_color" />
<java-symbol type="id" name="media_actions" />
<!-- From SystemUI -->
<java-symbol type="anim" name="push_down_in" />

View File

@@ -85,6 +85,10 @@
<!-- The color of the material notification background when low priority -->
<color name="notification_material_background_low_priority_color">#ffe0e0e0</color>
<!-- The color of the material notification background for media notifications when no custom
color is specified -->
<color name="notification_material_background_media_default_color">#ff424242</color>
<!-- The color of the ripples on the untinted notifications -->
<color name="notification_ripple_untinted_color">#20000000</color>

View File

@@ -677,7 +677,10 @@ public abstract class BaseStatusBar extends SystemUI implements
// Using platform templates
final int color = sbn.getNotification().color;
if (isMediaNotification(entry)) {
entry.row.setTintColor(color);
entry.row.setTintColor(color == Notification.COLOR_DEFAULT
? mContext.getResources().getColor(
R.color.notification_material_background_media_default_color)
: color);
}
}
@@ -693,7 +696,7 @@ public abstract class BaseStatusBar extends SystemUI implements
public boolean isMediaNotification(NotificationData.Entry entry) {
// TODO: confirm that there's a valid media key
return entry.expandedBig != null &&
entry.expandedBig.findViewById(com.android.internal.R.id.media_action_area) != null;
entry.expandedBig.findViewById(com.android.internal.R.id.media_actions) != null;
}
private void startAppNotificationSettingsActivity(String packageName, final int appUid) {