Warkop v5.73.0版本的 MD5 值为:a4330ec2d6f5e146f59fc7622f3cdb45
以下内容为反编译后的 SimpleStoriesWebView.java 源代码,内容仅作参考
package com.inappstory.sdk.stories.ui.widgets.readerscreen.webview;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewParent;
import android.webkit.ConsoleMessage;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import androidx.core.view.p0;
import com.exponea.sdk.models.Constants;
import com.inappstory.sdk.InAppStoryManager;
import com.inappstory.sdk.InAppStoryService;
import com.inappstory.sdk.stories.ui.views.IASWebView;
import com.inappstory.sdk.stories.ui.views.IASWebViewClient;
import com.inappstory.sdk.stories.ui.widgets.readerscreen.storiespager.ReaderPager;
import com.inappstory.sdk.stories.ui.widgets.readerscreen.storiespager.SimpleStoriesView;
import com.inappstory.sdk.stories.ui.widgets.readerscreen.storiespager.StoriesViewManager;
import com.inappstory.sdk.stories.utils.Sizes;
public class SimpleStoriesWebView extends IASWebView implements SimpleStoriesView {
boolean clientIsSet;
float coordinate1;
long lastTap;
StoriesViewManager manager;
boolean notFirstLoading;
boolean touchSlider;
public class a implements Runnable {
final String f31938c;
a(String str) {
this.f31938c = str;
}
@Override
public void run() {
SimpleStoriesWebView.super.loadUrl(this.f31938c);
}
}
class b implements Runnable {
final String f31940c;
b(String str) {
this.f31940c = str;
}
@Override
public void run() {
SimpleStoriesWebView simpleStoriesWebView = SimpleStoriesWebView.this;
SimpleStoriesWebView.this.loadDataWithBaseURL("file:///data/", simpleStoriesWebView.setDir(simpleStoriesWebView.injectUnselectableStyle(this.f31940c)), "text/html; charset=utf-8", "UTF-8", null);
}
}
class c implements Runnable {
final String f31942c;
c(String str) {
this.f31942c = str;
}
@Override
public void run() {
SimpleStoriesWebView.this.replaceHtml(this.f31942c);
}
}
public SimpleStoriesWebView(Context context) {
super(context);
this.clientIsSet = false;
this.notFirstLoading = false;
this.touchSlider = false;
}
private boolean checkIfParentsHasCubeAnimation(ViewParent viewParent) {
if (viewParent == null) {
return false;
}
if (viewParent instanceof ReaderPager) {
return ((ReaderPager) viewParent).cubeAnimation;
}
return checkIfParentsHasCubeAnimation(viewParent.getParentForAccessibility());
}
private String escape(String str) {
return str.replaceAll("\"", "\\\"").replaceAll("\b", "\\b").replaceAll("\f", "\\f").replaceAll("\n", "\\n").replaceAll("\r", "\\r").replaceAll("\t", "\\t");
}
private void logMethod(String str) {
InAppStoryManager.showDLog("JS_method_call", this.manager.storyId + " " + this.manager.loadedIndex + " " + str);
}
private String oldEscape(String str) {
return str.replaceAll("\"", "\\\\\"").replaceAll("\n", " ").replaceAll("\r", " ");
}
public void replaceHtml(String str) {
evaluateJavascript("(function(){show_slide(\"" + oldEscape(str) + "\");})()", null);
logMethod("show_slide");
}
@Override
public void cancelDialog(String str) {
loadUrl("javascript:(function(){story_send_text_input_result(\"" + str + "\", \"\");})()");
}
@Override
public void changeSoundStatus() {
if (InAppStoryService.getInstance().isSoundOn()) {
loadUrl("javascript:(function(){story_slide_enable_audio();})()");
} else {
loadUrl("javascript:(function(){story_slide_disable_audio();})()");
}
}
@Override
public void checkIfClientIsSet() {
if (!this.clientIsSet) {
addJavascriptInterface(new WebAppInterface(getContext(), getManager()), Constants.DeviceInfo.osName);
setWebViewClient(new IASWebViewClient());
setWebChromeClient(new WebChromeClient() {
@Override
public Bitmap getDefaultVideoPoster() {
if (super.getDefaultVideoPoster() == null) {
Bitmap createBitmap = Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
new Canvas(createBitmap).drawColor(-16777216);
return createBitmap;
}
return super.getDefaultVideoPoster();
}
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
SimpleStoriesWebView simpleStoriesWebView = SimpleStoriesWebView.this;
StoriesViewManager storiesViewManager = simpleStoriesWebView.manager;
if (storiesViewManager != null) {
simpleStoriesWebView.sendWebConsoleLog(consoleMessage, Integer.toString(storiesViewManager.storyId), SimpleStoriesWebView.this.manager.index);
}
StringBuilder sb5 = new StringBuilder();
sb5.append(consoleMessage.messageLevel().name());
sb5.append(": ");
sb5.append(consoleMessage.message());
sb5.append(" -- From line ");
sb5.append(consoleMessage.lineNumber());
sb5.append(" of ");
sb5.append(consoleMessage.sourceId());
return super.onConsoleMessage(consoleMessage);
}
@Override
public void onProgressChanged(WebView webView, int i15) {
if (SimpleStoriesWebView.this.getManager().getProgressBar() != null) {
SimpleStoriesWebView.this.getManager().getProgressBar().setProgress(i15, 100);
}
}
});
}
this.clientIsSet = true;
}
@Override
public void clearSlide(int i15) {
if (i15 < 0) {
return;
}
evaluateJavascript("(function(){clear_slide(" + i15 + ");})()", null);
StringBuilder sb5 = new StringBuilder();
sb5.append("clear_slide ");
sb5.append(i15);
logMethod(sb5.toString());
}
@Override
public void destroyView() {
removeAllViews();
clearHistory();
clearCache(true);
loadUrl("about:blank");
StoriesViewManager storiesViewManager = this.manager;
storiesViewManager.loadedId = -1;
storiesViewManager.loadedIndex = -1;
removeAllViews();
destroyDrawingCache();
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
int dpToPxExt;
if (checkIfParentsHasCubeAnimation(getParentForAccessibility())) {
return false;
}
if (motionEvent.getActionMasked() == 0) {
this.coordinate1 = motionEvent.getX();
if (p0.B(this) == 1) {
if (!Sizes.isTablet()) {
dpToPxExt = Sizes.getScreenSize().x;
} else {
dpToPxExt = Sizes.dpToPxExt(400);
}
this.coordinate1 = dpToPxExt - this.coordinate1;
}
}
return super.dispatchTouchEvent(motionEvent);
}
@Override
public void freezeUI() {
this.touchSlider = true;
getParentForAccessibility().requestDisallowInterceptTouchEvent(true);
}
public void gameComplete(String str) {
if (str != null) {
loadUrl("javascript:game_complete('" + str + "')");
} else {
loadUrl("javascript:game_complete()");
}
logMethod("game_complete " + str);
}
@Override
public float getCoordinate() {
return this.coordinate1;
}
@Override
public StoriesViewManager getManager() {
return this.manager;
}
@Override
public void goodsWidgetComplete(String str) {
evaluateJavascript("goods_widget_complete(\"" + str + "\");", null);
StringBuilder sb5 = new StringBuilder();
sb5.append("goods_widget_complete ");
sb5.append(str);
logMethod(sb5.toString());
}
@Override
protected void init() {
super.init();
StoriesViewManager storiesViewManager = new StoriesViewManager(getContext());
this.manager = storiesViewManager;
storiesViewManager.setStoriesView(this);
}
@Override
public void loadJsApiResponse(String str, String str2) {
evaluateJavascript(str2 + "('" + str + "');", null);
}
@Override
public void loadUrl(String str) {
post(new a(str));
}
public void loadWebData(String str, String str2) {
if (this.notFirstLoading && !str2.isEmpty()) {
post(new c(str2));
} else {
this.notFirstLoading = true;
post(new b(str));
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
if (checkIfParentsHasCubeAnimation(getParentForAccessibility())) {
return false;
}
boolean onInterceptTouchEvent = super.onInterceptTouchEvent(motionEvent);
if (motionEvent.getAction() == 0) {
if (System.currentTimeMillis() - this.lastTap < 1500) {
return false;
}
getManager().getPageManager().pauseSlide(false);
this.lastTap = System.currentTimeMillis();
} else if (motionEvent.getAction() == 1 || motionEvent.getAction() == 3) {
this.touchSlider = false;
getParentForAccessibility().requestDisallowInterceptTouchEvent(false);
}
if (!onInterceptTouchEvent && !this.touchSlider) {
return false;
}
return true;
}
@Override
public boolean onTouchEvent(MotionEvent motionEvent) {
if (checkIfParentsHasCubeAnimation(getParentForAccessibility())) {
return false;
}
boolean onTouchEvent = super.onTouchEvent(motionEvent);
if (motionEvent.getAction() == 0) {
if (System.currentTimeMillis() - this.lastTap < 1500) {
return true;
}
} else if (motionEvent.getAction() == 1 && Sizes.isTablet()) {
getManager().getPageManager().resumeSlide(false);
}
return onTouchEvent;
}
@Override
public void restartVideo() {
stopVideo();
slideStart();
}
@Override
public void resumeVideo() {
loadUrl("javascript:(function() {if ('story_slide_resume' in window) { window.story_slide_resume(); }})()");
logMethod("story_slide_resume");
}
@Override
public void screenshotShare() {
evaluateJavascript("share_slide_screenshot();", null);
logMethod("share_slide_screenshot");
}
@Override
public void sendDialog(String str, String str2) {
loadUrl("javascript:story_send_text_input_result(\"" + str + "\", \"" + str2.replaceAll("\n", "<br>") + "\")");
}
@Override
public void setStoriesView(SimpleStoriesView simpleStoriesView) {
}
@Override
public void shareComplete(String str, boolean z15) {
if (str == null) {
return;
}
loadUrl("javascript:(function(){share_complete(\"" + str + "\", " + z15 + ");})()");
StringBuilder sb5 = new StringBuilder();
sb5.append("share_complete ");
sb5.append(str);
sb5.append(" ");
sb5.append(z15);
logMethod(sb5.toString());
}
@Override
public void slidePause() {
loadUrl("javascript:(function(){if ('story_slide_pause' in window) { window.story_slide_pause(); }})()");
logMethod("story_slide_pause");
}
@Override
public void slideStart() {
String str;
if (InAppStoryService.getInstance() != null && InAppStoryService.getInstance().isSoundOn()) {
str = "story_slide_start('{\"muted\": false}');";
} else {
str = "story_slide_start('{\"muted\": true}');";
}
loadUrl("javascript:(function(){if ('story_slide_start' in window) { window." + str + "}})()");
logMethod("story_slide_start");
}
@Override
public void stopVideo() {
loadUrl("javascript:(function(){if ('story_slide_stop' in window) { window.story_slide_stop(); }})()");
logMethod("story_slide_stop");
}
@Override
public void swipeUp() {
loadUrl("javascript:window.story_slide_swipe_up()");
logMethod("story_slide_swipe_up");
}
public SimpleStoriesWebView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.clientIsSet = false;
this.notFirstLoading = false;
this.touchSlider = false;
}
public SimpleStoriesWebView(Context context, AttributeSet attributeSet, int i15) {
super(context, attributeSet, i15);
this.clientIsSet = false;
this.notFirstLoading = false;
this.touchSlider = false;
}
}