Tweak inverted notification

Use American English, clarify description, simplify code a bit, and
default to disabled.
This commit is contained in:
Christopher Eby 2011-08-31 21:24:55 -05:00
parent e7ea4941ea
commit 7c00dc4496
4 changed files with 14 additions and 17 deletions

View File

@ -112,8 +112,8 @@ THE SOFTWARE.
<string name="notification_mode_summary">When to show the notification</string>
<string name="notification_action_title">Notification Action</string>
<string name="notification_action_summary">What to do when the notification is pressed</string>
<string name="notification_invert_colour_title">Invert notification colour</string>
<string name="notification_invert_colour_summary">Use inverted colour for notifications</string>
<string name="notification_invert_color_title">Invert Notification Color</string>
<string name="notification_invert_color_summary">Use white text instead of black text</string>
<string name="pref_playback_view">Playback View</string>
<string name="display_mode_title">Display Mode</string>

View File

@ -55,9 +55,9 @@ THE SOFTWARE.
android:entryValues="@array/entry_values"
android:defaultValue="0" />
<CheckBoxPreference
android:key="notification_inverted_colour"
android:title="@string/notification_invert_colour_title"
android:summary="@string/notification_invert_colour_summary"
android:key="notification_inverted_color"
android:title="@string/notification_invert_color_title"
android:summary="@string/notification_invert_color_summary"
android:defaultValue="false" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_playback_view">

View File

@ -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();
}
}

View File

@ -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;