美文网首页
视频相关接口,弹窗

视频相关接口,弹窗

作者: 啊了个支 | 来源:发表于2018-04-27 10:08 被阅读0次

    /**

    • @创建者 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);
    
    }
    

    }

    相关文章

      网友评论

          本文标题:视频相关接口,弹窗

          本文链接:https://www.haomeiwen.com/subject/yxqblftx.html