reset idle timer each time a new swap screen is loaded
This means that as long as the user is using swap, it'll stay running.
This commit is contained in:
parent
e02bc4134a
commit
74c3c24f0a
@ -484,7 +484,11 @@ public class SwapService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initTimer() {
|
/**
|
||||||
|
* Sets or resets the idel timer for {@link #TIMEOUT}ms, once the timer
|
||||||
|
* expires, this service and all things that rely on it will be stopped.
|
||||||
|
*/
|
||||||
|
public void initTimer() {
|
||||||
if (timer != null) {
|
if (timer != null) {
|
||||||
Utils.debugLog(TAG, "Cancelling existing timeout timer so timeout can be reset.");
|
Utils.debugLog(TAG, "Cancelling existing timeout timer so timeout can be reset.");
|
||||||
timer.cancel();
|
timer.cancel();
|
||||||
|
@ -472,6 +472,8 @@ public class SwapWorkflowActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void inflateSwapView(@LayoutRes int viewRes) {
|
public void inflateSwapView(@LayoutRes int viewRes) {
|
||||||
|
getSwapService().initTimer();
|
||||||
|
|
||||||
container.removeAllViews();
|
container.removeAllViews();
|
||||||
View view = ((LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE)).inflate(viewRes, container, false);
|
View view = ((LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE)).inflate(viewRes, container, false);
|
||||||
currentView = (SwapView) view;
|
currentView = (SwapView) view;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user