Prevent crash

pull/171/head
M66B 5 years ago
parent aadcce757d
commit b9d400e161

@ -1182,7 +1182,12 @@ public class FragmentCompose extends FragmentBase {
private void onActionRecordAudio() { private void onActionRecordAudio() {
Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION); Intent intent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION);
try {
startActivityForResult(intent, REQUEST_RECORD_AUDIO); startActivityForResult(intent, REQUEST_RECORD_AUDIO);
} catch (SecurityException ex) {
Log.w(ex);
Snackbar.make(view, getString(R.string.title_no_viewer, intent.getAction()), Snackbar.LENGTH_LONG).show();
}
} }
private void onActionTakePhoto() { private void onActionTakePhoto() {
@ -1193,9 +1198,14 @@ public class FragmentCompose extends FragmentBase {
// https://developer.android.com/training/camera/photobasics // https://developer.android.com/training/camera/photobasics
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
try {
photoURI = FileProvider.getUriForFile(getContext(), BuildConfig.APPLICATION_ID, file); photoURI = FileProvider.getUriForFile(getContext(), BuildConfig.APPLICATION_ID, file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI); intent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(intent, REQUEST_TAKE_PHOTO); startActivityForResult(intent, REQUEST_TAKE_PHOTO);
} catch (SecurityException ex) {
Log.w(ex);
Snackbar.make(view, getString(R.string.title_no_viewer, intent.getAction()), Snackbar.LENGTH_LONG).show();
}
} }
private void onActionImage() { private void onActionImage() {

Loading…
Cancel
Save