From 67a7eb839150b270753a2a239ff0e8a44e3ebafa Mon Sep 17 00:00:00 2001 From: Super12138 <70494801+Super12138@users.noreply.github.com> Date: Fri, 12 Jan 2024 17:52:03 +0800 Subject: [PATCH] Update lifecycle-viewmodel to 2.7.0 --- app/build.gradle.kts | 4 ++-- app/src/main/kotlin/cn/super12138/todo/ToDoApplication.kt | 4 +--- .../main/kotlin/cn/super12138/todo/logic/database/SPHelper.kt | 3 ++- app/src/main/kotlin/cn/super12138/todo/logic/model/ToDo.kt | 2 +- .../main/kotlin/cn/super12138/todo/views/main/MainActivity.kt | 1 - 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7883077..d4753db 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -58,8 +58,8 @@ dependencies { implementation("androidx.fragment:fragment:1.6.2") implementation("androidx.fragment:fragment-ktx:1.6.2") implementation("androidx.recyclerview:recyclerview:1.3.2") - implementation("androidx.lifecycle:lifecycle-viewmodel:2.6.2") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2") + implementation("androidx.lifecycle:lifecycle-viewmodel:2.7.0") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0") implementation("androidx.preference:preference:1.2.1") implementation("androidx.preference:preference-ktx:1.2.1") // Material Design diff --git a/app/src/main/kotlin/cn/super12138/todo/ToDoApplication.kt b/app/src/main/kotlin/cn/super12138/todo/ToDoApplication.kt index a2b6c84..740da4f 100644 --- a/app/src/main/kotlin/cn/super12138/todo/ToDoApplication.kt +++ b/app/src/main/kotlin/cn/super12138/todo/ToDoApplication.kt @@ -6,12 +6,10 @@ import android.content.Context import cn.super12138.todo.logic.dao.ToDoRoomDB import cn.super12138.todo.views.crash.CrashHandler import com.google.android.material.color.DynamicColors -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch class ToDoApplication : Application() { private val database by lazy { ToDoRoomDB.getDatabase(this) } + companion object { @SuppressLint("StaticFieldLeak") lateinit var context: Context diff --git a/app/src/main/kotlin/cn/super12138/todo/logic/database/SPHelper.kt b/app/src/main/kotlin/cn/super12138/todo/logic/database/SPHelper.kt index f93de2b..a1e1cf3 100644 --- a/app/src/main/kotlin/cn/super12138/todo/logic/database/SPHelper.kt +++ b/app/src/main/kotlin/cn/super12138/todo/logic/database/SPHelper.kt @@ -9,7 +9,8 @@ object SPHelper { PreferenceManager.getDefaultSharedPreferences(context /* Activity context */) return sharedPreferences.getString(name, defaultValue) } - fun getPreferenceBoolean(context: Context, name: String, defaultValue: Boolean): Boolean? { + + fun getPreferenceBoolean(context: Context, name: String, defaultValue: Boolean): Boolean { val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context /* Activity context */) return sharedPreferences.getBoolean(name, defaultValue) diff --git a/app/src/main/kotlin/cn/super12138/todo/logic/model/ToDo.kt b/app/src/main/kotlin/cn/super12138/todo/logic/model/ToDo.kt index 39387db..b64f421 100644 --- a/app/src/main/kotlin/cn/super12138/todo/logic/model/ToDo.kt +++ b/app/src/main/kotlin/cn/super12138/todo/logic/model/ToDo.kt @@ -1,5 +1,5 @@ package cn.super12138.todo.logic.model -data class ToDo(val uuid: String, val content: String, val subject: String){ +data class ToDo(val uuid: String, val content: String, val subject: String) { var isAnimated = false } \ No newline at end of file diff --git a/app/src/main/kotlin/cn/super12138/todo/views/main/MainActivity.kt b/app/src/main/kotlin/cn/super12138/todo/views/main/MainActivity.kt index 0f4b339..656115f 100644 --- a/app/src/main/kotlin/cn/super12138/todo/views/main/MainActivity.kt +++ b/app/src/main/kotlin/cn/super12138/todo/views/main/MainActivity.kt @@ -64,7 +64,6 @@ class MainActivity : BaseActivity() { ) false -> window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE) - else -> window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE) } } } \ No newline at end of file