Skip to content

Commit d8fad97

Browse files
committed
make sure Recents are loaded properly at first launch, after granting permission
1 parent e22322b commit d8fad97

File tree

1 file changed

+7
-2
lines changed
  • app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities

1 file changed

+7
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ class MainActivity : SimpleActivity() {
259259
}
260260

261261
private fun tryInitFileManager() {
262+
val hadPermission = hasPermission(PERMISSION_WRITE_STORAGE)
262263
handlePermission(PERMISSION_WRITE_STORAGE) {
263264
checkOTGPath()
264265
if (it) {
@@ -267,7 +268,7 @@ class MainActivity : SimpleActivity() {
267268
}
268269

269270
main_view_pager.onGlobalLayout {
270-
initFileManager()
271+
initFileManager(!hadPermission)
271272
}
272273
} else {
273274
toast(R.string.no_storage_permissions)
@@ -276,7 +277,7 @@ class MainActivity : SimpleActivity() {
276277
}
277278
}
278279

279-
private fun initFileManager() {
280+
private fun initFileManager(refreshRecents: Boolean) {
280281
if (intent.action == Intent.ACTION_VIEW && intent.data != null) {
281282
val data = intent.data
282283
if (data?.scheme == "file") {
@@ -302,6 +303,10 @@ class MainActivity : SimpleActivity() {
302303
it?.isGetContentIntent = intent.action == Intent.ACTION_GET_CONTENT
303304
it?.isPickMultipleIntent = intent.getBooleanExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
304305
}
306+
307+
if (refreshRecents) {
308+
recents_fragment?.refreshItems()
309+
}
305310
}
306311

307312
private fun initFragments() {

0 commit comments

Comments
 (0)