diff --git a/app/src/main/java/io/legado/app/lib/theme/ATH.kt b/app/src/main/java/io/legado/app/lib/theme/ATH.kt index 7553da7b8..62a8cad34 100644 --- a/app/src/main/java/io/legado/app/lib/theme/ATH.kt +++ b/app/src/main/java/io/legado/app/lib/theme/ATH.kt @@ -8,6 +8,7 @@ import android.os.Build import android.view.View import android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR import android.widget.EdgeEffect +import android.widget.ScrollView import androidx.annotation.ColorInt import androidx.appcompat.app.AlertDialog import androidx.recyclerview.widget.RecyclerView @@ -146,10 +147,24 @@ object ATH { } } + fun setEdgeEffectColor(scrollView: ScrollView?, @ColorInt color: Int) { + try { + val clazz = ScrollView::class.java + for (name in arrayOf("mEdgeGlowTop", "mEdgeGlowBottom")) { + val field = clazz.getDeclaredField(name) + field.isAccessible = true + val edge = field.get(scrollView) + (edge as EdgeEffect).color = color + } + } catch (ignored: Exception) { + } + } + fun applyEdgeEffectColor(view: View?) { when (view) { is RecyclerView -> view.edgeEffectFactory = DEFAULT_EFFECT_FACTORY is ViewPager -> setEdgeEffectColor(view, ThemeStore.primaryColor(view.context)) + is ScrollView -> setEdgeEffectColor(view, ThemeStore.primaryColor(view.context)) } } diff --git a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt index db9285137..5f2220b07 100644 --- a/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt +++ b/app/src/main/java/io/legado/app/ui/about/AboutFragment.kt @@ -3,6 +3,7 @@ package io.legado.app.ui.about import android.content.Intent import android.net.Uri import android.os.Bundle +import android.view.View import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import io.legado.app.App @@ -22,6 +23,11 @@ class AboutFragment : PreferenceFragmentCompat() { return super.onPreferenceTreeClick(preference) } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + listView.overScrollMode = View.OVER_SCROLL_NEVER + } + private fun openIntent(intentName: String, address: String) { try { val intent = Intent(intentName) diff --git a/app/src/main/java/io/legado/app/ui/about/DonateActivity.kt b/app/src/main/java/io/legado/app/ui/about/DonateActivity.kt index b27bfb654..c5bb90704 100644 --- a/app/src/main/java/io/legado/app/ui/about/DonateActivity.kt +++ b/app/src/main/java/io/legado/app/ui/about/DonateActivity.kt @@ -11,6 +11,7 @@ import android.widget.Toast import androidx.lifecycle.AndroidViewModel import io.legado.app.R import io.legado.app.base.BaseActivity +import io.legado.app.lib.theme.ATH import io.legado.app.utils.getViewModel import kotlinx.android.synthetic.main.activity_donate.* import kotlinx.android.synthetic.main.view_title_bar.* @@ -32,6 +33,7 @@ class DonateActivity : BaseActivity() { override fun onActivityCreated(viewModel: AndroidViewModel, savedInstanceState: Bundle?) { setSupportActionBar(toolbar) + ATH.applyEdgeEffectColor(scroll_view) vw_zfb_tz.setOnClickListener { aliDonate(this) } cv_wx_gzh.setOnClickListener { val clipboard = this.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager diff --git a/app/src/main/java/io/legado/app/ui/bookshelf/BookshelfActivity.kt b/app/src/main/java/io/legado/app/ui/bookshelf/BookshelfActivity.kt index 15a920dca..a6cda3975 100644 --- a/app/src/main/java/io/legado/app/ui/bookshelf/BookshelfActivity.kt +++ b/app/src/main/java/io/legado/app/ui/bookshelf/BookshelfActivity.kt @@ -12,6 +12,7 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.base.BaseActivity import io.legado.app.data.entities.Book +import io.legado.app.lib.theme.ATH import io.legado.app.utils.getViewModel import kotlinx.android.synthetic.main.activity_bookshelf.* @@ -36,6 +37,7 @@ class BookshelfActivity : BaseActivity() { } private fun initRecyclerView() { + ATH.applyEdgeEffectColor(rv_bookshelf) rv_bookshelf.layoutManager = LinearLayoutManager(this) rv_bookshelf.addItemDecoration(DividerItemDecoration(this, LinearLayout.VERTICAL)) bookshelfAdapter = BookshelfAdapter() diff --git a/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt index bdc43ffeb..25690f258 100644 --- a/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt @@ -17,6 +17,7 @@ import io.legado.app.R import io.legado.app.base.BaseActivity import io.legado.app.data.entities.BookSource import io.legado.app.help.ItemTouchCallback +import io.legado.app.lib.theme.ATH import io.legado.app.ui.bookshelf.BookshelfViewModel import io.legado.app.ui.qrcode.QrCodeActivity import io.legado.app.ui.sourceedit.SourceEditActivity @@ -73,6 +74,7 @@ class BookSourceActivity : BaseActivity(), BookSourceAdapter } private fun initRecyclerView() { + ATH.applyEdgeEffectColor(recycler_view) recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.addItemDecoration( DividerItemDecoration( diff --git a/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt index efac58fbc..c33d584a5 100644 --- a/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt @@ -2,10 +2,12 @@ package io.legado.app.ui.config import android.content.SharedPreferences import android.os.Bundle +import android.view.View import androidx.preference.ListPreference import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import io.legado.app.R +import io.legado.app.lib.theme.ATH import io.legado.app.utils.getPrefString @@ -16,6 +18,11 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange addPreferencesFromResource(R.xml.pref_config) } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + ATH.applyEdgeEffectColor(listView) + } + override fun onResume() { super.onResume() preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this) diff --git a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt index 07b60b065..0a727d354 100644 --- a/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt @@ -3,6 +3,7 @@ package io.legado.app.ui.config import android.content.SharedPreferences import android.os.Bundle import android.os.Handler +import android.view.View import androidx.appcompat.app.AlertDialog import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat @@ -11,6 +12,7 @@ import com.jeremyliao.liveeventbus.LiveEventBus import io.legado.app.App import io.legado.app.R import io.legado.app.constant.Bus +import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ColorUtils import io.legado.app.utils.* @@ -21,6 +23,11 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar addPreferencesFromResource(R.xml.pref_config_theme) } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + ATH.applyEdgeEffectColor(listView) + } + override fun onResume() { super.onResume() preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this) diff --git a/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt index b6e8f778c..9faa87b39 100644 --- a/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt @@ -1,10 +1,12 @@ package io.legado.app.ui.config import android.os.Bundle +import android.view.View import androidx.preference.ListPreference import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import io.legado.app.R +import io.legado.app.lib.theme.ATH import io.legado.app.utils.getPrefString class WebDavConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener { @@ -15,6 +17,11 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), Preference.OnPreference bindPreferenceSummaryToValue(findPreference("web_dav_account")) } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + ATH.applyEdgeEffectColor(listView) + } + override fun onPreferenceChange(preference: Preference?, newValue: Any?): Boolean { val stringValue = newValue.toString() diff --git a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt index eac5212ee..a6d206d36 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt @@ -16,6 +16,7 @@ import io.legado.app.R import io.legado.app.base.BaseActivity import io.legado.app.constant.AppConst.APP_TAG import io.legado.app.data.entities.ReplaceRule +import io.legado.app.lib.theme.ATH import io.legado.app.utils.getViewModel import kotlinx.android.synthetic.main.activity_replace_rule.* import org.jetbrains.anko.doAsync @@ -38,6 +39,7 @@ class ReplaceRuleActivity : BaseActivity() { } private fun initRecyclerView() { + ATH.applyEdgeEffectColor(rv_replace_rule) rv_replace_rule.layoutManager = LinearLayoutManager(this) adapter = ReplaceRuleAdapter(this) adapter.onClickListener = object : ReplaceRuleAdapter.OnClickListener { diff --git a/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt index 644684e44..c2a420c6f 100644 --- a/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt +++ b/app/src/main/java/io/legado/app/ui/search/SearchActivity.kt @@ -4,7 +4,9 @@ import android.os.Bundle import android.view.View import io.legado.app.R import io.legado.app.base.BaseActivity +import io.legado.app.lib.theme.ATH import io.legado.app.utils.getViewModel +import kotlinx.android.synthetic.main.activity_search.* import kotlinx.android.synthetic.main.view_title_bar.* class SearchActivity : BaseActivity() { @@ -17,6 +19,7 @@ class SearchActivity : BaseActivity() { override fun onActivityCreated(viewModel: SearchViewModel, savedInstanceState: Bundle?) { initSearchView() + initRecyclerView() viewModel.search() } @@ -31,4 +34,8 @@ class SearchActivity : BaseActivity() { } } + private fun initRecyclerView() { + ATH.applyEdgeEffectColor(rv_search_list) + } + } diff --git a/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt b/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt index af7dfe808..a5543ff39 100644 --- a/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt +++ b/app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt @@ -10,6 +10,7 @@ import io.legado.app.R import io.legado.app.base.BaseActivity import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookSource +import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ThemeStore import io.legado.app.model.WebBook import io.legado.app.model.webbook.SourceDebug @@ -41,6 +42,7 @@ class SourceDebugActivity : BaseActivity(), SourceDebug.Callba } private fun initRecyclerView() { + ATH.applyEdgeEffectColor(recycler_view) adapter = SourceDebugAdapter() recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.adapter = adapter diff --git a/app/src/main/java/io/legado/app/ui/sourceedit/SourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/sourceedit/SourceEditActivity.kt index 787ee6868..a290ffd45 100644 --- a/app/src/main/java/io/legado/app/ui/sourceedit/SourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/sourceedit/SourceEditActivity.kt @@ -15,6 +15,7 @@ import io.legado.app.R import io.legado.app.base.BaseActivity import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.rule.* +import io.legado.app.lib.theme.ATH import io.legado.app.ui.sourcedebug.SourceDebugActivity import io.legado.app.ui.widget.KeyboardToolPop import io.legado.app.utils.GSON @@ -89,6 +90,7 @@ class SourceEditActivity : BaseActivity(false), KeyboardToo } private fun initView() { + ATH.applyEdgeEffectColor(recycler_view) mSoftKeyboardTool = KeyboardToolPop(this, this) window.decorView.viewTreeObserver.addOnGlobalLayoutListener(KeyboardOnGlobalChangeListener()) recycler_view.layoutManager = LinearLayoutManager(this) diff --git a/app/src/main/res/layout/activity_donate.xml b/app/src/main/res/layout/activity_donate.xml index e485130be..0956dd71b 100644 --- a/app/src/main/res/layout/activity_donate.xml +++ b/app/src/main/res/layout/activity_donate.xml @@ -1,228 +1,232 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/ll_content" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + android:id="@+id/title_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:title="@string/donate"/> - - + android:layout_height="match_parent" + android:overScrollMode="always" + android:fillViewport="true" + android:padding="5dp" + android:clipToPadding="false"> - + android:orientation="vertical"> - + android:layout_margin="5dp" + app:cardBackgroundColor="@color/background_card"> - + android:orientation="vertical"> + + - - + android:layout_margin="5dp" + android:clickable="true" + android:focusable="true" + android:foreground="?attr/selectableItemBackground" + app:cardBackgroundColor="@color/background_card"> - + android:orientation="vertical"> + + - - + android:layout_margin="5dp" + android:clickable="true" + android:focusable="true" + android:foreground="?attr/selectableItemBackground" + app:cardBackgroundColor="@color/background_card"> - + android:orientation="horizontal" + android:padding="5dp"> + + - - + android:layout_margin="5dp" + android:clickable="true" + android:focusable="true" + android:foreground="?attr/selectableItemBackground" + app:cardBackgroundColor="@color/background_card"> - + android:orientation="horizontal" + android:padding="5dp"> + + - - + android:layout_margin="5dp" + android:clickable="true" + android:focusable="true" + android:foreground="?attr/selectableItemBackground" + app:cardBackgroundColor="@color/background_card"> - + android:orientation="horizontal" + android:padding="5dp"> + + - - + android:layout_margin="5dp" + android:clickable="true" + android:focusable="true" + android:foreground="?attr/selectableItemBackground" + app:cardBackgroundColor="@color/background_card"> - + android:orientation="horizontal" + android:padding="5dp"> + + - - + android:layout_margin="5dp" + android:clickable="true" + android:focusable="true" + android:foreground="?attr/selectableItemBackground" + app:cardBackgroundColor="@color/background_card"> - + android:orientation="horizontal" + android:padding="5dp"> + + - - + android:layout_margin="5dp" + android:clickable="true" + android:focusable="true" + android:foreground="?attr/selectableItemBackground" + app:cardBackgroundColor="@color/background_card"> - + android:orientation="horizontal" + android:padding="5dp"> + +