- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
168 lines
6.2 KiB
Java
168 lines
6.2 KiB
Java
package com.mbridge.msdk.video.module;
|
|
|
|
import android.R;
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.res.Configuration;
|
|
import android.graphics.drawable.GradientDrawable;
|
|
import android.text.TextUtils;
|
|
import android.util.AttributeSet;
|
|
import android.util.Base64;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.webkit.WebView;
|
|
import android.widget.RelativeLayout;
|
|
import androidx.annotation.RequiresApi;
|
|
import com.mbridge.msdk.foundation.controller.c;
|
|
import com.mbridge.msdk.foundation.download.download.H5DownLoadManager;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.mbridge.msdk.foundation.same.report.d.d;
|
|
import com.mbridge.msdk.foundation.same.report.d.e;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.foundation.tools.ak;
|
|
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
|
|
import com.mbridge.msdk.mbsignalcommon.windvane.g;
|
|
import com.mbridge.msdk.video.signal.factory.b;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class MBridgeClickMiniCardView extends MBridgeH5EndCardView {
|
|
private boolean w;
|
|
|
|
public MBridgeClickMiniCardView(Context context) {
|
|
super(context);
|
|
this.w = false;
|
|
}
|
|
|
|
public MBridgeClickMiniCardView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.w = false;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView, com.mbridge.msdk.video.module.MBridgeBaseView
|
|
@RequiresApi(api = 11)
|
|
public void onSelfConfigurationChanged(Configuration configuration) {
|
|
if (this.e) {
|
|
a(this.m);
|
|
}
|
|
super.onSelfConfigurationChanged(configuration);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView
|
|
public final RelativeLayout.LayoutParams b() {
|
|
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
|
|
layoutParams.addRule(13, -1);
|
|
return layoutParams;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView
|
|
@RequiresApi(api = 11)
|
|
public final void e() {
|
|
super.e();
|
|
if (this.e) {
|
|
setBackgroundResource(findColor("mbridge_reward_minicard_bg"));
|
|
a(this.m);
|
|
setClickable(true);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView
|
|
public final String a() {
|
|
CampaignEx campaignEx = this.b;
|
|
if (campaignEx == null) {
|
|
return null;
|
|
}
|
|
CampaignEx.c rewardTemplateMode = campaignEx.getRewardTemplateMode();
|
|
String c = rewardTemplateMode != null ? rewardTemplateMode.c() : null;
|
|
if (TextUtils.isEmpty(c) || !c.contains(".zip")) {
|
|
return c;
|
|
}
|
|
String h5ResAddress = H5DownLoadManager.getInstance().getH5ResAddress(c);
|
|
return !TextUtils.isEmpty(h5ResAddress) ? h5ResAddress : c;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView
|
|
public void preLoadData(b bVar) {
|
|
super.preLoadData(bVar);
|
|
setCloseVisible(0);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.video.module.MBridgeH5EndCardView
|
|
public void webviewshow() {
|
|
WindVaneWebView windVaneWebView = this.p;
|
|
if (windVaneWebView != null) {
|
|
windVaneWebView.post(new Runnable() { // from class: com.mbridge.msdk.video.module.MBridgeClickMiniCardView.1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
try {
|
|
af.a(MBridgeBaseView.TAG, "webviewshow");
|
|
String str = "";
|
|
try {
|
|
int[] iArr = new int[2];
|
|
MBridgeClickMiniCardView.this.p.getLocationOnScreen(iArr);
|
|
af.b(MBridgeBaseView.TAG, "coordinate:" + iArr[0] + "--" + iArr[1]);
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("startX", ak.b(c.m().c(), (float) iArr[0]));
|
|
jSONObject.put("startY", ak.b(c.m().c(), (float) iArr[1]));
|
|
str = jSONObject.toString();
|
|
} catch (Throwable th) {
|
|
af.b(MBridgeBaseView.TAG, th.getMessage(), th);
|
|
}
|
|
g.a().a((WebView) MBridgeClickMiniCardView.this.p, "webviewshow", Base64.encodeToString(str.toString().getBytes(), 2));
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
});
|
|
e eVar = new e();
|
|
eVar.a("type", 3);
|
|
d.a().a("2000133", this.b, eVar);
|
|
}
|
|
}
|
|
|
|
@RequiresApi(api = 11)
|
|
private void a(View view) {
|
|
int f = ak.f(this.a);
|
|
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
|
|
layoutParams.width = (int) ((f * 0.7f) + 0.5f);
|
|
layoutParams.height = (int) ((ak.e(this.a) * 0.7f) + 0.5f);
|
|
view.setLayoutParams(layoutParams);
|
|
}
|
|
|
|
public void setMBridgeClickMiniCardViewTransparent() {
|
|
setBackgroundColor(0);
|
|
}
|
|
|
|
public void setMBridgeClickMiniCardViewClickable(boolean z) {
|
|
setClickable(z);
|
|
}
|
|
|
|
public void setMiniCardLocation(int i, int i2, int i3, int i4) {
|
|
this.w = true;
|
|
resizeMiniCard(i3, i4);
|
|
}
|
|
|
|
public void resizeMiniCard(int i, int i2) {
|
|
View findViewById = ((Activity) this.a).getWindow().findViewById(R.id.content);
|
|
int width = findViewById.getWidth();
|
|
int height = findViewById.getHeight();
|
|
if (i <= 0 || i2 <= 0 || i > width || i2 > height) {
|
|
return;
|
|
}
|
|
ViewGroup.LayoutParams layoutParams = this.m.getLayoutParams();
|
|
layoutParams.width = i;
|
|
layoutParams.height = i2;
|
|
this.m.setLayoutParams(layoutParams);
|
|
}
|
|
|
|
public void setRadius(int i) {
|
|
if (i > 0) {
|
|
GradientDrawable gradientDrawable = new GradientDrawable();
|
|
gradientDrawable.setCornerRadius(ak.a(getContext(), i));
|
|
gradientDrawable.setColor(-1);
|
|
this.p.setBackground(gradientDrawable);
|
|
this.p.setClipToOutline(true);
|
|
}
|
|
}
|
|
}
|