This commit is contained in:
tom79 2020-04-08 19:10:32 +02:00
parent 2bcca4c5c8
commit cb69d20cfa
1 changed files with 6 additions and 0 deletions

View File

@ -14,6 +14,7 @@ package app.fedilab.android.fragments;
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
* see <http://www.gnu.org/licenses>. */
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@ -250,6 +251,11 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
swipeRefreshLayout.setEnabled(true);
if (context == null)
return;
if( getUserVisibleHint()){
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
assert mNotificationManager != null;
mNotificationManager.cancelAll();
}
if (getUserVisibleHint() && notifications != null && notifications.size() > 0) {
retrieveMissingNotifications(notifications.get(0).getId());
updateNotificationLastId(notifications.get(0).getId());