提交 4397cf18 编写于 作者: G guoshuyu

add isShowDragProgressTextOnSeekBar

上级 93bb8bc7
......@@ -113,6 +113,9 @@ public class GSYVideoOptionBuilder {
//是否需要在利用window实现全屏幕的时候隐藏statusbar
protected boolean mStatusBar = false;
//拖动进度条时,是否在 seekbar 开始部位显示拖动进度
protected boolean isShowDragProgressTextOnSeekBar = false;
//播放的tag,防止错误,因为普通的url也可能重复
protected String mPlayTag = "";
......@@ -547,6 +550,10 @@ public class GSYVideoOptionBuilder {
return this;
}
public GSYVideoOptionBuilder setShowDragProgressTextOnSeekBar(boolean isShowDragProgressTextOnSeekBar) {
this.isShowDragProgressTextOnSeekBar = isShowDragProgressTextOnSeekBar;
return this;
}
/**
* 在播放前才真正执行setup
......@@ -635,6 +642,7 @@ public class GSYVideoOptionBuilder {
gsyVideoPlayer.setStartAfterPrepared(mStartAfterPrepared);
gsyVideoPlayer.setReleaseWhenLossAudio(mReleaseWhenLossAudio);
gsyVideoPlayer.setFullHideActionBar(mActionBar);
gsyVideoPlayer.setShowDragProgressTextOnSeekBar(isShowDragProgressTextOnSeekBar);
gsyVideoPlayer.setFullHideStatusBar(mStatusBar);
if (mEnlargeImageRes > 0) {
gsyVideoPlayer.setEnlargeImageRes(mEnlargeImageRes);
......
......@@ -132,6 +132,7 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
protected boolean mPostProgress = false;
protected boolean mPostDismiss = false;
protected boolean isShowDragProgressTextOnSeekBar = false;
//播放按键
protected View mStartButton;
......@@ -570,10 +571,7 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
int duration = getDuration();
mCurrentTimeTextView.setText(CommonUtil.stringForTime(progress * duration / 100));
}
showDragProgressTextOnSeekBar(fromUser, progress);
}
@Override
......@@ -667,6 +665,14 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
mFirstTouch = true;
}
protected void showDragProgressTextOnSeekBar(boolean fromUser, int progress) {
if (fromUser && isShowDragProgressTextOnSeekBar) {
int duration = getDuration();
if (mCurrentTimeTextView != null)
mCurrentTimeTextView.setText(CommonUtil.stringForTime(progress * duration / 100));
}
}
protected void touchSurfaceMove(float deltaX, float deltaY, float y) {
int curWidth = 0;
int curHeight = 0;
......@@ -1344,4 +1350,16 @@ public abstract class GSYVideoControlView extends GSYVideoView implements View.O
public void setGSYVideoProgressListener(GSYVideoProgressListener videoProgressListener) {
this.mGSYVideoProgressListener = videoProgressListener;
}
public boolean isShowDragProgressTextOnSeekBar() {
return isShowDragProgressTextOnSeekBar;
}
/**
* 拖动进度条时,是否在 seekbar 开始部位显示拖动进度
* 默认 false
*/
public void setShowDragProgressTextOnSeekBar(boolean showDragProgressTextOnSeekBar) {
isShowDragProgressTextOnSeekBar = showDragProgressTextOnSeekBar;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册