更新
This commit is contained in:
@@ -304,4 +304,6 @@ dependencies {
|
|||||||
|
|
||||||
//com.github.AmrDeveloper:CodeView代码编辑已集成到应用内
|
//com.github.AmrDeveloper:CodeView代码编辑已集成到应用内
|
||||||
//epubLib集成到应用内
|
//epubLib集成到应用内
|
||||||
|
|
||||||
|
implementation libs.androidx.datastore.preferences
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,24 +120,6 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
|
|||||||
preferenceManager.sharedPreferences?.unregisterOnSharedPreferenceChangeListener(this)
|
preferenceManager.sharedPreferences?.unregisterOnSharedPreferenceChangeListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
// override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
|
|
||||||
// menuInflater.inflate(R.menu.theme_config, menu)
|
|
||||||
// menu.applyTint(requireContext())
|
|
||||||
// }
|
|
||||||
|
|
||||||
// override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
|
|
||||||
// when (menuItem.itemId) {
|
|
||||||
// R.id.menu_theme_mode -> {
|
|
||||||
// AppConfig.isNightTheme = !AppConfig.isNightTheme
|
|
||||||
// ThemeConfig.applyDayNight(requireContext())
|
|
||||||
// return true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
//不使用菜单
|
|
||||||
|
|
||||||
|
|
||||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
|
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
|
||||||
sharedPreferences ?: return
|
sharedPreferences ?: return
|
||||||
when (key) {
|
when (key) {
|
||||||
@@ -171,19 +153,6 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
|
|||||||
@SuppressLint("PrivateResource")
|
@SuppressLint("PrivateResource")
|
||||||
override fun onPreferenceTreeClick(preference: Preference): Boolean {
|
override fun onPreferenceTreeClick(preference: Preference): Boolean {
|
||||||
when (val key = preference.key) {
|
when (val key = preference.key) {
|
||||||
// PreferKey.barElevation -> NumberPickerDialog(requireContext())
|
|
||||||
// .setTitle(getString(R.string.bar_elevation))
|
|
||||||
// .setMaxValue(32)
|
|
||||||
// .setMinValue(0)
|
|
||||||
// .setValue(AppConfig.elevation)
|
|
||||||
// .setCustomButton((R.string.btn_default_s)) {
|
|
||||||
// AppConfig.elevation = AppConst.sysElevation
|
|
||||||
// recreateActivities()
|
|
||||||
// }
|
|
||||||
// .show {
|
|
||||||
// AppConfig.elevation = it
|
|
||||||
// recreateActivities()
|
|
||||||
// }
|
|
||||||
|
|
||||||
PreferKey.fontScale -> NumberPickerDialog(requireContext())
|
PreferKey.fontScale -> NumberPickerDialog(requireContext())
|
||||||
.setTitle(getString(R.string.font_scale))
|
.setTitle(getString(R.string.font_scale))
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import androidx.annotation.DrawableRes
|
|||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.content.FileProvider
|
import androidx.core.content.FileProvider
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
|
import androidx.datastore.preferences.preferencesDataStore
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
||||||
import io.legato.kazusa.R
|
import io.legato.kazusa.R
|
||||||
@@ -76,7 +77,6 @@ fun Context.startActivityForBook(
|
|||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline fun <reified T : Service> Context.startService(configIntent: Intent.() -> Unit = {}) {
|
inline fun <reified T : Service> Context.startService(configIntent: Intent.() -> Unit = {}) {
|
||||||
startService(Intent(this, T::class.java).apply(configIntent))
|
startService(Intent(this, T::class.java).apply(configIntent))
|
||||||
}
|
}
|
||||||
@@ -414,3 +414,6 @@ val Context.channel: String
|
|||||||
|
|
||||||
val Context.isDebuggable: Boolean
|
val Context.isDebuggable: Boolean
|
||||||
get() = applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0
|
get() = applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0
|
||||||
|
|
||||||
|
val Context.dataStore by preferencesDataStore(name = "settings")
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
|
datastorePreferences = "1.0.0"
|
||||||
kotlin = "2.1.21"
|
kotlin = "2.1.21"
|
||||||
ksp = "2.1.21-2.0.1"
|
ksp = "2.1.21-2.0.1"
|
||||||
agp = "8.10.0"
|
agp = "8.10.0"
|
||||||
@@ -63,6 +64,7 @@ androidx-annotation = { group = "androidx.annotation", name = "annotation", vers
|
|||||||
#androidx-annotation-experimental = { group = "androidx.annotation", name = "annotation-experimental", version = "1.3.1" }
|
#androidx-annotation-experimental = { group = "androidx.annotation", name = "annotation-experimental", version = "1.3.1" }
|
||||||
|
|
||||||
androidx-collection = { module = "androidx.collection:collection", version.ref = "collection" }
|
androidx-collection = { module = "androidx.collection:collection", version.ref = "collection" }
|
||||||
|
androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" }
|
||||||
appcompat-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
|
appcompat-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
|
||||||
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
|
androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user