diff --git a/.idea/modules.xml b/.idea/modules.xml
index d285ce1..373a6ee 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -16,9 +16,6 @@
-
-
-
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 6143e2f..35eb1dd 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,6 +2,5 @@
-
\ No newline at end of file
diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy
index 8c98818..6bfbe90 100644
--- a/app/src/main/assets/updatelog.fy
+++ b/app/src/main/assets/updatelog.fy
@@ -1,3 +1,5 @@
+1、修复阅读界面概率性闪退的问题
+
2022.05.28
风月读书v2.4.6
更新内容:
diff --git a/app/src/main/java/xyz/fycz/myreader/widget/page/PageView.java b/app/src/main/java/xyz/fycz/myreader/widget/page/PageView.java
index bbef581..c53cf3f 100644
--- a/app/src/main/java/xyz/fycz/myreader/widget/page/PageView.java
+++ b/app/src/main/java/xyz/fycz/myreader/widget/page/PageView.java
@@ -491,9 +491,10 @@ public class PageView extends View {
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- mPageAnim.abortAnim();
- mPageAnim.clear();
-
+ if (mPageAnim != null) {
+ mPageAnim.abortAnim();
+ mPageAnim.clear();
+ }
mPageLoader = null;
mPageAnim = null;
}
diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt
index 763e3ca..fa7938d 100644
--- a/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt
+++ b/dynamic/src/main/java/xyz/fycz/dynamic/AppLoadImpl.kt
@@ -46,6 +46,7 @@ class AppLoadImpl : IAppLoader {
App244Fix::class.java,
App244Fix2::class.java,
App246Fix::class.java,
+ App246Fix2::class.java,
AppSubSourceFix::class.java,
)
@@ -66,7 +67,7 @@ class AppLoadImpl : IAppLoader {
}
if (sb.isNotEmpty()) {
if (sb.endsWith("\n")) sb.substring(0, sb.length - 1)
- val key = "fix2022-06-21"
+ val key = "fix2022-06-23"
val hasRead = spu.getBoolean(key, false)
if (!hasRead) {
announce("插件更新", "更新内容:\n$sb")
diff --git a/dynamic/src/main/java/xyz/fycz/dynamic/fix/App246Fix2.kt b/dynamic/src/main/java/xyz/fycz/dynamic/fix/App246Fix2.kt
new file mode 100644
index 0000000..380d7cd
--- /dev/null
+++ b/dynamic/src/main/java/xyz/fycz/dynamic/fix/App246Fix2.kt
@@ -0,0 +1,59 @@
+/*
+ * This file is part of FYReader.
+ * FYReader is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * FYReader is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FYReader. If not, see .
+ *
+ * Copyright (C) 2020 - 2022 fengyuecanzhu
+ */
+
+package xyz.fycz.dynamic.fix
+
+import me.fycz.maple.MapleBridge
+import me.fycz.maple.MapleUtils
+import me.fycz.maple.MethodHook
+import xyz.fycz.myreader.widget.page.PageView
+
+/**
+ * @author fengyue
+ * @date 2022/6/23 20:51
+ */
+@AppFix([], ["修复阅读界面概率性闪退的问题"], "2022-06-23")
+class App246Fix2 : AppFixHandle {
+ override fun onFix(key: String): BooleanArray {
+ val result = try {
+ fxPageView()
+ true
+ } catch (e: Exception) {
+ MapleUtils.log(e)
+ false
+ }
+ fixResult(key, "pageView", result)
+ return booleanArrayOf(result)
+ }
+
+ private fun fxPageView() {
+ MapleUtils.findAndHookMethod(
+ PageView::class.java,
+ "onDetachedFromWindow",
+ object : MethodHook(){
+ override fun beforeHookedMethod(param: MapleBridge.MethodHookParam) {
+ val mPageAnim = MapleUtils.getObjectField(param.thisObject, "mPageAnim")
+ if (mPageAnim == null){
+ MapleUtils.setObjectField(param.thisObject, "mPageLoader", null)
+ param.result = null
+ }
+ }
+ }
+ )
+ }
+}
\ No newline at end of file