mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Catch ActivityNotFoundException when saving image.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.briarproject.briar.android.conversation;
|
package org.briarproject.briar.android.conversation;
|
||||||
|
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -263,7 +264,11 @@ public class ImageActivity extends BriarActivity
|
|||||||
if (SDK_INT >= 19) {
|
if (SDK_INT >= 19) {
|
||||||
String name = viewModel.getFileName() + "." +
|
String name = viewModel.getFileName() + "." +
|
||||||
getVisibleAttachment().getExtension();
|
getVisibleAttachment().getExtension();
|
||||||
launcher.launch(name);
|
try {
|
||||||
|
launcher.launch(name);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
viewModel.onSaveImageError();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
viewModel.saveImage(getVisibleAttachment());
|
viewModel.saveImage(getVisibleAttachment());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,6 +186,11 @@ public class ImageViewModel extends DbViewModel implements EventListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UiThread
|
||||||
|
void onSaveImageError() {
|
||||||
|
saveState.setEvent(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the attachment on external storage,
|
* Saves the attachment on external storage,
|
||||||
* assuming the permission was granted during install time.
|
* assuming the permission was granted during install time.
|
||||||
|
|||||||
Reference in New Issue
Block a user