Exemplo n.º 1
0
  /**
   * 更新播放进度
   *
   * @param progress 当前进度
   * @param secondProgress 缓冲进度
   * @param maxValue 最大值
   * @param isTracking 用户是否正在操作中
   */
  public void updateProgress(int progress, int secondProgress, int maxValue, boolean isTracking) {
    // 更新播放时间信息
    initFormatter(maxValue);

    // 更新进度条
    mDuration = maxValue;
    mCsb.setMax(maxValue);
    mCsb.setSecondaryProgress(secondProgress * maxValue / 100);

    if (!isTracking) {
      mCsb.setProgress(progress);
      mTvCurrentTime.setText(formatPlayTime(progress));
    }

    mTvTotalTime.setText(formatPlayTime(maxValue));
  }