diff --git a/app/build.gradle b/app/build.gradle
index a8775b1c3..baa389c14 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -42,13 +42,11 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
- implementation 'androidx.core:core-ktx:1.0.2'
- implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.core:core-ktx:1.2.0-alpha01'
+ implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
- implementation 'androidx.recyclerview:recyclerview:1.0.0'
- implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9d4cfaca1..d540a2f60 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -23,7 +23,7 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
- android:theme="@style/CAppTheme"
+ android:theme="@style/AppTheme.Light"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
@@ -32,7 +32,7 @@
+ android:theme="@style/AppTheme.Light.NoActionBar">
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 2ee755f42..c58318df1 100644
--- a/app/src/main/java/io/legado/app/base/BaseActivity.kt
+++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt
@@ -1,17 +1,17 @@
package io.legado.app.base
-import android.annotation.SuppressLint
-import android.graphics.PorterDuff
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.app.AppCompatActivity
+import androidx.appcompat.view.menu.MenuItemImpl
+import androidx.core.content.ContextCompat
import androidx.lifecycle.ViewModel
import io.legado.app.R
-import io.legado.app.lib.theme.ColorUtil
-import io.legado.app.lib.theme.MaterialValueHelper
+import io.legado.app.lib.theme.ColorUtils
+import io.legado.app.lib.theme.DrawableUtils
import io.legado.app.lib.theme.ThemeStore
-import java.util.*
+import io.legado.app.lib.theme.getPrimaryTextColor
abstract class BaseActivity : AppCompatActivity() {
@@ -34,47 +34,45 @@ abstract class BaseActivity : AppCompatActivity() {
* 设置MENU图标颜色
*/
override fun onCreateOptionsMenu(menu: Menu): Boolean {
- val primaryTextColor = MaterialValueHelper
- .getPrimaryTextColor(this, ColorUtil.isColorLight(ThemeStore.primaryColor(this)))
+ val primaryTextColor = getPrimaryTextColor(ColorUtils.isColorLight(ThemeStore.primaryColor(this)))
+ val defaultTextColor = ContextCompat.getColor(this, R.color.tv_text_default)
for (i in 0 until menu.size()) {
- val drawable = menu.getItem(i).icon
- if (drawable != null) {
- drawable.mutate()
- drawable.setColorFilter(primaryTextColor, PorterDuff.Mode.SRC_ATOP)
+ (menu.getItem(i) as MenuItemImpl).let {//overflow:展开的item
+ DrawableUtils.setTint(it.icon, if (it.requiresOverflow()) defaultTextColor else primaryTextColor)
}
}
return super.onCreateOptionsMenu(menu)
}
- @SuppressLint("PrivateApi")
- override fun onMenuOpened(featureId: Int, menu: Menu?): Boolean {
- if (menu != null) {
- //展开菜单显示图标
- if (menu.javaClass.simpleName.equals("MenuBuilder", ignoreCase = true)) {
- try {
- var method = menu.javaClass.getDeclaredMethod("setOptionalIconsVisible", java.lang.Boolean.TYPE)
- method.isAccessible = true
- method.invoke(menu, true)
- method = menu.javaClass.getDeclaredMethod("getNonActionItems")
- val menuItems = method.invoke(menu) as ArrayList