Skip to content

Commit 0f03bcd

Browse files
committed
perf: syncFixState
1 parent 2a24eef commit 0f03bcd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/src/main/kotlin/li/songe/gkd/App.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ import rikka.shizuku.Shizuku
3838

3939
val appScope by lazy { MainScope() }
4040

41-
private lateinit var innerApp: Application
42-
val app: Application
41+
private lateinit var innerApp: App
42+
val app: App
4343
get() = innerApp
4444

4545
private val applicationInfo by lazy {
@@ -74,6 +74,8 @@ class App : Application() {
7474
}
7575
}
7676

77+
val startTime = System.currentTimeMillis()
78+
7779
override fun onCreate() {
7880
super.onCreate()
7981
innerApp = this

app/src/main/kotlin/li/songe/gkd/MainActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import kotlin.reflect.KClass
6969
import kotlin.reflect.jvm.jvmName
7070

7171
class MainActivity : ComponentActivity() {
72+
val startTime = System.currentTimeMillis()
7273
val mainVm by viewModels<MainViewModel>()
7374
val launcher by lazy { StartActivityLauncher(this) }
7475
val pickContentLauncher by lazy { PickContentLauncher(this) }
@@ -126,6 +127,9 @@ class MainActivity : ComponentActivity() {
126127

127128
override fun onResume() {
128129
super.onResume()
130+
if (startTime - app.startTime < 2000) {
131+
return
132+
}
129133
syncFixState()
130134
}
131135

0 commit comments

Comments
 (0)