pull/32/head
Administrator 5 years ago
parent c5a5b069d4
commit fa543ccaf8
  1. 15
      app/src/main/java/io/legado/app/lib/theme/ATH.kt
  2. 6
      app/src/main/java/io/legado/app/ui/about/AboutFragment.kt
  3. 2
      app/src/main/java/io/legado/app/ui/about/DonateActivity.kt
  4. 2
      app/src/main/java/io/legado/app/ui/bookshelf/BookshelfActivity.kt
  5. 2
      app/src/main/java/io/legado/app/ui/booksource/BookSourceActivity.kt
  6. 7
      app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt
  7. 7
      app/src/main/java/io/legado/app/ui/config/ThemeConfigFragment.kt
  8. 7
      app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt
  9. 2
      app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt
  10. 7
      app/src/main/java/io/legado/app/ui/search/SearchActivity.kt
  11. 2
      app/src/main/java/io/legado/app/ui/sourcedebug/SourceDebugActivity.kt
  12. 2
      app/src/main/java/io/legado/app/ui/sourceedit/SourceEditActivity.kt
  13. 24
      app/src/main/res/layout/activity_donate.xml

@ -8,6 +8,7 @@ import android.os.Build
import android.view.View import android.view.View
import android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR import android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
import android.widget.EdgeEffect import android.widget.EdgeEffect
import android.widget.ScrollView
import androidx.annotation.ColorInt import androidx.annotation.ColorInt
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.recyclerview.widget.RecyclerView 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?) { fun applyEdgeEffectColor(view: View?) {
when (view) { when (view) {
is RecyclerView -> view.edgeEffectFactory = DEFAULT_EFFECT_FACTORY is RecyclerView -> view.edgeEffectFactory = DEFAULT_EFFECT_FACTORY
is ViewPager -> setEdgeEffectColor(view, ThemeStore.primaryColor(view.context)) is ViewPager -> setEdgeEffectColor(view, ThemeStore.primaryColor(view.context))
is ScrollView -> setEdgeEffectColor(view, ThemeStore.primaryColor(view.context))
} }
} }

