Java Code Examples for io.vov.vitamio.utils.StringUtils
The following examples show how to use
io.vov.vitamio.utils.StringUtils. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: MyHearts Source File: MediaController.java License: Apache License 2.0 | 6 votes |
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; }
Example 2
Source Project: HPlayer Source File: MediaController.java License: Apache License 2.0 | 6 votes |
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; }
Example 3
Source Project: video-player Source File: MediaController.java License: MIT License | 6 votes |
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; }
Example 4
Source Project: NetEasyNews Source File: MediaController.java License: GNU General Public License v3.0 | 6 votes |
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; }
Example 5
Source Project: react-native-android-vitamio Source File: MediaController.java License: MIT License | 6 votes |
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; }
Example 6
Source Project: Vitamio Source File: MediaController.java License: Apache License 2.0 | 6 votes |
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; }
Example 7
Source Project: BambooPlayer Source File: MediaController.java License: Apache License 2.0 | 6 votes |
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; }
Example 8
Source Project: MyHearts Source File: MediaController.java License: Apache License 2.0 | 5 votes |
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); }
Example 9
Source Project: HPlayer Source File: VideoListAdapter.java License: Apache License 2.0 | 5 votes |
@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; }
Example 10
Source Project: HPlayer Source File: PlayerActivity.java License: Apache License 2.0 | 5 votes |
@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())); } }
Example 11
Source Project: HPlayer Source File: MediaController.java License: Apache License 2.0 | 5 votes |
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); }
Example 12
Source Project: video-player Source File: MediaController.java License: MIT License | 5 votes |
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); }
Example 13
Source Project: NetEasyNews Source File: MediaController.java License: GNU General Public License v3.0 | 5 votes |
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); }
Example 14
Source Project: react-native-android-vitamio Source File: MediaController.java License: MIT License | 5 votes |
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); }
Example 15
Source Project: Vitamio Source File: MediaController.java License: Apache License 2.0 | 5 votes |
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); }
Example 16
Source Project: BambooPlayer Source File: MediaController.java License: Apache License 2.0 | 5 votes |
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); }
Example 17
Source Project: HPlayer Source File: DlnaFragment.java License: Apache License 2.0 | 4 votes |
@Override public void run() { mSeekBar.setProgress((int) (currentPosition / (float) duration * 1000)); mCurrentTime.setText(StringUtils.generateTime(currentPosition)); mTotalTime.setText(StringUtils.generateTime(duration)); }