Refresh app list when package change & Bump to 3.0.5
This commit is contained in:
parent
70e75dd4b3
commit
8a56135420
3 changed files with 39 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import android.annotation.SuppressLint
|
|||
import android.app.Application
|
||||
import com.tsng.hidemyapplist.R
|
||||
import icu.nullptr.hidemyapplist.service.PrefManager
|
||||
import icu.nullptr.hidemyapplist.ui.receiver.AppChangeReceiver
|
||||
import icu.nullptr.hidemyapplist.ui.util.makeToast
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
|
@ -35,6 +36,7 @@ class MyApp : Application() {
|
|||
exitProcess(0)
|
||||
}
|
||||
hmaApp = this
|
||||
AppChangeReceiver.register(this)
|
||||
|
||||
DayNightDelegate.setApplicationContext(this)
|
||||
DayNightDelegate.setDefaultNightMode(PrefManager.darkTheme)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
package icu.nullptr.hidemyapplist.ui.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.util.Log
|
||||
import icu.nullptr.hidemyapplist.util.PackageHelper
|
||||
|
||||
class AppChangeReceiver : BroadcastReceiver() {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AppChangeReceiver"
|
||||
|
||||
private val actions = setOf(
|
||||
Intent.ACTION_PACKAGE_ADDED,
|
||||
Intent.ACTION_PACKAGE_REMOVED,
|
||||
Intent.ACTION_PACKAGE_REPLACED
|
||||
)
|
||||
|
||||
fun register(context: Context) {
|
||||
val filter = IntentFilter().apply {
|
||||
actions.forEach(::addAction)
|
||||
addDataScheme("package")
|
||||
}
|
||||
context.registerReceiver(AppChangeReceiver(), filter)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (intent.action in actions) {
|
||||
Log.i(TAG, "Received intent: $intent")
|
||||
PackageHelper.invalidateCache()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ fun String.execute(currentWorkingDir: File = file("./")): String {
|
|||
val minSdkVer by extra(24)
|
||||
val targetSdkVer by extra(33)
|
||||
|
||||
val appVerName by extra("3.0.4-Beta")
|
||||
val appVerName by extra("3.0.5-Beta")
|
||||
val serviceVerCode by extra(87)
|
||||
val minBackupVerCode by extra(65)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue