diff --git a/res/drawable/circle.xml b/res/drawable/circle.xml new file mode 100644 index 00000000000..f207cc2c8f3 --- /dev/null +++ b/res/drawable/circle.xml @@ -0,0 +1,27 @@ + + + + + + + \ No newline at end of file diff --git a/res/layout/notification_history_app_layout.xml b/res/layout/notification_history_app_layout.xml index aaca0fd9224..42edd704d2d 100644 --- a/res/layout/notification_history_app_layout.xml +++ b/res/layout/notification_history_app_layout.xml @@ -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"> + + - - - - + android:layout_width="wrap_content" + android:layout_gravity="center_vertical" + android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"/> + android:scaleType="centerInside" /> diff --git a/src/com/android/settings/notification/history/NotificationSbnAdapter.java b/src/com/android/settings/notification/history/NotificationSbnAdapter.java index f836855c195..e0328542803 100644 --- a/src/com/android/settings/notification/history/NotificationSbnAdapter.java +++ b/src/com/android/settings/notification/history/NotificationSbnAdapter.java @@ -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; @@ -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())); @@ -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(); @@ -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; } @@ -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); - } } diff --git a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java index 1219143b465..c98b036d7e2 100644 --- a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java +++ b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java @@ -75,6 +75,10 @@ public class NotificationSbnViewHolder extends RecyclerView.ViewHolder { mIcon.setImageDrawable(icon); } + void setIconBackground(Drawable background) { + mIcon.setBackground(background); + } + void setPackageLabel(String pkg) { mPkgName.setText(pkg); }