Dismiss notifications when notifications fragment is opened

main
Eugen Rochko 7 years ago
parent d09e9706b6
commit 636c2f266e
  1. 9
      app/src/main/java/com/keylesspalace/tusky/NotificationsFragment.java
  2. 2
      app/src/main/java/com/keylesspalace/tusky/PullNotificationService.java

@ -15,6 +15,7 @@
package com.keylesspalace.tusky;
import android.app.NotificationManager;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@ -70,6 +71,14 @@ public class NotificationsFragment extends SFragment implements
super.onDestroy();
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
NotificationManager notificationManager =
(NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(PullNotificationService.NOTIFY_ID);
super.onCreate(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,

@ -57,7 +57,7 @@ import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class PullNotificationService extends IntentService {
private static final int NOTIFY_ID = 6; // This is an arbitrary number.
static final int NOTIFY_ID = 6; // This is an arbitrary number.
private static final String TAG = "PullNotifications"; // logging tag and Volley request tag
public PullNotificationService() {

Loading…
Cancel
Save