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:
@@ -343,8 +343,6 @@ public class SweetSounds extends Activity implements OnClickListener, OnSeekBarC
|
|||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
class Timer extends CountDownTimer {
|
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
|
* 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.i(TAG,"Timer()");
|
||||||
Log.v(TAG,"millisInFuture = "+ millisInFuture);
|
Log.v(TAG,"millisInFuture = "+ millisInFuture);
|
||||||
timeLeft = (TextView) findViewById(R.id.time_left);
|
timeLeft = (TextView) findViewById(R.id.time_left);
|
||||||
minutes = (int) (millisInFuture / 60000);
|
int hours = (int) (millisInFuture / 3600000);
|
||||||
seconds = (int) (millisInFuture % 60000);
|
millisInFuture = millisInFuture - (hours * 3600000);
|
||||||
|
int minutes = (int) ( millisInFuture / 60000);
|
||||||
|
int seconds = (int) (millisInFuture % 60000);
|
||||||
seconds = seconds / 1000;
|
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
|
@Override
|
||||||
public void onTick(long millisUntilFinished) {
|
public void onTick(long millisUntilFinished) {
|
||||||
Log.i(TAG,"onTick()");
|
Log.i(TAG,"onTick()");
|
||||||
minutes = (int) (millisUntilFinished / 60000);
|
int hours = (int) (millisUntilFinished / 3600000);
|
||||||
seconds = (int) (millisUntilFinished % 60000);
|
millisUntilFinished = millisUntilFinished - (hours * 3600000);
|
||||||
|
int minutes = (int) ( millisUntilFinished / 60000);
|
||||||
|
int seconds = (int) (millisUntilFinished % 60000);
|
||||||
seconds = seconds / 1000;
|
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
|
* @return formated string
|
||||||
* @author ricky barrette
|
* @author ricky barrette
|
||||||
*/
|
*/
|
||||||
private String padSeconds(int seconds){
|
private String padTime(int seconds){
|
||||||
if (seconds <= 9)
|
if (seconds <= 9)
|
||||||
return "0"+ seconds;
|
return "0"+ seconds;
|
||||||
return ""+ seconds;
|
return ""+ seconds;
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ public class TimePickerPreference extends Preference implements OnTimeChangedLis
|
|||||||
layout.setPadding(15, 5, 10, 5);
|
layout.setPadding(15, 5, 10, 5);
|
||||||
layout.setOrientation(LinearLayout.VERTICAL);
|
layout.setOrientation(LinearLayout.VERTICAL);
|
||||||
|
|
||||||
|
layout.removeAllViews();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* create a textview that will be used to display the title provided in xml
|
* create a textview that will be used to display the title provided in xml
|
||||||
* and add it to the lay out
|
* and add it to the lay out
|
||||||
|
|||||||
Reference in New Issue
Block a user