本文整理汇总了Java中io.vov.vitamio.utils.StringUtils类的典型用法代码示例。如果您正苦于以下问题:Java StringUtils类的具体用法?Java StringUtils怎么用?Java StringUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringUtils类属于io.vov.vitamio.utils包,在下文中一共展示了StringUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setProgress
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
private long setProgress() {
if (mPlayer == null || mDragging)
return 0;
long position = mPlayer.getCurrentPosition();
long duration = mPlayer.getDuration();
if (mProgress != null) {
if (duration > 0) {
long pos = 1000L * position / duration;
mProgress.setProgress((int) pos);
}
int percent = mPlayer.getBufferPercentage();
mProgress.setSecondaryProgress(percent * 10);
}
mDuration = duration;
if (mEndTime != null)
mEndTime.setText(StringUtils.generateTime(mDuration));
if (mCurrentTime != null)
mCurrentTime.setText(StringUtils.generateTime(position));
return position;
}
示例2: setProgress
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
private long setProgress() {
if (mPlayer == null || mDragging)
return 0;
long position = mPlayer.getCurrentPosition();
long duration = mPlayer.getDuration();
if (mProgress != null) {
if (duration > 0) {
long pos = 1000L * position / duration;
mProgress.setProgress((int) pos);
}
int percent = mPlayer.getBufferPercentage();
mProgress.setSecondaryProgress(percent * 10);
}
mDuration = duration;
if (mEndTime != null)
mEndTime.setText(StringUtils.generateTime(mDuration));
if (mCurrentTime != null)
mCurrentTime.setText(StringUtils.generateTime(position));
return position;
}
示例3: setProgress
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
private long setProgress() {
if (mPlayer == null || mDragging) return 0;
long position = mPlayer.getCurrentPosition();
long duration = mPlayer.getDuration();
if (mProgress != null) {
if (duration > 0) {
long pos = 1000L * position / duration;
mProgress.setProgress((int) pos);
}
int percent = mPlayer.getBufferPercentage();
mProgress.setSecondaryProgress(percent * 10);
}
mDuration = duration;
if (mEndTime != null) mEndTime.setText(StringUtils.generateTime(mDuration));
if (mCurrentTime != null) mCurrentTime.setText(StringUtils.generateTime(position));
return position;
}
示例4: setProgress
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
private long setProgress() {
if (mPlayer == null || mDragging)
return 0;
long position = mPlayer.getCurrentPosition();
long duration = mPlayer.getDuration();
if (mProgress != null) {
if (duration > 0) {
long pos = 1000L * position / duration;
mProgress.setProgress((int) pos);
}
int percent = mPlayer.getBufferPercentage();
// mProgress.setSecondaryProgress(percent * 10);
}
mDuration = duration;
if (mEndTime != null)
mEndTime.setText(StringUtils.generateTime(mDuration));
if (mCurrentTime != null)
mCurrentTime.setText(StringUtils.generateTime(position));
return position;
}
示例5: onProgressChanged
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
if (!fromuser)
return;
long newposition = (mDuration * progress) / 1000;
String time = StringUtils.generateTime(newposition);
if (mInstantSeeking)
mPlayer.seekTo(newposition);
if (mInfoView != null)
mInfoView.setText(time);
if (mCurrentTime != null)
mCurrentTime.setText(time);
}
示例6: setFlashText
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
private void setFlashText(long seek) {
String showTime = StringUtils.generateTime(seek) +
"/" + StringUtils.generateTime(mVideoView.getDuration());
mTvFast.setText(showTime);
mSeek = seek;
mIsFastFinish = true;
if (mTvFast.getVisibility() != View.VISIBLE) {
mTvFast.setVisibility(View.VISIBLE);
}
}
示例7: onProgressChanged
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
if (!fromuser)
return;
long newposition = (mDuration * progress) / 1000;
String time = StringUtils.generateTime(newposition);
if (mInstantSeeking)
mPlayer.seekTo(newposition);
if (mInfoView != null)
mInfoView.setText(time);
if (mCurrentTime != null)
mCurrentTime.setText(time);
}
示例8: initProgress
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
private void initProgress() {
currentPosition = mVideoView.getCurrentPosition();
duration = mVideoView.getDuration();
sb_process.setProgress((int) (100 * currentPosition / duration));
tv_start.setText(StringUtils.generateTime(currentPosition));
tv_end.setText(StringUtils.generateTime(duration));
mHandler.sendEmptyMessageDelayed(MESSAGE_CHANGE_TEXT_PROGRESS, 1000);
}
示例9: onProgressChanged
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
long currentPosition = progress * duration / seekBar.getMax();
tv_start.setText(StringUtils.generateTime(currentPosition));
mVideoView.seekTo(currentPosition);
}
}
示例10: onStopTrackingTouch
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// 结束触摸seekbar时
long currentPosition = seekBar.getProgress() * duration / seekBar.getMax();
mVideoView.seekTo(currentPosition);
tv_start.setText(StringUtils.generateTime(currentPosition));
mVideoView.start();
mHandler.sendEmptyMessage(MESSAGE_CHANGE_TEXT_PROGRESS);
mHandler.sendEmptyMessageDelayed(MESSAGE_WINDOW_GONE, DEFAULT_DISMISS_TIME);
}
示例11: onProgressChanged
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
public void onProgressChanged(SeekBar bar, int progress, boolean fromuser) {
if (!fromuser) return;
long newposition = (mDuration * progress) / 1000;
String time = StringUtils.generateTime(newposition);
if (mInstantSeeking) mPlayer.seekTo(newposition);
if (mInfoView != null) mInfoView.setText(time);
if (mCurrentTime != null) mCurrentTime.setText(time);
if (mOnProgressChangeListener != null) {
mOnProgressChangeListener.onChange();
}
}
示例12: getView
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.video_list_item, null);
holder = new ViewHolder();
holder.infoLayout = convertView.findViewById(R.id.info_layout);
holder.name = (TextView) convertView.findViewById(R.id.media_name);
holder.size = (TextView) convertView.findViewById(R.id.media_size);
holder.path = (TextView) convertView.findViewById(R.id.media_path);
holder.duration = (TextView) convertView.findViewById(R.id.media_duration);
holder.image = (ImageView) convertView.findViewById(R.id.media_image);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
Utility.resizeImageViewOnScreenSize(mContext, holder.image, 3, 10, 4, 3);
ViewGroup.LayoutParams lp = holder.infoLayout.getLayoutParams();
lp.height = holder.image.getLayoutParams().height;
MediaInfo mediaInfo = getItem(position);
holder.name.setText(mediaInfo.getName());
holder.size.setText(FileManager.sizeAddUnit(mediaInfo.getSize()));
holder.duration.setText(StringUtils.generateTime(mediaInfo.getDuration()));
holder.path.setText(mediaInfo.getPath());
if (mediaInfo.getThumbnailPath() != null) {
Picasso.with(mContext).load("file://" + mediaInfo.getThumbnailPath())
.error(R.drawable.image_default_bg).into(holder.image);
} else {
holder.image.setImageResource(R.drawable.image_default_bg);
}
return convertView;
}
示例13: run
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
@Override
public void run() {
mHandler.postDelayed(updateSeekBarThread, UPDATE_INTERVAL);
if (mVideoView.getDuration() != 0) {
mSeekBar.setProgress((int) (mVideoView.getCurrentPosition() /
(float) mVideoView.getDuration() * 1000));
mCurrentTime.setText(StringUtils.generateTime(
mVideoView.getCurrentPosition()));
mTotalTime.setText(StringUtils.generateTime(
mVideoView.getDuration()));
}
}
示例14: run
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
@Override
public void run() {
mSeekBar.setProgress((int) (currentPosition / (float) duration * 1000));
mCurrentTime.setText(StringUtils.generateTime(currentPosition));
mTotalTime.setText(StringUtils.generateTime(duration));
}
示例15: sec2time
import io.vov.vitamio.utils.StringUtils; //导入依赖的package包/类
/**
* 秒转化为常见格式
*
* @param time 时间
* @return
*/
private String sec2time(long time) {
return StringUtils.generateTime(time);
}