导航菜单

页面标题

页面副标题

CallApp v2.226 - VideoPlayerActivity.java 源代码

正在查看: CallApp v2.226 应用的 VideoPlayerActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package io.bidmachine.nativead.view;

import a1.d0;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.VideoView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.bidmachine.core.Logger;
import io.bidmachine.core.Utils;
import io.bidmachine.iab.utils.Assets;
import io.bidmachine.iab.vast.view.CircleCountdownView;
import io.bidmachine.media3.exoplayer.mediacodec.l;

public class VideoPlayerActivity extends Activity implements MediaPlayer.OnCompletionListener, MediaPlayer.OnErrorListener, MediaPlayer.OnPreparedListener {
    private static final String FILE_URI = "io.bidmachine.fileUri";
    private static final String SEEK_TO = "io.bidmachine.seekTo";
    private c listener;
    private int seekTo;
    private VideoView videoView;

    public class a implements View.OnClickListener {
        public a() {
        }

        @Override
        public void onClick(View view) {
            VideoPlayerActivity.this.closeClicked();
        }
    }

    public class b implements Runnable {
        public b() {
        }

        @Override
        public void run() {
            try {
                VideoPlayerActivity.this.getWindow().clearFlags(128);
            } catch (Exception e) {
                Logger.w(e);
            }
        }
    }

    public void closeClicked() {
        if (this.listener != null) {
            this.listener.videoPlayerActivityClosed(this.videoView.isPlaying() ? this.videoView.getCurrentPosition() : 0, false);
        }
        finishActivity();
    }

    private void finishActivity() {
        runOnUiThread(new b());
        finish();
    }

    public static Intent getIntent(@NonNull Context context, @NonNull String str, int i) {
        Intent intent = new Intent(context, (Class<?>) VideoPlayerActivity.class);
        intent.putExtra(FILE_URI, str);
        intent.putExtra(SEEK_TO, i);
        return intent;
    }

    public String lambda$onCreate$0() {
        return d0.j(this.seekTo, "VideoPlayerActivity started, position: ");
    }

    @Override
    public void onBackPressed() {
        closeClicked();
    }

    @Override
    public void onCompletion(MediaPlayer mediaPlayer) {
        c cVar = this.listener;
        if (cVar != null) {
            cVar.videoPlayerActivityClosed(0, true);
        }
        finishActivity();
    }

    @Override
    public void onCreate(@Nullable Bundle bundle) {
        super.onCreate(bundle);
        getWindow().addFlags(128);
        Intent intent = getIntent();
        String stringExtra = intent.getStringExtra(FILE_URI);
        this.seekTo = intent.getIntExtra(SEEK_TO, 0);
        Logger.d(new l(this, 8));
        if (stringExtra == null) {
            return;
        }
        this.listener = MediaView.listener;
        RelativeLayout relativeLayout = new RelativeLayout(this);
        relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
        this.videoView = new VideoView(this);
        this.videoView.setLayoutParams(com.amazon.device.ads.l.i(-1, -1, 13));
        this.videoView.setOnCompletionListener(this);
        this.videoView.setOnPreparedListener(this);
        this.videoView.setVideoPath(stringExtra);
        relativeLayout.addView(this.videoView);
        float screenDensity = Utils.getScreenDensity(this);
        int round = Math.round(24.0f * screenDensity);
        int round2 = Math.round(screenDensity * 8.0f);
        CircleCountdownView circleCountdownView = new CircleCountdownView(this);
        circleCountdownView.setColors(Assets.MAIN_ASSETS_COLOR, Assets.BACKGROUND_COLOR);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(round, round);
        layoutParams.addRule(11, -1);
        layoutParams.addRule(10, -1);
        layoutParams.setMargins(round2, round2, round2, round2);
        circleCountdownView.setImage(Assets.getBitmapFromBase64(Assets.CLOSE));
        circleCountdownView.setLayoutParams(layoutParams);
        circleCountdownView.setOnClickListener(new a());
        relativeLayout.addView(circleCountdownView);
        setContentView(relativeLayout);
    }

    @Override
    public boolean onError(MediaPlayer mediaPlayer, int i, int i2) {
        finishActivity();
        return false;
    }

    @Override
    public void onPrepared(MediaPlayer mediaPlayer) {
        VideoView videoView = this.videoView;
        if (videoView == null || !videoView.canSeekForward()) {
            return;
        }
        this.videoView.seekTo(this.seekTo);
        this.videoView.start();
    }
}