handle storage permission at EditActivity
This commit is contained in:
parent
6c7e406dad
commit
16f913a026
2 changed files with 19 additions and 7 deletions
|
@ -42,7 +42,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:3.3.12'
|
||||
implementation 'com.simplemobiletools:commons:3.4.0'
|
||||
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.9.0'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
|
||||
implementation 'com.android.support:multidex:1.0.2'
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.provider.MediaStore
|
|||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.dialogs.ResizeDialog
|
||||
import com.simplemobiletools.gallery.dialogs.SaveAsDialog
|
||||
|
@ -24,17 +25,28 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
private val ASPECT_Y = "aspectY"
|
||||
private val CROP = "crop"
|
||||
|
||||
lateinit var uri: Uri
|
||||
lateinit var saveUri: Uri
|
||||
var resizeWidth = 0
|
||||
var resizeHeight = 0
|
||||
var isCropIntent = false
|
||||
var isEditingWithThirdParty = false
|
||||
private lateinit var uri: Uri
|
||||
private lateinit var saveUri: Uri
|
||||
private var resizeWidth = 0
|
||||
private var resizeHeight = 0
|
||||
private var isCropIntent = false
|
||||
private var isEditingWithThirdParty = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.view_crop_image)
|
||||
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
if (it) {
|
||||
initEditActivity()
|
||||
} else {
|
||||
toast(R.string.no_storage_permissions)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initEditActivity() {
|
||||
if (intent.data == null) {
|
||||
toast(R.string.invalid_image_path)
|
||||
finish()
|
||||
|
|
Loading…
Reference in a new issue