diff options
| -rw-r--r-- | main/src/cgeo/geocaching/CacheListActivity.java | 7 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/activity/AbstractListActivity.java | 23 |
2 files changed, 29 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java index 85972be..cc8b178 100644 --- a/main/src/cgeo/geocaching/CacheListActivity.java +++ b/main/src/cgeo/geocaching/CacheListActivity.java @@ -305,7 +305,12 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA showProgress(false); progress.dismiss(); - startGeoAndDir(); + if (!isPaused()) { + // If the current activity has been paused, then we do not want to fiddle with the + // GPS and direction states. If the activity later gets resumed, its onResume() + // function will take care of turning the GPS back on. + startGeoAndDir(); + } } } }; 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; + } } |
