更改菜单图标颜色

pull/32/head
GKF 6 years ago
parent 5b5c660e02
commit f87efa47ca
  1. 6
      app/src/main/java/io/legado/app/base/BaseActivity.kt

@ -33,8 +33,8 @@ abstract class BaseActivity<VM : ViewModel> : AppCompatActivity() {
* 设置MENU图标颜色 * 设置MENU图标颜色
*/ */
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
val primaryTextColor = val primaryTextColor = MaterialValueHelper
MaterialValueHelper.getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.primaryColor(this))) .getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.primaryColor(this)))
for (i in 0 until menu.size()) { for (i in 0 until menu.size()) {
val drawable = menu.getItem(i).icon val drawable = menu.getItem(i).icon
if (drawable != null) { if (drawable != null) {
@ -56,7 +56,7 @@ abstract class BaseActivity<VM : ViewModel> : AppCompatActivity() {
method.invoke(menu, true) method.invoke(menu, true)
method = menu.javaClass.getDeclaredMethod("getNonActionItems") method = menu.javaClass.getDeclaredMethod("getNonActionItems")
val menuItems = method.invoke(menu) as ArrayList<MenuItem> val menuItems = method.invoke(menu) as ArrayList<MenuItem>
if (!menuItems.isEmpty()) { if (menuItems.isNotEmpty()) {
for (menuItem in menuItems) { for (menuItem in menuItems) {
val drawable = menuItem.icon val drawable = menuItem.icon
if (drawable != null) { if (drawable != null) {

Loading…
Cancel
Save