云执法小微版 v1.0.0版本的 MD5 值为:dfa1ab09653b3256f84dafdbda8bb96c
以下内容为反编译后的 VideoPlayListActivity.java 源代码,内容仅作参考
package com.kedacom.chinamobile.latestvideo;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.widget.SeekBar;
import androidx.databinding.ViewDataBinding;
import androidx.media3.common.AudioAttributes;
import androidx.media3.common.DeviceInfo;
import androidx.media3.common.MediaItem;
import androidx.media3.common.MediaMetadata;
import androidx.media3.common.PlaybackException;
import androidx.media3.common.PlaybackParameters;
import androidx.media3.common.Player;
import androidx.media3.common.Timeline;
import androidx.media3.common.TrackSelectionParameters;
import androidx.media3.common.Tracks;
import androidx.media3.common.VideoSize;
import androidx.media3.common.text.CueGroup;
import androidx.media3.exoplayer.ExoPlayer;
import androidx.media3.ui.PlayerView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.kedacom.chinamobile.R;
import com.kedacom.chinamobile.base.BaseActivity;
import com.kedacom.chinamobile.databinding.ActivityVideoPlayListBinding;
import com.kedacom.chinamobile.databinding.ItemVideoPlayListBinding;
import com.kedacom.lego.adapter.recyclerview.LegoBaseRecyclerViewAdapter;
import com.kedacom.lego.annotation.ContentView;
import com.kedacom.util.LegoLog;
import java.util.ArrayList;
import java.util.Formatter;
import java.util.List;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
@Metadata(d1 = {"\u0000d\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\b\u0007\u0018\u00002\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00030\u0001B\u0005¢\u0006\u0002\u0010\u0004J\b\u0010&\u001a\u00020'H\u0002J\b\u0010(\u001a\u00020'H\u0002J\u0010\u0010)\u001a\u00020\u00072\u0006\u0010*\u001a\u00020+H\u0002J\b\u0010,\u001a\u00020'H\u0002J\u0012\u0010-\u001a\u00020'2\b\u0010.\u001a\u0004\u0018\u00010/H\u0014J\b\u00100\u001a\u00020'H\u0014J\b\u00101\u001a\u00020'H\u0014J\b\u00102\u001a\u00020'H\u0014J\u0010\u00103\u001a\u00020'2\u0006\u0010 \u001a\u00020!H\u0002J\u0010\u00104\u001a\u00020'2\u0006\u0010 \u001a\u00020!H\u0002J\u0016\u00105\u001a\u00020'2\f\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00070\u0006H\u0002J\u0018\u00106\u001a\u00020'2\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u00107\u001a\u000208H\u0002R\"\u0010\u0005\u001a\n\u0012\u0004\u0012\u00020\u0007\u0018\u00010\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\b\u0010\t\"\u0004\b\n\u0010\u000bR\u0010\u0010\f\u001a\u0004\u0018\u00010\rX\u0082\u000e¢\u0006\u0002\n\u0000R \u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\u00070\u000fX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0010\u0010\u0011\"\u0004\b\u0012\u0010\u0013R\u001c\u0010\u0014\u001a\u0004\u0018\u00010\u0015X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0016\u0010\u0017\"\u0004\b\u0018\u0010\u0019R\u001a\u0010\u001a\u001a\u00020\u001bX\u0086.¢\u0006\u000e\n\u0000\u001a\u0004\b\u001c\u0010\u001d\"\u0004\b\u001e\u0010\u001fR\u001a\u0010 \u001a\u00020!X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\"\u0010#\"\u0004\b$\u0010%¨\u00069"}, d2 = {"Lcom/kedacom/chinamobile/latestvideo/VideoPlayListActivity;", "Lcom/kedacom/chinamobile/base/BaseActivity;", "Lcom/kedacom/chinamobile/databinding/ActivityVideoPlayListBinding;", "Lcom/kedacom/chinamobile/latestvideo/VideoPlayListViewModel;", "()V", "adapter", "Lcom/kedacom/lego/adapter/recyclerview/LegoBaseRecyclerViewAdapter;", "", "getAdapter", "()Lcom/kedacom/lego/adapter/recyclerview/LegoBaseRecyclerViewAdapter;", "setAdapter", "(Lcom/kedacom/lego/adapter/recyclerview/LegoBaseRecyclerViewAdapter;)V", "layoutManager", "Landroidx/recyclerview/widget/LinearLayoutManager;", "list", "", "getList", "()Ljava/util/List;", "setList", "(Ljava/util/List;)V", "nLayoutManager", "Lcom/kedacom/chinamobile/latestvideo/CMCustomLayoutManager;", "getNLayoutManager", "()Lcom/kedacom/chinamobile/latestvideo/CMCustomLayoutManager;", "setNLayoutManager", "(Lcom/kedacom/chinamobile/latestvideo/CMCustomLayoutManager;)V", "player", "Landroidx/media3/exoplayer/ExoPlayer;", "getPlayer", "()Landroidx/media3/exoplayer/ExoPlayer;", "setPlayer", "(Landroidx/media3/exoplayer/ExoPlayer;)V", "position", "", "getPosition", "()I", "setPosition", "(I)V", "addListener", "", "addTestData", "formatTime", "timeMs", "", "initView", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onPause", "onResume", "playVideo", "releaseVideo", "scrollToNextItem", "updateProgress", "seekBar", "Landroid/widget/SeekBar;", "app_devRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@ContentView(R.layout.activity_video_play_list)
public final class VideoPlayListActivity extends BaseActivity<ActivityVideoPlayListBinding, VideoPlayListViewModel> {
private LegoBaseRecyclerViewAdapter<String> adapter;
private LinearLayoutManager layoutManager;
private List<String> list = new ArrayList();
private CMCustomLayoutManager nLayoutManager;
public ExoPlayer player;
private int position;
public final List<String> getList() {
return this.list;
}
public final void setList(List<String> list) {
Intrinsics.checkNotNullParameter(list, "<set-?>");
this.list = list;
}
public final LegoBaseRecyclerViewAdapter<String> getAdapter() {
return this.adapter;
}
public final void setAdapter(LegoBaseRecyclerViewAdapter<String> legoBaseRecyclerViewAdapter) {
this.adapter = legoBaseRecyclerViewAdapter;
}
public final int getPosition() {
return this.position;
}
public final void setPosition(int i) {
this.position = i;
}
public final ExoPlayer getPlayer() {
ExoPlayer exoPlayer = this.player;
if (exoPlayer != null) {
return exoPlayer;
}
Intrinsics.throwUninitializedPropertyAccessException("player");
return null;
}
public final void setPlayer(ExoPlayer exoPlayer) {
Intrinsics.checkNotNullParameter(exoPlayer, "<set-?>");
this.player = exoPlayer;
}
public final CMCustomLayoutManager getNLayoutManager() {
return this.nLayoutManager;
}
public final void setNLayoutManager(CMCustomLayoutManager cMCustomLayoutManager) {
this.nLayoutManager = cMCustomLayoutManager;
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
initView();
addListener();
addTestData();
((ActivityVideoPlayListBinding) this.nViewDataBinding).recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int i) {
LinearLayoutManager linearLayoutManager;
LinearLayoutManager linearLayoutManager2;
ViewDataBinding viewDataBinding;
Intrinsics.checkNotNullParameter(recyclerView, "recyclerView");
super.onScrollStateChanged(recyclerView, i);
if (i == 0) {
linearLayoutManager = VideoPlayListActivity.this.layoutManager;
if (linearLayoutManager != null) {
linearLayoutManager2 = VideoPlayListActivity.this.layoutManager;
Intrinsics.checkNotNull(linearLayoutManager2);
int findFirstVisibleItemPosition = linearLayoutManager2.findFirstVisibleItemPosition();
LegoLog.d(" onScrollStateChanged " + findFirstVisibleItemPosition);
LegoBaseRecyclerViewAdapter<String> adapter = VideoPlayListActivity.this.getAdapter();
if (adapter != null) {
VideoPlayListActivity videoPlayListActivity = VideoPlayListActivity.this;
if (videoPlayListActivity.getPosition() != findFirstVisibleItemPosition) {
MediaItem fromUri = MediaItem.fromUri(Uri.parse(adapter.getData().get(findFirstVisibleItemPosition)));
Intrinsics.checkNotNullExpressionValue(fromUri, "fromUri(videoUri)");
viewDataBinding = videoPlayListActivity.nViewDataBinding;
RecyclerView.ViewHolder findViewHolderForAdapterPosition = ((ActivityVideoPlayListBinding) viewDataBinding).recyclerView.findViewHolderForAdapterPosition(findFirstVisibleItemPosition);
if (findViewHolderForAdapterPosition != null) {
View view = findViewHolderForAdapterPosition.itemView;
Intrinsics.checkNotNullExpressionValue(view, "viewHolder.itemView");
Player player = ((PlayerView) view.findViewById(R.id.exoPlayerView)).getPlayer();
if (player != null) {
player.stop();
}
if (player != null) {
player.clearMediaItems();
}
if (player != null) {
player.setMediaItem(fromUri);
}
if (player != null) {
player.prepare();
}
if (player != null) {
player.play();
}
}
}
}
VideoPlayListActivity.this.setPosition(findFirstVisibleItemPosition);
}
}
}
});
}
private final void addTestData() {
this.list.add("https://eos-wuxi-1.cmecloud.cn/cvftest/video/20230703/14/10000001031321000059/al43oy-new.mp4?AWSAccessKeyId=NTTBD40EBXC3L1IJS635&Expires=1719900907&Signature=YfpkeOgJCJNS1uQJ0WdoP3C8GQY%3d");
this.list.add("https://eos-wuxi-1.cmecloud.cn/cvftest/video/20230707/12/10000001031321000059/iluchg-new.mp4?AWSAccessKeyId=NTTBD40EBXC3L1IJS635&Expires=1720490942&Signature=VBeoiuvAWl2hyIVoX8VnMA8bNUs%3d");
this.list.add("https://eos-wuxi-1.cmecloud.cn/cvftest/video/20230710/09/10000001031321000059/q3qvxs-new.mp4?AWSAccessKeyId=NTTBD40EBXC3L1IJS635&Expires=1720500522&Signature=FGJLKhOoJLP6uU0a%2bSXBTeYE4%2f4%3d");
this.list.add("https://eos-wuxi-1.cmecloud.cn/cvftest/video/20230710/12/10000001031321000059/47psqo-new.mp4?AWSAccessKeyId=NTTBD40EBXC3L1IJS635&Expires=1720504624&Signature=MhPCw%2fRuBkFMNDRXhL2iucVnv9U%3d");
this.list.add("https://eos-wuxi-1.cmecloud.cn/cvftest/video/20230529/10/10000001031321000022/1h9cbo-new.mp4?AWSAccessKeyId=NTTBD40EBXC3L1IJS635&Expires=1716863360&Signature=zIpHI9qVHijHLl32bJEKXnXy084%3d");
this.list.add("https://eos-wuxi-1.cmecloud.cn/cvftest/video/20230425/09/10000001031321000012/frnvqq-new.mp4?AWSAccessKeyId=NTTBD40EBXC3L1IJS635&Expires=1713922455&Signature=AZ18byR3Buqc%2f%2bnt1g6xCeYdE3Q%3d");
this.list.add("https://eos-wuxi-1.cmecloud.cn/cvftest/video/20230216/15/10000001031321000020/10000001031321000020012023021615442700030.mp4?AWSAccessKeyId=NTTBD40EBXC3L1IJS635&Expires=1708070329&Signature=t4AjHCAkOTtdsDwLBTD0TbqptGY%3d");
this.list.add("https://eos-wuxi-1.cmecloud.cn/cvftest/video/20230216/15/10000001031321000020/10000001031321000020012023021615412400029.mp4?AWSAccessKeyId=NTTBD40EBXC3L1IJS635&Expires=1708070364&Signature=qLuPhSdj0yuVJ0uYpfk4P6dsL8M%3d");
this.list.add("https://eos-wuxi-1.cmecloud.cn/cvftest/video/20230216/15/10000001031321000020/10000001031321000020012023021615291500025.mp4?AWSAccessKeyId=NTTBD40EBXC3L1IJS635&Expires=1708068775&Signature=S7Rktowl0lE%2bcJQC0A23Ece0t7g%3d");
}
private final void addListener() {
CMCustomLayoutManager cMCustomLayoutManager = this.nLayoutManager;
if (cMCustomLayoutManager != null) {
cMCustomLayoutManager.setOnPageSlideListener(new OnPageSlideListener() {
@Override
public void onPageRelease(boolean z, int i) {
LegoLog.d("setOnPageSlideListener position " + i);
VideoPlayListActivity.this.releaseVideo(i);
}
@Override
public void onPageSelected(int i, boolean z) {
VideoPlayListActivity.this.playVideo(i);
}
});
}
}
public final void playVideo(int i) {
LegoBaseRecyclerViewAdapter<String> legoBaseRecyclerViewAdapter;
if (this.position == i) {
return;
}
RecyclerView.ViewHolder findViewHolderForAdapterPosition = ((ActivityVideoPlayListBinding) this.nViewDataBinding).recyclerView.findViewHolderForAdapterPosition(i);
View view = findViewHolderForAdapterPosition != null ? findViewHolderForAdapterPosition.itemView : null;
LegoLog.d("position " + i + " itemView " + view);
if ((view != null ? (PlayerView) view.findViewById(R.id.exoPlayerView) : null) == null || (legoBaseRecyclerViewAdapter = this.adapter) == null) {
return;
}
this.position = i;
MediaItem fromUri = MediaItem.fromUri(Uri.parse(legoBaseRecyclerViewAdapter.getData().get(this.position)));
Intrinsics.checkNotNullExpressionValue(fromUri, "fromUri(videoUri)");
getPlayer().setMediaItem(fromUri);
getPlayer().prepare();
getPlayer().play();
}
public final void releaseVideo(int i) {
RecyclerView.ViewHolder findViewHolderForAdapterPosition = ((ActivityVideoPlayListBinding) this.nViewDataBinding).recyclerView.findViewHolderForAdapterPosition(i);
View view = findViewHolderForAdapterPosition != null ? findViewHolderForAdapterPosition.itemView : null;
if (view != null) {
PlayerView playerView = (PlayerView) view.findViewById(R.id.exoPlayerView);
}
}
private final void initView() {
ExoPlayer build = new ExoPlayer.Builder(getContext()).build();
Intrinsics.checkNotNullExpressionValue(build, "Builder(context).build()");
setPlayer(build);
getPlayer().addListener(new Player.Listener() {
@Override
public void onAudioAttributesChanged(AudioAttributes audioAttributes) {
Player.Listener.CC.$default$onAudioAttributesChanged(this, audioAttributes);
}
@Override
public void onAudioSessionIdChanged(int i) {
Player.Listener.CC.$default$onAudioSessionIdChanged(this, i);
}
@Override
public void onAvailableCommandsChanged(Player.Commands commands) {
Player.Listener.CC.$default$onAvailableCommandsChanged(this, commands);
}
@Override
public void onCues(CueGroup cueGroup) {
Player.Listener.CC.$default$onCues(this, cueGroup);
}
@Override
public void onCues(List list) {
Player.Listener.CC.$default$onCues(this, list);
}
@Override
public void onDeviceInfoChanged(DeviceInfo deviceInfo) {
Player.Listener.CC.$default$onDeviceInfoChanged(this, deviceInfo);
}
@Override
public void onDeviceVolumeChanged(int i, boolean z) {
Player.Listener.CC.$default$onDeviceVolumeChanged(this, i, z);
}
@Override
public void onEvents(Player player, Player.Events events) {
Player.Listener.CC.$default$onEvents(this, player, events);
}
@Override
public void onIsLoadingChanged(boolean z) {
Player.Listener.CC.$default$onIsLoadingChanged(this, z);
}
@Override
public void onIsPlayingChanged(boolean z) {
Player.Listener.CC.$default$onIsPlayingChanged(this, z);
}
@Override
public void onLoadingChanged(boolean z) {
Player.Listener.CC.$default$onLoadingChanged(this, z);
}
@Override
public void onMaxSeekToPreviousPositionChanged(long j) {
Player.Listener.CC.$default$onMaxSeekToPreviousPositionChanged(this, j);
}
@Override
public void onMediaItemTransition(MediaItem mediaItem, int i) {
Player.Listener.CC.$default$onMediaItemTransition(this, mediaItem, i);
}
@Override
public void onMediaMetadataChanged(MediaMetadata mediaMetadata) {
Player.Listener.CC.$default$onMediaMetadataChanged(this, mediaMetadata);
}
@Override
public void onMetadata(androidx.media3.common.Metadata metadata) {
Player.Listener.CC.$default$onMetadata(this, metadata);
}
@Override
public void onPlayWhenReadyChanged(boolean z, int i) {
Player.Listener.CC.$default$onPlayWhenReadyChanged(this, z, i);
}
@Override
public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
Player.Listener.CC.$default$onPlaybackParametersChanged(this, playbackParameters);
}
@Override
public void onPlaybackSuppressionReasonChanged(int i) {
Player.Listener.CC.$default$onPlaybackSuppressionReasonChanged(this, i);
}
@Override
public void onPlayerError(PlaybackException playbackException) {
Player.Listener.CC.$default$onPlayerError(this, playbackException);
}
@Override
public void onPlayerErrorChanged(PlaybackException playbackException) {
Player.Listener.CC.$default$onPlayerErrorChanged(this, playbackException);
}
@Override
public void onPlayerStateChanged(boolean z, int i) {
Player.Listener.CC.$default$onPlayerStateChanged(this, z, i);
}
@Override
public void onPlaylistMetadataChanged(MediaMetadata mediaMetadata) {
Player.Listener.CC.$default$onPlaylistMetadataChanged(this, mediaMetadata);
}
@Override
public void onPositionDiscontinuity(int i) {
Player.Listener.CC.$default$onPositionDiscontinuity(this, i);
}
@Override
public void onRenderedFirstFrame() {
Player.Listener.CC.$default$onRenderedFirstFrame(this);
}
@Override
public void onRepeatModeChanged(int i) {
Player.Listener.CC.$default$onRepeatModeChanged(this, i);
}
@Override
public void onSeekBackIncrementChanged(long j) {
Player.Listener.CC.$default$onSeekBackIncrementChanged(this, j);
}
@Override
public void onSeekForwardIncrementChanged(long j) {
Player.Listener.CC.$default$onSeekForwardIncrementChanged(this, j);
}
@Override
public void onSeekProcessed() {
Player.Listener.CC.$default$onSeekProcessed(this);
}
@Override
public void onShuffleModeEnabledChanged(boolean z) {
Player.Listener.CC.$default$onShuffleModeEnabledChanged(this, z);
}
@Override
public void onSkipSilenceEnabledChanged(boolean z) {
Player.Listener.CC.$default$onSkipSilenceEnabledChanged(this, z);
}
@Override
public void onSurfaceSizeChanged(int i, int i2) {
Player.Listener.CC.$default$onSurfaceSizeChanged(this, i, i2);
}
@Override
public void onTimelineChanged(Timeline timeline, int i) {
Player.Listener.CC.$default$onTimelineChanged(this, timeline, i);
}
@Override
public void onTrackSelectionParametersChanged(TrackSelectionParameters trackSelectionParameters) {
Player.Listener.CC.$default$onTrackSelectionParametersChanged(this, trackSelectionParameters);
}
@Override
public void onTracksChanged(Tracks tracks) {
Player.Listener.CC.$default$onTracksChanged(this, tracks);
}
@Override
public void onVideoSizeChanged(VideoSize videoSize) {
Player.Listener.CC.$default$onVideoSizeChanged(this, videoSize);
}
@Override
public void onVolumeChanged(float f) {
Player.Listener.CC.$default$onVolumeChanged(this, f);
}
@Override
public void onPlaybackStateChanged(int i) {
Player.Listener.CC.$default$onPlaybackStateChanged(this, i);
if (i == 4) {
VideoPlayListActivity.this.getPlayer().stop();
VideoPlayListActivity.this.getPlayer().release();
LegoBaseRecyclerViewAdapter<String> adapter = VideoPlayListActivity.this.getAdapter();
if (adapter != null) {
VideoPlayListActivity.this.scrollToNextItem(adapter);
}
}
}
@Override
public void onPositionDiscontinuity(Player.PositionInfo oldPosition, Player.PositionInfo newPosition, int i) {
Intrinsics.checkNotNullParameter(oldPosition, "oldPosition");
Intrinsics.checkNotNullParameter(newPosition, "newPosition");
Player.Listener.CC.$default$onPositionDiscontinuity(this, oldPosition, newPosition, i);
VideoPlayListActivity.this.getPlayer().getCurrentPosition();
VideoPlayListActivity.this.getPlayer().getDuration();
}
});
this.nLayoutManager = new CMCustomLayoutManager(this, 1, false);
((ActivityVideoPlayListBinding) getViewDataBinding()).recyclerView.setLayoutManager(this.nLayoutManager);
final List<String> list = this.list;
this.adapter = new LegoBaseRecyclerViewAdapter<String>(list) {
@Override
public void onCustomBindItem(ViewDataBinding binding, int i) {
Intrinsics.checkNotNullParameter(binding, "binding");
super.onCustomBindItem(binding, i);
ItemVideoPlayListBinding itemVideoPlayListBinding = (ItemVideoPlayListBinding) binding;
itemVideoPlayListBinding.exoPlayerView.setPlayer(VideoPlayListActivity.this.getPlayer());
itemVideoPlayListBinding.exoPlayerView.setTag(R.id.playerView_tag, Integer.valueOf(i));
itemVideoPlayListBinding.tvUriStr.setText(String.valueOf(i));
SeekBar seekBar = itemVideoPlayListBinding.seekBar;
final VideoPlayListActivity videoPlayListActivity = VideoPlayListActivity.this;
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onStartTrackingTouch(SeekBar seekBar2) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar2) {
}
@Override
public void onProgressChanged(SeekBar seekBar2, int i2, boolean z) {
if (z) {
VideoPlayListActivity.this.getPlayer().seekTo((VideoPlayListActivity.this.getPlayer().getDuration() * i2) / 100);
}
}
});
VideoPlayListActivity videoPlayListActivity2 = VideoPlayListActivity.this;
ExoPlayer player = videoPlayListActivity2.getPlayer();
SeekBar seekBar2 = itemVideoPlayListBinding.seekBar;
Intrinsics.checkNotNullExpressionValue(seekBar2, "itemBinding.seekBar");
videoPlayListActivity2.updateProgress(player, seekBar2);
}
};
((ActivityVideoPlayListBinding) this.nViewDataBinding).recyclerView.setAdapter(this.adapter);
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public final void run() {
VideoPlayListActivity.initView$lambda$4(VideoPlayListActivity.this);
}
}, 200L);
}
public static final void initView$lambda$4(VideoPlayListActivity this$0) {
LegoBaseRecyclerViewAdapter<String> legoBaseRecyclerViewAdapter;
Intrinsics.checkNotNullParameter(this$0, "this$0");
RecyclerView.ViewHolder findViewHolderForAdapterPosition = ((ActivityVideoPlayListBinding) this$0.nViewDataBinding).recyclerView.findViewHolderForAdapterPosition(0);
StringBuilder sb = new StringBuilder("position ");
sb.append(this$0.position);
sb.append(" xx itemView ");
sb.append(findViewHolderForAdapterPosition != null ? findViewHolderForAdapterPosition.itemView : null);
LegoLog.d(sb.toString());
if ((findViewHolderForAdapterPosition != null ? findViewHolderForAdapterPosition.itemView : null) == null || (legoBaseRecyclerViewAdapter = this$0.adapter) == null) {
return;
}
MediaItem fromUri = MediaItem.fromUri(Uri.parse(legoBaseRecyclerViewAdapter.getData().get(this$0.position)));
Intrinsics.checkNotNullExpressionValue(fromUri, "fromUri(videoUri)");
this$0.getPlayer().setMediaItem(fromUri);
this$0.getPlayer().prepare();
this$0.getPlayer().play();
}
public final void updateProgress(ExoPlayer exoPlayer, SeekBar seekBar) {
seekBar.setProgress((int) ((100 * exoPlayer.getCurrentPosition()) / exoPlayer.getDuration()));
}
public final void scrollToNextItem(LegoBaseRecyclerViewAdapter<String> legoBaseRecyclerViewAdapter) {
LinearLayoutManager linearLayoutManager = this.layoutManager;
if (linearLayoutManager != null) {
Intrinsics.checkNotNull(linearLayoutManager);
int findFirstCompletelyVisibleItemPosition = linearLayoutManager.findFirstCompletelyVisibleItemPosition();
if (findFirstCompletelyVisibleItemPosition == -1 || findFirstCompletelyVisibleItemPosition >= legoBaseRecyclerViewAdapter.getItemCount() - 1) {
return;
}
((ActivityVideoPlayListBinding) this.nViewDataBinding).recyclerView.smoothScrollToPosition(findFirstCompletelyVisibleItemPosition + 1);
}
}
private final String formatTime(long j) {
Formatter formatter = new Formatter(new StringBuilder(), Locale.getDefault());
long j2 = j / 1000;
long j3 = 60;
long j4 = j2 % j3;
long j5 = (j2 / j3) % j3;
long j6 = j2 / 3600;
if (j2 < 0 || j4 < 0 || j5 < 0 || j6 < 0) {
String formatter2 = formatter.format("%02d:%02d:%02d", 0L, 0L, 0L).toString();
Intrinsics.checkNotNullExpressionValue(formatter2, "formatter.format(\"%02d:%…\", 0L, 0L, 0L).toString()");
return formatter2;
}
String formatter3 = formatter.format("%02d:%02d:%02d", Long.valueOf(j6), Long.valueOf(j5), Long.valueOf(j4)).toString();
Intrinsics.checkNotNullExpressionValue(formatter3, "formatter.format(\"%02d:%…utes, seconds).toString()");
return formatter3;
}
@Override
public void onResume() {
super.onResume();
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onDestroy() {
super.onDestroy();
}
}