Clean code
This commit is contained in:
parent
02757c1878
commit
f51997540c
2 changed files with 4 additions and 25 deletions
|
@ -65,7 +65,7 @@ public class CurrentPositionHelper {
|
||||||
private boolean scheduleRouteSegmentFind(final Location loc, final boolean storeFound, final ResultMatcher<GeocodingResult> geoCoding, final ResultMatcher<RouteDataObject> result) {
|
private boolean scheduleRouteSegmentFind(final Location loc, final boolean storeFound, final ResultMatcher<GeocodingResult> geoCoding, final ResultMatcher<RouteDataObject> result) {
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
if (loc != null) {
|
if (loc != null) {
|
||||||
Runnable run = new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
@ -88,8 +88,8 @@ public class CurrentPositionHelper {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}, "Geocoding...").start();
|
||||||
res = app.getRoutingHelper().startTaskInRouteThreadIfPossible(run);
|
res = true;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -914,28 +914,7 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean startTaskInRouteThreadIfPossible(final Runnable r) {
|
|
||||||
if (currentRunningJob == null) {
|
|
||||||
synchronized (this) {
|
|
||||||
currentRunningJob = new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
r.run();
|
|
||||||
} finally {
|
|
||||||
currentRunningJob = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, "Calculating position"); //$NON-NLS-1$
|
|
||||||
currentRunningJob.start();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void updateProgress(final RouteCalculationParams params) {
|
private void updateProgress(final RouteCalculationParams params) {
|
||||||
if(progressRoute != null ) {
|
if(progressRoute != null ) {
|
||||||
app.runInUIThread(new Runnable() {
|
app.runInUIThread(new Runnable() {
|
||||||
|
|
Loading…
Reference in a new issue