- 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
481 lines
18 KiB
Java
481 lines
18 KiB
Java
package com.applovin.mediation.nativeAds;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewParent;
|
|
import android.view.ViewTreeObserver;
|
|
import android.widget.Button;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import androidx.annotation.Nullable;
|
|
import com.applovin.impl.je;
|
|
import com.applovin.impl.mediation.ads.a;
|
|
import com.applovin.impl.mediation.ads.b;
|
|
import com.applovin.impl.sdk.j;
|
|
import com.applovin.impl.sdk.n;
|
|
import com.applovin.impl.sdk.nativeAd.AppLovinStarRatingView;
|
|
import com.applovin.impl.sdk.utils.ImageViewUtils;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import com.applovin.mediation.MaxAdFormat;
|
|
import com.applovin.mediation.nativeAds.MaxNativeAd;
|
|
import com.applovin.mediation.nativeAds.MaxNativeAdViewBinder;
|
|
import com.applovin.sdk.R;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
@SuppressLint({"ViewConstructor"})
|
|
/* loaded from: classes2.dex */
|
|
public class MaxNativeAdView extends FrameLayout {
|
|
public static final String MEDIUM_TEMPLATE_1 = "medium_template_1";
|
|
private final View a;
|
|
private final TextView b;
|
|
private final TextView c;
|
|
private final TextView d;
|
|
private final Button f;
|
|
private final ImageView g;
|
|
private final FrameLayout h;
|
|
private final ViewGroup i;
|
|
private final FrameLayout j;
|
|
private final ViewGroup k;
|
|
private final ViewGroup l;
|
|
private final FrameLayout m;
|
|
private b n;
|
|
|
|
public class a implements ViewTreeObserver.OnPreDrawListener {
|
|
final /* synthetic */ WeakReference a;
|
|
final /* synthetic */ ViewGroup b;
|
|
|
|
public a(WeakReference weakReference, ViewGroup viewGroup) {
|
|
this.a = weakReference;
|
|
this.b = viewGroup;
|
|
}
|
|
|
|
@Override // android.view.ViewTreeObserver.OnPreDrawListener
|
|
public boolean onPreDraw() {
|
|
ViewTreeObserver viewTreeObserver = (ViewTreeObserver) this.a.get();
|
|
if (viewTreeObserver == null || !viewTreeObserver.isAlive()) {
|
|
j.v0.J();
|
|
if (n.a()) {
|
|
j.v0.J().k("MaxNativeAdView", "Failed to remove onPreDrawListener since the view tree observer is not alive.");
|
|
}
|
|
} else {
|
|
viewTreeObserver.removeOnPreDrawListener(this);
|
|
}
|
|
this.a.clear();
|
|
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.b.getLayoutParams();
|
|
layoutParams.height = ((View) this.b.getParent()).getWidth();
|
|
this.b.setLayoutParams(layoutParams);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public MaxNativeAdView(MaxNativeAd maxNativeAd, Activity activity) {
|
|
this(maxNativeAd, (String) null, activity);
|
|
}
|
|
|
|
private void b() {
|
|
ViewGroup viewGroup = (ViewGroup) findViewById(R.id.applovin_native_inner_parent_layout);
|
|
if (viewGroup == null) {
|
|
return;
|
|
}
|
|
ViewTreeObserver viewTreeObserver = getViewTreeObserver();
|
|
if (viewTreeObserver.isAlive()) {
|
|
viewTreeObserver.addOnPreDrawListener(new a(new WeakReference(viewTreeObserver), viewGroup));
|
|
}
|
|
}
|
|
|
|
@Nullable
|
|
public b getAdViewTracker() {
|
|
return this.n;
|
|
}
|
|
|
|
public TextView getAdvertiserTextView() {
|
|
return this.c;
|
|
}
|
|
|
|
public TextView getBodyTextView() {
|
|
return this.d;
|
|
}
|
|
|
|
public Button getCallToActionButton() {
|
|
return this.f;
|
|
}
|
|
|
|
public List<View> getClickableViews() {
|
|
ArrayList arrayList = new ArrayList(5);
|
|
TextView textView = this.b;
|
|
if (textView != null) {
|
|
arrayList.add(textView);
|
|
}
|
|
TextView textView2 = this.c;
|
|
if (textView2 != null) {
|
|
arrayList.add(textView2);
|
|
}
|
|
TextView textView3 = this.d;
|
|
if (textView3 != null) {
|
|
arrayList.add(textView3);
|
|
}
|
|
Button button = this.f;
|
|
if (button != null) {
|
|
arrayList.add(button);
|
|
}
|
|
ImageView imageView = this.g;
|
|
if (imageView != null) {
|
|
arrayList.add(imageView);
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
@Deprecated
|
|
public FrameLayout getIconContentView() {
|
|
return this.h;
|
|
}
|
|
|
|
public ImageView getIconImageView() {
|
|
return this.g;
|
|
}
|
|
|
|
public View getMainView() {
|
|
return this.a;
|
|
}
|
|
|
|
@Deprecated
|
|
public FrameLayout getMediaContentView() {
|
|
return this.m;
|
|
}
|
|
|
|
public ViewGroup getMediaContentViewGroup() {
|
|
ViewGroup viewGroup = this.l;
|
|
return viewGroup != null ? viewGroup : this.m;
|
|
}
|
|
|
|
@Deprecated
|
|
public FrameLayout getOptionsContentView() {
|
|
return this.j;
|
|
}
|
|
|
|
public ViewGroup getOptionsContentViewGroup() {
|
|
ViewGroup viewGroup = this.i;
|
|
return viewGroup != null ? viewGroup : this.j;
|
|
}
|
|
|
|
public ViewGroup getStarRatingContentViewGroup() {
|
|
return this.k;
|
|
}
|
|
|
|
public TextView getTitleTextView() {
|
|
return this.b;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
b bVar = this.n;
|
|
if (bVar != null) {
|
|
bVar.c();
|
|
}
|
|
if (isHardwareAccelerated()) {
|
|
return;
|
|
}
|
|
n.j("MaxNativeAdView", "Attached to non-hardware accelerated window: some native ad views require hardware accelerated Activities to render properly.");
|
|
}
|
|
|
|
public void recycle() {
|
|
setOnClickListener(null);
|
|
b bVar = this.n;
|
|
if (bVar != null) {
|
|
bVar.a();
|
|
this.n = null;
|
|
}
|
|
View view = this.a;
|
|
if (view == null || view.getParent() == this) {
|
|
return;
|
|
}
|
|
ViewGroup viewGroup = (ViewGroup) this.a.getParent();
|
|
if (viewGroup != null) {
|
|
viewGroup.removeAllViews();
|
|
removeView(viewGroup);
|
|
}
|
|
addView(this.a);
|
|
}
|
|
|
|
public MaxNativeAdView(String str, Context context) {
|
|
this((MaxNativeAd) null, str, context);
|
|
}
|
|
|
|
private int a(String str, MaxAdFormat maxAdFormat) {
|
|
if (maxAdFormat == MaxAdFormat.NATIVE) {
|
|
if ("small_template_1".equalsIgnoreCase(str)) {
|
|
return R.layout.max_native_ad_small_template_1;
|
|
}
|
|
if (MEDIUM_TEMPLATE_1.equalsIgnoreCase(str)) {
|
|
return R.layout.max_native_ad_medium_template_1;
|
|
}
|
|
throw new IllegalArgumentException("Attempting to render MAX native ad with invalid format: " + str);
|
|
}
|
|
if (maxAdFormat == MaxAdFormat.BANNER) {
|
|
return "vertical_banner_template".equals(str) ? R.layout.max_native_ad_vertical_banner_view : ("media_banner_template".equals(str) || "no_body_banner_template".equals(str)) ? R.layout.max_native_ad_media_banner_view : "vertical_media_banner_template".equals(str) ? R.layout.max_native_ad_vertical_media_banner_view : R.layout.max_native_ad_banner_view;
|
|
}
|
|
if (maxAdFormat == MaxAdFormat.LEADER) {
|
|
return "vertical_leader_template".equals(str) ? R.layout.max_native_ad_vertical_leader_view : R.layout.max_native_ad_leader_view;
|
|
}
|
|
if (maxAdFormat == MaxAdFormat.MREC) {
|
|
return R.layout.max_native_ad_mrec_view;
|
|
}
|
|
throw new IllegalArgumentException("Unsupported ad format: " + maxAdFormat);
|
|
}
|
|
|
|
@Deprecated
|
|
public MaxNativeAdView(@Nullable MaxNativeAd maxNativeAd, @Nullable String str, Activity activity) {
|
|
this(maxNativeAd, str, activity.getApplicationContext());
|
|
}
|
|
|
|
public void renderCustomNativeAdView(MaxNativeAd maxNativeAd) {
|
|
TextView textView = this.b;
|
|
if (textView != null) {
|
|
textView.setText(maxNativeAd.getTitle());
|
|
}
|
|
TextView textView2 = this.d;
|
|
if (textView2 != null) {
|
|
textView2.setText(maxNativeAd.getBody());
|
|
}
|
|
TextView textView3 = this.c;
|
|
if (textView3 != null) {
|
|
textView3.setText(maxNativeAd.getAdvertiser());
|
|
}
|
|
Button button = this.f;
|
|
if (button != null) {
|
|
button.setText(maxNativeAd.getCallToAction());
|
|
}
|
|
MaxNativeAd.MaxNativeAdImage icon = maxNativeAd.getIcon();
|
|
ImageView imageView = this.g;
|
|
if (imageView != null) {
|
|
if (icon != null) {
|
|
if (icon.getDrawable() != null) {
|
|
this.g.setImageDrawable(icon.getDrawable());
|
|
} else if (icon.getUri() != null) {
|
|
ImageViewUtils.setAndDownscaleImageUri(this.g, icon.getUri());
|
|
} else {
|
|
this.g.setImageDrawable(null);
|
|
}
|
|
} else {
|
|
imageView.setImageDrawable(null);
|
|
}
|
|
}
|
|
View mediaView = maxNativeAd.getMediaView();
|
|
ViewGroup viewGroup = this.l;
|
|
if (viewGroup != null) {
|
|
viewGroup.removeAllViews();
|
|
if (mediaView != null) {
|
|
ViewParent parent = mediaView.getParent();
|
|
if (parent != null) {
|
|
((ViewGroup) parent).removeAllViews();
|
|
}
|
|
mediaView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
|
|
this.l.addView(mediaView);
|
|
}
|
|
}
|
|
View optionsView = maxNativeAd.getOptionsView();
|
|
ViewGroup viewGroup2 = this.i;
|
|
if (viewGroup2 != null) {
|
|
viewGroup2.removeAllViews();
|
|
if (optionsView != null) {
|
|
ViewParent parent2 = optionsView.getParent();
|
|
if (parent2 != null) {
|
|
((ViewGroup) parent2).removeAllViews();
|
|
}
|
|
optionsView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
|
|
this.i.addView(optionsView);
|
|
this.i.bringToFront();
|
|
}
|
|
}
|
|
ViewGroup viewGroup3 = this.k;
|
|
if (viewGroup3 != null) {
|
|
viewGroup3.removeAllViews();
|
|
Double starRating = maxNativeAd.getStarRating();
|
|
if (starRating != null) {
|
|
AppLovinStarRatingView appLovinStarRatingView = new AppLovinStarRatingView(starRating, getContext());
|
|
appLovinStarRatingView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
|
|
this.k.addView(appLovinStarRatingView);
|
|
}
|
|
}
|
|
}
|
|
|
|
public MaxNativeAdView(@Nullable MaxNativeAd maxNativeAd, @Nullable String str, Context context) {
|
|
this(maxNativeAd, new MaxNativeAdViewBinder.Builder(-1).setTemplateType(str).setTitleTextViewId(R.id.applovin_native_title_text_view).setAdvertiserTextViewId(R.id.applovin_native_advertiser_text_view).setBodyTextViewId(R.id.applovin_native_body_text_view).setCallToActionButtonId(R.id.applovin_native_cta_button).setIconImageViewId(R.id.applovin_native_icon_image_view).setIconContentViewId(R.id.applovin_native_icon_view).setOptionsContentViewGroupId(R.id.applovin_native_options_view).setOptionsContentFrameLayoutId(R.id.applovin_native_options_view).setStarRatingContentViewGroupId(R.id.applovin_native_star_rating_view).setMediaContentViewGroupId(R.id.applovin_native_media_content_view).setMediaContentFrameLayoutId(R.id.applovin_native_media_content_view).build(), context);
|
|
}
|
|
|
|
public MaxNativeAdView(MaxNativeAdViewBinder maxNativeAdViewBinder, Context context) {
|
|
this((MaxNativeAd) null, maxNativeAdViewBinder, context);
|
|
}
|
|
|
|
public MaxNativeAdView(@Nullable MaxNativeAd maxNativeAd, MaxNativeAdViewBinder maxNativeAdViewBinder, Context context) {
|
|
super(context);
|
|
int i;
|
|
boolean z = maxNativeAdViewBinder.templateType != null;
|
|
MaxAdFormat format = maxNativeAd != null ? maxNativeAd.getFormat() : MaxAdFormat.NATIVE;
|
|
View view = maxNativeAdViewBinder.mainView;
|
|
if (view != null) {
|
|
this.a = view;
|
|
} else {
|
|
if (z) {
|
|
i = a(maxNativeAdViewBinder.templateType, format);
|
|
} else {
|
|
i = maxNativeAdViewBinder.layoutResourceId;
|
|
}
|
|
this.a = LayoutInflater.from(context).inflate(i, (ViewGroup) this, false);
|
|
}
|
|
addView(this.a);
|
|
this.b = (TextView) findViewById(maxNativeAdViewBinder.titleTextViewId);
|
|
this.c = (TextView) findViewById(maxNativeAdViewBinder.advertiserTextViewId);
|
|
this.d = (TextView) findViewById(maxNativeAdViewBinder.bodyTextViewId);
|
|
this.f = (Button) findViewById(maxNativeAdViewBinder.callToActionButtonId);
|
|
this.g = (ImageView) findViewById(maxNativeAdViewBinder.iconImageViewId);
|
|
this.h = (FrameLayout) findViewById(maxNativeAdViewBinder.iconContentViewId);
|
|
this.i = (ViewGroup) findViewById(maxNativeAdViewBinder.optionsContentViewGroupId);
|
|
this.j = (FrameLayout) findViewById(maxNativeAdViewBinder.optionsContentFrameLayoutId);
|
|
this.k = (ViewGroup) findViewById(maxNativeAdViewBinder.starRatingContentViewGroupId);
|
|
this.l = (ViewGroup) findViewById(maxNativeAdViewBinder.mediaContentViewGroupId);
|
|
this.m = (FrameLayout) findViewById(maxNativeAdViewBinder.mediaContentFrameLayoutId);
|
|
if (maxNativeAd != null) {
|
|
a(maxNativeAd);
|
|
}
|
|
}
|
|
|
|
private void a(MaxNativeAd maxNativeAd) {
|
|
if (this.b == null) {
|
|
n.j("MaxNativeAdView", "Rendering template ad view without title text view");
|
|
} else if (StringUtils.isValidString(maxNativeAd.getTitle())) {
|
|
this.b.setText(maxNativeAd.getTitle());
|
|
} else {
|
|
this.b.setVisibility(8);
|
|
}
|
|
if (this.c != null) {
|
|
if (StringUtils.isValidString(maxNativeAd.getAdvertiser())) {
|
|
this.c.setText(maxNativeAd.getAdvertiser());
|
|
} else {
|
|
this.c.setVisibility(8);
|
|
}
|
|
}
|
|
if (this.d != null) {
|
|
if (StringUtils.isValidString(maxNativeAd.getBody())) {
|
|
this.d.setText(maxNativeAd.getBody());
|
|
} else if (maxNativeAd.getFormat() != MaxAdFormat.NATIVE && maxNativeAd.getFormat() != MaxAdFormat.MREC) {
|
|
this.d.setVisibility(4);
|
|
} else {
|
|
this.d.setVisibility(8);
|
|
}
|
|
}
|
|
if (this.f != null) {
|
|
if (StringUtils.isValidString(maxNativeAd.getCallToAction())) {
|
|
this.f.setText(maxNativeAd.getCallToAction());
|
|
} else if (maxNativeAd.getFormat() != MaxAdFormat.NATIVE && maxNativeAd.getFormat() != MaxAdFormat.MREC) {
|
|
this.f.setVisibility(4);
|
|
} else {
|
|
this.f.setVisibility(8);
|
|
}
|
|
}
|
|
MaxNativeAd.MaxNativeAdImage icon = maxNativeAd.getIcon();
|
|
View iconView = maxNativeAd.getIconView();
|
|
FrameLayout frameLayout = this.h;
|
|
if (frameLayout != null) {
|
|
if (icon == null || this.g == null) {
|
|
if (iconView != null) {
|
|
iconView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
|
|
this.h.removeAllViews();
|
|
this.h.addView(iconView);
|
|
} else {
|
|
frameLayout.setVisibility(8);
|
|
}
|
|
} else if (icon.getDrawable() != null) {
|
|
this.g.setImageDrawable(icon.getDrawable());
|
|
} else if (icon.getUri() != null && StringUtils.isValidString(icon.getUri().toString())) {
|
|
ImageViewUtils.setAndDownscaleImageUri(this.g, icon.getUri());
|
|
} else {
|
|
this.h.setVisibility(8);
|
|
}
|
|
}
|
|
View optionsView = maxNativeAd.getOptionsView();
|
|
FrameLayout frameLayout2 = this.j;
|
|
if (frameLayout2 != null && optionsView != null) {
|
|
optionsView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
|
|
this.j.addView(optionsView);
|
|
this.j.bringToFront();
|
|
} else if (frameLayout2 != null) {
|
|
frameLayout2.setVisibility(8);
|
|
}
|
|
View mediaView = maxNativeAd.getMediaView();
|
|
if (this.m != null) {
|
|
if (mediaView != null) {
|
|
mediaView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
|
|
this.m.addView(mediaView);
|
|
} else if (maxNativeAd.getFormat() == MaxAdFormat.LEADER) {
|
|
this.m.setVisibility(8);
|
|
}
|
|
}
|
|
if (this.k != null) {
|
|
Double starRating = maxNativeAd.getStarRating();
|
|
if (starRating != null) {
|
|
this.k.removeAllViews();
|
|
AppLovinStarRatingView appLovinStarRatingView = new AppLovinStarRatingView(starRating, getContext());
|
|
appLovinStarRatingView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
|
|
this.k.addView(appLovinStarRatingView);
|
|
} else {
|
|
this.k.setVisibility(8);
|
|
}
|
|
}
|
|
b();
|
|
postDelayed(new Runnable() { // from class: com.applovin.mediation.nativeAds.MaxNativeAdView$$ExternalSyntheticLambda1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
MaxNativeAdView.this.a();
|
|
}
|
|
}, 2000L);
|
|
}
|
|
|
|
public void render(je jeVar, a.InterfaceC0026a interfaceC0026a, j jVar) {
|
|
recycle();
|
|
if (!jeVar.u0().get() || !jeVar.s0().get()) {
|
|
this.n = new b(jeVar, this, interfaceC0026a, jVar);
|
|
}
|
|
final MaxNativeAd nativeAd = jeVar.getNativeAd();
|
|
if (jeVar.v0() && nativeAd.isContainerClickable()) {
|
|
jVar.J();
|
|
if (n.a()) {
|
|
jVar.J().a("MaxNativeAdView", "Enabling container click");
|
|
}
|
|
setOnClickListener(new View.OnClickListener() { // from class: com.applovin.mediation.nativeAds.MaxNativeAdView$$ExternalSyntheticLambda0
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
MaxNativeAd.this.performClick();
|
|
}
|
|
});
|
|
}
|
|
if (StringUtils.isValidString(jeVar.t0())) {
|
|
jVar.J();
|
|
if (n.a()) {
|
|
jVar.J().a("MaxNativeAdView", "Rendering template ad view");
|
|
}
|
|
a(nativeAd);
|
|
return;
|
|
}
|
|
jVar.J();
|
|
if (n.a()) {
|
|
jVar.J().a("MaxNativeAdView", "Rendering custom ad view");
|
|
}
|
|
renderCustomNativeAdView(nativeAd);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a() {
|
|
setSelected(true);
|
|
}
|
|
}
|