diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2014-01-06 17:36:28 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2014-01-06 17:36:28 +0100 |
| commit | a6fd369d05b821108952b136a9002d02a19af9a8 (patch) | |
| tree | 02f3ac763d038a67dbbfe6e45ed4f97b3d80833e | |
| parent | c80fdade78ba0d5a693f823ff0d0ae2d512656ce (diff) | |
| parent | df523e8a6c019efe419b96d434a7ed73400393aa (diff) | |
| download | cgeo-a6fd369d05b821108952b136a9002d02a19af9a8.zip cgeo-a6fd369d05b821108952b136a9002d02a19af9a8.tar.gz cgeo-a6fd369d05b821108952b136a9002d02a19af9a8.tar.bz2 | |
Merge branch 'release' into upstream
| -rw-r--r-- | main/res/values/changelog_release.xml | 1 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/CacheListActivity.java | 7 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/activity/AbstractListActivity.java | 23 |
3 files changed, 30 insertions, 1 deletions
diff --git a/main/res/values/changelog_release.xml b/main/res/values/changelog_release.xml index e5b58ee..363a09e 100644 --- a/main/res/values/changelog_release.xml +++ b/main/res/values/changelog_release.xml @@ -28,6 +28,7 @@ <b>Bugfixes:</b>\n · Reduce memory usage for OSM mapsforge to avoid crashes\n · Optimize database access for faster live map loading\n + · In rare cases GPS was not switched off when leaving the app\n · Cache type filter was not applied for OC nearby search\n · No cache coords if cache is at equator or prime meridian\n · Parts of the compass not shown when using big fonts\n 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; + } } |
