本文整理了Java中android.widget.SeekBar
类的一些代码示例,展示了SeekBar
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SeekBar
类的具体详情如下:
包路径:android.widget.SeekBar
类名称:SeekBar
暂无
代码示例来源:origin: seven332/EhViewer
@Override
protected void onBindView(View view) {
super.onBindView(view);
SeekBar seekBar = (SeekBar) view.findViewById(R.id.seekbar);
seekBar.setOnSeekBarChangeListener(this);
seekBar.setMax(mMax);
seekBar.setProgress(mProgress);
seekBar.setEnabled(isEnabled());
}
代码示例来源:origin: PhilJay/MPAndroidChart
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tvX.setText(String.valueOf(seekBarX.getProgress()));
tvY.setText(String.valueOf(seekBarY.getProgress()));
setData(seekBarX.getProgress(), seekBarY.getProgress());
}
代码示例来源:origin: TeamNewPipe/NewPipe
@Override
public void onProgressUpdate(int currentProgress, int duration, int bufferPercent) {
// Set buffer progress
progressSeekBar.setSecondaryProgress((int) (progressSeekBar.getMax() * ((float) bufferPercent / 100)));
// Set Duration
progressSeekBar.setMax(duration);
progressEndTime.setText(Localization.getDurationString(duration / 1000));
// Set current time if not seeking
if (!seeking) {
progressSeekBar.setProgress(currentProgress);
progressCurrentTime.setText(Localization.getDurationString(currentProgress / 1000));
}
if (player != null) {
progressLiveSync.setClickable(!player.isLiveEdge());
}
// this will make shure progressCurrentTime has the same width as progressEndTime
final ViewGroup.LayoutParams endTimeParams = progressEndTime.getLayoutParams();
final ViewGroup.LayoutParams currentTimeParams = progressCurrentTime.getLayoutParams();
currentTimeParams.width = progressEndTime.getWidth();
progressCurrentTime.setLayoutParams(currentTimeParams);
}
代码示例来源:origin: jiajunhui/PlayerBase
private void setBottomSeekProgress(int curr, int duration){
mBottomSeekBar.setMax(duration);
mBottomSeekBar.setProgress(curr);
float secondProgress = mBufferPercentage * 1.0f/100 * duration;
mBottomSeekBar.setSecondaryProgress((int) secondProgress);
}
代码示例来源:origin: CarGuo/GSYVideoPlayer
protected void loopSetProgressAndTime() {
if (mProgressBar == null || mTotalTimeTextView == null || mCurrentTimeTextView == null) {
return;
}
mProgressBar.setProgress(0);
mProgressBar.setSecondaryProgress(0);
mCurrentTimeTextView.setText(CommonUtil.stringForTime(0));
if (mBottomProgressBar != null)
mBottomProgressBar.setProgress(0);
}
代码示例来源:origin: lipangit/JiaoZiVideoPlayer
public void onStateAutoComplete() {
Log.i(TAG, "onStateAutoComplete " + " [" + this.hashCode() + "] ");
currentState = CURRENT_STATE_AUTO_COMPLETE;
cancelProgressTimer();
progressBar.setProgress(100);
currentTimeTextView.setText(totalTimeTextView.getText());
}
代码示例来源:origin: dkim0419/SoundRecorder
@Override
public void run() {
if(mMediaPlayer != null){
int mCurrentPosition = mMediaPlayer.getCurrentPosition();
mSeekBar.setProgress(mCurrentPosition);
long minutes = TimeUnit.MILLISECONDS.toMinutes(mCurrentPosition);
long seconds = TimeUnit.MILLISECONDS.toSeconds(mCurrentPosition)
- TimeUnit.MINUTES.toSeconds(minutes);
mCurrentProgressTextView.setText(String.format("%02d:%02d", minutes, seconds));
updateSeekBar();
}
}
};
代码示例来源:origin: dkim0419/SoundRecorder
private void stopPlaying() {
mPlayButton.setImageResource(R.drawable.ic_media_play);
mHandler.removeCallbacks(mRunnable);
mMediaPlayer.stop();
mMediaPlayer.reset();
mMediaPlayer.release();
mMediaPlayer = null;
mSeekBar.setProgress(mSeekBar.getMax());
isPlaying = !isPlaying;
mCurrentProgressTextView.setText(mFileLengthTextView.getText());
mSeekBar.setProgress(mSeekBar.getMax());
//allow the screen to turn off again once audio is finished playing
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
代码示例来源:origin: TeamNewPipe/NewPipe
@Override
public void onUpdateProgress(int currentProgress, int duration, int bufferPercent) {
if (!isPrepared()) return;
if (duration != playbackSeekBar.getMax()) {
playbackEndTime.setText(getTimeString(duration));
playbackSeekBar.setMax(duration);
}
if (currentState != STATE_PAUSED) {
if (currentState != STATE_PAUSED_SEEK) playbackSeekBar.setProgress(currentProgress);
playbackCurrentTime.setText(getTimeString(currentProgress));
}
if (simpleExoPlayer.isLoading() || bufferPercent > 90) {
playbackSeekBar.setSecondaryProgress((int) (playbackSeekBar.getMax() * ((float) bufferPercent / 100)));
}
if (DEBUG && bufferPercent % 20 == 0) { //Limit log
Log.d(TAG, "updateProgress() called with: isVisible = " + isControlsVisible() + ", currentProgress = [" + currentProgress + "], duration = [" + duration + "], bufferPercent = [" + bufferPercent + "]");
}
playbackLiveSync.setClickable(!isLiveEdge());
}
代码示例来源:origin: lingochamp/okdownload
.setText(holder.priorityTv.getContext().getString(R.string.priority, priority));
holder.prioritySb.setProgress(priority);
if (this.context.isStarted()) {
holder.prioritySb.setEnabled(false);
} else {
holder.prioritySb.setEnabled(true);
holder.prioritySb.setOnSeekBarChangeListener(
new SeekBar.OnSeekBarChangeListener() {
boolean isFromUser;
代码示例来源:origin: TeamNewPipe/NewPipe
private void buildSeekBar() {
progressCurrentTime = rootView.findViewById(R.id.current_time);
progressSeekBar = rootView.findViewById(R.id.seek_bar);
progressEndTime = rootView.findViewById(R.id.end_time);
progressLiveSync = rootView.findViewById(R.id.live_sync);
seekDisplay = rootView.findViewById(R.id.seek_display);
progressSeekBar.setOnSeekBarChangeListener(this);
progressLiveSync.setOnClickListener(this);
}
代码示例来源:origin: TeamNewPipe/NewPipe
@Override
public void onPrepared(boolean playWhenReady) {
if (DEBUG) Log.d(TAG, "onPrepared() called with: playWhenReady = [" + playWhenReady + "]");
playbackSeekBar.setMax((int) simpleExoPlayer.getDuration());
playbackEndTime.setText(getTimeString((int) simpleExoPlayer.getDuration()));
playbackSpeedTextView.setText(formatSpeed(getPlaybackSpeed()));
super.onPrepared(playWhenReady);
}
代码示例来源:origin: adolfAn/FBReader_AS
private void setupNavigation() {
final SeekBar slider = (SeekBar)myWindow.findViewById(R.id.navigation_slider);
final TextView text = (TextView)myWindow.findViewById(R.id.navigation_text);
final ZLTextView textView = myFBReader.getTextView();
final ZLTextView.PagePosition pagePosition = textView.pagePosition();
if (slider.getMax() != pagePosition.Total - 1 || slider.getProgress() != pagePosition.Current - 1) {
slider.setMax(pagePosition.Total - 1);
slider.setProgress(pagePosition.Current - 1);
text.setText(makeProgressText(pagePosition.Current, pagePosition.Total));
}
}
代码示例来源:origin: ExcaliburZ/ImitateBilibili
@Override
public void onPrepared(MediaPlayer mp) {
System.out.println("onPrepared");
rocketAnimation.stop();
mLoadingLayout.setVisibility(View.INVISIBLE);
long duration = mp.getDuration();
mTotalTime.setText(TimeUtils.LongToStr((long) mp.getDuration()));
mProcess.setMax((int) duration);
mProcess.setProgress(0);
isPrepared = true;
}
});
代码示例来源:origin: Lauzy/LyricView
@Override
public void onPrepared(MediaPlayer mp) {
mMediaPlayer.start();
mSeekBar.setMax(mMediaPlayer.getDuration());
mTvEnd.setText(LrcHelper.formatTime(mMediaPlayer.getDuration()));
}
});
代码示例来源:origin: dkim0419/SoundRecorder
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
if (mMediaPlayer != null) {
mHandler.removeCallbacks(mRunnable);
mMediaPlayer.seekTo(seekBar.getProgress());
long minutes = TimeUnit.MILLISECONDS.toMinutes(mMediaPlayer.getCurrentPosition());
long seconds = TimeUnit.MILLISECONDS.toSeconds(mMediaPlayer.getCurrentPosition())
- TimeUnit.MINUTES.toSeconds(minutes);
mCurrentProgressTextView.setText(String.format("%02d:%02d", minutes,seconds));
updateSeekBar();
}
}
});
代码示例来源:origin: 18Gray/ProCamera
@Override
public void onCompletion(MediaPlayer mp)
{
// 播放结束,隐藏该控件
setVisibility(View.GONE);
mProgressBar.setProgress(0);
mCurrentTimeView.setText("00:00");
mp.reset();
}
代码示例来源:origin: brianwernick/ExoMedia
@Override
public void setDuration(@IntRange(from = 0) long duration) {
if (duration != seekBar.getMax()) {
endTimeTextView.setText(TimeFormatUtil.formatMs(duration));
seekBar.setMax((int) duration);
}
}
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
setRetainInstance(true);
View result=inflater.inflate(R.layout.scaleclip, container, false);
SeekBar bar=((SeekBar)result.findViewById(R.id.level));
bar.setOnSeekBarChangeListener(this);
image=(ImageView)result.findViewById(R.id.image);
setImageBackground(image);
image.setImageLevel(bar.getProgress());
return(result);
}
代码示例来源:origin: googlecast/CastVideos-android
@Override
public void onPrepared(MediaPlayer mp) {
Log.d(TAG, "onPrepared is reached");
mDuration = mp.getDuration();
mEndText.setText(Utils.formatMillis(mDuration));
mSeekbar.setMax(mDuration);
restartTrickplayTimer();
}
});
内容来源于网络,如有侵权,请联系作者删除!