mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 15:13:50 +00:00
Allow batch deletion of media.
It is now possible to batch-delete media in the "media overview" screen. You can long press to enter multi-select mode. Then a delete button appears on the menu bar. After pressing delete, you will get a confirmation, and if the user confirms, the items will delete while a progres dialog shows.
This commit is contained in:
committed by
Moxie Marlinspike
parent
0c768a24e4
commit
10e5b24cfd
@@ -62,6 +62,7 @@ import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||
import org.thoughtcrime.securesms.permissions.Permissions;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientModifiedListener;
|
||||
import org.thoughtcrime.securesms.util.AttachmentUtil;
|
||||
import org.thoughtcrime.securesms.util.DateUtils;
|
||||
import org.thoughtcrime.securesms.util.DynamicLanguage;
|
||||
import org.thoughtcrime.securesms.util.SaveAttachmentTask;
|
||||
@@ -277,18 +278,8 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity im
|
||||
if (mediaItem.attachment == null) {
|
||||
return null;
|
||||
}
|
||||
Context context = MediaPreviewActivity.this.getApplicationContext();
|
||||
AttachmentId attachmentId = mediaItem.attachment.getAttachmentId();
|
||||
long mmsId = mediaItem.attachment.getMmsId();
|
||||
int attachmentCount = DatabaseFactory.getAttachmentDatabase(context)
|
||||
.getAttachmentsForMessage(mmsId)
|
||||
.size();
|
||||
|
||||
if (attachmentCount <= 1) {
|
||||
DatabaseFactory.getMmsDatabase(context).delete(mmsId);
|
||||
} else {
|
||||
DatabaseFactory.getAttachmentDatabase(context).deleteAttachment(attachmentId);
|
||||
}
|
||||
AttachmentUtil.deleteAttachment(MediaPreviewActivity.this.getApplicationContext(),
|
||||
mediaItem.attachment);
|
||||
return null;
|
||||
}
|
||||
}.execute();
|
||||
|
||||
Reference in New Issue
Block a user