Ask to delete local messages

pull/153/head
M66B 6 years ago
parent 935952c036
commit f6fde69b4a

@ -343,29 +343,43 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
}.execute(context, owner, args, "folder:sync"); }.execute(context, owner, args, "folder:sync");
} }
private void OnActionDeleteLocal(boolean browsed) { private void OnActionDeleteLocal(final boolean browsed) {
Bundle args = new Bundle(); View dview = LayoutInflater.from(context).inflate(R.layout.dialog_message, null);
args.putLong("id", folder.id); TextView tvMessage = dview.findViewById(R.id.tvMessage);
args.putBoolean("browsed", browsed);
new SimpleTask<Void>() { tvMessage.setText(context.getText(R.string.title_ask_delete_local));
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
boolean browsed = args.getBoolean("browsed");
Log.i("Delete local messages browsed=" + browsed);
if (browsed)
DB.getInstance(context).message().deleteBrowsedMessages(id);
else
DB.getInstance(context).message().deleteLocalMessages(id);
return null;
}
@Override new DialogBuilderLifecycle(context, owner)
public void onException(Bundle args, Throwable ex) { .setView(dview)
Helper.unexpectedError(context, owner, ex); .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
} @Override
}.execute(context, owner, args, "folder:delete:local"); public void onClick(DialogInterface dialog, int which) {
Bundle args = new Bundle();
args.putLong("id", folder.id);
args.putBoolean("browsed", browsed);
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
boolean browsed = args.getBoolean("browsed");
Log.i("Delete local messages browsed=" + browsed);
if (browsed)
DB.getInstance(context).message().deleteBrowsedMessages(id);
else
DB.getInstance(context).message().deleteLocalMessages(id);
return null;
}
@Override
public void onException(Bundle args, Throwable ex) {
Helper.unexpectedError(context, owner, ex);
}
}.execute(context, owner, args, "folder:delete:local");
}
})
.setNegativeButton(android.R.string.cancel, null)
.show();
} }
private void onActionEmptyTrash() { private void onActionEmptyTrash() {

@ -373,6 +373,7 @@
<string name="title_ask_show_html">Showing the original message can leak privacy sensitive information</string> <string name="title_ask_show_html">Showing the original message can leak privacy sensitive information</string>
<string name="title_ask_show_image">Showing images can leak privacy sensitive information</string> <string name="title_ask_show_image">Showing images can leak privacy sensitive information</string>
<string name="title_ask_edit_ref">Edit reformatted replied/forwarded message text?</string> <string name="title_ask_edit_ref">Edit reformatted replied/forwarded message text?</string>
<string name="title_ask_delete_local">Delete local messages which are stored on the remote server too?</string>
<string name="title_compose">Compose</string> <string name="title_compose">Compose</string>
<string name="title_from">From:</string> <string name="title_from">From:</string>

Loading…
Cancel
Save