Fix crash because of the re-lock timer
If the option is not enabled the timer never gets created, needed a null check when aborting it in onPause() + Some minor style fixes
This commit is contained in:
parent
e7748e7979
commit
ea5f8e01f8
1 changed files with 15 additions and 5 deletions
|
@ -357,7 +357,8 @@ public class MainActivity extends BaseActivity
|
|||
checkIntent();
|
||||
}
|
||||
|
||||
if(setCountDownTimerNow()) countDownTimer.start();
|
||||
if (setCountDownTimerNow())
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
if (filterString != null) {
|
||||
|
@ -383,7 +384,9 @@ public class MainActivity extends BaseActivity
|
|||
});
|
||||
super.onPause();
|
||||
stopUpdater();
|
||||
countDownTimer.cancel();
|
||||
|
||||
if (countDownTimer != null)
|
||||
countDownTimer.cancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -762,13 +765,19 @@ public class MainActivity extends BaseActivity
|
|||
super.onUserInteraction();
|
||||
|
||||
// Refresh Blackout Timer
|
||||
if(countDownTimer != null) countDownTimer.cancel();
|
||||
if(setCountDownTimerNow()) countDownTimer.start();
|
||||
if (countDownTimer != null)
|
||||
countDownTimer.cancel();
|
||||
|
||||
if (setCountDownTimerNow())
|
||||
countDownTimer.start();
|
||||
}
|
||||
|
||||
private boolean setCountDownTimerNow() {
|
||||
int secondsToBlackout = 1000 * settings.getAuthInactivityDelay();
|
||||
if(settings.getAuthMethod() == AuthMethod.NONE || !settings.getAuthInactivity() || secondsToBlackout == 0 ) return false;
|
||||
|
||||
if (settings.getAuthMethod() == AuthMethod.NONE || !settings.getAuthInactivity() || secondsToBlackout == 0)
|
||||
return false;
|
||||
|
||||
countDownTimer = new CountDownTimer(secondsToBlackout, 1000) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
|
@ -780,6 +789,7 @@ public class MainActivity extends BaseActivity
|
|||
this.cancel();
|
||||
}
|
||||
};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue