- 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
711 lines
30 KiB
Java
711 lines
30 KiB
Java
package com.applovin.impl.sdk.nativeAd;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.graphics.drawable.AnimatedVectorDrawable;
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.os.SystemClock;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.core.view.ViewCompat;
|
|
import com.applovin.communicator.AppLovinCommunicator;
|
|
import com.applovin.communicator.AppLovinCommunicatorMessage;
|
|
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
|
|
import com.applovin.exoplayer2.ui.d;
|
|
import com.applovin.impl.adview.AppLovinTouchToClickListener;
|
|
import com.applovin.impl.aq;
|
|
import com.applovin.impl.be;
|
|
import com.applovin.impl.bi;
|
|
import com.applovin.impl.ck;
|
|
import com.applovin.impl.fq;
|
|
import com.applovin.impl.gq;
|
|
import com.applovin.impl.kq;
|
|
import com.applovin.impl.lq;
|
|
import com.applovin.impl.mq;
|
|
import com.applovin.impl.nh;
|
|
import com.applovin.impl.oq;
|
|
import com.applovin.impl.p;
|
|
import com.applovin.impl.qh;
|
|
import com.applovin.impl.r;
|
|
import com.applovin.impl.sdk.j;
|
|
import com.applovin.impl.sdk.n;
|
|
import com.applovin.impl.sdk.nativeAd.AppLovinVastMediaView;
|
|
import com.applovin.impl.sdk.utils.ImageViewUtils;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import com.applovin.impl.sj;
|
|
import com.applovin.impl.td;
|
|
import com.applovin.impl.tp;
|
|
import com.applovin.impl.v4;
|
|
import com.applovin.impl.w5;
|
|
import com.applovin.impl.xp;
|
|
import com.applovin.impl.yp;
|
|
import com.applovin.impl.z3;
|
|
import com.applovin.impl.zq;
|
|
import com.applovin.sdk.AppLovinSdkUtils;
|
|
import com.applovin.sdk.R;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.Set;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
@SuppressLint({"ViewConstructor"})
|
|
/* loaded from: classes2.dex */
|
|
public class AppLovinVastMediaView extends AppLovinMediaView implements AppLovinCommunicatorSubscriber {
|
|
private static final String COUNTDOWN_IDENTIFIER_PROGRESS_TRACKING = "PROGRESS_TRACKING";
|
|
private static final long FADE_ANIMATION_DURATION_MILLIS = 250;
|
|
private static final String TAG = "AppLovinVastMediaView";
|
|
private final AtomicBoolean automaticPauseHandled;
|
|
private final AtomicBoolean automaticResumeHandled;
|
|
private final Handler countdownHandler;
|
|
private final v4 countdownManager;
|
|
|
|
@Nullable
|
|
private ImageView industryIconImageView;
|
|
private final AtomicBoolean initialOnAttachedToWindowHandled;
|
|
private boolean isVideoMuted;
|
|
private boolean isVideoPausedByUser;
|
|
private final boolean isVideoStream;
|
|
private long lastVideoPositionFromPauseMillis;
|
|
private final p lifecycleCallbacksAdapter;
|
|
private final AtomicBoolean mediaErrorHandled;
|
|
private final ck mediaPlayer;
|
|
|
|
@Nullable
|
|
private ImageView muteButtonImageView;
|
|
|
|
@Nullable
|
|
private ImageView playPauseButtonImageView;
|
|
|
|
@Nullable
|
|
private FrameLayout replayIconContainer;
|
|
private int savedVideoPercentViewed;
|
|
private long startTimeMillis;
|
|
private final aq vastAd;
|
|
private long videoDurationMillis;
|
|
private final AtomicBoolean videoEndListenerNotified;
|
|
private final Set<kq> videoProgressTrackers;
|
|
private final com.applovin.exoplayer2.ui.e videoView;
|
|
private boolean videoWasCompleted;
|
|
|
|
@Nullable
|
|
private LinearLayout videoWidgetLinearLayout;
|
|
private Activity viewActivity;
|
|
|
|
public class a extends p {
|
|
public a() {
|
|
}
|
|
|
|
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
|
|
public void onActivityPaused(Activity activity) {
|
|
if (activity.equals(AppLovinVastMediaView.this.viewActivity)) {
|
|
AppLovinVastMediaView.this.maybeHandlePause();
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
|
|
public void onActivityResumed(Activity activity) {
|
|
if (!activity.equals(AppLovinVastMediaView.this.viewActivity) || AppLovinVastMediaView.this.isVideoPausedByUser) {
|
|
return;
|
|
}
|
|
AppLovinVastMediaView.this.maybeHandleResume();
|
|
}
|
|
}
|
|
|
|
public class b implements v4.b {
|
|
public b() {
|
|
}
|
|
|
|
@Override // com.applovin.impl.v4.b
|
|
public void a() {
|
|
long seconds = TimeUnit.MILLISECONDS.toSeconds(AppLovinVastMediaView.this.videoDurationMillis - (AppLovinVastMediaView.this.mediaPlayer.getDuration() - AppLovinVastMediaView.this.mediaPlayer.getCurrentPosition()));
|
|
int videoPercentViewed = AppLovinVastMediaView.this.getVideoPercentViewed();
|
|
HashSet hashSet = new HashSet();
|
|
Iterator it = new HashSet(AppLovinVastMediaView.this.videoProgressTrackers).iterator();
|
|
while (it.hasNext()) {
|
|
kq kqVar = (kq) it.next();
|
|
if (kqVar.a(seconds, videoPercentViewed)) {
|
|
hashSet.add(kqVar);
|
|
AppLovinVastMediaView.this.videoProgressTrackers.remove(kqVar);
|
|
}
|
|
}
|
|
AppLovinVastMediaView.this.maybeFireTrackers(hashSet);
|
|
if (videoPercentViewed >= 25 && videoPercentViewed < 50) {
|
|
AppLovinVastMediaView.this.vastAd.getAdEventTracker().x();
|
|
return;
|
|
}
|
|
if (videoPercentViewed >= 50 && videoPercentViewed < 75) {
|
|
AppLovinVastMediaView.this.vastAd.getAdEventTracker().y();
|
|
} else if (videoPercentViewed >= 75) {
|
|
AppLovinVastMediaView.this.vastAd.getAdEventTracker().C();
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.v4.b
|
|
public boolean b() {
|
|
return !AppLovinVastMediaView.this.videoWasCompleted;
|
|
}
|
|
}
|
|
|
|
public class c implements View.OnClickListener {
|
|
private c() {
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
Uri b;
|
|
gq p1 = AppLovinVastMediaView.this.vastAd.p1();
|
|
if (p1 == null || (b = p1.b()) == null) {
|
|
return;
|
|
}
|
|
n nVar = AppLovinVastMediaView.this.logger;
|
|
if (n.a()) {
|
|
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Industry icon clicked, opening URL: " + b);
|
|
}
|
|
AppLovinVastMediaView.this.maybeFireTrackers(aq.d.INDUSTRY_ICON_CLICK);
|
|
tp.a(b, view.getContext(), AppLovinVastMediaView.this.sdk);
|
|
}
|
|
|
|
public /* synthetic */ c(AppLovinVastMediaView appLovinVastMediaView, a aVar) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
public class d implements AppLovinTouchToClickListener.OnClickListener {
|
|
private final AppLovinNativeAdImpl a;
|
|
|
|
public d(AppLovinNativeAdImpl appLovinNativeAdImpl) {
|
|
this.a = appLovinNativeAdImpl;
|
|
}
|
|
|
|
@Override // com.applovin.impl.adview.AppLovinTouchToClickListener.OnClickListener
|
|
public void onClick(View view, MotionEvent motionEvent) {
|
|
Uri k0;
|
|
AppLovinVastMediaView.this.maybeFireTrackers(aq.d.VIDEO_CLICK);
|
|
AppLovinVastMediaView.this.vastAd.getAdEventTracker().v();
|
|
if (AppLovinVastMediaView.this.vastAd.H0() && (k0 = AppLovinVastMediaView.this.vastAd.k0()) != null) {
|
|
n nVar = AppLovinVastMediaView.this.logger;
|
|
if (n.a()) {
|
|
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Clicking through video");
|
|
}
|
|
AppLovinVastMediaView.this.sdk.i().maybeSubmitPersistentPostbacks(AppLovinVastMediaView.this.vastAd.a(motionEvent, false));
|
|
this.a.handleNativeAdClick(k0, null, motionEvent, (!((Boolean) AppLovinVastMediaView.this.sdk.a(sj.F)).booleanValue() || AppLovinVastMediaView.this.viewActivity == null) ? AppLovinVastMediaView.this.getContext() : AppLovinVastMediaView.this.viewActivity);
|
|
}
|
|
}
|
|
}
|
|
|
|
public class e implements qh.c, d.e {
|
|
private e() {
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void c() {
|
|
AppLovinVastMediaView.this.mediaPlayer.a(0L);
|
|
}
|
|
|
|
@Override // com.applovin.impl.qh.c
|
|
public void b(int i) {
|
|
n nVar = AppLovinVastMediaView.this.logger;
|
|
if (n.a()) {
|
|
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Player state changed to state " + i + " and will play when ready: " + AppLovinVastMediaView.this.mediaPlayer.l());
|
|
}
|
|
if (i != 3) {
|
|
if (i == 4) {
|
|
n nVar2 = AppLovinVastMediaView.this.logger;
|
|
if (n.a()) {
|
|
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Video completed");
|
|
}
|
|
AppLovinVastMediaView.this.videoWasCompleted = true;
|
|
AppLovinVastMediaView.this.finishVideo();
|
|
if (AppLovinVastMediaView.this.replayIconContainer != null) {
|
|
zq.a(AppLovinVastMediaView.this.replayIconContainer, AppLovinVastMediaView.FADE_ANIMATION_DURATION_MILLIS, new Runnable() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinVastMediaView$e$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
AppLovinVastMediaView.e.this.c();
|
|
}
|
|
});
|
|
return;
|
|
} else {
|
|
AppLovinVastMediaView.this.showMediaImageView();
|
|
return;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
AppLovinVastMediaView.this.mediaPlayer.a(!AppLovinVastMediaView.this.isVideoMuted ? 1 : 0);
|
|
AppLovinVastMediaView appLovinVastMediaView = AppLovinVastMediaView.this;
|
|
appLovinVastMediaView.videoDurationMillis = appLovinVastMediaView.mediaPlayer.getDuration();
|
|
AppLovinVastMediaView.this.vastAd.getAdEventTracker().b(TimeUnit.MILLISECONDS.toSeconds(AppLovinVastMediaView.this.videoDurationMillis), yp.e(AppLovinVastMediaView.this.sdk));
|
|
n nVar3 = AppLovinVastMediaView.this.logger;
|
|
if (n.a()) {
|
|
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "MediaPlayer prepared: " + AppLovinVastMediaView.this.mediaPlayer);
|
|
}
|
|
AppLovinVastMediaView.this.countdownManager.b();
|
|
}
|
|
|
|
@Override // com.applovin.exoplayer2.ui.d.e
|
|
public void d(int i) {
|
|
if (i == 0) {
|
|
AppLovinVastMediaView.this.videoView.c();
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ e(AppLovinVastMediaView appLovinVastMediaView, a aVar) {
|
|
this();
|
|
}
|
|
|
|
@Override // com.applovin.impl.qh.c
|
|
public void a(nh nhVar) {
|
|
AppLovinVastMediaView.this.handleMediaError("Video view error (" + yp.a(nhVar) + ")");
|
|
}
|
|
}
|
|
|
|
public class f implements View.OnClickListener {
|
|
private f() {
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a() {
|
|
AppLovinVastMediaView.this.videoWasCompleted = false;
|
|
AppLovinVastMediaView.this.automaticResumeHandled.set(false);
|
|
AppLovinVastMediaView.this.sdk.e().a(AppLovinVastMediaView.this.lifecycleCallbacksAdapter);
|
|
AppLovinVastMediaView.this.maybeHandleResume();
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (view == AppLovinVastMediaView.this.playPauseButtonImageView) {
|
|
if (AppLovinVastMediaView.this.mediaPlayer.isPlaying()) {
|
|
AppLovinVastMediaView.this.isVideoPausedByUser = true;
|
|
AppLovinVastMediaView.this.maybeHandlePause();
|
|
return;
|
|
} else {
|
|
AppLovinVastMediaView.this.isVideoPausedByUser = false;
|
|
AppLovinVastMediaView.this.maybeHandleResume();
|
|
return;
|
|
}
|
|
}
|
|
if (view != AppLovinVastMediaView.this.muteButtonImageView) {
|
|
if (view == AppLovinVastMediaView.this.replayIconContainer) {
|
|
zq.b(AppLovinVastMediaView.this.replayIconContainer, AppLovinVastMediaView.FADE_ANIMATION_DURATION_MILLIS, new Runnable() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinVastMediaView$f$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
AppLovinVastMediaView.f.this.a();
|
|
}
|
|
});
|
|
}
|
|
} else {
|
|
boolean z = AppLovinVastMediaView.this.isVideoMuted;
|
|
boolean z2 = !z;
|
|
AppLovinVastMediaView.this.isVideoMuted = z2;
|
|
AppLovinVastMediaView.this.mediaPlayer.a(z ? 1.0f : 0.0f);
|
|
AppLovinVastMediaView.this.populateMuteImage(z2);
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ f(AppLovinVastMediaView appLovinVastMediaView, a aVar) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
public AppLovinVastMediaView(AppLovinNativeAdImpl appLovinNativeAdImpl, j jVar, Context context) {
|
|
super(appLovinNativeAdImpl, jVar, context);
|
|
int i;
|
|
Handler handler = new Handler(Looper.getMainLooper());
|
|
this.countdownHandler = handler;
|
|
this.countdownManager = new v4(handler, this.sdk);
|
|
this.videoEndListenerNotified = new AtomicBoolean();
|
|
this.mediaErrorHandled = new AtomicBoolean();
|
|
this.initialOnAttachedToWindowHandled = new AtomicBoolean();
|
|
this.automaticPauseHandled = new AtomicBoolean();
|
|
this.automaticResumeHandled = new AtomicBoolean();
|
|
this.isVideoMuted = true;
|
|
this.lastVideoPositionFromPauseMillis = -1L;
|
|
HashSet hashSet = new HashSet();
|
|
this.videoProgressTrackers = hashSet;
|
|
this.lifecycleCallbacksAdapter = new a();
|
|
aq vastAd = appLovinNativeAdImpl.getVastAd();
|
|
this.vastAd = vastAd;
|
|
boolean I0 = vastAd.I0();
|
|
this.isVideoStream = I0;
|
|
if (I0) {
|
|
AppLovinCommunicator.getInstance(context).subscribe(this, "video_caching_failed");
|
|
}
|
|
a aVar = null;
|
|
if (vastAd.v1()) {
|
|
this.industryIconImageView = gq.a(vastAd.p1().d(), context, jVar);
|
|
int dpToPx = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.a5)).intValue());
|
|
this.industryIconImageView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx, dpToPx, ((Integer) jVar.a(sj.c5)).intValue()));
|
|
this.industryIconImageView.setOnClickListener(new c(this, aVar));
|
|
addView(this.industryIconImageView);
|
|
}
|
|
if (((Boolean) jVar.a(sj.h5)).booleanValue()) {
|
|
LinearLayout linearLayout = new LinearLayout(context);
|
|
this.videoWidgetLinearLayout = linearLayout;
|
|
linearLayout.setOrientation(0);
|
|
this.videoWidgetLinearLayout.setBackgroundResource(R.drawable.applovin_rounded_black_background);
|
|
this.videoWidgetLinearLayout.setAlpha(((Float) jVar.a(sj.g5)).floatValue());
|
|
ImageView imageView = new ImageView(context);
|
|
this.playPauseButtonImageView = imageView;
|
|
imageView.setClickable(true);
|
|
f fVar = new f(this, aVar);
|
|
this.playPauseButtonImageView.setOnClickListener(fVar);
|
|
int dpToPx2 = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.e5)).intValue());
|
|
this.playPauseButtonImageView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx2, dpToPx2));
|
|
populatePlayPauseImage(false);
|
|
this.videoWidgetLinearLayout.addView(this.playPauseButtonImageView);
|
|
this.muteButtonImageView = new ImageView(context);
|
|
if (populateMuteImage(this.isVideoMuted)) {
|
|
i = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.d5)).intValue());
|
|
this.muteButtonImageView.setClickable(true);
|
|
this.muteButtonImageView.setOnClickListener(fVar);
|
|
this.muteButtonImageView.setLayoutParams(new FrameLayout.LayoutParams(i, i));
|
|
this.videoWidgetLinearLayout.addView(this.muteButtonImageView);
|
|
} else {
|
|
i = 0;
|
|
}
|
|
int dpToPx3 = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.f5)).intValue());
|
|
this.videoWidgetLinearLayout.setPadding(dpToPx3, dpToPx3, dpToPx3, dpToPx3);
|
|
int i2 = dpToPx3 * 2;
|
|
this.videoWidgetLinearLayout.setLayoutParams(new FrameLayout.LayoutParams(dpToPx2 + i + i2, Math.max(dpToPx2, i) + i2, 8388691));
|
|
addView(this.videoWidgetLinearLayout);
|
|
}
|
|
if (((Boolean) jVar.a(sj.i5)).booleanValue()) {
|
|
FrameLayout frameLayout = new FrameLayout(getContext());
|
|
this.replayIconContainer = frameLayout;
|
|
frameLayout.setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
|
|
this.replayIconContainer.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
|
|
this.replayIconContainer.setVisibility(4);
|
|
this.replayIconContainer.setOnClickListener(new f(this, aVar));
|
|
ImageView imageView2 = new ImageView(getContext());
|
|
int dpToPx4 = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.j5)).intValue());
|
|
imageView2.setLayoutParams(new FrameLayout.LayoutParams(dpToPx4, dpToPx4, 17));
|
|
imageView2.setImageResource(R.drawable.applovin_ic_replay_icon);
|
|
imageView2.setAdjustViewBounds(true);
|
|
imageView2.setMaxHeight(this.replayIconContainer.getHeight());
|
|
imageView2.setMaxWidth(this.replayIconContainer.getWidth());
|
|
this.replayIconContainer.addView(imageView2);
|
|
addView(this.replayIconContainer);
|
|
}
|
|
ck a2 = new ck.b(getContext()).a();
|
|
this.mediaPlayer = a2;
|
|
e eVar = new e(this, aVar);
|
|
a2.a((qh.c) eVar);
|
|
a2.a(0);
|
|
com.applovin.exoplayer2.ui.e eVar2 = new com.applovin.exoplayer2.ui.e(getContext());
|
|
this.videoView = eVar2;
|
|
eVar2.c();
|
|
eVar2.setControllerVisibilityListener(eVar);
|
|
eVar2.setPlayer(a2);
|
|
eVar2.setOnTouchListener(new AppLovinTouchToClickListener(jVar, sj.E0, getContext(), new d(appLovinNativeAdImpl)));
|
|
addView(eVar2);
|
|
bringChildToFront(this.industryIconImageView);
|
|
bringChildToFront(this.videoWidgetLinearLayout);
|
|
prepareMediaPlayer();
|
|
appLovinNativeAdImpl.setVideoView(eVar2);
|
|
hashSet.addAll(vastAd.a(aq.d.VIDEO, lq.a));
|
|
}
|
|
|
|
private void checkCachedAdResourcesImmediately(boolean z) {
|
|
if (yp.a(z, this.vastAd, this.sdk, getContext()).isEmpty()) {
|
|
return;
|
|
}
|
|
handleUnavailableCachedResources();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void finishVideo() {
|
|
maybeFireTrackers(aq.d.VIDEO, "close");
|
|
maybeHandlePause();
|
|
this.sdk.e().b(this.lifecycleCallbacksAdapter);
|
|
if (this.videoWasCompleted) {
|
|
maybeFireRemainingCompletionTrackers();
|
|
this.vastAd.getAdEventTracker().w();
|
|
}
|
|
if (this.videoEndListenerNotified.compareAndSet(false, true)) {
|
|
this.sdk.i().trackVideoEnd(this.vastAd, TimeUnit.MILLISECONDS.toSeconds(SystemClock.elapsedRealtime() - this.startTimeMillis), getVideoPercentViewed(), this.isVideoStream);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public int getVideoPercentViewed() {
|
|
long currentPosition = this.mediaPlayer.getCurrentPosition();
|
|
if (this.videoWasCompleted) {
|
|
return 100;
|
|
}
|
|
return currentPosition > 0 ? (int) ((currentPosition / this.videoDurationMillis) * 100.0f) : this.savedVideoPercentViewed;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void handleMediaError(String str) {
|
|
if (n.a()) {
|
|
this.logger.b(TAG, str);
|
|
}
|
|
if (!StringUtils.containsAtLeastOneSubstring(str, this.sdk.c(sj.l5))) {
|
|
maybeFireTrackers(aq.d.ERROR, fq.MEDIA_FILE_ERROR);
|
|
this.vastAd.getAdEventTracker().b(str);
|
|
} else if (n.a()) {
|
|
this.logger.a(TAG, "Not firing trackers for media error: " + str);
|
|
}
|
|
if (!StringUtils.containsAtLeastOneSubstring(str, this.sdk.c(sj.X2))) {
|
|
if (this.mediaErrorHandled.compareAndSet(false, true)) {
|
|
this.sdk.E().a("handleVastVideoError", str, this.vastAd);
|
|
finishVideo();
|
|
showMediaImageView();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (n.a()) {
|
|
this.logger.a(TAG, "Ignoring media error: " + str);
|
|
}
|
|
}
|
|
|
|
private void handleUnavailableCachedResources() {
|
|
if (n.a()) {
|
|
this.logger.b(TAG, "Video failed due to unavailable resources");
|
|
}
|
|
finishVideo();
|
|
showMediaImageView();
|
|
}
|
|
|
|
private void maybeFireRemainingCompletionTrackers() {
|
|
if (getVideoPercentViewed() < this.vastAd.n0() || this.videoProgressTrackers.isEmpty()) {
|
|
return;
|
|
}
|
|
if (n.a()) {
|
|
this.logger.k(TAG, "Firing " + this.videoProgressTrackers.size() + " un-fired video progress trackers when video was completed.");
|
|
}
|
|
maybeFireTrackers(this.videoProgressTrackers);
|
|
}
|
|
|
|
private void maybeHandleOnAttachedToWindow() {
|
|
if (this.initialOnAttachedToWindowHandled.compareAndSet(false, true)) {
|
|
if (this.industryIconImageView != null && this.vastAd.v1()) {
|
|
maybeFireTrackers(aq.d.INDUSTRY_ICON_IMPRESSION);
|
|
this.industryIconImageView.setVisibility(0);
|
|
}
|
|
this.startTimeMillis = SystemClock.elapsedRealtime();
|
|
maybeFireTrackers(aq.d.IMPRESSION);
|
|
maybeFireTrackers(aq.d.VIDEO, "creativeView");
|
|
this.vastAd.getAdEventTracker().g();
|
|
this.vastAd.setHasShown(true);
|
|
this.sdk.i().trackImpression(this.vastAd);
|
|
this.viewActivity = r.a(zq.b(this));
|
|
this.sdk.e().a(this.lifecycleCallbacksAdapter);
|
|
this.mediaPlayer.a(true);
|
|
this.countdownManager.a(COUNTDOWN_IDENTIFIER_PROGRESS_TRACKING, TimeUnit.SECONDS.toMillis(1L), new b());
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void maybeHandlePause() {
|
|
if (this.automaticPauseHandled.compareAndSet(false, true)) {
|
|
maybeFireTrackers(aq.d.VIDEO, CampaignEx.JSON_NATIVE_VIDEO_PAUSE);
|
|
this.vastAd.getAdEventTracker().z();
|
|
pauseVideo();
|
|
populatePlayPauseImage(true);
|
|
this.automaticResumeHandled.set(false);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void maybeHandleResume() {
|
|
if (this.automaticResumeHandled.compareAndSet(false, true)) {
|
|
maybeFireTrackers(aq.d.VIDEO, CampaignEx.JSON_NATIVE_VIDEO_RESUME);
|
|
this.vastAd.getAdEventTracker().A();
|
|
if (this.lastVideoPositionFromPauseMillis >= 0) {
|
|
if (n.a()) {
|
|
this.logger.a(TAG, "Resuming video at position " + this.lastVideoPositionFromPauseMillis);
|
|
}
|
|
this.mediaPlayer.a(true);
|
|
this.countdownManager.b();
|
|
this.lastVideoPositionFromPauseMillis = -1L;
|
|
} else if (n.a()) {
|
|
this.logger.a(TAG, "Invalid last video position, isVideoPlaying=" + this.mediaPlayer.isPlaying());
|
|
}
|
|
populatePlayPauseImage(false);
|
|
this.automaticPauseHandled.set(false);
|
|
}
|
|
}
|
|
|
|
private void pauseVideo() {
|
|
if (n.a()) {
|
|
this.logger.a(TAG, "Pausing video");
|
|
}
|
|
this.savedVideoPercentViewed = getVideoPercentViewed();
|
|
this.lastVideoPositionFromPauseMillis = this.mediaPlayer.getCurrentPosition();
|
|
this.mediaPlayer.a(false);
|
|
this.countdownManager.c();
|
|
if (n.a()) {
|
|
this.logger.a(TAG, "Paused video at position " + this.lastVideoPositionFromPauseMillis + " ms");
|
|
}
|
|
}
|
|
|
|
private void prepareMediaPlayer() {
|
|
checkCachedAdResourcesImmediately(!this.isVideoStream);
|
|
bi a2 = new bi.b(new w5(getContext(), xp.a(getContext(), "com.applovin.sdk"))).a(td.a(this.vastAd.t0()));
|
|
this.mediaPlayer.a(!this.isVideoMuted ? 1 : 0);
|
|
this.mediaPlayer.a((be) a2);
|
|
this.mediaPlayer.b();
|
|
this.mediaPlayer.a(false);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void showMediaImageView() {
|
|
if (this.imageView.getDrawable() == null) {
|
|
return;
|
|
}
|
|
this.imageView.setVisibility(0);
|
|
this.videoView.setVisibility(8);
|
|
LinearLayout linearLayout = this.videoWidgetLinearLayout;
|
|
if (linearLayout != null) {
|
|
linearLayout.setVisibility(8);
|
|
}
|
|
ImageView imageView = this.industryIconImageView;
|
|
if (imageView != null) {
|
|
imageView.setVisibility(8);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.sdk.nativeAd.AppLovinMediaView
|
|
public void destroy() {
|
|
finishVideo();
|
|
ImageView imageView = this.industryIconImageView;
|
|
if (imageView != null) {
|
|
imageView.setOnClickListener(null);
|
|
}
|
|
ImageView imageView2 = this.playPauseButtonImageView;
|
|
if (imageView2 != null) {
|
|
imageView2.setOnClickListener(null);
|
|
}
|
|
ImageView imageView3 = this.muteButtonImageView;
|
|
if (imageView3 != null) {
|
|
imageView3.setOnClickListener(null);
|
|
}
|
|
FrameLayout frameLayout = this.replayIconContainer;
|
|
if (frameLayout != null) {
|
|
frameLayout.setOnClickListener(null);
|
|
}
|
|
this.videoView.setOnTouchListener(null);
|
|
this.viewActivity = null;
|
|
this.mediaPlayer.V();
|
|
this.vastAd.getAdEventTracker().f();
|
|
this.countdownManager.a();
|
|
this.countdownHandler.removeCallbacksAndMessages(null);
|
|
if (this.isVideoStream) {
|
|
AppLovinCommunicator.getInstance(getContext()).unsubscribe(this, "video_caching_failed");
|
|
}
|
|
super.destroy();
|
|
}
|
|
|
|
@Override // com.applovin.communicator.AppLovinCommunicatorEntity
|
|
public String getCommunicatorId() {
|
|
return TAG;
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
maybeHandleOnAttachedToWindow();
|
|
if (this.isVideoPausedByUser) {
|
|
return;
|
|
}
|
|
maybeHandleResume();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onDetachedFromWindow() {
|
|
maybeHandlePause();
|
|
super.onDetachedFromWindow();
|
|
}
|
|
|
|
@Override // com.applovin.communicator.AppLovinCommunicatorSubscriber
|
|
public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
|
|
if ("video_caching_failed".equals(appLovinCommunicatorMessage.getTopic())) {
|
|
Bundle messageData = appLovinCommunicatorMessage.getMessageData();
|
|
if (messageData.getLong("ad_id") == this.vastAd.getAdIdNumber() && this.isVideoStream) {
|
|
int i = messageData.getInt("load_response_code");
|
|
String string = messageData.getString("load_exception_message");
|
|
if ((string == null && i >= 200 && i < 300) || this.videoWasCompleted || this.mediaPlayer.isPlaying()) {
|
|
return;
|
|
}
|
|
handleMediaError("Video cache error during stream. ResponseCode=" + i + ", exception=" + string);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public boolean populateMuteImage(boolean z) {
|
|
if (this.muteButtonImageView == null) {
|
|
return false;
|
|
}
|
|
if (z3.f()) {
|
|
AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) getContext().getDrawable(z ? R.drawable.applovin_ic_unmute_to_mute : R.drawable.applovin_ic_mute_to_unmute);
|
|
if (animatedVectorDrawable != null) {
|
|
this.muteButtonImageView.setImageDrawable(animatedVectorDrawable);
|
|
animatedVectorDrawable.start();
|
|
return true;
|
|
}
|
|
}
|
|
Uri L = z ? this.vastAd.L() : this.vastAd.f0();
|
|
if (L == null) {
|
|
return false;
|
|
}
|
|
ImageViewUtils.setImageUri(this.muteButtonImageView, L, this.sdk);
|
|
return true;
|
|
}
|
|
|
|
private void populatePlayPauseImage(boolean z) {
|
|
ImageView imageView = this.playPauseButtonImageView;
|
|
if (imageView == null) {
|
|
return;
|
|
}
|
|
imageView.setImageResource(z ? R.drawable.applovin_ic_play_icon : R.drawable.applovin_ic_pause_icon);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void maybeFireTrackers(aq.d dVar) {
|
|
maybeFireTrackers(dVar, fq.UNSPECIFIED);
|
|
}
|
|
|
|
private void maybeFireTrackers(aq.d dVar, fq fqVar) {
|
|
maybeFireTrackers(dVar, "", fqVar);
|
|
}
|
|
|
|
private void maybeFireTrackers(aq.d dVar, String str) {
|
|
maybeFireTrackers(dVar, str, fq.UNSPECIFIED);
|
|
}
|
|
|
|
private void maybeFireTrackers(aq.d dVar, String str, fq fqVar) {
|
|
maybeFireTrackers((Set<kq>) this.vastAd.a(dVar, str), fqVar);
|
|
}
|
|
|
|
private void maybeFireTrackers(Set<kq> set, fq fqVar) {
|
|
if (set == null || set.isEmpty()) {
|
|
return;
|
|
}
|
|
long seconds = TimeUnit.MILLISECONDS.toSeconds(this.mediaPlayer.getCurrentPosition());
|
|
oq u1 = this.vastAd.u1();
|
|
Uri c2 = u1 != null ? u1.c() : null;
|
|
if (n.a()) {
|
|
this.logger.a(TAG, "Firing " + set.size() + " tracker(s): " + set);
|
|
}
|
|
mq.a(set, seconds, c2, fqVar, this.sdk);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void maybeFireTrackers(Set<kq> set) {
|
|
maybeFireTrackers(set, fq.UNSPECIFIED);
|
|
}
|
|
}
|