Loading res/drawable/circle.xml 0 → 100644 +27 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2021 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="#FFFFFF" android:pathData="M 12 0 C 18.627416998 0 24 5.37258300203 24 12 C 24 18.627416998 18.627416998 24 12 24 C 5.37258300203 24 0 18.627416998 0 12 C 0 5.37258300203 5.37258300203 0 12 0 Z" /> </vector> No newline at end of file res/layout/notification_history_app_layout.xml +15 −18 Original line number Diff line number Diff line Loading @@ -26,35 +26,32 @@ android:layout_width="match_parent" android:background="@drawable/button_ripple_radius" android:paddingTop="12dp" android:orientation="horizontal" android:paddingBottom="12dp" android:paddingStart="16dp"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView android:id="@+id/icon" android:layout_height="24dp" android:layout_width="24dp" android:layout_gravity="center_vertical" android:layout_marginTop="12dp" android:layout_gravity="center_vertical|start" android:scaleType="centerInside"/> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="32dp" android:orientation="vertical"> <TextView android:id="@+id/label" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center_vertical" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification" android:paddingStart="8dp" /> </LinearLayout> android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"/> <TextView android:id="@+id/count" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingStart="6dp" android:layout_gravity="start|center_vertical" android:textDirection="locale" android:paddingTop="8dp" Loading res/layout/notification_history_log_row.xml +2 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginStart="32dp" android:ellipsize="end" android:singleLine="true" android:textAppearance="@style/TextAppearance.NotificationHistory.Title" Loading Loading @@ -76,6 +77,7 @@ android:layout_height="wrap_content" android:layout_gravity="left|center_vertical" android:ellipsize="end" android:layout_marginStart="32dp" android:maxLines="3" android:paddingTop="3dp" android:textAppearance="@style/TextAppearance.NotificationHistory.Text" Loading res/layout/notification_sbn_log_row.xml +5 −5 Original line number Diff line number Diff line Loading @@ -37,15 +37,14 @@ <ImageView android:id="@+id/icon" android:layout_height="@*android:dimen/status_bar_icon_size" android:layout_width="@*android:dimen/status_bar_icon_size" android:layout_height="24dp" android:layout_width="24dp" android:layout_centerVertical="true" android:layout_marginStart="0dp" android:layout_marginEnd="8dp" android:padding="4dp" android:contentDescription="@null" android:adjustViewBounds="true" android:tint="?android:attr/textColorPrimary" android:scaleType="fitCenter" /> android:scaleType="centerInside" /> <TextView android:id="@+id/pkgname" Loading Loading @@ -98,6 +97,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="32dp" android:orientation="vertical" android:layout_marginBottom="6dp" > Loading src/com/android/settings/notification/history/NotificationSbnAdapter.java +16 −10 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -110,6 +111,7 @@ public class NotificationSbnAdapter extends int position) { final StatusBarNotification sbn = mValues.get(position); if (sbn != null) { holder.setIconBackground(loadBackground(sbn)); holder.setIcon(loadIcon(sbn)); holder.setPackageLabel(loadPackageLabel(sbn.getPackageName()).toString()); holder.setTitle(getTitleString(sbn.getNotification())); Loading Loading @@ -140,6 +142,19 @@ public class NotificationSbnAdapter extends } } private Drawable loadBackground(StatusBarNotification sbn) { Drawable bg = mContext.getDrawable(R.drawable.circle); int color = sbn.getNotification().color; if (color == COLOR_DEFAULT) { color = Utils.getColorAttrDefaultColor( mContext, com.android.internal.R.attr.colorAccent); } color = ContrastColorUtil.resolveContrastColor( mContext, color, mBackgroundColor, mInNightMode); bg.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP)); return bg; } @Override public int getItemCount() { return mValues.size(); Loading Loading @@ -229,7 +244,7 @@ public class NotificationSbnAdapter extends return null; } draw.mutate(); draw.setColorFilter(getContrastedColor(sbn.getNotification()), PorterDuff.Mode.SRC_ATOP); draw.setColorFilter(mBackgroundColor, PorterDuff.Mode.SRC_ATOP); return draw; } Loading @@ -240,13 +255,4 @@ public class NotificationSbnAdapter extends } return userId; } private int getContrastedColor(Notification n) { int rawColor = n.color; if (rawColor != COLOR_DEFAULT) { rawColor |= 0xFF000000; // no alpha for custom colors } return ContrastColorUtil.resolveContrastColor( mContext, rawColor, mBackgroundColor, mInNightMode); } } Loading
res/drawable/circle.xml 0 → 100644 +27 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2021 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="#FFFFFF" android:pathData="M 12 0 C 18.627416998 0 24 5.37258300203 24 12 C 24 18.627416998 18.627416998 24 12 24 C 5.37258300203 24 0 18.627416998 0 12 C 0 5.37258300203 5.37258300203 0 12 0 Z" /> </vector> No newline at end of file
res/layout/notification_history_app_layout.xml +15 −18 Original line number Diff line number Diff line Loading @@ -26,35 +26,32 @@ android:layout_width="match_parent" android:background="@drawable/button_ripple_radius" android:paddingTop="12dp" android:orientation="horizontal" android:paddingBottom="12dp" android:paddingStart="16dp"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView android:id="@+id/icon" android:layout_height="24dp" android:layout_width="24dp" android:layout_gravity="center_vertical" android:layout_marginTop="12dp" android:layout_gravity="center_vertical|start" android:scaleType="centerInside"/> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="32dp" android:orientation="vertical"> <TextView android:id="@+id/label" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center_vertical" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification" android:paddingStart="8dp" /> </LinearLayout> android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"/> <TextView android:id="@+id/count" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingStart="6dp" android:layout_gravity="start|center_vertical" android:textDirection="locale" android:paddingTop="8dp" Loading
res/layout/notification_history_log_row.xml +2 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginStart="32dp" android:ellipsize="end" android:singleLine="true" android:textAppearance="@style/TextAppearance.NotificationHistory.Title" Loading Loading @@ -76,6 +77,7 @@ android:layout_height="wrap_content" android:layout_gravity="left|center_vertical" android:ellipsize="end" android:layout_marginStart="32dp" android:maxLines="3" android:paddingTop="3dp" android:textAppearance="@style/TextAppearance.NotificationHistory.Text" Loading
res/layout/notification_sbn_log_row.xml +5 −5 Original line number Diff line number Diff line Loading @@ -37,15 +37,14 @@ <ImageView android:id="@+id/icon" android:layout_height="@*android:dimen/status_bar_icon_size" android:layout_width="@*android:dimen/status_bar_icon_size" android:layout_height="24dp" android:layout_width="24dp" android:layout_centerVertical="true" android:layout_marginStart="0dp" android:layout_marginEnd="8dp" android:padding="4dp" android:contentDescription="@null" android:adjustViewBounds="true" android:tint="?android:attr/textColorPrimary" android:scaleType="fitCenter" /> android:scaleType="centerInside" /> <TextView android:id="@+id/pkgname" Loading Loading @@ -98,6 +97,7 @@ <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="32dp" android:orientation="vertical" android:layout_marginBottom="6dp" > Loading
src/com/android/settings/notification/history/NotificationSbnAdapter.java +16 −10 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -110,6 +111,7 @@ public class NotificationSbnAdapter extends int position) { final StatusBarNotification sbn = mValues.get(position); if (sbn != null) { holder.setIconBackground(loadBackground(sbn)); holder.setIcon(loadIcon(sbn)); holder.setPackageLabel(loadPackageLabel(sbn.getPackageName()).toString()); holder.setTitle(getTitleString(sbn.getNotification())); Loading Loading @@ -140,6 +142,19 @@ public class NotificationSbnAdapter extends } } private Drawable loadBackground(StatusBarNotification sbn) { Drawable bg = mContext.getDrawable(R.drawable.circle); int color = sbn.getNotification().color; if (color == COLOR_DEFAULT) { color = Utils.getColorAttrDefaultColor( mContext, com.android.internal.R.attr.colorAccent); } color = ContrastColorUtil.resolveContrastColor( mContext, color, mBackgroundColor, mInNightMode); bg.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP)); return bg; } @Override public int getItemCount() { return mValues.size(); Loading Loading @@ -229,7 +244,7 @@ public class NotificationSbnAdapter extends return null; } draw.mutate(); draw.setColorFilter(getContrastedColor(sbn.getNotification()), PorterDuff.Mode.SRC_ATOP); draw.setColorFilter(mBackgroundColor, PorterDuff.Mode.SRC_ATOP); return draw; } Loading @@ -240,13 +255,4 @@ public class NotificationSbnAdapter extends } return userId; } private int getContrastedColor(Notification n) { int rawColor = n.color; if (rawColor != COLOR_DEFAULT) { rawColor |= 0xFF000000; // no alpha for custom colors } return ContrastColorUtil.resolveContrastColor( mContext, rawColor, mBackgroundColor, mInNightMode); } }