- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
386 lines
15 KiB
Java
386 lines
15 KiB
Java
package com.mbridge.msdk.newreward.player.presenter;
|
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.text.TextUtils;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.foundation.tools.ak;
|
|
import com.mbridge.msdk.newout.RewardVideoListener;
|
|
import com.mbridge.msdk.newreward.a.b.b;
|
|
import com.mbridge.msdk.newreward.function.command.c;
|
|
import com.mbridge.msdk.newreward.function.command.f;
|
|
import com.mbridge.msdk.newreward.player.iview.IBaseWebView;
|
|
import com.mbridge.msdk.newreward.player.model.BaseWebContentModel;
|
|
import com.mbridge.msdk.newreward.player.redirect.RedirectType;
|
|
import com.mbridge.msdk.newreward.player.view.hybrid.util.MBCommunicatorUtil;
|
|
import com.mbridge.msdk.video.dynview.a;
|
|
import com.mbridge.msdk.widget.MBAdChoice;
|
|
import java.util.Iterator;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class FloatWebViewPresenter extends AbsPresenter implements b {
|
|
final int EXPAND_VIEW_BUILD_TYPE;
|
|
final int MINI_CARD_BUILD_TYPE;
|
|
private final String TAG;
|
|
boolean isLoadResourceError;
|
|
boolean isShown;
|
|
Handler mHandler;
|
|
IBaseWebView mWebContentView;
|
|
int muteState;
|
|
public Runnable nativeCloseBtnVisibleRunnable;
|
|
int webCloseViewStatus;
|
|
BaseWebContentModel webContentModel;
|
|
|
|
public void onShown() {
|
|
this.isShown = true;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void releaseSource() {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.a.b.b
|
|
public void reqFailed(com.mbridge.msdk.foundation.c.b bVar) {
|
|
}
|
|
|
|
public FloatWebViewPresenter(IBaseWebView iBaseWebView, int i) {
|
|
super(iBaseWebView);
|
|
this.TAG = "MiniCardPresenter";
|
|
this.webCloseViewStatus = -1;
|
|
this.muteState = -1;
|
|
this.isLoadResourceError = false;
|
|
this.isShown = false;
|
|
this.MINI_CARD_BUILD_TYPE = 3;
|
|
this.EXPAND_VIEW_BUILD_TYPE = 4;
|
|
this.mHandler = new Handler(Looper.getMainLooper());
|
|
this.nativeCloseBtnVisibleRunnable = new Runnable() { // from class: com.mbridge.msdk.newreward.player.presenter.FloatWebViewPresenter.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
FloatWebViewPresenter floatWebViewPresenter = FloatWebViewPresenter.this;
|
|
if (floatWebViewPresenter.webCloseViewStatus != -1) {
|
|
return;
|
|
}
|
|
floatWebViewPresenter.mWebContentView.setNativeCloseButtonVisibility(0);
|
|
}
|
|
};
|
|
this.mWebContentView = iBaseWebView;
|
|
BaseWebContentModel baseWebContentModel = new BaseWebContentModel();
|
|
this.webContentModel = baseWebContentModel;
|
|
baseWebContentModel.setCommandManager(this.commandManager);
|
|
this.webContentModel.setAdapterModel(this.adapterModel);
|
|
this.webContentModel.setCallbackListener(this);
|
|
this.TEMPLATE_MARK_TYPE = i != 273 ? 5 : 4;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void click(View view) {
|
|
IBaseWebView iBaseWebView = this.mWebContentView;
|
|
if (iBaseWebView != null) {
|
|
iBaseWebView.removeTempleFromSuperView(null);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void getView() {
|
|
initDataForView(null);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void initDataForView(a aVar) {
|
|
this.mWebContentView.initViews(false);
|
|
addWaterMark(this.adapterModel.H());
|
|
addAdChoice();
|
|
}
|
|
|
|
public void renderMRAID(String str) {
|
|
CampaignEx campaignEx;
|
|
try {
|
|
if (TextUtils.isEmpty(str) && (campaignEx = this.campaignEx) != null && !TextUtils.isEmpty(campaignEx.getMraid())) {
|
|
str = "file:////" + this.campaignEx.getMraid();
|
|
}
|
|
render(str);
|
|
} catch (Throwable th) {
|
|
af.b("MiniCardPresenter", th.getMessage());
|
|
}
|
|
}
|
|
|
|
public void renderPauseUrl() {
|
|
try {
|
|
if (this.adapterModel.U() != null) {
|
|
String V = this.adapterModel.V();
|
|
String str = "";
|
|
if (!TextUtils.isEmpty(V)) {
|
|
Iterator<com.mbridge.msdk.newreward.function.c.a.a> it = this.adapterModel.D().b().u().iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
break;
|
|
}
|
|
com.mbridge.msdk.newreward.function.c.a.a next = it.next();
|
|
if (next.g().equals(V)) {
|
|
str = next.a().i();
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
render(str);
|
|
}
|
|
} catch (Throwable th) {
|
|
af.b("MiniCardPresenter", th.getMessage());
|
|
}
|
|
}
|
|
|
|
private void render(String str) {
|
|
if (TextUtils.isEmpty(str) || this.mWebContentView.getWebView() == null) {
|
|
return;
|
|
}
|
|
this.mWebContentView.getWebView().setHybridCommunicator(this.webContentModel);
|
|
this.mWebContentView.getWebView().setWebViewEventListener(this.webContentModel);
|
|
this.mWebContentView.getWebView().loadUrl(str);
|
|
}
|
|
|
|
public void onDetachedFromWindow() {
|
|
this.mHandler.removeCallbacksAndMessages(null);
|
|
}
|
|
|
|
public void onActivityLifeCycleCallback(String str) {
|
|
String str2;
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
str.hashCode();
|
|
switch (str) {
|
|
case "onDestroy":
|
|
str2 = "onSystemDestory";
|
|
break;
|
|
case "onPause":
|
|
str2 = "onSystemPause";
|
|
break;
|
|
case "onBackPressed":
|
|
str2 = "onSystemBackPressed";
|
|
break;
|
|
case "onResume":
|
|
str2 = "onSystemResume";
|
|
break;
|
|
default:
|
|
str2 = "";
|
|
break;
|
|
}
|
|
if (!TextUtils.isEmpty(str2)) {
|
|
MBCommunicatorUtil.fireEvent(this.mWebContentView.getWebView(), str2, "");
|
|
}
|
|
if (str.equals("onBackPressed") && this.isShown) {
|
|
click(null);
|
|
}
|
|
}
|
|
|
|
public void changeNativeCloseButton() {
|
|
int cbd = this.adapterModel.U().getCbd();
|
|
if (cbd < 0) {
|
|
cbd = this.adapterModel.x().b().p();
|
|
}
|
|
this.mHandler.postDelayed(this.nativeCloseBtnVisibleRunnable, cbd * 1000);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void finish(boolean z) {
|
|
this.mWebContentView.onDestroyWebContent(this.TEMPLATE_MARK_TYPE);
|
|
}
|
|
|
|
public void setNotchData(String str) {
|
|
this.webContentModel.sendNotchData(this.mWebContentView.getWebView(), str);
|
|
}
|
|
|
|
public void onWebContentError() {
|
|
if (this.isLoadResourceError) {
|
|
return;
|
|
}
|
|
this.isLoadResourceError = true;
|
|
this.mWebContentView.onDestroyWebContent(this.TEMPLATE_MARK_TYPE);
|
|
this.mWebContentView.removeTempleFromSuperView(this.data.getRootViewGroup());
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.a.b.b
|
|
public void reqSuccessful(Object obj) {
|
|
char c;
|
|
try {
|
|
if (obj instanceof JSONObject) {
|
|
JSONObject jSONObject = (JSONObject) obj;
|
|
if (jSONObject.length() > 0) {
|
|
String string = jSONObject.getString("action");
|
|
switch (string.hashCode()) {
|
|
case -1765453640:
|
|
if (string.equals("toggleCloseBtn")) {
|
|
c = 2;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case -1488920312:
|
|
if (string.equals("onReceivedError")) {
|
|
c = 4;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case -505277536:
|
|
if (string.equals("onPageFinished")) {
|
|
c = 0;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 94750088:
|
|
if (string.equals("click")) {
|
|
c = 5;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 94756344:
|
|
if (string.equals("close")) {
|
|
c = 3;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
case 96046965:
|
|
if (string.equals("readyStatus")) {
|
|
c = 1;
|
|
break;
|
|
}
|
|
c = 65535;
|
|
break;
|
|
default:
|
|
c = 65535;
|
|
break;
|
|
}
|
|
if (c == 0) {
|
|
this.mWebContentView.onWebViewShow(this.TEMPLATE_MARK_TYPE);
|
|
return;
|
|
}
|
|
if (c == 1) {
|
|
if (jSONObject.optInt("status", 1) == 1) {
|
|
this.mWebContentView.onWebViewShow(this.TEMPLATE_MARK_TYPE);
|
|
return;
|
|
} else {
|
|
onWebContentError();
|
|
return;
|
|
}
|
|
}
|
|
if (c == 2) {
|
|
int optInt = jSONObject.optInt("status", 1);
|
|
this.webCloseViewStatus = optInt;
|
|
this.mWebContentView.setNativeCloseButtonVisibility(optInt == 1 ? 0 : 4);
|
|
} else {
|
|
if (c == 3) {
|
|
this.mWebContentView.onCloseViewClick(3);
|
|
return;
|
|
}
|
|
if (c == 4) {
|
|
onWebContentError();
|
|
return;
|
|
}
|
|
if (c != 5) {
|
|
return;
|
|
}
|
|
c cVar = this.commandManager;
|
|
cVar.f(cVar.a("campaign_redirect", this.redirectModel.setRedirectType(RedirectType.AD_TRACKING_CLICK_URL)), f.CAMPAIGN_REDIRECT);
|
|
RewardVideoListener rewardVideoListener = this.rewardVideoListener;
|
|
if (rewardVideoListener != null) {
|
|
rewardVideoListener.onVideoAdClicked(this.mBridgeIds);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
af.b("MiniCardPresenter", th.getMessage());
|
|
}
|
|
}
|
|
|
|
public String getWebViewShowExtraData() {
|
|
if (this.reward == null) {
|
|
return "";
|
|
}
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
JSONObject jSONObject2 = new JSONObject();
|
|
jSONObject2.put("name", this.reward.a());
|
|
jSONObject2.put("amount", this.reward.b());
|
|
jSONObject2.put("id", "");
|
|
jSONObject.put("userId", "");
|
|
jSONObject.put("reward", jSONObject2);
|
|
jSONObject.put("playVideoMute", this.muteState);
|
|
jSONObject.put("extra", this.adapterModel.W());
|
|
return jSONObject.toString();
|
|
} catch (JSONException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
|
|
public int getCampaignOrientation() {
|
|
try {
|
|
if (this.adapterModel.U() != null) {
|
|
return this.adapterModel.U().getRewardTemplateMode().b();
|
|
}
|
|
return 0;
|
|
} catch (Throwable th) {
|
|
af.b("MiniCardPresenter", th.getMessage());
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
private void addWaterMark(String str) {
|
|
try {
|
|
BitmapDrawable a = com.mbridge.msdk.foundation.controller.c.m().a(str, 296);
|
|
if (a != null) {
|
|
ImageView imageView = new ImageView(com.mbridge.msdk.foundation.controller.c.m().c());
|
|
imageView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
|
|
ak.a(imageView, a, this.mWebContentView.getWebView().getResources().getDisplayMetrics());
|
|
this.mWebContentView.addViewToCurrentViewGroup(imageView);
|
|
}
|
|
} catch (Throwable th) {
|
|
af.b("MiniCardPresenter", th.getMessage());
|
|
}
|
|
}
|
|
|
|
private void addAdChoice() {
|
|
try {
|
|
CampaignEx campaignEx = this.campaignEx;
|
|
if (campaignEx == null || campaignEx.getPrivacyButtonTemplateVisibility() == 0) {
|
|
return;
|
|
}
|
|
MBAdChoice mBAdChoice = new MBAdChoice(com.mbridge.msdk.foundation.controller.c.m().c());
|
|
mBAdChoice.setCampaign(this.campaignEx);
|
|
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ak.a(com.mbridge.msdk.foundation.controller.c.m().c(), 12.0f), ak.a(com.mbridge.msdk.foundation.controller.c.m().c(), 12.0f));
|
|
layoutParams.gravity = 8388693;
|
|
layoutParams.bottomMargin = 30;
|
|
layoutParams.rightMargin = 30;
|
|
mBAdChoice.setLayoutParams(layoutParams);
|
|
mBAdChoice.setFeedbackDialogEventListener(new com.mbridge.msdk.foundation.d.a() { // from class: com.mbridge.msdk.newreward.player.presenter.FloatWebViewPresenter.2
|
|
@Override // com.mbridge.msdk.foundation.d.a
|
|
public void close() {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.d.a
|
|
public void showed() {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.d.a
|
|
public void summit(String str) {
|
|
}
|
|
});
|
|
this.mWebContentView.addViewToCurrentViewGroup(mBAdChoice);
|
|
} catch (Throwable th) {
|
|
af.b("MiniCardPresenter", th.getMessage());
|
|
}
|
|
}
|
|
}
|