confirm delete notifications (#1186)

* confirm delete notificaitons

* Use same strings as website

* Cleanup
main
Bernd 5 years ago committed by Konrad Pozniak
parent ca2dbe1e73
commit 7ffb06675c
  1. 15
      app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java
  2. 2
      app/src/main/res/values/strings.xml

@ -17,6 +17,7 @@ package com.keylesspalace.tusky.fragment;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
@ -77,6 +78,7 @@ import javax.inject.Inject;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.arch.core.util.Function;
import androidx.core.util.Pair;
import androidx.lifecycle.Lifecycle;
@ -237,7 +239,7 @@ public class NotificationsFragment extends SFragment implements
updateAdapter();
Button buttonClear = rootView.findViewById(R.id.buttonClear);
buttonClear.setOnClickListener(v -> clearNotifications());
buttonClear.setOnClickListener(v -> confirmClearNotifications());
buttonFilter = rootView.findViewById(R.id.buttonFilter);
buttonFilter.setOnClickListener(v -> showFilterMenu());
@ -252,6 +254,17 @@ public class NotificationsFragment extends SFragment implements
return rootView;
}
private void confirmClearNotifications(){
AlertDialog.Builder dialog = new AlertDialog.Builder(getContext());
dialog.setMessage(R.string.notification_clear_text);
dialog.setPositiveButton(android.R.string.yes, (DialogInterface dia, int which) -> clearNotifications());
dialog.setNeutralButton(android.R.string.no, null);
dialog.show();
}
private void handleFavEvent(FavoriteEvent event) {
Pair<Integer, Notification> posAndNotification =
findReplyPosition(event.getStatusId());

@ -472,4 +472,6 @@
<string name="compose_shortcut_short_label">Compose</string>
<string name="pref_title_bot_overlay">Show indicator for bots</string>
<string name="notification_clear_text">Are you sure you want to permanently clear all your notifications?</string>
</resources>

Loading…
Cancel
Save