Confirm expunge

This commit is contained in:
M66B 2021-10-24 15:13:30 +02:00
parent 650f2bcc64
commit a570896632
2 changed files with 27 additions and 3 deletions

View File

@ -23,6 +23,7 @@ import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
@ -50,6 +51,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
import androidx.constraintlayout.widget.Group;
import androidx.core.content.pm.ShortcutInfoCompat;
@ -529,7 +531,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
popupMenu.getMenu().add(Menu.NONE, R.string.title_delete_local, order++, R.string.title_delete_local);
popupMenu.getMenu().add(Menu.NONE, R.string.title_delete_browsed, order++, R.string.title_delete_browsed);
if (!perform_expunge || BuildConfig.DEBUG)
popupMenu.getMenu().add(Menu.NONE, R.string.title_advanced_expunge, order++, R.string.title_advanced_expunge);
popupMenu.getMenu().add(Menu.NONE, R.string.title_expunge, order++, R.string.title_expunge);
}
if (EntityFolder.TRASH.equals(folder.type))
@ -658,7 +660,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
} else if (itemId == R.string.title_delete_browsed) {
OnActionDeleteLocal(true);
return true;
} else if (itemId == R.string.title_advanced_expunge) {
} else if (itemId == R.string.title_expunge) {
onActionExpunge();
return true;
} else if (itemId == R.string.title_empty_trash) {
@ -944,6 +946,26 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
}
private void onActionExpunge() {
new AlertDialog.Builder(view.getContext())
.setIcon(R.drawable.twotone_help_24)
.setTitle(R.string.title_expunge)
.setMessage(R.string.title_expunge_remark)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
expunge();
}
})
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Do nothing
}
})
.show();
}
private void expunge() {
Bundle args = new Bundle();
args.putLong("id", folder.id);

View File

@ -663,7 +663,7 @@
<string name="title_advanced_sqlite_cache" translatable="false">Sqlite cache: %1$s %% - %2$s</string>
<string name="title_advanced_chunk_size" translatable="false">Chunk size: %1$d</string>
<string name="title_advanced_modseq" translatable="false">MODSEQ</string>
<string name="title_advanced_expunge" translatable="false">EXPUNGE</string>
<string name="title_advanced_expunge" translatable="false">AUTO EXPUNGE</string>
<string name="title_advanced_auth_plain" translatable="false">PLAIN</string>
<string name="title_advanced_auth_login" translatable="false">LOGIN</string>
<string name="title_advanced_auth_ntlm" translatable="false">NTLM</string>
@ -912,6 +912,8 @@
<string name="title_notify_batch_disable">Disable new message notifications</string>
<string name="title_delete_local">Delete local messages</string>
<string name="title_delete_browsed">Delete browsed/searched messages</string>
<string name="title_expunge">Expunge</string>
<string name="title_expunge_remark">This will permanently delete all messages marked for deletion</string>
<string name="title_empty_trash">Empty trash</string>
<string name="title_empty_spam">Empty spam</string>
<string name="title_edit_properties">Edit properties</string>