Java Code Examples for android.widget.SeekBar#getMax()

The following examples show how to use android.widget.SeekBar#getMax() . 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 File: AudioView.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  if (fromUser && durationMillis > 0) {
    float progressFloat = progress / (float) seekBar.getMax();
    updateProgress(progressFloat, (long) (durationMillis * progressFloat));
  }
}
 
Example 2
Source File: ReaderSettingDialog.java    From FriendBook with GNU General Public License v3.0 5 votes vote down vote up
private void setBrightness(int progress, SeekBar seekBar) {
    if (progress < 0 || progress > seekBar.getMax()) {
        return;
    }
    if (readTvLightnessSystem.isSelected()) {
        setAutoBrightness(false, readTvLightnessSystem);
    }
    seekBar.setProgress(progress);
    BrightnessUtils.setBrightness(getOwnerActivity(), progress);
}
 
Example 3
Source File: PluginSimplePlayer.java    From Dota2Helper with Apache License 2.0 5 votes vote down vote up
/**
 * 搜索进度
 * 
 * @param seekBar
 */
protected void seekChange(SeekBar seekBar) {
	if (null == mMediaPlayerDelegate)
		return;
	if (null != seekBar && seekBar.getProgress() == seekBar.getMax()
			&& seekBar.getMax() > 0) {
		if (null != mMediaPlayerDelegate.videoInfo)
			mMediaPlayerDelegate.videoInfo
					.setProgress(mMediaPlayerDelegate.videoInfo
							.getDurationMills());
		// complete = true;
		mMediaPlayerDelegate.onComplete();

		// if (null != playHandler) {
		// playHandler.removeCallbacksAndMessages(null);
		// playHandler.sendEmptyMessage(MSG_COMPLETE);
		// }
	} else if (mMediaPlayerDelegate != null) {
		if (null != mMediaPlayerDelegate.videoInfo)
			mMediaPlayerDelegate.videoInfo.setProgress(seekBar
					.getProgress());
		if (!mMediaPlayerDelegate.isPlaying()) {
			startPlay();
		}
		mMediaPlayerDelegate.seekTo(seekBar.getProgress());
		isLoading = true;
		videoBar.setEnabled(false);
		Logger.e("PlayFlow", "小播放器拖动seekto" + seekBar.getProgress());
	}
}
 
Example 4
Source File: YoukuPluginPlayer.java    From Dota2Helper with Apache License 2.0 5 votes vote down vote up
/**
 * 搜索进度
 *
 * @param seekBar
 */
protected void seekChange(SeekBar seekBar) {
    if (null == mMediaPlayerDelegate)
        return;
    if (null != seekBar && seekBar.getProgress() == seekBar.getMax()
            && seekBar.getMax() > 0) {
        if (null != mMediaPlayerDelegate.videoInfo)
            mMediaPlayerDelegate.videoInfo
                    .setProgress(mMediaPlayerDelegate.videoInfo
                            .getDurationMills());
        // complete = true;
        mMediaPlayerDelegate.onComplete();

        // if (null != playHandler) {
        // playHandler.removeCallbacksAndMessages(null);
        // playHandler.sendEmptyMessage(MSG_COMPLETE);
        // }
    } else if (mMediaPlayerDelegate != null) {
        if (null != mMediaPlayerDelegate.videoInfo)
            mMediaPlayerDelegate.videoInfo.setProgress(seekBar
                    .getProgress());
        if (!mMediaPlayerDelegate.isPlaying()) {
            startPlay();
        }
        mMediaPlayerDelegate.seekTo(seekBar.getProgress());
        isLoading = true;
        videoBar.setEnabled(false);
        Logger.e("PlayFlow", "小播放器拖动seekto" + seekBar.getProgress());
    }
}
 
Example 5
Source File: MNViderPlayer.java    From MNVideoPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    if (mediaPlayer != null && mediaPlayer.isPlaying()) {
        int maxCanSeekTo = seekBar.getMax() - 5 * 1000;
        if (seekBar.getProgress() < maxCanSeekTo) {
            mediaPlayer.seekTo(seekBar.getProgress());
        } else {
            //不能拖到最后
            mediaPlayer.seekTo(maxCanSeekTo);
        }
    }
}
 
Example 6
Source File: PluginSimplePlayer.java    From SimplifyReader with Apache License 2.0 5 votes vote down vote up
/**
 * 搜索进度
 * 
 * @param seekBar
 */
