From 7c00dc44967aa71e00e474115262c254e738dacb Mon Sep 17 00:00:00 2001 From: Christopher Eby Date: Wed, 31 Aug 2011 21:24:55 -0500 Subject: [PATCH] Tweak inverted notification Use American English, clarify description, simplify code a bit, and default to disabled. --- res/values/strings.xml | 4 ++-- res/xml/preferences.xml | 6 +++--- src/org/kreed/vanilla/PlaybackService.java | 2 +- src/org/kreed/vanilla/SongNotification.java | 19 ++++++++----------- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b3c333f0..5bd6b439 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -112,8 +112,8 @@ THE SOFTWARE. When to show the notification Notification Action What to do when the notification is pressed - Invert notification colour - Use inverted colour for notifications + Invert Notification Color + Use white text instead of black text Playback View Display Mode diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 5377633a..dca3e01f 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -55,9 +55,9 @@ THE SOFTWARE. android:entryValues="@array/entry_values" android:defaultValue="0" /> diff --git a/src/org/kreed/vanilla/PlaybackService.java b/src/org/kreed/vanilla/PlaybackService.java index 92158fa5..a49749ba 100644 --- a/src/org/kreed/vanilla/PlaybackService.java +++ b/src/org/kreed/vanilla/PlaybackService.java @@ -425,7 +425,7 @@ public final class PlaybackService extends Service implements Handler.Callback, if (activity instanceof FullPlaybackActivity) activity.finish(); } - } else if ("notification_inverted_colour".equals(key)) { + } else if ("notification_inverted_color".equals(key)) { updateNotification(); } } diff --git a/src/org/kreed/vanilla/SongNotification.java b/src/org/kreed/vanilla/SongNotification.java index 98439639..66a58d52 100644 --- a/src/org/kreed/vanilla/SongNotification.java +++ b/src/org/kreed/vanilla/SongNotification.java @@ -69,21 +69,18 @@ public class SongNotification extends Notification { int action = Integer.parseInt(prefs.getString("notification_action", "0")); int statusIcon = playing ? R.drawable.status_icon : R.drawable.status_icon_paused; - RemoteViews views = new RemoteViews(ContextApplication.getContext().getPackageName(), R.layout.notification); + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.notification); views.setImageViewResource(R.id.icon, statusIcon); views.setTextViewText(R.id.title, song.title); views.setTextViewText(R.id.artist, song.artist); - TypedArray array = ContextApplication.getContext().getTheme().obtainStyledAttributes(new int[] { - android.R.attr.textColorPrimary, - android.R.attr.textColorPrimaryInverse, - }); - int color1 = array.getColor(0, 0xFF00FF); - int color2 = array.getColor(1, 0xFF00FF); - int color = prefs.getBoolean("notification_inverted_colour", true) ? color1: color2; - array.recycle(); - views.setTextColor(R.id.title, color); - views.setTextColor(R.id.artist, color); + if (prefs.getBoolean("notification_inverted_color", false)) { + TypedArray array = context.getTheme().obtainStyledAttributes(new int[] { android.R.attr.textColorPrimary }); + int color = array.getColor(0, 0xFF00FF); + array.recycle(); + views.setTextColor(R.id.title, color); + views.setTextColor(R.id.artist, color); + } contentView = views; icon = statusIcon;