aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2016-03-24 17:56:38 -0700
committerScott Jackson <daneren2005@gmail.com>2016-03-24 17:56:38 -0700
commit79a92bd6f401aef9095b48e5e47570b7c1b1159e (patch)
tree1fe9f500c0eb1ef4d76b2abe587012ffbdcb6ffa /app/src/main
parentb0b312e89217fa0bd582370a0a97e2f2eb50549c (diff)
downloaddsub-79a92bd6f401aef9095b48e5e47570b7c1b1159e.tar.gz
dsub-79a92bd6f401aef9095b48e5e47570b7c1b1159e.tar.bz2
dsub-79a92bd6f401aef9095b48e5e47570b7c1b1159e.zip
Fixes #554: Add option for heads up notifications
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Constants.java1
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Notifications.java4
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--app/src/main/res/xml/settings_playback.xml6
4 files changed, 13 insertions, 0 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Constants.java b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
index 9aebef83..541f342e 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Constants.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Constants.java
@@ -172,6 +172,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_BATCH_MODE = "batchMode";
public static final String PREFERENCES_KEY_CAST_GAPLESS_PLAYBACK = "castingGaplessPlayback";
public static final String PREFERENCES_KEY_CAST_STREAM_ORIGINAL = "castStreamOriginal";
+ public static final String PREFERENCES_KEY_HEADS_UP_NOTIFICATION = "headsUpNotification";
public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount";
public static final String OFFLINE_SCROBBLE_ID = "scrobbleID";
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
index 356ec552..a59a9766 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java
@@ -74,6 +74,10 @@ public final class Notifications {
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
notification.visibility = Notification.VISIBILITY_PUBLIC;
+
+ if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_HEADS_UP_NOTIFICATION, false)) {
+ notification.vibrate = new long[0];
+ }
}
RemoteViews smallContentView = new RemoteViews(context.getPackageName(), R.layout.notification);
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6b38f337..ee4af53c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -470,6 +470,8 @@
<string name="settings.shuffle_by_album.false">Shuffle all songs together</string>
<string name="settings.casting_stream_original">Stream original</string>
<string name="settings.casting_stream_original_summary">Stream original files where supported by cast device</string>
+ <string name="settings.heads_up_notification">Heads Up Notifications (5.0+)</string>
+ <string name="settings.heads_up_notification_summary">Show playing notifications as Heads Up notifications (Android Lollipop+ only)</string>
<string name="shuffle.title">Shuffle By</string>
<string name="shuffle.startYear">Start Year:</string>
diff --git a/app/src/main/res/xml/settings_playback.xml b/app/src/main/res/xml/settings_playback.xml
index a4ea443e..91b0435b 100644
--- a/app/src/main/res/xml/settings_playback.xml
+++ b/app/src/main/res/xml/settings_playback.xml
@@ -41,6 +41,12 @@
android:defaultValue="false"/>
<CheckBoxPreference
+ android:title="@string/settings.heads_up_notification"
+ android:summary="@string/settings.heads_up_notification_summary"
+ android:key="headsUpNotification"
+ android:defaultValue="false"/>
+
+ <CheckBoxPreference
android:title="@string/settings.play_now_after"
android:summary="@string/settings.play_now_after_summary"
android:key="playNowAfter"