Skip to content

Commit

Permalink
Release the wakeLock in onPause(), because onPause is guaranteed to b…
Browse files Browse the repository at this point in the history
…e called.
  • Loading branch information
John Wood committed Nov 26, 2009
1 parent 4b07091 commit 72bf4b9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/net/johnpwood/android/standuptimer/StandupTimer.java
Expand Up @@ -33,8 +33,8 @@ public class StandupTimer extends Activity implements OnClickListener {

private boolean finished = false;
private Timer timer = null;
private PowerManager.WakeLock wakeLock = null;

private static PowerManager.WakeLock wakeLock = null;
private static MediaPlayer bell = null;
private static MediaPlayer airhorn = null;

Expand Down Expand Up @@ -71,6 +71,7 @@ protected void onPause() {

synchronized(this) {
cancelTimer();
releaseWakeLock();

if (finished) {
clearState();
Expand All @@ -80,12 +81,6 @@ protected void onPause() {
}
}

@Override
protected void onDestroy() {
super.onDestroy();
releaseWakeLock();
}

public void onClick(View v) {
switch (v.getId()) {
case R.id.next_button:
Expand Down Expand Up @@ -262,7 +257,6 @@ private synchronized boolean individualStatusInProgress() {

private synchronized void processFinishedButtonClick() {
destroySounds();
releaseWakeLock();
finished = true;
finish();
}
Expand Down

0 comments on commit 72bf4b9

Please sign in to comment.