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) {
|
||||
boolean res = false;
|
||||
if (loc != null) {
|
||||
Runnable run = new Runnable() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
@ -88,8 +88,8 @@ public class CurrentPositionHelper {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
res = app.getRoutingHelper().startTaskInRouteThreadIfPossible(run);
|
||||
}, "Geocoding...").start();
|
||||
res = true;
|
||||
}
|
||||
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) {
|
||||
if(progressRoute != null ) {
|
||||
app.runInUIThread(new Runnable() {
|
||||
|
|
Loading…
Reference in a new issue