mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-02-18 20:40:46 +01:00
adding a null check at handling Edit Photo result
This commit is contained in:
parent
bcdd8fe40f
commit
74140b1665
@ -94,7 +94,7 @@ class EditContactActivity : ContactActivity() {
|
|||||||
super.onActivityResult(requestCode, resultCode, resultData)
|
super.onActivityResult(requestCode, resultCode, resultData)
|
||||||
if (resultCode == RESULT_OK) {
|
if (resultCode == RESULT_OK) {
|
||||||
when (requestCode) {
|
when (requestCode) {
|
||||||
INTENT_TAKE_PHOTO, INTENT_CHOOSE_PHOTO -> startCropPhotoIntent(lastPhotoIntentUri!!)
|
INTENT_TAKE_PHOTO, INTENT_CHOOSE_PHOTO -> startCropPhotoIntent(lastPhotoIntentUri)
|
||||||
INTENT_CROP_PHOTO -> updateContactPhoto(lastPhotoIntentUri.toString(), contact_photo)
|
INTENT_CROP_PHOTO -> updateContactPhoto(lastPhotoIntentUri.toString(), contact_photo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +190,12 @@ class EditContactActivity : ContactActivity() {
|
|||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun startCropPhotoIntent(uri: Uri) {
|
private fun startCropPhotoIntent(uri: Uri?) {
|
||||||
|
if (uri == null) {
|
||||||
|
toast(R.string.unknown_error_occurred)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
lastPhotoIntentUri = getCachePhotoUri()
|
lastPhotoIntentUri = getCachePhotoUri()
|
||||||
Intent("com.android.camera.action.CROP").apply {
|
Intent("com.android.camera.action.CROP").apply {
|
||||||
setDataAndType(uri, "image/*")
|
setDataAndType(uri, "image/*")
|
||||||
|
@ -35,7 +35,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
|
|||||||
|
|
||||||
private val FIRST_CONTACT_ID = 1000000
|
private val FIRST_CONTACT_ID = 1000000
|
||||||
|
|
||||||
private val mDb: SQLiteDatabase = writableDatabase
|
private val mDb = writableDatabase
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val DB_VERSION = 1
|
private const val DB_VERSION = 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user