正在查看: Rilo v2.0.21 应用的 VideoWatchActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 VideoWatchActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.misc;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.media3.common.MediaItem;
import androidx.media3.common.Player;
import androidx.media3.datasource.DefaultDataSource;
import androidx.media3.exoplayer.DefaultLoadControl;
import androidx.media3.exoplayer.DefaultRenderersFactory;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.exoplayer.LoadControl;
import androidx.media3.exoplayer.RenderersFactory;
import androidx.media3.exoplayer.mediacodec.MediaCodecSelector;
import androidx.media3.exoplayer.source.MediaSource;
import androidx.media3.exoplayer.source.ProgressiveMediaSource;
import androidx.media3.ui.DefaultTimeBar;
import androidx.media3.ui.PlayerControlView;
import androidx.media3.ui.PlayerView;
import app.callpe.common.utils.Helper;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.APIError;
import app.callpe.data.model.ErrorHandler;
import app.callpe.data.model.SuccessModel;
import app.callpe.databinding.ActivityVideoWatchBinding;
import app.callpe.service.ApiService;
import app.callpe.ui.home.BaseActivity;
import app.callpe.ui.misc.VideoWatchActivity;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.Objects;
import javax.inject.Inject;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Dispatchers;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import timber.log.Timber;
@Metadata(d1 = {"\u0000`\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0001+B\u0005¢\u0006\u0002\u0010\u0003J\u0010\u0010\u0016\u001a\u00020\u00022\u0006\u0010\u0017\u001a\u00020\u0018H\u0016J\b\u0010\u0019\u001a\u00020\u001aH\u0016J\u0012\u0010\u001b\u001a\u00020\u001a2\b\u0010\u001c\u001a\u0004\u0018\u00010\u001dH\u0014J\b\u0010\u001e\u001a\u00020\u001aH\u0014J\u0010\u0010\u001f\u001a\u00020 2\u0006\u0010!\u001a\u00020\"H\u0016J\b\u0010#\u001a\u00020\u001aH\u0014J\b\u0010$\u001a\u00020\u001aH\u0014J\b\u0010%\u001a\u00020\u001aH\u0002J\b\u0010&\u001a\u00020\u001aH\u0002J\u0010\u0010'\u001a\u00020\u001a2\u0006\u0010(\u001a\u00020)H\u0007J\b\u0010*\u001a\u00020\u001aH\u0002R\u001e\u0010\u0004\u001a\u00020\u00058\u0006@\u0006X\u0087.¢\u0006\u000e\n\u0000\u001a\u0004\b\u0006\u0010\u0007\"\u0004\b\b\u0010\tR\u001c\u0010\n\u001a\u0004\u0018\u00010\u000bX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\f\u0010\r\"\u0004\b\u000e\u0010\u000fR\u000e\u0010\u0010\u001a\u00020\u0011X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u0013X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0014\u001a\u00020\u0015X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006,"}, d2 = {"Lapp/callpe/ui/misc/VideoWatchActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityVideoWatchBinding;", "()V", "apiService", "Lapp/callpe/service/ApiService;", "getApiService", "()Lapp/callpe/service/ApiService;", "setApiService", "(Lapp/callpe/service/ApiService;)V", "durationTracker", "Lapp/callpe/ui/misc/VideoWatchActivity$DurationTracker;", "getDurationTracker", "()Lapp/callpe/ui/misc/VideoWatchActivity$DurationTracker;", "setDurationTracker", "(Lapp/callpe/ui/misc/VideoWatchActivity$DurationTracker;)V", "exoPlayer", "Landroidx/media3/exoplayer/ExoPlayer;", "mediaSource", "Landroidx/media3/exoplayer/source/MediaSource;", "watchedDurationPercentage", "", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "onBackPressed", "", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onOptionsItemSelected", "", "item", "Landroid/view/MenuItem;", "onPause", "onResume", "onVideoCloseDialog", "setUpToolbar", "setVideoPath", "url", "", "submitWatchStatus", "DurationTracker", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class VideoWatchActivity extends BaseActivity<ActivityVideoWatchBinding> {
@Inject
public ApiService apiService;
private DurationTracker durationTracker;
private ExoPlayer exoPlayer;
private MediaSource mediaSource;
private float watchedDurationPercentage;
public static final boolean setVideoPath$lambda$2(View view, MotionEvent motionEvent) {
return true;
}
@Override
public ActivityVideoWatchBinding inflateLayout(LayoutInflater layoutInflater) {
Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
ActivityVideoWatchBinding inflate = ActivityVideoWatchBinding.inflate(layoutInflater);
Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
return inflate;
}
public final ApiService getApiService() {
ApiService apiService = this.apiService;
if (apiService != null) {
return apiService;
}
Intrinsics.throwUninitializedPropertyAccessException("apiService");
return null;
}
public final void setApiService(ApiService apiService) {
Intrinsics.checkNotNullParameter(apiService, "<set-?>");
this.apiService = apiService;
}
public final DurationTracker getDurationTracker() {
return this.durationTracker;
}
public final void setDurationTracker(DurationTracker durationTracker) {
this.durationTracker = durationTracker;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
Unit unit;
String stringExtra;
super.onCreate(savedInstanceState);
setUpToolbar();
Intent intent = getIntent();
if (intent == null || (stringExtra = intent.getStringExtra("url")) == null) {
unit = null;
} else {
setVideoPath(stringExtra);
unit = Unit.INSTANCE;
}
if (unit == null) {
finish();
}
}
private final void setUpToolbar() {
try {
getBinding().toolbar.setTitle("");
setSupportActionBar(getBinding().toolbar);
ActionBar actionBar = (ActionBar) Objects.requireNonNull(getSupportActionBar());
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
} catch (Exception e) {
Timber.tag("").e(e, "setUpToolbar: Error ", new Object[0]);
}
}
public final void setVideoPath(String url) {
Intrinsics.checkNotNullParameter(url, "url");
Context context = ((ActivityVideoWatchBinding) getBinding()).getRoot().getContext();
LoadControl build = new DefaultLoadControl.Builder().setBufferDurationsMs(25000, 50000, 1500, 2000).build();
Intrinsics.checkNotNullExpressionValue(build, "Builder().setBufferDurat…0000, 1500, 2000).build()");
RenderersFactory mediaCodecSelector = new DefaultRenderersFactory(context).setEnableDecoderFallback(true).setMediaCodecSelector(MediaCodecSelector.DEFAULT);
Intrinsics.checkNotNullExpressionValue(mediaCodecSelector, "DefaultRenderersFactory(…diaCodecSelector.DEFAULT)");
ExoPlayer build2 = new ExoPlayer.Builder(context, mediaCodecSelector).setLoadControl(build).build();
Intrinsics.checkNotNullExpressionValue(build2, "Builder(context, rendere…trol(loadControl).build()");
this.exoPlayer = build2;
PlayerControlView findViewById = ((ActivityVideoWatchBinding) getBinding()).videoView.findViewById(2131362812);
((ImageButton) findViewById.findViewById(2131362819)).setVisibility(8);
((ImageButton) findViewById.findViewById(2131362841)).setVisibility(8);
final ImageButton imageButton = (ImageButton) findViewById.findViewById(2131362833);
final ImageButton imageButton2 = (ImageButton) findViewById.findViewById(2131362832);
View view = (DefaultTimeBar) findViewById.findViewById(2131362838);
View view2 = (AppCompatImageView) findViewById.findViewById(2131362822);
LinearLayout linearLayout = (LinearLayout) findViewById.findViewById(2131365338);
Intrinsics.checkNotNullExpressionValue(view, "progress");
view.setVisibility(0);
Intrinsics.checkNotNullExpressionValue(linearLayout, "videoTimeContainer");
linearLayout.setVisibility(0);
Intrinsics.checkNotNullExpressionValue(view2, "exFullscreenIcon");
view2.setVisibility(8);
Intrinsics.checkNotNullExpressionValue(imageButton2, "pause");
imageButton2.setVisibility(0);
Intrinsics.checkNotNullExpressionValue(imageButton, "play");
imageButton.setVisibility(8);
ExoPlayer exoPlayer = null;
BuildersKt.launch$default(CoroutineScopeKt.CoroutineScope(Dispatchers.getMain()), (CoroutineContext) null, (CoroutineStart) null, new VideoWatchActivity$setVideoPath$1(this, null), 3, (Object) null);
view.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view3, MotionEvent motionEvent) {
boolean videoPath$lambda$2;
videoPath$lambda$2 = VideoWatchActivity.setVideoPath$lambda$2(view3, motionEvent);
return videoPath$lambda$2;
}
});
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
VideoWatchActivity.setVideoPath$lambda$3(imageButton, imageButton2, this, view3);
}
});
imageButton2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
VideoWatchActivity.setVideoPath$lambda$4(imageButton, imageButton2, this, view3);
}
});
ExoPlayer exoPlayer2 = this.exoPlayer;
if (exoPlayer2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer2 = null;
}
exoPlayer2.addListener(new Player.Listener() {
public void onPlaybackStateChanged(int playbackState) {
ExoPlayer exoPlayer3;
ExoPlayer exoPlayer4;
ActivityVideoWatchBinding binding;
VideoWatchActivity.DurationTracker durationTracker;
super.onPlaybackStateChanged(playbackState);
if (playbackState != 4) {
return;
}
VideoWatchActivity.this.watchedDurationPercentage = 100.0f;
VideoWatchActivity.this.submitWatchStatus();
if (VideoWatchActivity.this.getDurationTracker() != null && (durationTracker = VideoWatchActivity.this.getDurationTracker()) != null) {
durationTracker.purgeHandler();
}
exoPlayer3 = VideoWatchActivity.this.exoPlayer;
ExoPlayer exoPlayer5 = null;
if (exoPlayer3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer3 = null;
}
exoPlayer3.seekTo(0L);
exoPlayer4 = VideoWatchActivity.this.exoPlayer;
if (exoPlayer4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
} else {
exoPlayer5 = exoPlayer4;
}
exoPlayer5.pause();
binding = VideoWatchActivity.this.getBinding();
binding.videoView.showController();
ImageButton imageButton3 = imageButton;
Intrinsics.checkNotNullExpressionValue(imageButton3, "play");
imageButton3.setVisibility(0);
ImageButton imageButton4 = imageButton2;
Intrinsics.checkNotNullExpressionValue(imageButton4, "pause");
imageButton4.setVisibility(8);
}
});
PlayerView playerView = ((ActivityVideoWatchBinding) getBinding()).videoView;
ExoPlayer exoPlayer3 = this.exoPlayer;
if (exoPlayer3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer3 = null;
}
playerView.setPlayer((Player) exoPlayer3);
ExoPlayer exoPlayer4 = this.exoPlayer;
if (exoPlayer4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer4 = null;
}
exoPlayer4.seekTo(0L);
ExoPlayer exoPlayer5 = this.exoPlayer;
if (exoPlayer5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer5 = null;
}
exoPlayer5.setVolume(1.0f);
MediaSource createMediaSource = new ProgressiveMediaSource.Factory(new DefaultDataSource.Factory(context)).createMediaSource(MediaItem.fromUri(Uri.parse(url)));
Intrinsics.checkNotNullExpressionValue(createMediaSource, "Factory(dataSourceFactor…)\n )\n )");
this.mediaSource = createMediaSource;
final Ref.FloatRef floatRef = new Ref.FloatRef();
floatRef.element = SharedPref.getFloat((Context) this, PrefKeys.WATCH_VIDEO_PERCENTAGE);
if (floatRef.element == 0.0f) {
floatRef.element = 90.0f;
}
DurationTracker.DurationListener durationListener = new DurationTracker.DurationListener() {
@Override
public void duration(long watchedDuration, long totalDuration) {
float f;
float f2;
VideoWatchActivity.this.watchedDurationPercentage = 100 * ((watchedDuration / 1000.0f) / (totalDuration / 1000.0f));
Timber.i("progress: position=%s", new Object[]{Long.valueOf(watchedDuration / 1000)});
f = VideoWatchActivity.this.watchedDurationPercentage;
if (f >= floatRef.element) {
VideoWatchActivity.this.submitWatchStatus();
}
f2 = VideoWatchActivity.this.watchedDurationPercentage;
Timber.e("duration: %s", new Object[]{Float.valueOf(f2)});
}
};
ExoPlayer exoPlayer6 = this.exoPlayer;
if (exoPlayer6 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer6 = null;
}
this.durationTracker = new DurationTracker(exoPlayer6, durationListener);
ExoPlayer exoPlayer7 = this.exoPlayer;
if (exoPlayer7 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer7 = null;
}
MediaSource mediaSource = this.mediaSource;
if (mediaSource == null) {
Intrinsics.throwUninitializedPropertyAccessException("mediaSource");
mediaSource = null;
}
exoPlayer7.setMediaSource(mediaSource);
ExoPlayer exoPlayer8 = this.exoPlayer;
if (exoPlayer8 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer8 = null;
}
exoPlayer8.prepare();
ExoPlayer exoPlayer9 = this.exoPlayer;
if (exoPlayer9 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer9 = null;
}
exoPlayer9.setPlayWhenReady(true);
ExoPlayer exoPlayer10 = this.exoPlayer;
if (exoPlayer10 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
} else {
exoPlayer = exoPlayer10;
}
exoPlayer.play();
}
public static final void setVideoPath$lambda$3(ImageButton imageButton, ImageButton imageButton2, VideoWatchActivity videoWatchActivity, View view) {
Intrinsics.checkNotNullParameter(videoWatchActivity, "this$0");
Intrinsics.checkNotNullExpressionValue(imageButton, "play");
imageButton.setVisibility(8);
Intrinsics.checkNotNullExpressionValue(imageButton2, "pause");
imageButton2.setVisibility(0);
videoWatchActivity.getBinding().videoView.hideController();
ExoPlayer exoPlayer = videoWatchActivity.exoPlayer;
if (exoPlayer == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer = null;
}
exoPlayer.play();
}
public static final void setVideoPath$lambda$4(ImageButton imageButton, ImageButton imageButton2, VideoWatchActivity videoWatchActivity, View view) {
Intrinsics.checkNotNullParameter(videoWatchActivity, "this$0");
Intrinsics.checkNotNullExpressionValue(imageButton, "play");
imageButton.setVisibility(0);
Intrinsics.checkNotNullExpressionValue(imageButton2, "pause");
imageButton2.setVisibility(8);
ExoPlayer exoPlayer = videoWatchActivity.exoPlayer;
if (exoPlayer == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer = null;
}
exoPlayer.pause();
}
protected void onDestroy() {
super.onDestroy();
ExoPlayer exoPlayer = this.exoPlayer;
if (exoPlayer != null) {
ExoPlayer exoPlayer2 = null;
if (exoPlayer == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer = null;
}
exoPlayer.stop();
ExoPlayer exoPlayer3 = this.exoPlayer;
if (exoPlayer3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
} else {
exoPlayer2 = exoPlayer3;
}
exoPlayer2.release();
}
DurationTracker durationTracker = this.durationTracker;
if (durationTracker == null || durationTracker == null) {
return;
}
durationTracker.purgeHandler();
}
public boolean onOptionsItemSelected(MenuItem item) {
Intrinsics.checkNotNullParameter(item, "item");
if (item.getItemId() != 16908332) {
return true;
}
onBackPressed();
return true;
}
public final void submitWatchStatus() {
if (getIntent().getBooleanExtra("watched", false)) {
return;
}
long longExtra = getIntent().getLongExtra("videoId", -1L);
if (longExtra == -1) {
return;
}
getApiService().videoWatched(longExtra).enqueue(new Callback<SuccessModel>() {
public void onResponse(Call<SuccessModel> call, Response<SuccessModel> response) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
try {
Timber.e("%s", new Object[]{response.raw()});
if (response.isSuccessful()) {
Timber.e("Submit success", new Object[0]);
VideoWatchActivity.this.getIntent().putExtra("watched", true);
VideoWatchActivity.this.setResult(-1);
} else {
try {
APIError parseError = ErrorHandler.parseError(response);
Toast.makeText((Context) VideoWatchActivity.this, "Error: " + parseError.getReason(), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception unused) {
Toast.makeText((Context) VideoWatchActivity.this, "Error", 0).show();
}
}
public void onFailure(Call<SuccessModel> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Helper.noNetworkToast((Context) VideoWatchActivity.this, t);
}
});
}
@Metadata(d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001:\u0001\fB\u0019\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\b\u0010\u0004\u001a\u0004\u0018\u00010\u0005¢\u0006\u0002\u0010\u0006J\u0006\u0010\t\u001a\u00020\nJ\b\u0010\u000b\u001a\u00020\nH\u0016R\u0010\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0007\u001a\u0004\u0018\u00010\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\r"}, d2 = {"Lapp/callpe/ui/misc/VideoWatchActivity$DurationTracker;", "Ljava/lang/Runnable;", "player", "Landroidx/media3/exoplayer/ExoPlayer;", "durationListener", "Lapp/callpe/ui/misc/VideoWatchActivity$DurationTracker$DurationListener;", "(Landroidx/media3/exoplayer/ExoPlayer;Lapp/callpe/ui/misc/VideoWatchActivity$DurationTracker$DurationListener;)V", "handler", "Landroid/os/Handler;", "purgeHandler", "", "run", "DurationListener", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public static final class DurationTracker implements Runnable {
private DurationListener durationListener;
private Handler handler;
private ExoPlayer player;
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\bf\u0018\u00002\u00020\u0001J\u0018\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u0005H&¨\u0006\u0007"}, d2 = {"Lapp/callpe/ui/misc/VideoWatchActivity$DurationTracker$DurationListener;", "", "duration", "", "watchedDuration", "", "totalDuration", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public interface DurationListener {
void duration(long watchedDuration, long totalDuration);
}
public DurationTracker(ExoPlayer exoPlayer, DurationListener durationListener) {
if (exoPlayer != null) {
this.player = exoPlayer;
this.durationListener = durationListener;
Looper myLooper = Looper.myLooper();
Intrinsics.checkNotNull(myLooper);
Handler handler = new Handler(myLooper);
this.handler = handler;
handler.post(this);
}
}
@Override
public void run() {
ExoPlayer exoPlayer = this.player;
if (exoPlayer != null) {
long currentPosition = exoPlayer != null ? exoPlayer.getCurrentPosition() : 0L;
ExoPlayer exoPlayer2 = this.player;
long duration = exoPlayer2 != null ? exoPlayer2.getDuration() : 0L;
DurationListener durationListener = this.durationListener;
if (durationListener != null) {
durationListener.duration(currentPosition, duration);
}
Handler handler = this.handler;
if (handler != null) {
handler.postDelayed(this, 1000L);
}
}
}
public final void purgeHandler() {
Handler handler = this.handler;
if (handler != null) {
handler.removeCallbacks(this);
}
}
}
public void onBackPressed() {
onVideoCloseDialog();
}
private final void onVideoCloseDialog() {
if (!getIntent().getBooleanExtra("watched", false)) {
new AlertDialog.Builder((Context) this).setMessage("Are you sure you want to close?").setPositiveButton(getString(2131953093), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
VideoWatchActivity.onVideoCloseDialog$lambda$6(VideoWatchActivity.this, dialogInterface, i);
}
}).setNegativeButton(getString(2131952360), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
}).create().show();
} else {
finish();
}
}
public static final void onVideoCloseDialog$lambda$6(VideoWatchActivity videoWatchActivity, DialogInterface dialogInterface, int i) {
Intrinsics.checkNotNullParameter(videoWatchActivity, "this$0");
videoWatchActivity.finish();
}
protected void onResume() {
super.onResume();
ExoPlayer exoPlayer = this.exoPlayer;
if (exoPlayer != null) {
if (exoPlayer == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer = null;
}
exoPlayer.play();
}
}
protected void onPause() {
super.onPause();
ExoPlayer exoPlayer = this.exoPlayer;
if (exoPlayer != null) {
if (exoPlayer == null) {
Intrinsics.throwUninitializedPropertyAccessException("exoPlayer");
exoPlayer = null;
}
exoPlayer.pause();
}
}
}