优化,主题色适配

pull/298/head
gedoor 4 years ago
parent 6a442cb173
commit 9fa08b2002
  1. 4
      app/src/main/assets/updateLog.md
  2. 5
      app/src/main/java/io/legado/app/base/BaseActivity.kt
  3. 5
      app/src/main/java/io/legado/app/constant/AppConst.kt
  4. 2
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  5. 5
      app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt
  6. 3
      app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt
  7. 5
      app/src/main/java/io/legado/app/ui/replacerule/GroupManageDialog.kt
  8. 2
      app/src/main/res/layout/dialog_recycler_view.xml

@ -3,6 +3,10 @@
* 请关注公众号[开源阅读]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。 * 请关注公众号[开源阅读]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。
* 公众号会发布更新,请去公众号下载官方版本,防止软件包被篡改。 * 公众号会发布更新,请去公众号下载官方版本,防止软件包被篡改。
**2020/08/03**
* 菜单背景根随主题色
* 修复其它一些主题色没有适配到的地方
**2020/08/03** **2020/08/03**
* 修复一些主题色没有适配到的地方 * 修复一些主题色没有适配到的地方
* 尝试修复书架最新章节更新不及时的bug * 尝试修复书架最新章节更新不及时的bug

@ -10,6 +10,7 @@ import android.view.WindowManager
import android.widget.FrameLayout import android.widget.FrameLayout
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.AppConst
import io.legado.app.constant.Theme import io.legado.app.constant.Theme
import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ATH
import io.legado.app.lib.theme.ColorUtils import io.legado.app.lib.theme.ColorUtils
@ -37,9 +38,7 @@ abstract class BaseActivity(
context: Context, context: Context,
attrs: AttributeSet attrs: AttributeSet
): View? { ): View? {
if (name == "androidx.appcompat.view.menu.ListMenuItemView" && if (AppConst.menuViewNames.contains(name) && parent?.parent is FrameLayout) {
parent?.parent is FrameLayout
) {
(parent.parent as View).setBackgroundColor(backgroundColor) (parent.parent as View).setBackgroundColor(backgroundColor)
} }
return super.onCreateView(parent, name, context, attrs) return super.onCreateView(parent, name, context, attrs)

@ -67,4 +67,9 @@ object AppConst {
} }
""".trimIndent() """.trimIndent()
} }
val menuViewNames = arrayOf(
"com.android.internal.view.menu.ListMenuItemView",
"androidx.appcompat.view.menu.ListMenuItemView"
)
} }

@ -19,6 +19,7 @@ import io.legado.app.constant.PreferKey
import io.legado.app.constant.Theme import io.legado.app.constant.Theme
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.data.entities.SearchBook import io.legado.app.data.entities.SearchBook
import io.legado.app.lib.theme.bottomBackground
import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.applyTint import io.legado.app.utils.applyTint
import io.legado.app.utils.getPrefBoolean import io.legado.app.utils.getPrefBoolean
@ -68,6 +69,7 @@ class ChangeSourceDialog : BaseDialogFragment(),
} }
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
tool_bar.setBackgroundColor(bottomBackground)
viewModel.initData(arguments) viewModel.initData(arguments)
showTitle() showTitle()
initMenu() initMenu()

@ -29,6 +29,8 @@ import io.legado.app.lib.dialogs.customView
import io.legado.app.lib.dialogs.noButton import io.legado.app.lib.dialogs.noButton
import io.legado.app.lib.dialogs.yesButton import io.legado.app.lib.dialogs.yesButton
import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.lib.theme.bottomBackground
import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.applyTint import io.legado.app.utils.applyTint
import io.legado.app.utils.getViewModel import io.legado.app.utils.getViewModel
@ -63,6 +65,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
} }
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
tool_bar.setBackgroundColor(bottomBackground)
tool_bar.title = getString(R.string.group_manage) tool_bar.title = getString(R.string.group_manage)
initData() initData()
initMenu() initMenu()
@ -203,8 +206,8 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener
override fun convert(holder: ItemViewHolder, item: BookGroup, payloads: MutableList<Any>) { override fun convert(holder: ItemViewHolder, item: BookGroup, payloads: MutableList<Any>) {
holder.itemView.apply { holder.itemView.apply {
setBackgroundColor(context.backgroundColor)
tv_group.text = item.groupName tv_group.text = item.groupName
} }
} }

@ -22,6 +22,7 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.customView import io.legado.app.lib.dialogs.customView
import io.legado.app.lib.dialogs.noButton import io.legado.app.lib.dialogs.noButton
import io.legado.app.lib.dialogs.yesButton import io.legado.app.lib.dialogs.yesButton
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.applyTint import io.legado.app.utils.applyTint
import io.legado.app.utils.getViewModelOfActivity import io.legado.app.utils.getViewModelOfActivity
@ -54,6 +55,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
view.setBackgroundColor(backgroundColor)
initData() initData()
} }
@ -128,6 +130,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList<Any>) { override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList<Any>) {
with(holder.itemView) { with(holder.itemView) {
setBackgroundColor(context.backgroundColor)
tv_group.text = item tv_group.text = item
} }
} }

@ -22,6 +22,8 @@ import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.customView import io.legado.app.lib.dialogs.customView
import io.legado.app.lib.dialogs.noButton import io.legado.app.lib.dialogs.noButton
import io.legado.app.lib.dialogs.yesButton import io.legado.app.lib.dialogs.yesButton
import io.legado.app.lib.theme.backgroundColor
import io.legado.app.lib.theme.bottomBackground
import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.applyTint import io.legado.app.utils.applyTint
import io.legado.app.utils.getViewModelOfActivity import io.legado.app.utils.getViewModelOfActivity
@ -54,6 +56,8 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
view.setBackgroundColor(backgroundColor)
tool_bar.setBackgroundColor(bottomBackground)
initData() initData()
} }
@ -128,6 +132,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener {
override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList<Any>) { override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList<Any>) {
with(holder.itemView) { with(holder.itemView) {
setBackgroundColor(context.backgroundColor)
tv_group.text = item tv_group.text = item
} }
} }

@ -7,13 +7,11 @@
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/tool_bar" android:id="@+id/tool_bar"
android:background="@color/background_menu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"
android:background="@color/background_card"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" /> android:layout_weight="1" />

Loading…
Cancel
Save