Skip to content

Commit

Permalink
clear timer on stop()
Browse files Browse the repository at this point in the history
  • Loading branch information
segler-alex committed May 3, 2016
1 parent 0db0644 commit d288231
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ protected void onPostExecute(String result) {
private void InitControls() {
aTextViewName = (TextView) findViewById(R.id.detail_station_name_value);
textViewCountdown = (TextView) findViewById(R.id.textViewCountdown);
if (textViewCountdown != null){
textViewCountdown.setText("");
}

buttonStop = (ImageButton) findViewById(R.id.buttonStop);
if (buttonStop != null){
Expand Down Expand Up @@ -147,7 +150,7 @@ private void UpdateOutput() {

long seconds = PlayerServiceUtil.getTimerSeconds();

if (seconds < 0){
if (seconds <= 0){
buttonClearTimeout.setVisibility(View.GONE);
textViewCountdown.setText("");
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class PlayerService extends Service implements OnBufferingUpdateListener,
private String itsStationURL;
private MediaPlayer itsMediaPlayer = null;
private CountDownTimer timer = null;
long seconds = -1;
long seconds = 0;

void sendBroadCast(String action){
Intent local = new Intent();
Expand Down Expand Up @@ -84,7 +84,7 @@ private void clearTimer() {
timer.cancel();
timer = null;

seconds = -1;
seconds = 0;

sendBroadCast(PLAYER_SERVICE_TIMER_UPDATE);
}
Expand Down Expand Up @@ -233,10 +233,7 @@ public void Stop() {
itsMediaPlayer = null;
}

if (timer != null){
timer.cancel();
timer = null;
}
clearTimer();
stopForeground(true);
sendBroadCast(PLAYER_SERVICE_STATUS_UPDATE);
}
Expand Down

0 comments on commit d288231

Please sign in to comment.