diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2014-01-06 17:34:38 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2014-01-06 17:34:38 +0100 |
| commit | df523e8a6c019efe419b96d434a7ed73400393aa (patch) | |
| tree | 2d0a9345f48f9fd4c09d55c0d8c46bc805d546d6 /main/src/cgeo/geocaching/activity | |
| parent | 9b6cd5e94acebd5d8c307188ba6339f94946dc7d (diff) | |
| download | cgeo-df523e8a6c019efe419b96d434a7ed73400393aa.zip cgeo-df523e8a6c019efe419b96d434a7ed73400393aa.tar.gz cgeo-df523e8a6c019efe419b96d434a7ed73400393aa.tar.bz2 | |
fix #3521: GPS would stay on after a cache list refresh
The previous fix for #3521 was incomplete and only reduced the time
window during which the GPS could be turned on in a race condition
(4c5ef68f45a2b35537b89f857c1aa9fcb117ae83).
This one prevents the GPS from being turned on again when the
activity is paused (which includes a dead activity as well if
the user has left).
Diffstat (limited to 'main/src/cgeo/geocaching/activity')
| -rw-r--r-- | main/src/cgeo/geocaching/activity/AbstractListActivity.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/activity/AbstractListActivity.java b/main/src/cgeo/geocaching/activity/AbstractListActivity.java index a5d5c14..2adae7a 100644 --- a/main/src/cgeo/geocaching/activity/AbstractListActivity.java +++ b/main/src/cgeo/geocaching/activity/AbstractListActivity.java @@ -11,6 +11,7 @@ public abstract class AbstractListActivity extends FragmentListActivity implemen IAbstractActivity { private boolean keepScreenOn = false; + private boolean paused = true; protected CgeoApplication app = null; protected Resources res = null; @@ -84,4 +85,26 @@ public abstract class AbstractListActivity extends FragmentListActivity implemen // initialize action bar title with activity title ActivityMixin.setTitle(this, getTitle()); } + + @Override + public void onResume() { + paused = false; + super.onResume(); + } + + @Override + public void onPause() { + super.onPause(); + paused = true; + } + + /** + * Check if the current activity is paused. This must be called and acted + * upon only from the UI thread. + * + * @return <code>true</code> if the current activity is paused + */ + protected boolean isPaused() { + return paused; + } } |
