导入 v0.1.0 / v0.2.0 源码:五模块首版、交互重构、重复任务、任务分布
- 源码镜像 src/main(81 个文件):首页双模式、任务、项目、统计、设置 - 补齐 README / LICENSE / CHANGELOG / CONTRIBUTING / .gitignore - 不含构建配置、签名材料、编译产物与备份数据
This commit is contained in:
31
src/main/java/com/focusbox/app/App.kt
Normal file
31
src/main/java/com/focusbox/app/App.kt
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.focusbox.app
|
||||
|
||||
import android.app.Application
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import com.focusbox.app.data.Store
|
||||
import com.focusbox.app.service.Notif
|
||||
import com.focusbox.app.service.TimerCore
|
||||
import com.focusbox.app.util.Prefs
|
||||
|
||||
class App : Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
Prefs.init(this)
|
||||
Store.init(this)
|
||||
Notif.createChannels(this)
|
||||
applyTheme()
|
||||
TimerCore.init(this)
|
||||
}
|
||||
|
||||
/** 深色模式在 Activity 创建前定好,避免首帧闪一下浅色再跳深色 */
|
||||
fun applyTheme() {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
when (Prefs.themeMode) {
|
||||
1 -> AppCompatDelegate.MODE_NIGHT_NO
|
||||
2 -> AppCompatDelegate.MODE_NIGHT_YES
|
||||
else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user