make sure we have write storage permission before doing anything at editor
This commit is contained in:
parent
357286f1c9
commit
5d13b65b03
1 changed files with 13 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
|||
package com.simplemobiletools.filemanager.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import com.simplemobiletools.commons.extensions.toast
|
||||
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
|
||||
import com.simplemobiletools.filemanager.R
|
||||
import com.simplemobiletools.filemanager.extensions.config
|
||||
import kotlinx.android.synthetic.main.activity_read_text.*
|
||||
|
@ -11,6 +13,17 @@ class ReadTextActivity : SimpleActivity() {
|
|||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_read_text)
|
||||
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
if (it) {
|
||||
checkIntent()
|
||||
} else {
|
||||
toast(R.string.no_storage_permissions)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkIntent() {
|
||||
read_text_view.setTextColor(config.textColor)
|
||||
val uri = intent.data
|
||||
if (uri.scheme == "file") {
|
||||
|
|
Loading…
Reference in a new issue