视频相关接口,弹窗

/**

  • @创建者 fz

  • @时间 2018/4/27

  • @描述 生命周期监听
    */
    public interface LifeCycleListener {

    void onCreate();

    void onStart();

    void onResume();

    void onPause();

    void onStop();

    void onDestroy();
    }

public interface IVideoPlayer extends LifeCycleListener {

/**
 * 规定:
 * 1、args长度为0时,默认是继续播放
 * 2、args长度为1时,默认是全屏播放
 * 3、args长度>1时,默认是小窗口播放
 */
void play(Object... args);

void pause();

void stop();

void seekTo(int posi);

int getVideoDuration();

int getVideoPosition();

boolean isPlaying();

void show();

void hide();

void setListener(VideoPlayerListener listener);

}

public interface VideoPlayerListener {
void onPrepared();

void onError();

void onCompletion();

}

/**

  • 数据加载的时候,进度动画
    */
    public class CustomProgressDialog extends ProgressDialog {
    private AnimationDrawable mAnimation;
    private static CustomProgressDialog customProgressDialog;
    private Context mContext;
    private ImageView mImageView;
    // private String mLoadingTip="进度条加载中。。。。。。。";
    private TextView mLoadingTv;

    // private int count = 0;
    // private String oldLoadingTip;
    // private int mResid;
    public CustomProgressDialog(Context context) {
    super(context);
    }

    public CustomProgressDialog(Context context, int theme) {
    super(context, theme);
    // Log.e("CustomProgressDialog", "@@@@@@@@构造方法");
    this.mContext = context;
    }

public static CustomProgressDialog createDialog(Context context) {
// Log.e("CustomProgressDialog", "createDialog");
//获取dialog的样式
customProgressDialog = new CustomProgressDialog(context, R.style.loadingProgressDialog);
customProgressDialog.getWindow().getAttributes().gravity = Gravity.CENTER;
return customProgressDialog;
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

// Log.e("CustomProgressDialog", "onCreate()");

    initView();
    initData();
}

private void initView() {
// Log.e("CustomProgressDialog", "initView()");
setCancelable(false);
setContentView(R.layout.progress_dialog);
mLoadingTv = (TextView) findViewById(R.id.loadingTv);
mImageView = (ImageView) findViewById(R.id.loadingIv);
}

private void initData() {

// Log.e("CustomProgressDialog", "initData()");
mImageView.setBackgroundResource(R.drawable.loading_anim);
// 通过ImageView对象拿到背景显示的AnimationDrawable
mAnimation = (AnimationDrawable) mImageView.getBackground();
// mAnimation.start();
mImageView.post(new Runnable() {
@Override
public void run() {
mAnimation.start();

        }
    });
    mLoadingTv.setText(R.string.load_video);

}

}

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容