diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index e7ac56cee..7559c49d0 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -3,6 +3,10 @@ * 请关注公众号[开源阅读]()支持我,同时关注合作公众号[小说拾遗](),阅读公众号小编。 * 公众号会发布更新,请去公众号下载官方版本,防止软件包被篡改。 +**2020/08/03** +* 菜单背景根随主题色 +* 修复其它一些主题色没有适配到的地方 + **2020/08/03** * 修复一些主题色没有适配到的地方 * 尝试修复书架最新章节更新不及时的bug diff --git a/app/src/main/java/io/legado/app/base/BaseActivity.kt b/app/src/main/java/io/legado/app/base/BaseActivity.kt index a09f8f1d4..df448cc5d 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -10,6 +10,7 @@ import android.view.WindowManager import android.widget.FrameLayout import androidx.appcompat.app.AppCompatActivity import io.legado.app.R +import io.legado.app.constant.AppConst import io.legado.app.constant.Theme import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ColorUtils @@ -37,9 +38,7 @@ abstract class BaseActivity( context: Context, attrs: AttributeSet ): View? { - if (name == "androidx.appcompat.view.menu.ListMenuItemView" && - parent?.parent is FrameLayout - ) { + if (AppConst.menuViewNames.contains(name) && parent?.parent is FrameLayout) { (parent.parent as View).setBackgroundColor(backgroundColor) } return super.onCreateView(parent, name, context, attrs) diff --git a/app/src/main/java/io/legado/app/constant/AppConst.kt b/app/src/main/java/io/legado/app/constant/AppConst.kt index 10ffccd1f..d6bb81302 100644 --- a/app/src/main/java/io/legado/app/constant/AppConst.kt +++ b/app/src/main/java/io/legado/app/constant/AppConst.kt @@ -67,4 +67,9 @@ object AppConst { } """.trimIndent() } + + val menuViewNames = arrayOf( + "com.android.internal.view.menu.ListMenuItemView", + "androidx.appcompat.view.menu.ListMenuItemView" + ) } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt index 09fa066ec..a4ca4244c 100644 --- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt @@ -19,6 +19,7 @@ import io.legado.app.constant.PreferKey import io.legado.app.constant.Theme import io.legado.app.data.entities.Book 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.utils.applyTint import io.legado.app.utils.getPrefBoolean @@ -68,6 +69,7 @@ class ChangeSourceDialog : BaseDialogFragment(), } override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { + tool_bar.setBackgroundColor(bottomBackground) viewModel.initData(arguments) showTitle() initMenu() diff --git a/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt index 0f0865cfc..8a02ba06f 100644 --- a/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/group/GroupManageDialog.kt @@ -29,6 +29,8 @@ import io.legado.app.lib.dialogs.customView import io.legado.app.lib.dialogs.noButton import io.legado.app.lib.dialogs.yesButton 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.utils.applyTint import io.legado.app.utils.getViewModel @@ -63,6 +65,7 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener } override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { + tool_bar.setBackgroundColor(bottomBackground) tool_bar.title = getString(R.string.group_manage) initData() initMenu() @@ -203,8 +206,8 @@ class GroupManageDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener override fun convert(holder: ItemViewHolder, item: BookGroup, payloads: MutableList) { holder.itemView.apply { + setBackgroundColor(context.backgroundColor) tv_group.text = item.groupName - } } diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt index 9ed695a01..a926dbe55 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/GroupManageDialog.kt @@ -22,6 +22,7 @@ import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.customView import io.legado.app.lib.dialogs.noButton 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.utils.applyTint import io.legado.app.utils.getViewModelOfActivity @@ -54,6 +55,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + view.setBackgroundColor(backgroundColor) initData() } @@ -128,6 +130,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList) { with(holder.itemView) { + setBackgroundColor(context.backgroundColor) tv_group.text = item } } diff --git a/app/src/main/java/io/legado/app/ui/replacerule/GroupManageDialog.kt b/app/src/main/java/io/legado/app/ui/replacerule/GroupManageDialog.kt index df39b9a1d..c83d1f4b7 100644 --- a/app/src/main/java/io/legado/app/ui/replacerule/GroupManageDialog.kt +++ b/app/src/main/java/io/legado/app/ui/replacerule/GroupManageDialog.kt @@ -22,6 +22,8 @@ import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.customView import io.legado.app.lib.dialogs.noButton 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.utils.applyTint import io.legado.app.utils.getViewModelOfActivity @@ -54,6 +56,8 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + view.setBackgroundColor(backgroundColor) + tool_bar.setBackgroundColor(bottomBackground) initData() } @@ -128,6 +132,7 @@ class GroupManageDialog : DialogFragment(), Toolbar.OnMenuItemClickListener { override fun convert(holder: ItemViewHolder, item: String, payloads: MutableList) { with(holder.itemView) { + setBackgroundColor(context.backgroundColor) tv_group.text = item } } diff --git a/app/src/main/res/layout/dialog_recycler_view.xml b/app/src/main/res/layout/dialog_recycler_view.xml index 5b1d900a9..3a1e37bc3 100644 --- a/app/src/main/res/layout/dialog_recycler_view.xml +++ b/app/src/main/res/layout/dialog_recycler_view.xml @@ -7,13 +7,11 @@