feat: 优化

pull/219/head
kunfei 5 years ago
parent e4e5fbf549
commit 57543276b1
  1. 7
      app/src/main/java/io/legado/app/help/AppConfig.kt
  2. 2
      app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt

@ -1,5 +1,6 @@
package io.legado.app.help
import android.annotation.SuppressLint
import android.content.Context
import android.content.pm.PackageManager
import io.legado.app.App
@ -122,7 +123,11 @@ object AppConfig {
}
var elevation: Int
get() = App.INSTANCE.getPrefInt("elevation", -1)
@SuppressLint("PrivateResource")
get() = App.INSTANCE.getPrefInt(
"elevation",
App.INSTANCE.resources.getDimension(R.dimen.design_appbar_elevation).toInt()
)
set(value) {
App.INSTANCE.putPrefInt("elevation", value)
}

@ -1,5 +1,6 @@
package io.legado.app.ui.config
import android.annotation.SuppressLint
import android.content.SharedPreferences
import android.os.Build
import android.os.Bundle
@ -115,6 +116,7 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar
}
@SuppressLint("PrivateResource")
override fun onPreferenceTreeClick(preference: Preference?): Boolean {
when (preference?.key) {
"defaultTheme" -> alert(title = "切换默认主题") {

Loading…
Cancel
Save