diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-11-14 09:34:01 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-11-14 09:34:01 -0800 |
commit | 9cf4efb6e730d8e7962ef7df92143efba3b95b33 (patch) | |
tree | 5b04676598ca33a346efd3a44d9d1369bc606323 /src | |
parent | 138bea3e13e7ee6071003c8aab2c6dbd8447485b (diff) | |
download | dsub-9cf4efb6e730d8e7962ef7df92143efba3b95b33.tar.gz dsub-9cf4efb6e730d8e7962ef7df92143efba3b95b33.tar.bz2 dsub-9cf4efb6e730d8e7962ef7df92143efba3b95b33.zip |
#409 Remove color fix since style applied should already do it
Diffstat (limited to 'src')
-rw-r--r-- | src/github/daneren2005/dsub/util/Notifications.java | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/github/daneren2005/dsub/util/Notifications.java b/src/github/daneren2005/dsub/util/Notifications.java index 520c4a6c..5f64c602 100644 --- a/src/github/daneren2005/dsub/util/Notifications.java +++ b/src/github/daneren2005/dsub/util/Notifications.java @@ -133,14 +133,6 @@ public final class Notifications { rv.setTextViewText(R.id.notification_artist, arist);
rv.setTextViewText(R.id.notification_album, album);
- Pair<Integer, Integer> colors = getNotificationTextColors(context);
- if (colors.getFirst() != null) {
- rv.setTextColor(R.id.notification_title, colors.getFirst());
- }
- if (colors.getSecond() != null) {
- rv.setTextColor(R.id.notification_artist, colors.getSecond());
- }
-
boolean persistent = Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_PERSISTENT_NOTIFICATION, false);
if(persistent) {
if(expanded) {
@@ -341,44 +333,4 @@ public final class Notifications { notificationManager.notify(stringId, builder.build());
}
}
-
- /**
- * Resolves the default text color for notifications.
- *
- * Based on http://stackoverflow.com/questions/4867338/custom-notification-layouts-and-text-colors/7320604#7320604
- */
- private static Pair<Integer, Integer> getNotificationTextColors(Context context) {
- if (NOTIFICATION_TEXT_COLORS.getFirst() == null && NOTIFICATION_TEXT_COLORS.getSecond() == null) {
- try {
- Notification notification = new Notification();
- String title = "title";
- String content = "content";
- notification.setLatestEventInfo(context, title, content, null);
- LinearLayout group = new LinearLayout(context);
- ViewGroup event = (ViewGroup) notification.contentView.apply(context, group);
- findNotificationTextColors(event, title, content);
- group.removeAllViews();
- } catch (Exception x) {
- Log.w(TAG, "Failed to resolve notification text colors.", x);
- }
- }
- return NOTIFICATION_TEXT_COLORS;
- }
-
- private static void findNotificationTextColors(ViewGroup group, String title, String content) {
- for (int i = 0; i < group.getChildCount(); i++) {
- if (group.getChildAt(i) instanceof TextView) {
- TextView textView = (TextView) group.getChildAt(i);
- String text = textView.getText().toString();
- if (title.equals(text)) {
- NOTIFICATION_TEXT_COLORS.setFirst(textView.getTextColors().getDefaultColor());
- }
- else if (content.equals(text)) {
- NOTIFICATION_TEXT_COLORS.setSecond(textView.getTextColors().getDefaultColor());
- }
- }
- else if (group.getChildAt(i) instanceof ViewGroup)
- findNotificationTextColors((ViewGroup) group.getChildAt(i), title, content);
- }
- }
}
|