Java源码示例:com.devbrackets.android.exomedia.util.TimeFormatUtil
示例1
@Override
public void setDuration(@IntRange(from = 0) long duration) {
this.duration = duration;
if (duration != seekBar.getMax()) {
endTimeTextView.setText(TimeFormatUtil.formatMs(duration));
seekBar.setMax((int) duration);
}
if (duration != bottomProgressBar.getMax()) {
bottomProgressBar.setMax((int) duration);
}
}
示例2
@Override
public void updateProgress(@IntRange(from = 0) long position, @IntRange(from = 0) long duration, @IntRange(from = 0, to = 100) int bufferPercent) {
if (!userInteracting) {
seekBar.setSecondaryProgress((int) (seekBar.getMax() * ((float) bufferPercent / 100)));
seekBar.setProgress((int) position);
currentTimeTextView.setText(TimeFormatUtil.formatMs(position));
bottomProgressBar.setProgress((int) position);
bottomProgressBar.setSecondaryProgress((int) (bottomProgressBar.getMax() * ((float) bufferPercent / 100)));
}
}
示例3
@Override
public void showFormatTime(long formatTime) {
formatTimeTextView.setVisibility(VISIBLE);
if (isVisible()) {
playPauseButton.setVisibility(GONE);
}
if (formatTime >= 0) {
formatTimeTextView.setText("+ " + TimeFormatUtil.formatMs(formatTime));
} else {
formatTimeTextView.setText("- " + TimeFormatUtil.formatMs(Math.abs(formatTime)));
}
}
示例4
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (!fromUser) {
return;
}
seekToTime = progress;
if (currentTimeTextView != null) {
currentTimeTextView.setText(TimeFormatUtil.formatMs(seekToTime));
}
}
示例5
@Override
public void setDuration(@IntRange(from = 0) long duration) {
this.duration = duration;
if (duration != seekBar.getMax()) {
endTimeTextView.setText(TimeFormatUtil.formatMs(duration));
seekBar.setMax((int) duration);
}
if (duration != bottomProgressBar.getMax()) {
bottomProgressBar.setMax((int) duration);
}
}
示例6
@Override
public void updateProgress(@IntRange(from = 0) long position, @IntRange(from = 0) long duration, @IntRange(from = 0, to = 100) int bufferPercent) {
if (!userInteracting) {
seekBar.setSecondaryProgress((int) (seekBar.getMax() * ((float) bufferPercent / 100)));
seekBar.setProgress((int) position);
currentTimeTextView.setText(TimeFormatUtil.formatMs(position));
bottomProgressBar.setProgress((int) position);
bottomProgressBar.setSecondaryProgress((int) (bottomProgressBar.getMax() * ((float) bufferPercent / 100)));
}
}
示例7
@Override
public void showFormatTime(long formatTime) {
formatTimeTextView.setVisibility(VISIBLE);
if (isVisible()) {
playPauseButton.setVisibility(GONE);
}
if (formatTime >= 0) {
formatTimeTextView.setText("+ " + TimeFormatUtil.formatMs(formatTime));
} else {
formatTimeTextView.setText("- " + TimeFormatUtil.formatMs(Math.abs(formatTime)));
}
}
示例8
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (!fromUser) {
return;
}
seekToTime = progress;
if (currentTimeTextView != null) {
currentTimeTextView.setText(TimeFormatUtil.formatMs(seekToTime));
}
}
示例9
@Override
public void setDuration(long duration) {
if (duration != progressBar.getMax()) {
endTimeTextView.setText(TimeFormatUtil.formatMs(duration));
progressBar.setMax((int) duration);
}
}
示例10
/***
* Updates the current timestamp
*
* @param position The position in milliseconds
*/
protected void updateCurrentTime(long position) {
// optimization :
// update the timestamp text per second regarding the 'reset' or 'seek' operations.
if (Math.abs(position - lastUpdatedPosition) >= 1000 || lastUpdatedPosition == 0) {
lastUpdatedPosition = position;
currentTimeTextView.setText(TimeFormatUtil.formatMs(position));
}
}
示例11
@Override
public void setDuration(@IntRange(from = 0) long duration) {
if (duration != seekBar.getMax()) {
endTimeTextView.setText(TimeFormatUtil.formatMs(duration));
seekBar.setMax((int) duration);
}
}
示例12
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (!fromUser) {
return;
}
seekToTime = progress;
if (currentTimeTextView != null) {
currentTimeTextView.setText(TimeFormatUtil.formatMs(seekToTime));
}
}
示例13
@Override
public void setDuration(@IntRange(from = 0) long duration) {
if (duration != seekBar.getMax()) {
endTimeTextView.setText(TimeFormatUtil.formatMs(duration));
seekBar.setMax((int) duration);
}
}
示例14
@Override
public void updateProgress(@IntRange(from = 0) long position, @IntRange(from = 0) long duration,
@IntRange(from = 0, to = 100) int bufferPercent) {
if (!userInteracting) {
seekBar.setSecondaryProgress((int) (seekBar.getMax() * ((float) bufferPercent / 100)));
seekBar.setProgress((int) position);
currentTimeTextView.setText(TimeFormatUtil.formatMs(position));
}
}
示例15
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (!fromUser) {
return;
}
seekToTime = progress;
if (currentTimeTextView != null) {
currentTimeTextView.setText(TimeFormatUtil.formatMs(seekToTime));
}
}
示例16
@Override
public void setPosition(@IntRange(from = 0) long position) {
currentTimeTextView.setText(TimeFormatUtil.formatMs(position));
seekBar.setProgress((int) position);
bottomProgressBar.setProgress((int) position);
}
示例17
@Override
public void setPosition(@IntRange(from = 0) long position) {
currentTimeTextView.setText(TimeFormatUtil.formatMs(position));
seekBar.setProgress((int) position);
bottomProgressBar.setProgress((int) position);
}
示例18
@Override
public void setPosition(long position) {
currentTimeTextView.setText(TimeFormatUtil.formatMs(position));
progressBar.setProgress((int) position);
}
示例19
@Override
public void setPosition(@IntRange(from = 0) long position) {
currentTimeTextView.setText(TimeFormatUtil.formatMs(position));
seekBar.setProgress((int) position);
}
示例20
@Override
public void setPosition(@IntRange(from = 0) long position) {
currentTimeTextView.setText(TimeFormatUtil.formatMs(position));
seekBar.setProgress((int) position);
}