Пример #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); // 防止锁屏

    String obj = getIntent().getStringExtra("obj");
    mVideoPath = getIntent().getStringExtra("path");
    mMediaObject = restoneMediaObject(obj);
    if (mMediaObject == null) {
      Toast.makeText(this, R.string.record_read_object_faild, Toast.LENGTH_SHORT).show();
      finish();
      return;
    }

    mWindowWidth = DeviceUtils.getScreenWidth(this);
    setContentView(R.layout.activity_import_video);

    // ~~~ 绑定控件
    mVideoView = (VideoView) findViewById(R.id.record_preview);
    mRecordPlay = findViewById(R.id.record_play);
    mProgressView = (ProgressView) findViewById(R.id.record_progress);

    // ~~~ 绑定事件
    mVideoView.setOnClickListener(this);
    mVideoView.setOnPreparedListener(this);
    mVideoView.setOnPlayStateListener(this);
    findViewById(R.id.title_left).setOnClickListener(this);
    findViewById(R.id.title_right).setOnClickListener(this);

    findViewById(R.id.record_layout).getLayoutParams().height = mWindowWidth;
    mVideoView.setVideoPath(mVideoPath);
    System.out.println("mVideoPath:" + mVideoPath);
  }
Пример #2
0
  private void init() {
    mProgressPaint = new Paint();
    mActivePaint = new Paint();
    mPausePaint = new Paint();
    mRemovePaint = new Paint();
    mThreePaint = new Paint();
    mOverflowPaint = new Paint();

    mVLineWidth = DeviceUtils.dipToPX(getContext(), 1);

    setBackgroundColor(getResources().getColor(R.color.camera_bg));
    mProgressPaint.setColor(0xFF45C01A);
    mProgressPaint.setStyle(Paint.Style.FILL);

    mActivePaint.setColor(getResources().getColor(R.color.white));
    mActivePaint.setStyle(Paint.Style.FILL);

    mPausePaint.setColor(getResources().getColor(R.color.camera_progress_split));
    mPausePaint.setStyle(Paint.Style.FILL);

    mRemovePaint.setColor(getResources().getColor(R.color.camera_progress_delete));
    mRemovePaint.setStyle(Paint.Style.FILL);

    mThreePaint.setColor(getResources().getColor(R.color.camera_progress_three));
    mThreePaint.setStyle(Paint.Style.FILL);

    mOverflowPaint.setColor(getResources().getColor(R.color.camera_progress_overflow));
    mOverflowPaint.setStyle(Paint.Style.FILL);
  }