Closed Shouheng88 closed 11 months ago
方法错误
me.shouheng.utils.ui.ViewUtils#setIconsVisible
public static void setIconsVisible(Menu menu, boolean visible) {
if (menu != null) {
try {
Method method = Menu.class.getDeclaredMethod("setOptionalIconsVisible", Boolean.TYPE);
method.setAccessible(true);
method.invoke(menu, visible);
} catch (Exception e) {
e.printStackTrace();
}
}
}
setOptionalIconsVisible 是 Menu 的子类 MenuBuilder 的方法
改为,
fun setIconsVisible(menu: Menu?, visible: Boolean) {
if (menu != null) {
try {
val method =
menu.javaClass.getDeclaredMethod(
"setOptionalIconsVisible",
java.lang.Boolean.TYPE
)
method.isAccessible = true
method.invoke(menu, visible)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
me.shouheng.utils.store.KV#setOnSharedPreferenceChangeListener
这个方法应该改名为 registerOnSharedPreferenceChangeListener
/Users/shouhwang/.gradle/caches/modules-2/files-2.1/com.github.Shouheng88/utils-ktx/2.8.7/3d16a937b3877b2a49b6d05a9c49cb4667b181fa/utils-ktx-2.8.7-sources.jar!/me/shouheng/utils/ktx/StringKtx.kt:67
写错了,应该用 this 就行