check if there is an available app for Crop before launching it

This commit is contained in:
tibbi 2018-02-21 15:50:56 +01:00
parent 8dd3dd08cd
commit bcdd8fe40f
2 changed files with 9 additions and 1 deletions

View File

@ -204,7 +204,11 @@ class EditContactActivity : ContactActivity() {
putExtra("scaleUpIfNeeded", "true")
clipData = ClipData("Attachment", arrayOf("text/uri-list"), ClipData.Item(lastPhotoIntentUri))
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
startActivityForResult(this, INTENT_CROP_PHOTO)
if (resolveActivity(packageManager) != null) {
startActivityForResult(this, INTENT_CROP_PHOTO)
} else {
toast(R.string.no_app_found)
}
}
}

View File

@ -36,6 +36,10 @@ class ExportContactsDialog(val activity: SimpleActivity, val path: String, priva
.create().apply {
activity.setupDialogStuff(view, this, R.string.export_contacts) {
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
if (view.export_contacts_list.adapter == null) {
return@setOnClickListener
}
val filename = view.export_contacts_filename.value
when {
filename.isEmpty() -> activity.toast(R.string.empty_name)