Update icons

This commit is contained in:
Victor Shcherb 2015-04-21 23:30:29 +02:00
parent c1084489f3
commit 435ea60f93
7 changed files with 29 additions and 15 deletions

View file

@ -1,4 +1,4 @@
package net.osmand.plus.monitoring;
package net.osmand;
public class ValueHolder<T> {

View file

@ -4,6 +4,7 @@ import java.util.List;
import net.osmand.Location;
import net.osmand.StateChangedListener;
import net.osmand.ValueHolder;
import net.osmand.data.RotatedTileBox;
import net.osmand.map.IMapLocationListener;
import net.osmand.plus.OsmAndConstants;
@ -304,7 +305,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
}
@Override
public void newRouteIsCalculated(boolean newRoute) {
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
RoutingHelper rh = app.getRoutingHelper();
if(newRoute && rh.isRoutePlanningMode() && mapView != null) {
RotatedTileBox rt = mapView.getCurrentRotatedTileBox();

View file

@ -5,6 +5,7 @@ import gnu.trove.list.array.TIntArrayList;
import java.util.List;
import net.osmand.Location;
import net.osmand.ValueHolder;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
@ -27,7 +28,6 @@ import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.WindowManager;

View file

@ -6,6 +6,7 @@ import java.util.List;
import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.ValueHolder;
import net.osmand.data.LatLon;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.GPXUtilities.GPXFile;
@ -32,7 +33,7 @@ public class RoutingHelper {
public static interface IRouteInformationListener {
public void newRouteIsCalculated(boolean newRoute);
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast);
public void routeWasCancelled();
}
@ -547,7 +548,7 @@ public class RoutingHelper {
return false;
}
private void setNewRoute(RouteCalculationResult prevRoute, RouteCalculationResult res, Location start){
private void setNewRoute(RouteCalculationResult prevRoute, final RouteCalculationResult res, Location start){
final boolean newRoute = !prevRoute.isCalculated();
if (isFollowingMode) {
if(lastFixedLocation != null) {
@ -582,14 +583,27 @@ public class RoutingHelper {
voiceRouter.newRouteIsCalculated(newRoute);
}
}
app.runInUIThread(new Runnable() {
@Override
public void run() {
ValueHolder<Boolean> showToast = new ValueHolder<Boolean>();
showToast.value = true;
for (IRouteInformationListener l : listeners) {
l.newRouteIsCalculated(newRoute);
l.newRouteIsCalculated(newRoute, showToast);
}
if (showToast.value) {
String msg = app.getString(R.string.new_route_calculated_dist) + ": "
+ OsmAndFormatter.getFormattedDistance(res.getWholeDistance(), app);
if (res.getRoutingTime() != 0f) {
msg += " (" + Algorithms.formatDuration((int) res.getRoutingTime()) + ")";
}
app.showToastMessage(msg);
}
}
});
app.getWaypointHelper().setNewRoute(res);
}
@ -776,12 +790,6 @@ public class RoutingHelper {
if(res.isCalculated()){
setNewRoute(prev, res, params.start);
String msg = app.getString(R.string.new_route_calculated_dist) + ": " +
OsmAndFormatter.getFormattedDistance(res.getWholeDistance(), app);
if (res.getRoutingTime() != 0f) {
msg += " (" + Algorithms.formatDuration((int) res.getRoutingTime()) + ")";
}
showMessage(msg);
} else if (onlineSourceWithoutInternet) {
showMessage(app.getString(R.string.error_calculating_route)
+ ":\n" + app.getString(R.string.internet_connection_required_for_online_route)); //$NON-NLS-1$

View file

@ -6,6 +6,7 @@ import java.util.List;
import net.osmand.PlatformUtil;
import net.osmand.ResultMatcher;
import net.osmand.ValueHolder;
import net.osmand.access.AccessibleToast;
import net.osmand.data.Amenity;
import net.osmand.data.LatLon;
@ -345,7 +346,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
}
@Override
public void newRouteIsCalculated(boolean newRoute) {
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
}
@Override

View file

@ -5,6 +5,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.osmand.ValueHolder;
import net.osmand.data.FavouritePoint;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
@ -476,9 +477,12 @@ public class MapRouteInfoControl implements IRouteInformationListener {
@Override
public void newRouteIsCalculated(boolean newRoute) {
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
directionInfo = -1;
updateDialog();
if(isDialogVisible()) {
showToast.value = false;
}
}
public String generateViaDescription() {

View file

@ -1,6 +1,7 @@
package net.osmand.plus.views.mapwidgets;
import net.osmand.Location;
import net.osmand.ValueHolder;
import net.osmand.binary.RouteDataObject;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.NavigationService;
@ -18,7 +19,6 @@ import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.monitoring.ValueHolder;
import net.osmand.plus.routing.RouteDirectionInfo;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;