1.修复视频流滑动闪退问题 2.修复WebView闪退问题

This commit is contained in:
张玉久
2020-12-21 16:02:00 +08:00
parent 0d9a4baf32
commit a39a8c2cce
2 changed files with 17 additions and 1 deletions

View File

@ -414,7 +414,7 @@ public class DWebView extends WebView {
e.printStackTrace();
try {
super.loadUrl("javascript:" + script);
} catch (Exception ignored){
} catch (Exception ignored) {
}
}
@ -1023,4 +1023,19 @@ public class DWebView extends WebView {
mainHandler.post(runnable);
}
@Override
public void setOverScrollMode(int mode) {
try {
super.setOverScrollMode(mode);
} catch (Throwable e) {
String trace = Log.getStackTraceString(e);
if (trace.contains("android.content.pm.PackageManager$NameNotFoundException")
|| trace.contains("java.lang.RuntimeException: Cannot load WebView")
|| trace.contains("android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed")) {
e.printStackTrace();
} else {
throw e;
}
}
}
}

View File

@ -218,6 +218,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
val (itemHeight, distance) = getDistance()
if (itemHeight <= 0) return
val offsetY = distance % itemHeight
val alpha = 1 - offsetY.toFloat() / itemHeight
val homeVideoFragment = this@VideoDetailContainerFragment.parentFragment as? HomeVideoFragment