make sure Recents are loaded properly at first launch, after granting permission
This commit is contained in:
parent
e22322b2d5
commit
d8fad97da2
|
@ -259,6 +259,7 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun tryInitFileManager() {
|
||||
val hadPermission = hasPermission(PERMISSION_WRITE_STORAGE)
|
||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||
checkOTGPath()
|
||||
if (it) {
|
||||
|
@ -267,7 +268,7 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
main_view_pager.onGlobalLayout {
|
||||
initFileManager()
|
||||
initFileManager(!hadPermission)
|
||||
}
|
||||
} else {
|
||||
toast(R.string.no_storage_permissions)
|
||||
|
@ -276,7 +277,7 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun initFileManager() {
|
||||
private fun initFileManager(refreshRecents: Boolean) {
|
||||
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||
val data = intent.data
|
||||
if (data?.scheme == "file") {
|
||||
|
@ -302,6 +303,10 @@ class MainActivity : SimpleActivity() {
|
|||
it?.isGetContentIntent = intent.action == Intent.ACTION_GET_CONTENT
|
||||
it?.isPickMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
|
||||
}
|
||||
|
||||
if (refreshRecents) {
|
||||
recents_fragment?.refreshItems()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initFragments() {
|
||||
|
|
Loading…
Reference in New Issue