更新
This commit is contained in:
@@ -120,24 +120,6 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
|
||||
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?) {
|
||||
sharedPreferences ?: return
|
||||
when (key) {
|
||||
@@ -171,19 +153,6 @@ class ThemeConfigFragment : PreferenceFragmentCompat(),
|
||||
@SuppressLint("PrivateResource")
|
||||
override fun onPreferenceTreeClick(preference: Preference): Boolean {
|
||||
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())
|
||||
.setTitle(getString(R.string.font_scale))
|
||||
|
||||
@@ -34,6 +34,7 @@ import androidx.annotation.DrawableRes
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.content.edit
|
||||
import androidx.datastore.preferences.preferencesDataStore
|
||||
import androidx.preference.PreferenceManager
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
|
||||
import io.legato.kazusa.R
|
||||
@@ -76,7 +77,6 @@ fun Context.startActivityForBook(
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
|
||||
inline fun <reified T : Service> Context.startService(configIntent: Intent.() -> Unit = {}) {
|
||||
startService(Intent(this, T::class.java).apply(configIntent))
|
||||
}
|
||||
@@ -414,3 +414,6 @@ val Context.channel: String
|
||||
|
||||
val Context.isDebuggable: Boolean
|
||||
get() = applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0
|
||||
|
||||
val Context.dataStore by preferencesDataStore(name = "settings")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user