diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2014-01-08 14:10:27 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2014-01-08 14:10:27 +0100 |
| commit | 2c52d238ceae971eac793352f708c27136980227 (patch) | |
| tree | b24513ba39f4c11049a3e112d6c9e736198d6140 | |
| parent | 025c0affdf07fef63615c732c112fbc96a52fe75 (diff) | |
| download | cgeo-2c52d238ceae971eac793352f708c27136980227.zip cgeo-2c52d238ceae971eac793352f708c27136980227.tar.gz cgeo-2c52d238ceae971eac793352f708c27136980227.tar.bz2 | |
fix #3522: do not asynchronously play with GPS status
| -rw-r--r-- | main/src/cgeo/geocaching/CacheListActivity.java | 37 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/activity/AbstractListActivity.java | 23 |
2 files changed, 6 insertions, 54 deletions
diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java index cc8b178..d24df7c 100644 --- a/main/src/cgeo/geocaching/CacheListActivity.java +++ b/main/src/cgeo/geocaching/CacheListActivity.java @@ -304,13 +304,6 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA showProgress(false); progress.dismiss(); - - 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(); - } } } }; @@ -472,7 +465,10 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA public void onResume() { super.onResume(); - startGeoAndDir(); + geoDirHandler.startGeo(); + if (Settings.isLiveMap()) { + geoDirHandler.startDir(); + } adapter.setSelectMode(false); setAdapterCurrentCoordinates(true); @@ -503,8 +499,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA @Override public void onPause() { - removeGeoAndDir(); - + geoDirHandler.stopGeoAndDir(); super.onPause(); } @@ -742,8 +737,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA public void run(IFilter selectedFilter) { if (selectedFilter != null) { setFilter(selectedFilter); - } - else { + } else { // clear filter setFilter(null); } @@ -973,17 +967,6 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA listFooter.setClickable(enableMore); } - private void startGeoAndDir() { - geoDirHandler.startGeo(); - if (Settings.isLiveMap()) { - geoDirHandler.startDir(); - } - } - - private void removeGeoAndDir() { - geoDirHandler.stopGeoAndDir(); - } - private void importGpx() { GpxFileListActivity.startSubActivity(this, listId); } @@ -1146,7 +1129,6 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA @Override public void run() { - removeGeoAndDir(); // First refresh caches that do not yet have static maps to get them a chance to get a copy // before the limit expires, unless we do not want to store offline maps. final List<Geocache> allCaches = Settings.isStoreOfflineMaps() ? @@ -1207,9 +1189,6 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA @Override public void run() { - - removeGeoAndDir(); - int delay = -1; int times = 0; @@ -1267,8 +1246,6 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA } handler.sendEmptyMessage(ret); - - startGeoAndDir(); } } @@ -1283,9 +1260,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA @Override protected Void doInBackgroundInternal(Geocache[] caches) { - removeGeoAndDir(); DataStore.markDropped(Arrays.asList(caches)); - startGeoAndDir(); return null; } diff --git a/main/src/cgeo/geocaching/activity/AbstractListActivity.java b/main/src/cgeo/geocaching/activity/AbstractListActivity.java index 2adae7a..a5d5c14 100644 --- a/main/src/cgeo/geocaching/activity/AbstractListActivity.java +++ b/main/src/cgeo/geocaching/activity/AbstractListActivity.java @@ -11,7 +11,6 @@ public abstract class AbstractListActivity extends FragmentListActivity implemen IAbstractActivity { private boolean keepScreenOn = false; - private boolean paused = true; protected CgeoApplication app = null; protected Resources res = null; @@ -85,26 +84,4 @@ 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; - } } |
