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() {
|
private fun tryInitFileManager() {
|
||||||
|
val hadPermission = hasPermission(PERMISSION_WRITE_STORAGE)
|
||||||
handlePermission(PERMISSION_WRITE_STORAGE) {
|
handlePermission(PERMISSION_WRITE_STORAGE) {
|
||||||
checkOTGPath()
|
checkOTGPath()
|
||||||
if (it) {
|
if (it) {
|
||||||
|
@ -267,7 +268,7 @@ class MainActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
main_view_pager.onGlobalLayout {
|
main_view_pager.onGlobalLayout {
|
||||||
initFileManager()
|
initFileManager(!hadPermission)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
toast(R.string.no_storage_permissions)
|
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) {
|
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
|
||||||
val data = intent.data
|
val data = intent.data
|
||||||
if (data?.scheme == "file") {
|
if (data?.scheme == "file") {
|
||||||
|
@ -302,6 +303,10 @@ class MainActivity : SimpleActivity() {
|
||||||
it?.isGetContentIntent = intent.action == Intent.ACTION_GET_CONTENT
|
it?.isGetContentIntent = intent.action == Intent.ACTION_GET_CONTENT
|
||||||
it?.isPickMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
|
it?.isPickMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (refreshRecents) {
|
||||||
|
recents_fragment?.refreshItems()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initFragments() {
|
private fun initFragments() {
|
||||||
|
|
Loading…
Reference in New Issue