From 1d120322c5af19646f502aa8a0b6c3ec14da47de Mon Sep 17 00:00:00 2001 From: Andrew Comminos Date: Thu, 3 Aug 2017 13:52:04 -0700 Subject: Avoid suppressing foreground service notifications when activity is shown. --- .../java/com/morlunk/mumbleclient/channel/ChannelFragment.java | 2 +- .../java/com/morlunk/mumbleclient/service/PlumbleService.java | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/morlunk/mumbleclient/channel/ChannelFragment.java b/app/src/main/java/com/morlunk/mumbleclient/channel/ChannelFragment.java index bc2932c..6bc85b4 100644 --- a/app/src/main/java/com/morlunk/mumbleclient/channel/ChannelFragment.java +++ b/app/src/main/java/com/morlunk/mumbleclient/channel/ChannelFragment.java @@ -289,7 +289,7 @@ public class ChannelFragment extends JumbleServiceFragment implements SharedPref mTalkButton.setLayoutParams(params); boolean muted = false; - if (getService().isConnected()) { + if (getService() != null && getService().isConnected()) { IUser user = getService().getSession().getSessionUser(); muted = user.isMuted() || user.isSuppressed() || user.isSelfMuted(); } diff --git a/app/src/main/java/com/morlunk/mumbleclient/service/PlumbleService.java b/app/src/main/java/com/morlunk/mumbleclient/service/PlumbleService.java index 30865ba..0872487 100644 --- a/app/src/main/java/com/morlunk/mumbleclient/service/PlumbleService.java +++ b/app/src/main/java/com/morlunk/mumbleclient/service/PlumbleService.java @@ -123,16 +123,14 @@ public class PlumbleService extends JumbleService implements getString(R.string.plumbleConnecting), getString(R.string.connecting), PlumbleService.this); - if (!mSuppressNotifications) { - mNotification.show(); - } + mNotification.show(); mErrorShown = false; } @Override public void onConnected() { - if (mNotification != null && !mSuppressNotifications) { + if (mNotification != null) { mNotification.setCustomTicker(getString(R.string.plumbleConnected)); mNotification.setCustomContentText(getString(R.string.connected)); mNotification.setActionsShown(true); @@ -167,7 +165,7 @@ public class PlumbleService extends JumbleService implements public void onUserStateUpdated(IUser user) { if(user.getSession() == getSessionId()) { mSettings.setMutedAndDeafened(user.isSelfMuted(), user.isSelfDeafened()); // Update settings mute/deafen state - if(mNotification != null && !mSuppressNotifications) { + if(mNotification != null) { String contentText; if (user.isSelfMuted() && user.isSelfDeafened()) contentText = getString(R.string.status_notify_muted_and_deafened); -- cgit v1.2.3