Code example for SeekBar

Methods: getProgresssetVisibility

0
	} 
 
	private TurnProgressTask turnProgressTask;
	public void startRotation() { 
		turnProgress.setVisibility(View.VISIBLE);
		timeSlider.setVisibility(View.INVISIBLE);
		turnProgress.setMax(getRotationInHundrethsOfSecs());
		 
		if (turnProgressTask != null)
			turnProgressTask.cancel();
		turnProgressTask = new TurnProgressTask(new ClockImpl(), this);
		turnProgressTask.schedule();
	} 
 
 
	public void stopRotation() { 
		playerText.setText(R.string.rotationStopped);
		playerText.setTextColor(Color.CYAN);
		turnProgress.setVisibility(View.INVISIBLE);
		timeSlider.setVisibility(View.VISIBLE);
		 
		turnProgressTask.cancel();
	} 
	 
	@Override 
	public void onPause(){ 
		super.onPause(); 
		SharedPreferences.Editor prefs = this.getPreferences(MODE_PRIVATE).edit();
        prefs.putInt(ROTATION_TIME, timeSlider.getProgress());
        prefs.commit();
	} 
 
 
	public Integer getStoredRotationTime() {
		SharedPreferences prefs = getPreferences(Activity.MODE_PRIVATE);
		int rotationTime = prefs.getInt(ROTATION_TIME, 7);
		return rotationTime;
	} 
 
 
	public void updateTimeLabel()  
	{ 
		TextView timeLabel = (TextView) findViewById(R.id.rotationTimeLabel);
		int progress = timeSlider.getProgress();
		String label = getString(R.string.timer_slider);
		timeLabel.setText(label + " " + progress + " min");
	}	 
	 
	public boolean fireProgressUpdatedRetunTrueToReset(long elapsed) {
		boolean resetTimer = false;
		long newProgress = elapsed;
		int rotationPeriodInHundrethSeconds = getRotationInHundrethsOfSecs();
		if (newProgress > rotationPeriodInHundrethSeconds) {
			newProgress = newProgress - rotationPeriodInHundrethSeconds;
			resetTimer = true;
		} 
		turnProgress.setProgress((int) newProgress);
		 
		return resetTimer;
	} 
 
 
	private int getRotationInHundrethsOfSecs() { 
		return getRotationPeriod() /100; 
	} 
 
 
	public int getRotationPeriod() { 
		return timeSlider.getProgress() * 60000;
	} 
}