evict cached previews when file gets deleted
This commit is contained in:
parent
66da5ffb6c
commit
843d7fe12d
|
@ -508,6 +508,8 @@ public class FileBackend {
|
||||||
return getFile(message, true);
|
return getFile(message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public DownloadableFile getFileForPath(String path) {
|
public DownloadableFile getFileForPath(String path) {
|
||||||
return getFileForPath(path, MimeUtils.guessMimeTypeFromExtension(MimeUtils.extractRelevantExtension(path)));
|
return getFileForPath(path, MimeUtils.guessMimeTypeFromExtension(MimeUtils.extractRelevantExtension(path)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1854,6 +1854,9 @@ public class XmppConnectionService extends Service {
|
||||||
for (Conversation conversation : getConversations()) {
|
for (Conversation conversation : getConversations()) {
|
||||||
deleted |= conversation.markAsDeleted(uuids);
|
deleted |= conversation.markAsDeleted(uuids);
|
||||||
}
|
}
|
||||||
|
for(final String uuid : uuids) {
|
||||||
|
evictPreview(uuid);
|
||||||
|
}
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
updateConversationUi();
|
updateConversationUi();
|
||||||
}
|
}
|
||||||
|
@ -4575,6 +4578,12 @@ public class XmppConnectionService extends Service {
|
||||||
sendIqPacket(account, set, null);
|
sendIqPacket(account, set, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void evictPreview(String uuid) {
|
||||||
|
if (mBitmapCache.remove(uuid) != null) {
|
||||||
|
Log.d(Config.LOGTAG,"deleted cached preview");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public interface OnMamPreferencesFetched {
|
public interface OnMamPreferencesFetched {
|
||||||
void onPreferencesFetched(Element prefs);
|
void onPreferencesFetched(Element prefs);
|
||||||
|
|
||||||
|
|
|
@ -1653,6 +1653,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
builder.setPositiveButton(R.string.confirm, (dialog, which) -> {
|
builder.setPositiveButton(R.string.confirm, (dialog, which) -> {
|
||||||
if (activity.xmppConnectionService.getFileBackend().deleteFile(message)) {
|
if (activity.xmppConnectionService.getFileBackend().deleteFile(message)) {
|
||||||
message.setDeleted(true);
|
message.setDeleted(true);
|
||||||
|
activity.xmppConnectionService.evictPreview(message.getUuid());
|
||||||
activity.xmppConnectionService.updateMessage(message, false);
|
activity.xmppConnectionService.updateMessage(message, false);
|
||||||
activity.onConversationsListItemUpdated();
|
activity.onConversationsListItemUpdated();
|
||||||
refresh();
|
refresh();
|
||||||
|
|
Loading…
Reference in a new issue