fix: request for storage permission at startup
This commit is contained in:
parent
2caf68cf4a
commit
404a027576
@ -1,5 +1,6 @@
|
||||
package io.neoterm.ui.term
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
||||
import android.app.AlertDialog
|
||||
import android.content.*
|
||||
@ -8,6 +9,7 @@ import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import android.os.IBinder
|
||||
import android.preference.PreferenceManager
|
||||
import android.support.v4.app.ActivityCompat
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.support.v4.view.OnApplyWindowInsetsListener
|
||||
import android.support.v4.view.ViewCompat
|
||||
@ -72,6 +74,19 @@ class NeoTermActivity : AppCompatActivity(), ServiceConnection, SharedPreference
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||
}
|
||||
|
||||
val SDCARD_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE = 1
|
||||
if (ContextCompat.checkSelfPermission(
|
||||
this,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
|
||||
SDCARD_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE
|
||||
)
|
||||
}
|
||||
|
||||
setContentView(R.layout.ui_main)
|
||||
|
||||
toolbar = findViewById(R.id.terminal_toolbar)
|
||||
|
Loading…
Reference in New Issue
Block a user