@ -3,6 +3,7 @@ package io.legado.app.ui.about
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.view.View
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import io.legado.app.App import io.legado.app.App
@ -22,6 +23,11 @@ class AboutFragment : PreferenceFragmentCompat() {
return super.onPreferenceTreeClick(preference) 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) { private fun openIntent(intentName: String, address: String) {
try { try {
val intent = Intent(intentName) val intent = Intent(intentName)

@ -11,6 +11,7 @@ import android.widget.Toast
import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.AndroidViewModel
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
import io.legado.app.lib.theme.ATH
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_donate.* import kotlinx.android.synthetic.main.activity_donate.*
import kotlinx.android.synthetic.main.view_title_bar.* import kotlinx.android.synthetic.main.view_title_bar.*
@ -32,6 +33,7 @@ class DonateActivity : BaseActivity<AndroidViewModel>() {
override fun onActivityCreated(viewModel: AndroidViewModel, savedInstanceState: Bundle?) { override fun onActivityCreated(viewModel: AndroidViewModel, savedInstanceState: Bundle?) {
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
ATH.applyEdgeEffectColor(scroll_view)
vw_zfb_tz.setOnClickListener { aliDonate(this) } vw_zfb_tz.setOnClickListener { aliDonate(this) }
cv_wx_gzh.setOnClickListener { cv_wx_gzh.setOnClickListener {
val clipboard = this.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager val clipboard = this.getSystemService(Context.CLIPBOARD_SERVICE) as? ClipboardManager

@ -12,6 +12,7 @@ import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.lib.theme.ATH
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_bookshelf.* import kotlinx.android.synthetic.main.activity_bookshelf.*
@ -36,6 +37,7 @@ class BookshelfActivity : BaseActivity<BookshelfViewModel>() {
} }
private fun initRecyclerView() { private fun initRecyclerView() {
ATH.applyEdgeEffectColor(rv_bookshelf)
rv_bookshelf.layoutManager = LinearLayoutManager(this) rv_bookshelf.layoutManager = LinearLayoutManager(this)
rv_bookshelf.addItemDecoration(DividerItemDecoration(this, LinearLayout.VERTICAL)) rv_bookshelf.addItemDecoration(DividerItemDecoration(this, LinearLayout.VERTICAL))
bookshelfAdapter = BookshelfAdapter() bookshelfAdapter = BookshelfAdapter()

@ -17,6 +17,7 @@ import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.BookSource
import io.legado.app.help.ItemTouchCallback 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.bookshelf.BookshelfViewModel
import io.legado.app.ui.qrcode.QrCodeActivity import io.legado.app.ui.qrcode.QrCodeActivity
import io.legado.app.ui.sourceedit.SourceEditActivity import io.legado.app.ui.sourceedit.SourceEditActivity
@ -73,6 +74,7 @@ class BookSourceActivity : BaseActivity<BookshelfViewModel>(), BookSourceAdapter
} }
private fun initRecyclerView() { private fun initRecyclerView() {
ATH.applyEdgeEffectColor(recycler_view)
recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.layoutManager = LinearLayoutManager(this)
recycler_view.addItemDecoration( recycler_view.addItemDecoration(
DividerItemDecoration( DividerItemDecoration(

@ -2,10 +2,12 @@ package io.legado.app.ui.config
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.view.View
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import io.legado.app.R import io.legado.app.R
import io.legado.app.lib.theme.ATH
import io.legado.app.utils.getPrefString import io.legado.app.utils.getPrefString
@ -16,6 +18,11 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange
addPreferencesFromResource(R.xml.pref_config) addPreferencesFromResource(R.xml.pref_config)
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
ATH.applyEdgeEffectColor(listView)
}
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this) preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this)

@ -3,6 +3,7 @@ package io.legado.app.ui.config
import android.content.SharedPreferences import android.content.SharedPreferences
import android.os.Bundle import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.view.View
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
@ -11,6 +12,7 @@ import com.jeremyliao.liveeventbus.LiveEventBus
import io.legado.app.App import io.legado.app.App
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.Bus import io.legado.app.constant.Bus
import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.ColorUtils import io.legado.app.lib.theme.ColorUtils
import io.legado.app.utils.* import io.legado.app.utils.*
@ -21,6 +23,11 @@ class ThemeConfigFragment : PreferenceFragmentCompat(), SharedPreferences.OnShar
addPreferencesFromResource(R.xml.pref_config_theme) addPreferencesFromResource(R.xml.pref_config_theme)
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
ATH.applyEdgeEffectColor(listView)
}
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this) preferenceManager.sharedPreferences.registerOnSharedPreferenceChangeListener(this)

@ -1,10 +1,12 @@
package io.legado.app.ui.config package io.legado.app.ui.config
import android.os.Bundle import android.os.Bundle
import android.view.View
import androidx.preference.ListPreference import androidx.preference.ListPreference
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import io.legado.app.R import io.legado.app.R
import io.legado.app.lib.theme.ATH
import io.legado.app.utils.getPrefString import io.legado.app.utils.getPrefString
class WebDavConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener { class WebDavConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener {
@ -15,6 +17,11 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), Preference.OnPreference
bindPreferenceSummaryToValue(findPreference("web_dav_account")) 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 { override fun onPreferenceChange(preference: Preference?, newValue: Any?): Boolean {
val stringValue = newValue.toString() val stringValue = newValue.toString()

@ -16,6 +16,7 @@ import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
import io.legado.app.constant.AppConst.APP_TAG import io.legado.app.constant.AppConst.APP_TAG
import io.legado.app.data.entities.ReplaceRule import io.legado.app.data.entities.ReplaceRule
import io.legado.app.lib.theme.ATH
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_replace_rule.* import kotlinx.android.synthetic.main.activity_replace_rule.*
import org.jetbrains.anko.doAsync import org.jetbrains.anko.doAsync
@ -38,6 +39,7 @@ class ReplaceRuleActivity : BaseActivity<ReplaceRuleViewModel>() {
} }
private fun initRecyclerView() { private fun initRecyclerView() {
ATH.applyEdgeEffectColor(rv_replace_rule)
rv_replace_rule.layoutManager = LinearLayoutManager(this) rv_replace_rule.layoutManager = LinearLayoutManager(this)
adapter = ReplaceRuleAdapter(this) adapter = ReplaceRuleAdapter(this)
adapter.onClickListener = object : ReplaceRuleAdapter.OnClickListener { adapter.onClickListener = object : ReplaceRuleAdapter.OnClickListener {

@ -4,7 +4,9 @@ import android.os.Bundle
import android.view.View import android.view.View
import io.legado.app.R import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
import io.legado.app.lib.theme.ATH
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
import kotlinx.android.synthetic.main.activity_search.*
import kotlinx.android.synthetic.main.view_title_bar.* import kotlinx.android.synthetic.main.view_title_bar.*
class SearchActivity : BaseActivity<SearchViewModel>() { class SearchActivity : BaseActivity<SearchViewModel>() {
@ -17,6 +19,7 @@ class SearchActivity : BaseActivity<SearchViewModel>() {
override fun onActivityCreated(viewModel: SearchViewModel, savedInstanceState: Bundle?) { override fun onActivityCreated(viewModel: SearchViewModel, savedInstanceState: Bundle?) {
initSearchView() initSearchView()
initRecyclerView()
viewModel.search() viewModel.search()
} }
@ -31,4 +34,8 @@ class SearchActivity : BaseActivity<SearchViewModel>() {
} }
} }
private fun initRecyclerView() {
ATH.applyEdgeEffectColor(rv_search_list)
}
} }

@ -10,6 +10,7 @@ import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookSource 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.lib.theme.ThemeStore
import io.legado.app.model.WebBook import io.legado.app.model.WebBook
import io.legado.app.model.webbook.SourceDebug import io.legado.app.model.webbook.SourceDebug
@ -41,6 +42,7 @@ class SourceDebugActivity : BaseActivity<AndroidViewModel>(), SourceDebug.Callba
} }
private fun initRecyclerView() { private fun initRecyclerView() {
ATH.applyEdgeEffectColor(recycler_view)
adapter = SourceDebugAdapter() adapter = SourceDebugAdapter()
recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.layoutManager = LinearLayoutManager(this)
recycler_view.adapter = adapter recycler_view.adapter = adapter

@ -15,6 +15,7 @@ import io.legado.app.R
import io.legado.app.base.BaseActivity import io.legado.app.base.BaseActivity
import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.BookSource
import io.legado.app.data.entities.rule.* 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.sourcedebug.SourceDebugActivity
import io.legado.app.ui.widget.KeyboardToolPop import io.legado.app.ui.widget.KeyboardToolPop
import io.legado.app.utils.GSON import io.legado.app.utils.GSON
@ -89,6 +90,7 @@ class SourceEditActivity : BaseActivity<SourceEditViewModel>(false), KeyboardToo
} }
private fun initView() { private fun initView() {
ATH.applyEdgeEffectColor(recycler_view)
mSoftKeyboardTool = KeyboardToolPop(this, this) mSoftKeyboardTool = KeyboardToolPop(this, this)
window.decorView.viewTreeObserver.addOnGlobalLayoutListener(KeyboardOnGlobalChangeListener()) window.decorView.viewTreeObserver.addOnGlobalLayoutListener(KeyboardOnGlobalChangeListener())
recycler_view.layoutManager = LinearLayoutManager(this) recycler_view.layoutManager = LinearLayoutManager(this)

@ -10,12 +10,16 @@
android:id="@+id/title_bar" android:id="@+id/title_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:title="@string/donate" /> app:title="@string/donate"/>
<ScrollView <ScrollView
android:id="@+id/scroll_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="5dp"> android:overScrollMode="always"
android:fillViewport="true"
android:padding="5dp"
android:clipToPadding="false">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -37,7 +41,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="10dp" android:layout_margin="10dp"
android:text="你的支持是我更新的动力" /> android:text="你的支持是我更新的动力"/>
</LinearLayout> </LinearLayout>
@ -62,7 +66,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="10dp" android:layout_margin="10dp"
android:text="请关注微信公众号 开源阅读软件 点击复制" /> android:text="请关注微信公众号 开源阅读软件 点击复制"/>
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
@ -87,7 +91,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="5dp" android:layout_margin="5dp"
android:text="支付宝红包搜索码 537954522 点击复制" /> android:text="支付宝红包搜索码 537954522 点击复制"/>
</LinearLayout> </LinearLayout>
@ -114,7 +118,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="5dp" android:layout_margin="5dp"
android:text="支付宝收款,支持红包,点击直接跳转支付宝" /> android:text="支付宝收款,支持红包,点击直接跳转支付宝"/>
</LinearLayout> </LinearLayout>
@ -141,7 +145,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="5dp" android:layout_margin="5dp"
android:text="支付宝红包二维码" /> android:text="支付宝红包二维码"/>
</LinearLayout> </LinearLayout>
@ -168,7 +172,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="5dp" android:layout_margin="5dp"
android:text="支付宝收款二维码" /> android:text="支付宝收款二维码"/>
</LinearLayout> </LinearLayout>
@ -195,7 +199,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="5dp" android:layout_margin="5dp"
android:text="微信赞赏码" /> android:text="微信赞赏码"/>
</LinearLayout> </LinearLayout>
@ -222,7 +226,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_margin="5dp" android:layout_margin="5dp"
android:text="QQ收款码" /> android:text="QQ收款码"/>
</LinearLayout> </LinearLayout>

Loading…
Cancel
Save