in SweetSounds.java, CountDownTimer.class, onTick() i added hours to the output. i also renamed the method padSeconds() to padTime()

also in TimePickerPreference.java i added the call layout.removeAllViewes() in onCreateView()
This commit is contained in:
2010-08-01 16:22:14 +00:00
parent 5ae83cab4d
commit d4ac53b923
2 changed files with 13 additions and 9 deletions

View File

@@ -343,8 +343,6 @@ public class SweetSounds extends Activity implements OnClickListener, OnSeekBarC
* @author ricky barrette
*/
class Timer extends CountDownTimer {
int minutes;
int seconds;
/**
* creates a new count down timer that stops play back of a sound track after specified time, and
@@ -356,10 +354,12 @@ public class SweetSounds extends Activity implements OnClickListener, OnSeekBarC
Log.i(TAG,"Timer()");
Log.v(TAG,"millisInFuture = "+ millisInFuture);
timeLeft = (TextView) findViewById(R.id.time_left);
minutes = (int) (millisInFuture / 60000);
seconds = (int) (millisInFuture % 60000);
int hours = (int) (millisInFuture / 3600000);
millisInFuture = millisInFuture - (hours * 3600000);
int minutes = (int) ( millisInFuture / 60000);
int seconds = (int) (millisInFuture % 60000);
seconds = seconds / 1000;
timeLeft.setText(minutes +" : "+ padSeconds(seconds));
timeLeft.setText(hours +" : "+ padTime(minutes) +" : "+ padTime(seconds));
}
/**
@@ -389,10 +389,12 @@ public class SweetSounds extends Activity implements OnClickListener, OnSeekBarC
@Override
public void onTick(long millisUntilFinished) {
Log.i(TAG,"onTick()");
minutes = (int) (millisUntilFinished / 60000);
seconds = (int) (millisUntilFinished % 60000);
int hours = (int) (millisUntilFinished / 3600000);
millisUntilFinished = millisUntilFinished - (hours * 3600000);
int minutes = (int) ( millisUntilFinished / 60000);
int seconds = (int) (millisUntilFinished % 60000);
seconds = seconds / 1000;
timeLeft.setText(minutes +" : "+ padSeconds(seconds));
timeLeft.setText(hours +" : "+ padTime(minutes) +" : "+ padTime(seconds));
}
/**
@@ -401,7 +403,7 @@ public class SweetSounds extends Activity implements OnClickListener, OnSeekBarC
* @return formated string
* @author ricky barrette
*/
private String padSeconds(int seconds){
private String padTime(int seconds){
if (seconds <= 9)
return "0"+ seconds;
return ""+ seconds;

View File

@@ -102,6 +102,8 @@ public class TimePickerPreference extends Preference implements OnTimeChangedLis
layout.setPadding(15, 5, 10, 5);
layout.setOrientation(LinearLayout.VERTICAL);
layout.removeAllViews();
/*
* create a textview that will be used to display the title provided in xml
* and add it to the lay out