Merge pull request #268 from nitehu/fix/stuck-notification
Fixed stuck notification
This commit is contained in:
commit
b5bbabf376
|
@ -149,6 +149,8 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
|||
private boolean autoPlayStart;
|
||||
private final static int lockScreenBitmapSize = 500;
|
||||
|
||||
private boolean isInForeground = false;
|
||||
|
||||
static
|
||||
{
|
||||
try
|
||||
|
@ -719,6 +721,7 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
|||
if (tabInstance != null) {
|
||||
if (Util.isNotificationEnabled(this)) {
|
||||
startForeground(NOTIFICATION_ID, buildForegroundNotification());
|
||||
isInForeground = true;
|
||||
}
|
||||
tabInstance.showNowPlaying();
|
||||
}
|
||||
|
@ -728,6 +731,7 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
|||
if (tabInstance != null)
|
||||
{
|
||||
stopForeground(true);
|
||||
isInForeground = false;
|
||||
tabInstance.hideNowPlaying();
|
||||
}
|
||||
}
|
||||
|
@ -1252,6 +1256,7 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
|||
if (tabInstance != null)
|
||||
{
|
||||
stopForeground(true);
|
||||
isInForeground = false;
|
||||
tabInstance.hideNowPlaying();
|
||||
}
|
||||
}
|
||||
|
@ -2075,9 +2080,17 @@ public class DownloadServiceImpl extends Service implements DownloadService
|
|||
public void updateNotification()
|
||||
{
|
||||
if (Util.isNotificationEnabled(this)) {
|
||||
final NotificationManagerCompat notificationManager =
|
||||
NotificationManagerCompat.from(this);
|
||||
notificationManager.notify(NOTIFICATION_ID, buildForegroundNotification());
|
||||
if (isInForeground == true) {
|
||||
final NotificationManagerCompat notificationManager =
|
||||
NotificationManagerCompat.from(this);
|
||||
notificationManager.notify(NOTIFICATION_ID, buildForegroundNotification());
|
||||
Log.w(TAG, "--- Updated notification");
|
||||
}
|
||||
else {
|
||||
startForeground(NOTIFICATION_ID, buildForegroundNotification());
|
||||
isInForeground = true;
|
||||
Log.w(TAG, "--- Created Foreground notification");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -438,6 +438,10 @@
|
|||
|
||||
<string name="feature_flags_image_loader_title">Neuen Bild-Lader aktivieren</string>
|
||||
<string name="feature_flags_image_loader_description">Neuen Bild-Lader aktivieren. Bilder werden derzeit nur im Chache gespeichert.</string>
|
||||
<string name="feature_flags_five_star_rating_title">Verwenden Sie Fünf-Sterne-Bewertung für Songs</string>
|
||||
<string name="feature_flags_five_star_rating_description">Verwenden Sie Fünf-Sterne-Bewertungssystem für Songs
|
||||
anstatt einfach Elemente zu markieren / zu entfernen.
|
||||
</string>
|
||||
<string name="feature_flags_category_title">Funktionseinstellungem</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue