diff options
author | Scott Jackson <daneren2005@gmail.com> | 2016-04-26 20:34:45 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2016-04-26 20:34:45 -0700 |
commit | fa30b8dd4caff884cee6b8f787434efeabbdc1c2 (patch) | |
tree | f2aeb279cbb6c0575f6d2798f4614f2fddae48fb /app/src | |
parent | b531ec43824232005743c4a0e4da4d8a29cd669e (diff) | |
download | dsub-fa30b8dd4caff884cee6b8f787434efeabbdc1c2.tar.gz dsub-fa30b8dd4caff884cee6b8f787434efeabbdc1c2.tar.bz2 dsub-fa30b8dd4caff884cee6b8f787434efeabbdc1c2.zip |
#683 Only show heads up notification while out of app
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/Notifications.java | 3 | ||||
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/view/UpdateView.java | 4 |
2 files changed, 6 insertions, 1 deletions
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 1ec18905..eb8c01cc 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Notifications.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Notifications.java @@ -41,6 +41,7 @@ import github.daneren2005.dsub.domain.PlayerState; import github.daneren2005.dsub.provider.DSubWidgetProvider; import github.daneren2005.dsub.service.DownloadFile; import github.daneren2005.dsub.service.DownloadService; +import github.daneren2005.dsub.view.UpdateView; public final class Notifications { private static final String TAG = Notifications.class.getSimpleName(); @@ -75,7 +76,7 @@ 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)) { + if(Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_HEADS_UP_NOTIFICATION, false) && !UpdateView.hasActiveActivity()) { notification.vibrate = new long[0]; } } diff --git a/app/src/main/java/github/daneren2005/dsub/view/UpdateView.java b/app/src/main/java/github/daneren2005/dsub/view/UpdateView.java index 8f3b5271..0041eac5 100644 --- a/app/src/main/java/github/daneren2005/dsub/view/UpdateView.java +++ b/app/src/main/java/github/daneren2005/dsub/view/UpdateView.java @@ -201,6 +201,10 @@ public abstract class UpdateView<T> extends LinearLayout { }); } + public static boolean hasActiveActivity() { + return activeActivities > 0; + } + public static void addActiveActivity() { activeActivities++; |