diff --git a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt index 5259603f6..de1f63ae1 100644 --- a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt @@ -14,7 +14,6 @@ import io.legado.app.base.BaseFragment import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey import io.legado.app.lib.theme.ATH -import io.legado.app.lib.theme.prefs.ATESwitchPreference import io.legado.app.service.WebService import io.legado.app.ui.about.AboutActivity import io.legado.app.ui.about.DonateActivity @@ -24,6 +23,7 @@ import io.legado.app.ui.config.ConfigActivity import io.legado.app.ui.config.ConfigViewModel import io.legado.app.ui.filechooser.FileChooserDialog import io.legado.app.ui.replacerule.ReplaceRuleActivity +import io.legado.app.ui.widget.prefs.SwitchPreference import io.legado.app.utils.* import kotlinx.android.synthetic.main.view_title_bar.* import org.jetbrains.anko.startActivity @@ -70,7 +70,7 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config), FileChooserDialog. putPrefBoolean(PreferKey.webService, false) } addPreferencesFromResource(R.xml.pref_main) - val webServicePre = findPreference(PreferKey.webService) + val webServicePre = findPreference(PreferKey.webService) observeEvent(EventBus.WEB_SERVICE_STOP) { webServicePre?.isChecked = false } diff --git a/app/src/main/java/io/legado/app/lib/theme/prefs/ATEPreferenceCategory.kt b/app/src/main/java/io/legado/app/ui/widget/prefs/PreferenceCategory.kt similarity index 63% rename from app/src/main/java/io/legado/app/lib/theme/prefs/ATEPreferenceCategory.kt rename to app/src/main/java/io/legado/app/ui/widget/prefs/PreferenceCategory.kt index bfd000aa3..e1458b76e 100644 --- a/app/src/main/java/io/legado/app/lib/theme/prefs/ATEPreferenceCategory.kt +++ b/app/src/main/java/io/legado/app/ui/widget/prefs/PreferenceCategory.kt @@ -1,4 +1,4 @@ -package io.legado.app.lib.theme.prefs +package io.legado.app.ui.widget.prefs import android.content.Context import android.util.AttributeSet @@ -8,17 +8,15 @@ import androidx.preference.PreferenceViewHolder import io.legado.app.lib.theme.accentColor -class ATEPreferenceCategory(context: Context, attrs: AttributeSet) : +class PreferenceCategory(context: Context, attrs: AttributeSet) : PreferenceCategory(context, attrs) { override fun onBindViewHolder(holder: PreferenceViewHolder?) { super.onBindViewHolder(holder) holder?.let { val view = it.findViewById(android.R.id.title) - if (!view.isInEditMode) { - if (view is TextView) { - view.setTextColor(context.accentColor)//设置title文本的颜色 - } + if (view is TextView && !view.isInEditMode) { + view.setTextColor(context.accentColor)//设置title文本的颜色 } } } diff --git a/app/src/main/java/io/legado/app/lib/theme/prefs/ATESwitchPreference.kt b/app/src/main/java/io/legado/app/ui/widget/prefs/SwitchPreference.kt similarity index 86% rename from app/src/main/java/io/legado/app/lib/theme/prefs/ATESwitchPreference.kt rename to app/src/main/java/io/legado/app/ui/widget/prefs/SwitchPreference.kt index 70f620dac..4fe66af7b 100644 --- a/app/src/main/java/io/legado/app/lib/theme/prefs/ATESwitchPreference.kt +++ b/app/src/main/java/io/legado/app/ui/widget/prefs/SwitchPreference.kt @@ -1,4 +1,4 @@ -package io.legado.app.lib.theme.prefs +package io.legado.app.ui.widget.prefs import android.content.Context import android.util.AttributeSet @@ -9,7 +9,7 @@ import io.legado.app.R import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.accentColor -class ATESwitchPreference(context: Context, attrs: AttributeSet) : +class SwitchPreference(context: Context, attrs: AttributeSet) : SwitchPreferenceCompat(context, attrs) { override fun onBindViewHolder(holder: PreferenceViewHolder?) { diff --git a/app/src/main/java/io/legado/app/lib/theme/view/ATEEditText.kt b/app/src/main/java/io/legado/app/ui/widget/text/EditText.kt similarity index 53% rename from app/src/main/java/io/legado/app/lib/theme/view/ATEEditText.kt rename to app/src/main/java/io/legado/app/ui/widget/text/EditText.kt index c6c692634..ad1b979ff 100644 --- a/app/src/main/java/io/legado/app/lib/theme/view/ATEEditText.kt +++ b/app/src/main/java/io/legado/app/ui/widget/text/EditText.kt @@ -1,4 +1,4 @@ -package io.legado.app.lib.theme.view +package io.legado.app.ui.widget.text import android.content.Context import android.util.AttributeSet @@ -9,9 +9,11 @@ import io.legado.app.lib.theme.ThemeStore /** * @author Aidan Follestad (afollestad) */ -class ATEEditText(context: Context, attrs: AttributeSet) : AppCompatEditText(context, attrs) { +class EditText(context: Context, attrs: AttributeSet) : AppCompatEditText(context, attrs) { init { - ATH.setTint(this, ThemeStore.accentColor(context)) + if (!isInEditMode) { + ATH.setTint(this, ThemeStore.accentColor(context)) + } } } diff --git a/app/src/main/res/layout/activity_book_info_edit.xml b/app/src/main/res/layout/activity_book_info_edit.xml index ce6b0aff1..170449767 100644 --- a/app/src/main/res/layout/activity_book_info_edit.xml +++ b/app/src/main/res/layout/activity_book_info_edit.xml @@ -48,7 +48,7 @@ android:layout_height="wrap_content" android:hint="@string/book_name"> - - - @@ -125,7 +125,7 @@ android:layout_marginTop="10dp" android:hint="@string/book_intro"> - diff --git a/app/src/main/res/layout/dialog_page_key.xml b/app/src/main/res/layout/dialog_page_key.xml index 9ec5d3d06..62a77fdda 100644 --- a/app/src/main/res/layout/dialog_page_key.xml +++ b/app/src/main/res/layout/dialog_page_key.xml @@ -21,7 +21,7 @@ android:layout_margin="5dp" android:hint="@string/prev_page_key"> - - - @@ -42,7 +42,7 @@ android:layout_height="wrap_content" android:hint="@string/group"> - @@ -54,7 +54,7 @@ android:layout_height="wrap_content" android:hint="@string/replace_rule"> - @@ -72,7 +72,7 @@ android:layout_height="wrap_content" android:hint="@string/replace_to"> - @@ -84,7 +84,7 @@ android:layout_height="wrap_content" android:hint="@string/use_to"> - diff --git a/app/src/main/res/layout/item_source_edit.xml b/app/src/main/res/layout/item_source_edit.xml index 078e525d0..e68432c3e 100644 --- a/app/src/main/res/layout/item_source_edit.xml +++ b/app/src/main/res/layout/item_source_edit.xml @@ -5,7 +5,7 @@ android:layout_height="wrap_content" android:paddingTop="3dp"> - diff --git a/app/src/main/res/xml/about.xml b/app/src/main/res/xml/about.xml index 8139d9553..130e16e60 100644 --- a/app/src/main/res/xml/about.xml +++ b/app/src/main/res/xml/about.xml @@ -18,7 +18,7 @@ android:title="@string/update_log" app:iconSpaceReserved="false" /> - @@ -52,9 +52,9 @@ android:summary="@string/home_page_url" app:iconSpaceReserved="false" /> - + - @@ -68,6 +68,6 @@ android:title="@string/disclaimer" app:iconSpaceReserved="false" /> - + \ No newline at end of file diff --git a/app/src/main/res/xml/donate.xml b/app/src/main/res/xml/donate.xml index 555792b67..a126561ed 100644 --- a/app/src/main/res/xml/donate.xml +++ b/app/src/main/res/xml/donate.xml @@ -2,7 +2,7 @@ - @@ -18,9 +18,9 @@ android:summary="点击打开" app:iconSpaceReserved="false" /> - + - @@ -48,9 +48,9 @@ android:summary="点击打开" app:iconSpaceReserved="false" /> - + - @@ -60,6 +60,6 @@ android:summary="点击打开" app:iconSpaceReserved="false" /> - + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_config_aloud.xml b/app/src/main/res/xml/pref_config_aloud.xml index 5983eafb5..c3d4f20cc 100644 --- a/app/src/main/res/xml/pref_config_aloud.xml +++ b/app/src/main/res/xml/pref_config_aloud.xml @@ -2,17 +2,17 @@ - - - - + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_config_backup.xml b/app/src/main/res/xml/pref_config_backup.xml index d70d7145d..3f99cfef2 100644 --- a/app/src/main/res/xml/pref_config_backup.xml +++ b/app/src/main/res/xml/pref_config_backup.xml @@ -2,7 +2,7 @@ - @@ -24,9 +24,9 @@ android:summary="@string/web_dav_pw_s" app:iconSpaceReserved="false" /> - + - + - + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_config_other.xml b/app/src/main/res/xml/pref_config_other.xml index 55435ad10..4ecfb8a8e 100644 --- a/app/src/main/res/xml/pref_config_other.xml +++ b/app/src/main/res/xml/pref_config_other.xml @@ -2,33 +2,33 @@ - - - - - + - @@ -47,20 +47,20 @@ android:title="@string/cleanCache" app:iconSpaceReserved="false" /> - - - + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_config_read.xml b/app/src/main/res/xml/pref_config_read.xml index f7cbf93d4..37b089a09 100644 --- a/app/src/main/res/xml/pref_config_read.xml +++ b/app/src/main/res/xml/pref_config_read.xml @@ -10,37 +10,37 @@ android:title="@string/keep_light" app:iconSpaceReserved="false" /> - - - - - - - - - @@ -60,9 +60,9 @@ app:cpv_dialogType="preset" app:iconSpaceReserved="false" /> - + - @@ -90,6 +90,6 @@ app:cpv_dialogType="preset" app:iconSpaceReserved="false" /> - + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_main.xml b/app/src/main/res/xml/pref_main.xml index 74e4bbfac..c95b66d9e 100644 --- a/app/src/main/res/xml/pref_main.xml +++ b/app/src/main/res/xml/pref_main.xml @@ -20,19 +20,19 @@ android:title="@string/theme_mode" app:iconSpaceReserved="false" /> - - - @@ -54,9 +54,9 @@ android:title="@string/other_setting" app:iconSpaceReserved="false" /> - + - + - + \ No newline at end of file