- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
423 lines
20 KiB
Java
423 lines
20 KiB
Java
package com.mbridge.msdk.newreward.player.presenter;
|
|
|
|
import android.app.Activity;
|
|
import android.graphics.Bitmap;
|
|
import android.text.TextUtils;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import com.mbridge.msdk.MBridgeConstans;
|
|
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.foundation.tools.aq;
|
|
import com.mbridge.msdk.foundation.tools.x;
|
|
import com.mbridge.msdk.interstitial.view.MBInterstitialActivity;
|
|
import com.mbridge.msdk.newreward.function.command.f;
|
|
import com.mbridge.msdk.newreward.function.command.receiver.d;
|
|
import com.mbridge.msdk.newreward.function.g.e;
|
|
import com.mbridge.msdk.newreward.function.h.a;
|
|
import com.mbridge.msdk.newreward.player.imodel.IPlayModel;
|
|
import com.mbridge.msdk.newreward.player.iview.IBaseView;
|
|
import com.mbridge.msdk.newreward.player.iview.IPlayTempleView;
|
|
import com.mbridge.msdk.newreward.player.model.PlayTempleModel;
|
|
import com.mbridge.msdk.video.dynview.a;
|
|
import com.mbridge.msdk.video.dynview.b;
|
|
import com.mbridge.msdk.video.dynview.e.h;
|
|
import com.mbridge.msdk.video.dynview.j.c;
|
|
import com.tapjoy.TapjoyConstants;
|
|
import java.io.File;
|
|
import java.lang.reflect.Proxy;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class PlayTemplePresenter extends BaseTemplatePresenter implements IPresenter {
|
|
private final String TAG;
|
|
|
|
public PlayTemplePresenter(IPlayTempleView iPlayTempleView) {
|
|
super(iPlayTempleView);
|
|
this.TAG = "PlayTemplePresenter";
|
|
this.iView = (IPlayTempleView) Proxy.newProxyInstance(iPlayTempleView.getClass().getClassLoader(), new Class[]{IPlayTempleView.class, IBaseView.class}, new e(iPlayTempleView, this.adapterModel, this.commandManager));
|
|
this.playTempleModel = (IPlayModel) Proxy.newProxyInstance(PlayTempleModel.class.getClassLoader(), new Class[]{IPlayModel.class}, new e(new PlayTempleModel(this.commandManager, this.rewardVideoListener), this.adapterModel, this.commandManager));
|
|
this.TEMPLATE_MARK_TYPE = 2;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.BaseTemplatePresenter, com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void click(View view) {
|
|
super.click(view);
|
|
if (view.getId() == filterFindViewId(this.is_dy, "mbridge_rl_playing_close")) {
|
|
onCloseButtonClick();
|
|
return;
|
|
}
|
|
if (view.getId() == filterFindViewId(this.is_dy, "mbridge_sound_switch")) {
|
|
if (this.iView.getMuteState()) {
|
|
this.iView.setMuteState(false);
|
|
this.playTempleModel.eventTrackingForMute(this.redirectModel);
|
|
} else {
|
|
this.iView.setMuteState(true);
|
|
this.playTempleModel.eventTrackingForUnMute(this.redirectModel);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void getView() {
|
|
b.a().a(new c().a(this.rootParentView, this.campaignEx), new h() { // from class: com.mbridge.msdk.newreward.player.presenter.PlayTemplePresenter.1
|
|
@Override // com.mbridge.msdk.video.dynview.e.h
|
|
public void viewInflaterSuccess(a aVar) {
|
|
PlayTemplePresenter.this.initDataForView(aVar);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.dynview.e.h
|
|
public void viewInflaterFail(com.mbridge.msdk.video.dynview.c.a aVar) {
|
|
PlayTemplePresenter playTemplePresenter = PlayTemplePresenter.this;
|
|
if (playTemplePresenter.playTempleModel == null) {
|
|
return;
|
|
}
|
|
playTemplePresenter.adShowFail(com.mbridge.msdk.foundation.c.a.a(890008), 890008);
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void initDataForView(a aVar) {
|
|
try {
|
|
preRenderEc();
|
|
if (!parseRemoteViewData(aVar)) {
|
|
this.playTemplateRanderSuccess = false;
|
|
closeAdOrShowEndCard();
|
|
} else {
|
|
initPlayer();
|
|
addPrivacy();
|
|
preLoadECMoreOfferData();
|
|
}
|
|
} catch (Exception e) {
|
|
af.b("PlayTemplePresenter", e.getMessage());
|
|
adShowFail(com.mbridge.msdk.foundation.c.a.a(890009), 890009);
|
|
}
|
|
}
|
|
|
|
private void preRenderEc() {
|
|
try {
|
|
com.mbridge.msdk.newreward.a.e eVar = this.adapterModel;
|
|
if (eVar == null || !eVar.ai().equals("WEB_EC")) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.newreward.function.command.c cVar = this.commandManager;
|
|
cVar.i(cVar.a("web_resource_action", 1, "parent_temple", this.data.getRootViewGroup(), "adapter_model", this.adapterModel, "bridge_ids", this.campaignEx.getRequestIdNotice()), f.SHOW_OR_PRELOAD_WEB_EC);
|
|
} catch (Exception e) {
|
|
af.b("PlayTemplePresenter", e.getMessage());
|
|
}
|
|
}
|
|
|
|
private boolean parseRemoteViewData(a aVar) {
|
|
boolean z = false;
|
|
if (aVar == null) {
|
|
return false;
|
|
}
|
|
try {
|
|
boolean c = aVar.c();
|
|
this.is_dy = c;
|
|
com.mbridge.msdk.newreward.a.e eVar = this.adapterModel;
|
|
if (eVar != null) {
|
|
eVar.g(c);
|
|
this.campaignEx.setTemplateRenderSucc(this.is_dy);
|
|
}
|
|
if (aVar.a() == null) {
|
|
return false;
|
|
}
|
|
aVar.a().setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
|
|
try {
|
|
this.iView.addViewToCurrentViewGroup(aVar.a());
|
|
if (aVar.b() != null) {
|
|
Iterator<View> it = aVar.b().iterator();
|
|
while (it.hasNext()) {
|
|
it.next().setOnClickListener(new com.mbridge.msdk.widget.a() { // from class: com.mbridge.msdk.newreward.player.presenter.PlayTemplePresenter.2
|
|
@Override // com.mbridge.msdk.widget.a
|
|
public void onNoDoubleClick(View view) {
|
|
CampaignEx campaignEx = PlayTemplePresenter.this.campaignEx;
|
|
if (campaignEx != null) {
|
|
campaignEx.setClickTempSource(com.mbridge.msdk.foundation.same.report.d.a.g);
|
|
if (view instanceof TextView) {
|
|
PlayTemplePresenter.this.campaignEx.setTriggerClickSource(com.mbridge.msdk.foundation.same.report.d.a.m);
|
|
} else {
|
|
PlayTemplePresenter.this.campaignEx.setTriggerClickSource(com.mbridge.msdk.foundation.same.report.d.a.n);
|
|
}
|
|
}
|
|
PlayTemplePresenter playTemplePresenter = PlayTemplePresenter.this;
|
|
playTemplePresenter.playTempleModel.onAdClick(playTemplePresenter.mBridgeIds);
|
|
PlayTemplePresenter playTemplePresenter2 = PlayTemplePresenter.this;
|
|
playTemplePresenter2.playTempleModel.eventClickUrl(playTemplePresenter2.redirectModel);
|
|
PlayTemplePresenter playTemplePresenter3 = PlayTemplePresenter.this;
|
|
playTemplePresenter3.playTempleModel.eventTrackingForClick(playTemplePresenter3.redirectModel);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
z = this.iView.initViews(this.is_dy);
|
|
return z;
|
|
} catch (Exception e) {
|
|
af.b("PlayTemplePresenter", e.getMessage());
|
|
return false;
|
|
}
|
|
} catch (Exception e2) {
|
|
af.b("PlayTemplePresenter", e2.getMessage());
|
|
return z;
|
|
}
|
|
}
|
|
|
|
private void initPlayer() {
|
|
try {
|
|
if (this.campaignEx.getVideoUrlEncode() != null) {
|
|
File g = this.adapterModel.g(this.campaignEx.getRequestIdNotice());
|
|
com.mbridge.msdk.newreward.function.command.c cVar = this.commandManager;
|
|
Object d = cVar.d(cVar.a("fullScreenWidth", Float.valueOf(ak.j(this.context)), "fullScreenHeight", Float.valueOf(ak.i(this.context)), MBInterstitialActivity.INTENT_CAMAPIGN, this.campaignEx, "orientation", Integer.valueOf(this.context.getResources().getConfiguration().orientation)), f.TEMP_PLAYER_INIT);
|
|
if (d instanceof Map) {
|
|
Map map = (Map) d;
|
|
this.iView.setPlayerSize(((Integer) map.get("gravity")).intValue(), ((Integer) map.get("width")).intValue(), ((Integer) map.get("height")).intValue());
|
|
}
|
|
if (g != null && g.exists()) {
|
|
this.iView.play(g.getAbsolutePath(), getBufferTimeout());
|
|
} else {
|
|
this.iView.play(this.campaignEx.getVideoUrlEncode(), getBufferTimeout());
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
af.b("PlayTemplePresenter", e.getMessage());
|
|
adShowFail(com.mbridge.msdk.foundation.c.a.a(890004), 890004);
|
|
}
|
|
}
|
|
|
|
private void addPrivacy() {
|
|
ak.a(1, this.iView.getPrivacyButton(), this.campaignEx, this.context, false, new com.mbridge.msdk.foundation.d.a() { // from class: com.mbridge.msdk.newreward.player.presenter.PlayTemplePresenter.3
|
|
@Override // com.mbridge.msdk.foundation.d.a
|
|
public void showed() {
|
|
PlayTemplePresenter.this.onPause();
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.d.a
|
|
public void close() {
|
|
PlayTemplePresenter.this.resume();
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.d.a
|
|
public void summit(String str) {
|
|
PlayTemplePresenter.this.resume();
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void resume() {
|
|
this.iView.resume();
|
|
this.playTempleModel.eventTrackingForResume(this.redirectModel);
|
|
}
|
|
|
|
private void preLoadECMoreOfferData() {
|
|
CampaignEx campaignEx = this.campaignEx;
|
|
if (campaignEx == null || TextUtils.isEmpty(campaignEx.getendcard_url()) || !com.mbridge.msdk.newreward.function.h.c.b(this.campaignEx.getendcard_url())) {
|
|
return;
|
|
}
|
|
String a = aq.a(this.campaignEx.getendcard_url(), "mof");
|
|
if (TextUtils.isEmpty(a)) {
|
|
return;
|
|
}
|
|
try {
|
|
if (Integer.parseInt(a) == 1) {
|
|
com.mbridge.msdk.foundation.same.report.d.e eVar = new com.mbridge.msdk.foundation.same.report.d.e();
|
|
eVar.a(TapjoyConstants.TJC_RETRY, "2");
|
|
this.playTempleModel.modelReport("m_mof_initiate", eVar);
|
|
com.mbridge.msdk.newreward.function.command.c cVar = this.commandManager;
|
|
cVar.e(cVar.a(MBInterstitialActivity.INTENT_CAMAPIGN, this.campaignEx, "command_type", f.REQ_MORE_OFFER_CAMPAIGN, "more_offer_type", 2, "adapter_model", this.adapterModel), new com.mbridge.msdk.newreward.a.b.b() { // from class: com.mbridge.msdk.newreward.player.presenter.PlayTemplePresenter.4
|
|
@Override // com.mbridge.msdk.newreward.a.b.b
|
|
public void reqSuccessful(Object obj) {
|
|
com.mbridge.msdk.foundation.same.report.d.e eVar2 = new com.mbridge.msdk.foundation.same.report.d.e();
|
|
eVar2.a("result", "1");
|
|
eVar2.a(TapjoyConstants.TJC_RETRY, "2");
|
|
PlayTemplePresenter.this.playTempleModel.modelReport("m_mof_req_result", eVar2);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.a.b.b
|
|
public void reqFailed(com.mbridge.msdk.foundation.c.b bVar) {
|
|
com.mbridge.msdk.foundation.same.report.d.e eVar2 = new com.mbridge.msdk.foundation.same.report.d.e();
|
|
eVar2.a("result", "2");
|
|
eVar2.a("code", Integer.valueOf(bVar.a()));
|
|
eVar2.a(TapjoyConstants.TJC_RETRY, "2");
|
|
PlayTemplePresenter.this.playTempleModel.modelReport("m_mof_req_result", eVar2);
|
|
}
|
|
});
|
|
}
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void windowFocusChanged() {
|
|
int i;
|
|
int e;
|
|
int f;
|
|
try {
|
|
if (isHalfScreenOffer()) {
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.data.getRootViewGroup().getLayoutParams();
|
|
layoutParams.gravity = 17;
|
|
if (this.campaignEx.getRewardTemplateMode() != null) {
|
|
i = this.campaignEx.getRewardTemplateMode().b();
|
|
} else {
|
|
i = x.a(this.context).getConfiguration().orientation;
|
|
}
|
|
if (i == 1) {
|
|
e = (int) (ak.e(this.context) * 0.55f);
|
|
f = (int) (ak.f(this.context) * 0.65f);
|
|
} else {
|
|
e = (int) (ak.e(this.context) * 0.6f);
|
|
f = (int) (ak.f(this.context) * 0.6f);
|
|
}
|
|
layoutParams.height = e;
|
|
layoutParams.width = f;
|
|
this.iView.setPlayerSize(17, f, e);
|
|
return;
|
|
}
|
|
com.mbridge.msdk.newreward.function.command.c cVar = this.commandManager;
|
|
Object d = cVar.d(cVar.a("fullScreenWidth", Float.valueOf(ak.j(this.context)), "fullScreenHeight", Float.valueOf(ak.i(this.context)), MBInterstitialActivity.INTENT_CAMAPIGN, this.campaignEx, "orientation", Integer.valueOf(this.context.getResources().getConfiguration().orientation)), f.TEMP_PLAYER_INIT);
|
|
if (d instanceof Map) {
|
|
Map map = (Map) d;
|
|
this.iView.setPlayerSize(((Integer) map.get("gravity")).intValue(), ((Integer) map.get("width")).intValue(), ((Integer) map.get("height")).intValue());
|
|
}
|
|
} catch (Exception e2) {
|
|
af.b("PlayTemplePresenter", e2.getMessage());
|
|
}
|
|
}
|
|
|
|
public void setBackGrandImage() {
|
|
try {
|
|
com.mbridge.msdk.foundation.same.c.b.a(this.context.getApplicationContext()).a(this.campaignEx.getImageUrl(), new com.mbridge.msdk.foundation.same.c.c() { // from class: com.mbridge.msdk.newreward.player.presenter.PlayTemplePresenter.5
|
|
@Override // com.mbridge.msdk.foundation.same.c.c
|
|
public void onFailedLoad(String str, String str2) {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.same.c.c
|
|
public void onSuccessLoad(Bitmap bitmap, String str) {
|
|
if (bitmap == null || bitmap.isRecycled()) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.newreward.function.h.a.a(bitmap, new a.InterfaceC0221a() { // from class: com.mbridge.msdk.newreward.player.presenter.PlayTemplePresenter.5.1
|
|
@Override // com.mbridge.msdk.newreward.function.h.a.InterfaceC0221a
|
|
public void blurFailCallBack() {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.function.h.a.InterfaceC0221a
|
|
public void blurSuccessCallBack(Bitmap bitmap2) {
|
|
PlayTemplePresenter.this.iView.setBackGroundImage(bitmap2);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
} catch (Exception e) {
|
|
af.b("PlayTemplePresenter", e.getMessage());
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void finish(boolean z) {
|
|
try {
|
|
releaseSource();
|
|
if (z) {
|
|
((Activity) this.context).finish();
|
|
d.a().d(f.SHOW_OR_PRELOAD_WEB_EC);
|
|
}
|
|
d.a().a(this.adapterModel.G());
|
|
} catch (Throwable th) {
|
|
af.b("PlayTemplePresenter", th.getMessage());
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void releaseSource() {
|
|
if (!this.adapterModel.ac()) {
|
|
this.adapterModel.n(true);
|
|
this.playTempleModel.modelReport("2000146");
|
|
}
|
|
this.iView.release();
|
|
}
|
|
|
|
public void addMoreOfferView(ViewGroup viewGroup) {
|
|
CampaignEx campaignEx = this.campaignEx;
|
|
if (campaignEx == null || campaignEx.getRewardTemplateMode() == null || TextUtils.isEmpty(this.campaignEx.getRewardTemplateMode().e())) {
|
|
return;
|
|
}
|
|
try {
|
|
String a = aq.a(this.campaignEx.getRewardTemplateMode().e(), "mof");
|
|
if (TextUtils.isEmpty(a) || Integer.parseInt(a) != 1) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.newreward.function.command.c cVar = this.commandManager;
|
|
cVar.d(cVar.a("add_temple", 295, "parent_temple", viewGroup, "more_offer_type", 1, "command_type", f.SHOW_ADD_TEMPLE), new com.mbridge.msdk.newreward.a.b.b() { // from class: com.mbridge.msdk.newreward.player.presenter.PlayTemplePresenter.6
|
|
@Override // com.mbridge.msdk.newreward.a.b.b
|
|
public void reqFailed(com.mbridge.msdk.foundation.c.b bVar) {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.a.b.b
|
|
public void reqSuccessful(Object obj) {
|
|
try {
|
|
View view = (View) obj;
|
|
PlayTemplePresenter.this.moreOfferTemp = view;
|
|
view.setVisibility(0);
|
|
new com.mbridge.msdk.video.dynview.h.b().a(PlayTemplePresenter.this.moreOfferTemp, 0, ak.f(com.mbridge.msdk.foundation.controller.c.m().c()), 0, ak.a(com.mbridge.msdk.foundation.controller.c.m().c(), 100.0f), 500L);
|
|
PlayTemplePresenter.this.iView.setTemplateWidthAndHeight(ak.a(com.mbridge.msdk.foundation.controller.c.m().c(), 100.0f));
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void removeCurrPlayTemplateMoreOfferView(ViewGroup viewGroup) {
|
|
View view;
|
|
if (viewGroup == null || (view = this.moreOfferTemp) == null) {
|
|
return;
|
|
}
|
|
viewGroup.removeView(view);
|
|
}
|
|
|
|
public void addBaitClickView() {
|
|
try {
|
|
IPlayTempleView iPlayTempleView = this.iView;
|
|
if (iPlayTempleView == null || iPlayTempleView.getBaitClickView() == null) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.newreward.function.command.c cVar = this.commandManager;
|
|
cVar.e(cVar.a(MBInterstitialActivity.INTENT_CAMAPIGN, this.campaignEx, "template_model", this.playTempleModel, "template_redirect_model", this.redirectModel, "bait_click_view", this.iView.getBaitClickView(), "mbridge_ids", this.mBridgeIds), f.ADD_BAIT_CLICK);
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.newreward.player.presenter.BaseTemplatePresenter, com.mbridge.msdk.newreward.player.presenter.AbsPresenter
|
|
public void onDestroy() {
|
|
super.onDestroy();
|
|
try {
|
|
releaseSource();
|
|
d.a().d(f.SHOW_OR_PRELOAD_WEB_EC);
|
|
d.a().a(this.adapterModel.G());
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|