Remove unnecessary changes

This commit is contained in:
Chumva 2018-08-30 13:20:28 +03:00
parent 7948a66e58
commit 6b99ea420f
2 changed files with 4 additions and 7 deletions

View file

@ -148,7 +148,7 @@ class ShowLocationHelper(private val app: TelegramApplication) {
fun startShowingLocation() { fun startShowingLocation() {
if (!showingLocation) { if (!showingLocation) {
showingLocation = if (isOsmandUseCallback()) { showingLocation = if (isUseOsmandCallback()) {
osmandAidlHelper.registerForUpdates() osmandAidlHelper.registerForUpdates()
} else { } else {
app.startUserLocationService() app.startUserLocationService()
@ -160,7 +160,7 @@ class ShowLocationHelper(private val app: TelegramApplication) {
fun stopShowingLocation() { fun stopShowingLocation() {
if (showingLocation) { if (showingLocation) {
showingLocation = false showingLocation = false
if (isOsmandUseCallback()) { if (isUseOsmandCallback()) {
osmandAidlHelper.unregisterFromUpdates() osmandAidlHelper.unregisterFromUpdates()
} else { } else {
app.stopUserLocationService() app.stopUserLocationService()
@ -168,7 +168,7 @@ class ShowLocationHelper(private val app: TelegramApplication) {
} }
} }
fun isOsmandUseCallback(): Boolean { fun isUseOsmandCallback(): Boolean {
val packageOsmAndInfo = app.packageManager.getPackageInfo(app.settings.appToConnectPackage, 0) val packageOsmAndInfo = app.packageManager.getPackageInfo(app.settings.appToConnectPackage, 0)
return packageOsmAndInfo.versionCode >= MIN_OSMAND_CALLBACK_VERSION_CODE return packageOsmAndInfo.versionCode >= MIN_OSMAND_CALLBACK_VERSION_CODE
} }

View file

@ -82,7 +82,6 @@ public class OsmandAidlService extends Service {
HandlerThread mHandlerThread = new HandlerThread("OsmAndAidlServiceThread"); HandlerThread mHandlerThread = new HandlerThread("OsmAndAidlServiceThread");
private boolean updatesStarted = false; private boolean updatesStarted = false;
private boolean shouldStopUpdates = false;
OsmandApplication getApp() { OsmandApplication getApp() {
return (OsmandApplication) getApplication(); return (OsmandApplication) getApplication();
@ -589,7 +588,6 @@ public class OsmandAidlService extends Service {
if (!updatesStarted) { if (!updatesStarted) {
startRemoteUpdates(); startRemoteUpdates();
updatesStarted = true; updatesStarted = true;
shouldStopUpdates = false;
} }
return true; return true;
} }
@ -606,7 +604,6 @@ public class OsmandAidlService extends Service {
i.remove(); i.remove();
} }
} }
shouldStopUpdates = callbacks.isEmpty();
return true; return true;
} }
return false; return false;
@ -624,7 +621,7 @@ public class OsmandAidlService extends Service {
e.printStackTrace(); e.printStackTrace();
} }
} }
if (shouldStopUpdates) { if (callbacks.isEmpty()) {
updatesStarted = false; updatesStarted = false;
} else { } else {
startRemoteUpdates(); startRemoteUpdates();