protected void seekChange(SeekBar seekBar) {
	if (null == mMediaPlayerDelegate)
		return;
	if (null != seekBar && seekBar.getProgress() == seekBar.getMax()
			&& seekBar.getMax() > 0) {
		if (null != mMediaPlayerDelegate.videoInfo)
			mMediaPlayerDelegate.videoInfo
					.setProgress(mMediaPlayerDelegate.videoInfo
							.getDurationMills());
		// complete = true;
		mMediaPlayerDelegate.onComplete();

		// if (null != playHandler) {
		// playHandler.removeCallbacksAndMessages(null);
		// playHandler.sendEmptyMessage(MSG_COMPLETE);
		// }
	} else if (mMediaPlayerDelegate != null) {
		if (null != mMediaPlayerDelegate.videoInfo)
			mMediaPlayerDelegate.videoInfo.setProgress(seekBar
					.getProgress());
		if (!mMediaPlayerDelegate.isPlaying()) {
			startPlay();
		}
		mMediaPlayerDelegate.seekTo(seekBar.getProgress());
		isLoading = true;
		videoBar.setEnabled(false);
		Logger.e("PlayFlow", "小播放器拖动seekto" + seekBar.getProgress());
	}
}
 
Example 7
Source File: ChromecastControllerFragment.java    From SkyTube with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
	if(fromUser) {
	} else {
		if(durationTextView.getMilliseconds() != seekBar.getMax())
			durationTextView.setMilliseconds(seekBar.getMax());
	}
	currentPositionTextView.setMilliseconds(progress);
}
 
Example 8
Source File: FABActivity.java    From fab with Apache License 2.0 5 votes vote down vote up
private void initShadowXOffsetSeekBar() {
	shadowXOffsetSeekBar = (SeekBar) findViewById(R.id.fab_activity_seekbar_shadow_x_offset);
	final int progress = (int) (pxToDp(actionButton.getShadowXOffset())
			* SEEKBAR_PROGRESS_MULTIPLIER + shadowXOffsetSeekBar.getMax() / 2);
	shadowXOffsetSeekBar.setProgress(progress);
	shadowXOffsetSeekBar.setOnSeekBarChangeListener(new ShadowOffsetChangeListener());
}
 
Example 9
Source File: PlaybackController.java    From AntennaPodSP with MIT License 5 votes vote down vote up
/**
 * Should be used by classes which implement the OnSeekBarChanged interface.
 */
public float onSeekBarProgressChanged(SeekBar seekBar, int progress,
                                      boolean fromUser, TextView txtvPosition) {
    if (fromUser && playbackService != null && media != null) {
        float prog = progress / ((float) seekBar.getMax());
        int duration = media.getDuration();
        txtvPosition.setText(Converter
                .getDurationStringLong((int) (prog * duration)));
        return prog;
    }
    return 0;

}
 
Example 10
Source File: Utils.java    From TubiPlayer with MIT License 4 votes vote down vote up
public static long progressToMilli(long playerDurationMs, SeekBar seekBar) {
    long duration = playerDurationMs < 1 ? C.TIME_UNSET : playerDurationMs;
    return duration == C.TIME_UNSET ? 0 : ((duration * seekBar.getProgress()) / seekBar.getMax());
}
 
Example 11
Source File: MusicBottomFragment.java    From mobile-manager-tool with MIT License 4 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    // 原本是(progress/seekBar.getMax())*player.mediaPlayer.getDuration()
    this.progress = progress * duration/ seekBar.getMax();
}
 
Example 12
Source File: PlayerActivity.java    From MediaPlayerProxy with Apache License 2.0 4 votes vote down vote up
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
	this.progress = progress * player.mediaPlayer.getDuration() / seekBar.getMax();
}
 
Example 13
Source File: SettingsActivity.java    From GlassActionBar with Apache License 2.0 4 votes vote down vote up
private static float transformSeekBarValue(SeekBar seekBar, int min, int max) {
    float value = seekBar.getProgress() / (float) seekBar.getMax();
    float span = max - min;
    return min + value * span;
}
 
Example 14
Source File: SettingsActivity.java    From GlassActionBar with Apache License 2.0 4 votes vote down vote up
private static float transformSeekBarValue(SeekBar seekBar, int min, int max) {
    float value = seekBar.getProgress() / (float) seekBar.getMax();
    float span = max - min;
    return min + value * span;
}
 
Example 15
Source File: SettingsActivity.java    From GlassActionBar with Apache License 2.0 4 votes vote down vote up
private static float transformSeekBarValue(SeekBar seekBar, int min, int max) {
    float value = seekBar.getProgress() / (float) seekBar.getMax();
    float span = max - min;
    return min + value * span;
}