导航菜单

页面标题

页面副标题

自健身 v3.3.4 - PlayerVideoActivity.java 源代码

正在查看: 自健身 v3.3.4 应用的 PlayerVideoActivity.java JAVA 源代码文件

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


package com.mu.gymtrain.Activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import androidx.lifecycle.ViewModelProviders;
import com.blankj.utilcode.util.ActivityUtils;
import com.githang.statusbar.StatusBarCompat;
import com.mu.gymtrain.Base.BaseActivity;
import com.mu.gymtrain.R;
import com.mu.gymtrain.viewmodel.PlayerVideoViewModel;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
import com.shuyu.gsyvideoplayer.utils.OrientationUtils;
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;

public class PlayerVideoActivity extends BaseActivity {
    private String mp4;
    private OrientationUtils orientationUtils;
    private String title;
    private StandardGSYVideoPlayer videoPlayer;

    public int getContentLayout() {
        return R.layout.activity_player_video_layout;
    }

    public void initData() {
    }

    public static void startActivity(String title, String url) {
        startActivity(title, url, -1, false);
    }

    public static void startActivity(String title, String url, int videoId, boolean isRecord) {
        Bundle bundle = new Bundle();
        bundle.putString("title", title);
        bundle.putString("mp4", url);
        bundle.putInt("videoId", videoId);
        bundle.putBoolean("isRecord", isRecord);
        ActivityUtils.startActivity(bundle, PlayerVideoActivity.class);
    }

    public void initView() {
        PlayerVideoViewModel playerVideoViewModel = (PlayerVideoViewModel) ViewModelProviders.of(this).get(PlayerVideoViewModel.class);
        StatusBarCompat.setStatusBarColor((Activity) this, getResources().getColor(2131099685), true);
        this.mp4 = getIntent().getStringExtra("mp4");
        this.title = getIntent().getStringExtra("title");
        int intExtra = getIntent().getIntExtra("videoId", 0);
        if (getIntent().getBooleanExtra("isRecord", false)) {
            playerVideoViewModel.openVideo(intExtra, 1);
        }
        init();
    }

    private void init() {
        StandardGSYVideoPlayer standardGSYVideoPlayer = (StandardGSYVideoPlayer) findViewById(R.id.video_player);
        this.videoPlayer = standardGSYVideoPlayer;
        standardGSYVideoPlayer.setLockLand(true);
        this.videoPlayer.setUp(this.mp4, true, this.title);
        this.videoPlayer.getTitleTextView().setVisibility(0);
        this.videoPlayer.getBackButton().setVisibility(0);
        this.orientationUtils = new OrientationUtils(this, this.videoPlayer);
        this.videoPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PlayerVideoActivity.this.orientationUtils.resolveByClick();
            }
        });
        this.videoPlayer.setIsTouchWiget(true);
        this.videoPlayer.getBackButton().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PlayerVideoActivity.this.onBackPressed();
            }
        });
        this.videoPlayer.startPlayLogic();
    }

    protected void onPause() {
        super.onPause();
        this.videoPlayer.onVideoPause();
    }

    protected void onResume() {
        super.onResume();
        this.videoPlayer.onVideoResume();
    }

    protected void onDestroy() {
        super.onDestroy();
        GSYVideoManager.releaseAllVideos();
        OrientationUtils orientationUtils = this.orientationUtils;
        if (orientationUtils != null) {
            orientationUtils.releaseListener();
        }
    }

    public void onBackPressedSupport() {
        if (this.orientationUtils.getScreenType() == 0) {
            this.videoPlayer.getFullscreenButton().performClick();
        } else {
            this.videoPlayer.setVideoAllCallBack(null);
            super.onBackPressedSupport();
        }
    }
}