try prefetching directories after install, before first app launch
This commit is contained in:
parent
1f64427ef7
commit
a05ecbe861
3 changed files with 27 additions and 0 deletions
|
@ -174,5 +174,13 @@
|
|||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths"/>
|
||||
</provider>
|
||||
|
||||
<receiver
|
||||
android:name=".receivers.InstallReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.vending.INSTALL_REFERRER"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
|
@ -20,6 +20,9 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
|||
var shouldStop = false
|
||||
|
||||
override fun doInBackground(vararg params: Void): ArrayList<Directory> {
|
||||
if (!context.hasWriteStoragePermission())
|
||||
return ArrayList()
|
||||
|
||||
val media = ArrayList<Medium>()
|
||||
val showMedia = config.showMedia
|
||||
val fileSorting = config.fileSorting
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.simplemobiletools.gallery.receivers
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.google.gson.Gson
|
||||
import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask
|
||||
import com.simplemobiletools.gallery.extensions.config
|
||||
|
||||
class InstallReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
GetDirectoriesAsynctask(context, false, false) {
|
||||
context.config.directories = Gson().toJson(it)
|
||||
}.execute()
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue