设置图片背景

pull/823/head
gedoor 4 years ago
parent 0c0862673c
commit e7eb59c6ef
  1. 15
      app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt
  2. 2
      app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt
  3. 2
      app/src/main/res/xml/pref_config_theme.xml

@ -30,7 +30,7 @@ import io.legado.app.lib.dialogs.selector
import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ATH
import io.legado.app.ui.widget.number.NumberPickerDialog import io.legado.app.ui.widget.number.NumberPickerDialog
import io.legado.app.ui.widget.prefs.ColorPreference import io.legado.app.ui.widget.prefs.ColorPreference
import io.legado.app.ui.widget.prefs.IconListPreference import io.legado.app.ui.widget.prefs.PreferenceCategory
import io.legado.app.utils.* import io.legado.app.utils.*
import java.io.File import java.io.File
@ -45,13 +45,18 @@ class ThemeConfigFragment : BasePreferenceFragment(),
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.pref_config_theme) addPreferencesFromResource(R.xml.pref_config_theme)
if (Build.VERSION.SDK_INT < 26) { if (Build.VERSION.SDK_INT < 26) {
findPreference<IconListPreference>(PreferKey.launcherIcon)?.let { preferenceScreen.removePreferenceRecursively(PreferKey.launcherIcon)
preferenceScreen.removePreference(it)
} }
} if (AppConfig.isGooglePlay) {
upPreferenceSummary(PreferKey.barElevation, AppConfig.elevation.toString())
upPreferenceSummary(PreferKey.bgImage, getPrefString(PreferKey.bgImage)) upPreferenceSummary(PreferKey.bgImage, getPrefString(PreferKey.bgImage))
upPreferenceSummary(PreferKey.bgImageN, getPrefString(PreferKey.bgImageN)) upPreferenceSummary(PreferKey.bgImageN, getPrefString(PreferKey.bgImageN))
} else {
findPreference<PreferenceCategory>("dayThemeCategory")
?.removePreferenceRecursively(PreferKey.bgImage)
findPreference<PreferenceCategory>("nightThemeCategory")
?.removePreferenceRecursively(PreferKey.bgImageN)
}
upPreferenceSummary(PreferKey.barElevation, AppConfig.elevation.toString())
findPreference<ColorPreference>(PreferKey.cBackground)?.let { findPreference<ColorPreference>(PreferKey.cBackground)?.let {
it.onSaveColor = { color -> it.onSaveColor = { color ->
if (!ColorUtils.isColorLight(color)) { if (!ColorUtils.isColorLight(color)) {

@ -96,7 +96,7 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config), FilePickerDialog.C
} }
if (AppConfig.isGooglePlay) { if (AppConfig.isGooglePlay) {
findPreference<PreferenceCategory>("aboutCategory") findPreference<PreferenceCategory>("aboutCategory")
?.removePreference(findPreference("donate")) ?.removePreferenceRecursively("donate")
} }
} }

@ -42,6 +42,7 @@
app:iconSpaceReserved="false" /> app:iconSpaceReserved="false" />
<io.legado.app.ui.widget.prefs.PreferenceCategory <io.legado.app.ui.widget.prefs.PreferenceCategory
android:key="dayThemeCategory"
android:title="@string/day" android:title="@string/day"
app:allowDividerAbove="true" app:allowDividerAbove="true"
app:allowDividerBelow="false" app:allowDividerBelow="false"
@ -97,6 +98,7 @@
</io.legado.app.ui.widget.prefs.PreferenceCategory> </io.legado.app.ui.widget.prefs.PreferenceCategory>
<io.legado.app.ui.widget.prefs.PreferenceCategory <io.legado.app.ui.widget.prefs.PreferenceCategory
android:key="nightThemeCategory"
android:title="@string/night" android:title="@string/night"
app:allowDividerAbove="true" app:allowDividerAbove="true"
app:allowDividerBelow="false" app:allowDividerBelow="false"

Loading…
Cancel
Save