feat: add check for if device has a camera before sending out the image capture intent
This commit is contained in:
parent
a177d35c4f
commit
08866e0bea
@ -1486,7 +1486,11 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||
|
||||
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
|
||||
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST_CODE);
|
||||
if(getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)){
|
||||
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST_CODE);
|
||||
} else {
|
||||
Toast.makeText(getContext(), R.string.mo_camera_not_available, Toast.LENGTH_SHORT);
|
||||
}
|
||||
} else {
|
||||
getActivity().requestPermissions(new String[]{Manifest.permission.CAMERA}, CAMERA_PERMISSION_CODE);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
<string name="mo_composer_behavior">Composer\'s Behavior</string>
|
||||
<string name="mo_notification_management_settings">Manage Notifications</string>
|
||||
<string name="mo_open_camera">Take picture</string>
|
||||
<string name="mo_camera_not_available">No camera available!</string>
|
||||
|
||||
<!-- accessibility labels-->
|
||||
<string name="mo_poll_option_add">Add new poll option</string>
|
||||
|
Loading…
Reference in New Issue
Block a user