MD5 校验值:63e534d8efee12c91b8e626b68b614ab
z1.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.adivery.sdk; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.media.AudioFocusRequest; import android.media.AudioManager; import android.media.MediaPlayer; import android.media.PlaybackParams; import android.os.Build; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.VideoView; import androidx.constraintlayout.widget.ConstraintLayout; import com.adivery.sdk.networks.adivery.VideoProgress; import java.io.IOException; import java.io.InputStream; import kotlin.Metadata; import kotlin.Unit; import kotlin.jvm.functions.Function1; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.Lambda; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @Metadata(d1 = {"\u0000\u0086\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\t\n\u0002\u0010\u0007\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\b\u0016\u0018\u00002\u00020\u0001:\u0001CB\u001f\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0010\u0010\u0004\u001a\f\u0012\b\b\u0001\u0012\u0004\u0018\u00010\u00060\u0005¢\u0006\u0002\u0010\u0007J\u0010\u0010-\u001a\u00020.2\u0006\u0010/\u001a\u00020\u000bH\u0002J\u0010\u00100\u001a\u00020.2\u0006\u0010/\u001a\u00020\u000bH\u0002J\b\u00101\u001a\u00020.H\u0016J\b\u00102\u001a\u00020.H\u0016J\b\u00103\u001a\u00020.H\u0016J\b\u00104\u001a\u00020.H\u0016J\b\u00105\u001a\u00020.H\u0016J\u0010\u00106\u001a\u00020.2\u0006\u00107\u001a\u000208H\u0002J\u0010\u00109\u001a\u00020.2\u0006\u0010:\u001a\u00020;H\u0002J\b\u0010<\u001a\u00020.H\u0002J\u0006\u0010=\u001a\u00020.J\u0010\u0010>\u001a\u00020.2\u0006\u0010?\u001a\u00020\u0013H\u0002J\b\u0010@\u001a\u00020.H\u0002J\b\u0010A\u001a\u00020.H\u0002J\b\u0010B\u001a\u00020.H\u0002R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0018\u0010\u0004\u001a\f\u0012\b\b\u0001\u0012\u0004\u0018\u00010\u00060\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\b\u001a\u0004\u0018\u00010\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\n\u001a\u00020\u000bX\u0086.¢\u0006\u000e\n\u0000\u001a\u0004\b\f\u0010\r\"\u0004\b\u000e\u0010\u000fR\u000e\u0010\u0010\u001a\u00020\u0011X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0012\u001a\u00020\u00138BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0012\u0010\u0014R\u000e\u0010\u0015\u001a\u00020\u0013X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\u0017X\u0082.¢\u0006\u0002\n\u0000R\u0010\u0010\u0018\u001a\u0004\u0018\u00010\u0019X\u0082\u000e¢\u0006\u0002\n\u0000R\u0016\u0010\u001a\u001a\u0004\u0018\u00010\u001b8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u001c\u0010\u001dR\u000e\u0010\u001e\u001a\u00020\u001fX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010 \u001a\u00020\u001fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010!\u001a\u0004\u0018\u00010\"X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010#\u001a\u00020$X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010%\u001a\u0004\u0018\u00010&X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010'\u001a\u00020(X\u0086.¢\u0006\u000e\n\u0000\u001a\u0004\b)\u0010*\"\u0004\b+\u0010,¨\u0006D"}, d2 = {"Lcom/adivery/sdk/networks/adivery/VideoController;", "Lcom/adivery/sdk/networks/adivery/BaseController;", "activity", "Landroid/app/Activity;", "adObject", "Lcom/adivery/sdk/networks/adivery/AdObject;", "Lcom/adivery/sdk/AdiveryFullscreenCallback;", "(Landroid/app/Activity;Lcom/adivery/sdk/networks/adivery/AdObject;)V", "audioFocusRequest", "Landroid/media/AudioFocusRequest;", "closeButton", "Landroid/view/View;", "getCloseButton", "()Landroid/view/View;", "setCloseButton", "(Landroid/view/View;)V", "events", "Lcom/adivery/sdk/AdEvents;", "isDeviceMuted", "", "()Z", "isFinished", "mediaPlayer", "Landroid/media/MediaPlayer;", "muteController", "Lcom/adivery/sdk/networks/adivery/MuteController;", "roundedIconDrawable", "Landroid/graphics/drawable/Drawable;", "getRoundedIconDrawable", "()Landroid/graphics/drawable/Drawable;", "skipOffsetSeconds", "", "stopPosition", "typeface", "Landroid/graphics/Typeface;", "updateProgress", "Ljava/lang/Runnable;", "videoProgress", "Lcom/adivery/sdk/networks/adivery/VideoProgress;", "videoView", "Landroid/widget/VideoView;", "getVideoView", "()Landroid/widget/VideoView;", "setVideoView", "(Landroid/widget/VideoView;)V", "initVideoAction", "", "view", "initVideoView", "onBackPressed", "onCreate", "onDestroy", "onPause", "onResume", "postVideoFinished", "remaining", "", "showPostRoll", "videoStatus", "Lcom/adivery/sdk/networks/adivery/VideoController$VideoStatus;", "trySkipVideo", "updateProgressLater", "updateVideoSound", "isMuted", "videoCompleted", "videoFailed", "videoSkipped", "VideoStatus", "sdk_release"}, k = 1, mv = {1, 6, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_CONSTRAINT_VERTICAL_CHAINSTYLE) public class z1 extends s1 { public final Activity a; public final o1<? extends AdiveryFullscreenCallback> b; public final AdEvents c; public boolean d; public final int e; public MediaPlayer f; public VideoView g; public VideoProgress h; public View i; public Typeface j; public v1 k; public int l; public AudioFocusRequest m; public final Runnable n; @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0003\b\u0080\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lcom/adivery/sdk/networks/adivery/VideoController$VideoStatus;", "", "<init>", "(Ljava/lang/String;I)V", "sdk_release"}, k = 1, mv = {1, 6, 0}) public enum a { SKIPPED, REWARDED, ERROR } @Metadata(d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "", "isMuted", "", "invoke"}, k = 3, mv = {1, 6, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_CONSTRAINT_VERTICAL_CHAINSTYLE) public static final class b extends Lambda implements Function1<Boolean, Unit> { public b() { super(1); } public final void a(boolean z) { z1.this.a(z); } @Override public Unit invoke(Boolean bool) { a(bool.booleanValue()); return Unit.INSTANCE; } } @Metadata(d1 = {"\u0000\u0019\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\b\u001a\u00020\tH\u0016R\u001a\u0010\u0002\u001a\u00020\u0003X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0004\u0010\u0005\"\u0004\b\u0006\u0010\u0007¨\u0006\n"}, d2 = {"com/adivery/sdk/networks/adivery/VideoController$updateProgress$1", "Ljava/lang/Runnable;", "lastProgress", "", "getLastProgress", "()F", "setLastProgress", "(F)V", "run", "", "sdk_release"}, k = 1, mv = {1, 6, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_CONSTRAINT_VERTICAL_CHAINSTYLE) public static final class c implements Runnable { public float a = -1.0f; public c() { } @Override public void run() { if (z1.this.g == null) { return; } float currentPosition = r0.j().getCurrentPosition() / 1000.0f; float duration = z1.this.j().getDuration() / 1000.0f; z1.this.h().setVisibility(currentPosition >= ((float) z1.this.e) ? 0 : 4); float f = (currentPosition * 100.0f) / duration; if (this.a <= 0.0f && f > 0.0f) { AdiveryCallback b = z1.this.b.b(); Intrinsics.checkNotNull(b); ((AdiveryFullscreenCallback) b).onAdShown(); z1.this.c.a("impression"); } if (this.a <= 25.0f && f > 25.0f) { z1.this.c.a("firstQuartile"); } if (this.a <= 50.0f && f > 50.0f) { z1.this.c.a("midpoint"); } if (this.a <= 75.0f && f > 75.0f) { z1.this.c.a("thirdQuartile"); } VideoProgress videoProgress = z1.this.h; Intrinsics.checkNotNull(videoProgress); videoProgress.setProgress(f); if (f < 100.0f) { z1.this.m(); } float f2 = duration - currentPosition; if (f2 > 0.0f && f2 <= 1.0f) { Logger.a.a("posting video finished " + z1.this.d); z1.this.a(f2); } this.a = f; } } public z1(Activity activity, o1<? extends AdiveryFullscreenCallback> adObject) { Intrinsics.checkNotNullParameter(activity, "activity"); Intrinsics.checkNotNullParameter(adObject, "adObject"); this.a = activity; this.b = adObject; this.c = new AdEvents(adObject.getD().optJSONObject("events")); this.e = adObject.getD().optInt("skip_offset", 0); this.n = new c(); } public static final void f(z1 this$0) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.n(); } @Override public void e() { } @Override public void g() { if (this.g != null) { j().resume(); j().seekTo(this.l); } m(); } public final View h() { View view = this.i; if (view != null) { return view; } Intrinsics.throwUninitializedPropertyAccessException("closeButton"); return null; } public final Drawable i() { InputStream e = c2.a.e(this.b.getC().optString("icon")); if (e == null) { Logger.a.a("input stream is null"); return null; } Logger.a.a("loading bitmap"); Bitmap decodeStream = BitmapFactory.decodeStream(e); try { e.close(); } catch (IOException unused) { } x1 x1Var = new x1(this.a.getResources(), decodeStream); x1Var.a(e1.a(4.0f, this.a)); return x1Var; } public final VideoView j() { VideoView videoView = this.g; if (videoView != null) { return videoView; } Intrinsics.throwUninitializedPropertyAccessException("videoView"); return null; } public final boolean k() { boolean isStreamMute; Object systemService = this.a.getSystemService("audio"); if (systemService != null) { AudioManager audioManager = (AudioManager) systemService; if (Build.VERSION.SDK_INT < 23) { return false; } isStreamMute = audioManager.isStreamMute(3); return isStreamMute; } throw new NullPointerException("null cannot be cast to non-null type android.media.AudioManager"); } public final void l() { p(); } public final void m() { VideoProgress videoProgress = this.h; if (videoProgress != null) { videoProgress.postDelayed(this.n, 50L); } } public final void n() { if (this.d) { return; } this.c.a("complete"); a(a.REWARDED); } public final void o() { this.c.a("impression"); a(a.ERROR); } public final void p() { this.c.a("skip"); a(a.SKIPPED); } public static final void b(z1 this$0, View view) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.l(); } public final void c(View view) { Intrinsics.checkNotNullParameter(view, "<set-?>"); this.i = view; } @Override public void d() { try { View view = LayoutInflater.from(this.a).inflate(R.layout.adivery_video_player, (ViewGroup) null); this.a.setContentView(view); this.j = Typeface.createFromAsset(this.a.getAssets(), "adivery_dana_normal.ttf"); Intrinsics.checkNotNullExpressionValue(view, "view"); b(view); this.h = (VideoProgress) view.findViewById(R.id.adivery_video_progress); View findViewById = view.findViewById(R.id.adivery_close_button); Intrinsics.checkNotNullExpressionValue(findViewById, "view.findViewById(R.id.adivery_close_button)"); c(findViewById); h().setOnClickListener(new View.OnClickListener() { @Override public final void onClick(View view2) { z1.b(z1.this, view2); } }); view.findViewById(R.id.adivery_logo).setOnClickListener(new View.OnClickListener() { @Override public final void onClick(View view2) { z1.c(z1.this, view2); } }); a(view); } catch (Exception e) { a(a.SKIPPED); Logger.a.e("cannot init video ad", e); } } @Override public void f() { VideoProgress videoProgress = this.h; Intrinsics.checkNotNull(videoProgress); videoProgress.removeCallbacks(this.n); if (this.g != null) { this.l = j().getCurrentPosition(); j().suspend(); } } public static final void c(z1 this$0, View view) { Intrinsics.checkNotNullParameter(this$0, "this$0"); e1.b(this$0.a, "https://adivery.com/?ref=sdk"); } public final void b(View view) { AudioFocusRequest build; View findViewById = this.a.findViewById(R.id.adivery_video_player); Intrinsics.checkNotNullExpressionValue(findViewById, "activity.findViewById(R.id.adivery_video_player)"); a((VideoView) findViewById); final ImageView imageView = (ImageView) view.findViewById(R.id.adivery_mute_button); imageView.setVisibility(8); j().setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public final void onPrepared(MediaPlayer mediaPlayer) { z1.a(z1.this, imageView, mediaPlayer); } }); j().setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public final void onCompletion(MediaPlayer mediaPlayer) { z1.a(z1.this, mediaPlayer); } }); j().setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public final boolean onError(MediaPlayer mediaPlayer, int i, int i2) { return z1.a(z1.this, mediaPlayer, i, i2); } }); if (Build.VERSION.SDK_INT >= 26) { build = z1$$ExternalSyntheticApiModelOutline1.m(2).build(); this.m = build; j().setAudioFocusRequest(2); } String d = c2.a.d(this.b.getC().optString("video")); if (d != null) { j().setVideoPath(d); } else { Logger.a.a("Video path is null"); o(); } } public final void a(VideoView videoView) { Intrinsics.checkNotNullParameter(videoView, "<set-?>"); this.g = videoView; } public final void a(float f) { j().postDelayed(new Runnable() { @Override public final void run() { z1.f(z1.this); } }, f * 1000); } public final void a(a aVar) { Logger.a.a("post role " + aVar); if (this.d) { return; } this.d = true; try { this.b.getD().put("video_status", aVar.toString()); c(); } catch (JSONException unused) { this.a.finish(); } } public final void a(View view) { int i; TextView textView; int i2; Drawable i3; View findViewById = view.findViewById(R.id.adivery_video_action); try { TextView textView2 = (TextView) findViewById.findViewById(R.id.adivery_video_action_advertiser); TextView textView3 = (TextView) findViewById.findViewById(R.id.adivery_video_action_subtitle); ImageView imageView = (ImageView) findViewById.findViewById(R.id.adivery_video_action_subtitle_icon); TextView textView4 = (TextView) findViewById.findViewById(R.id.adivery_video_action_button); ImageView imageView2 = (ImageView) findViewById.findViewById(R.id.adivery_video_action_icon); JSONObject d = this.b.getD(); String string = d.getString("call_to_action"); String string2 = d.getString("advertiser"); String string3 = d.getString("headline"); JSONObject optJSONObject = d.optJSONObject("app"); if (optJSONObject != null) { int optInt = optJSONObject.optInt("ratings", 0); textView = textView2; double optDouble = optJSONObject.optDouble("stars", 0.0d); int optInt2 = optJSONObject.optInt("installs", 0); if (optDouble >= 4.0d && optInt >= 500) { i2 = R.drawable.adivery_ic_star; string3 = e1.a(optDouble, 1); if (string3 == null) { string3 = String.valueOf(optDouble); } } else if (optInt2 >= 10000) { int i4 = R.drawable.adivery_ic_person; string3 = "+" + e1.a(optInt2, 0); i2 = i4; } if (i2 <= 0) { imageView.setImageResource(i2); imageView.setVisibility(0); } else { i = 8; try { imageView.setVisibility(8); } catch (JSONException unused) { findViewById.setVisibility(i); return; } } textView4.setText(string); textView4.setTypeface(this.j); TextView textView5 = textView; textView5.setText(string2); textView5.setTypeface(this.j); textView3.setText(string3); textView3.setTypeface(this.j); textView4.setOnClickListener(new View.OnClickListener() { @Override public final void onClick(View view2) { z1.a(z1.this, view2); } }); i3 = i(); if (i3 == null) { imageView2.setImageDrawable(i3); return; } else { i = 8; imageView2.setVisibility(8); return; } } textView = textView2; i2 = 0; if (i2 <= 0) { } textView4.setText(string); textView4.setTypeface(this.j); TextView textView52 = textView; textView52.setText(string2); textView52.setTypeface(this.j); textView3.setText(string3); textView3.setTypeface(this.j); textView4.setOnClickListener(new View.OnClickListener() { @Override public final void onClick(View view2) { z1.a(z1.this, view2); } }); i3 = i(); if (i3 == null) { } } catch (JSONException unused2) { i = 8; } } @Override public void b() { if (this.i == null || h().getVisibility() != 0) { return; } l(); } public static final void a(z1 this$0, View view) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.b.getG().a("click"); JSONArray optJSONArray = this$0.b.getD().optJSONArray("android_intents"); if (optJSONArray != null && optJSONArray.length() != 0) { Logger.a.a(optJSONArray.toString()); Activity activity = this$0.a; String jSONArray = optJSONArray.toString(); Intrinsics.checkNotNullExpressionValue(jSONArray, "androidIntent.toString()"); e1.a(activity, jSONArray); } else { this$0.b.getE().a(this$0.a); } AdiveryFullscreenCallback b2 = this$0.b.b(); Intrinsics.checkNotNull(b2); b2.onAdClicked(); } public static final void a(z1 this$0, ImageView muteImageView, MediaPlayer mp) { Intrinsics.checkNotNullParameter(this$0, "this$0"); mp.setVideoScalingMode(1); mp.setLooping(false); if (Build.VERSION.SDK_INT >= 23) { PlaybackParams m220m = z1$$ExternalSyntheticApiModelOutline1.m220m(); m220m.setSpeed(1.0f); mp.setPlaybackParams(m220m); } Intrinsics.checkNotNullExpressionValue(mp, "mp"); this$0.f = mp; if (mp == null) { Intrinsics.throwUninitializedPropertyAccessException("mediaPlayer"); mp = null; } mp.start(); muteImageView.setVisibility(0); this$0.a(this$0.k()); Intrinsics.checkNotNullExpressionValue(muteImageView, "muteImageView"); this$0.k = new v1(muteImageView, this$0.k(), new b()); } public static final void a(z1 this$0, MediaPlayer mediaPlayer) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.n(); } public static final boolean a(z1 this$0, MediaPlayer mediaPlayer, int i, int i2) { Intrinsics.checkNotNullParameter(this$0, "this$0"); this$0.o(); Logger.a.a("video show failed " + i + ' ' + i2); return true; } public final void a(boolean z) { AudioFocusRequest build; MediaPlayer mediaPlayer = null; try { if (z) { MediaPlayer mediaPlayer2 = this.f; if (mediaPlayer2 == null) { Intrinsics.throwUninitializedPropertyAccessException("mediaPlayer"); } else { mediaPlayer = mediaPlayer2; } mediaPlayer.setVolume(0.0f, 0.0f); if (Build.VERSION.SDK_INT >= 26) { Object systemService = j().getContext().getSystemService("audio"); if (systemService != null) { AudioManager audioManager = (AudioManager) systemService; AudioFocusRequest audioFocusRequest = this.m; if (audioFocusRequest != null) { audioManager.abandonAudioFocusRequest(audioFocusRequest); return; } return; } throw new NullPointerException("null cannot be cast to non-null type android.media.AudioManager"); } return; } MediaPlayer mediaPlayer3 = this.f; if (mediaPlayer3 == null) { Intrinsics.throwUninitializedPropertyAccessException("mediaPlayer"); } else { mediaPlayer = mediaPlayer3; } mediaPlayer.setVolume(1.0f, 1.0f); if (Build.VERSION.SDK_INT >= 26) { z1$$ExternalSyntheticApiModelOutline1.m226m(); build = z1$$ExternalSyntheticApiModelOutline1.m(2).build(); this.m = build; Object systemService2 = j().getContext().getSystemService("audio"); if (systemService2 != null) { AudioManager audioManager2 = (AudioManager) systemService2; AudioFocusRequest audioFocusRequest2 = this.m; if (audioFocusRequest2 != null) { audioManager2.requestAudioFocus(audioFocusRequest2); return; } return; } throw new NullPointerException("null cannot be cast to non-null type android.media.AudioManager"); } } catch (Exception e) { Logger.a.a("Cannot update mute state", e); } } }