Fix small issues

This commit is contained in:
Victor Shcherb 2014-10-26 17:41:55 +01:00
parent 6bd0671f01
commit a581218f8b
3 changed files with 11 additions and 6 deletions

View file

@ -29,6 +29,7 @@ import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.ColorDialogs;
import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.util.MapUtils;
import android.app.Activity;
import android.app.AlertDialog;

View file

@ -14,6 +14,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.helpers.WaypointDialogHelper;
import net.osmand.util.MapUtils;
import android.app.Activity;
import android.app.AlertDialog;
@ -41,7 +42,8 @@ public class IntermediatePointsDialog {
public static void openIntermediatePointsDialog(MapActivity mapActivity){
openIntermediatePointsDialog(mapActivity, (OsmandApplication) mapActivity.getApplication(), false);
// openIntermediatePointsDialog(mapActivity, (OsmandApplication) mapActivity.getApplication(), false);
WaypointDialogHelper.showWaypointsDialog(mapActivity, false);
}
public static void openIntermediatePointsDialog(final Activity activity,

View file

@ -132,7 +132,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
}
}
private static void updatePointInfoView(final OsmandApplication app, final MapActivity ctx,
private static void updatePointInfoView(final OsmandApplication app, final Activity ctx,
View localView, final LocationPointWrapper ps, final DialogFragment dialog) {
WaypointHelper wh = app.getWaypointHelper();
final LocationPoint point = ps.getPoint();
@ -147,8 +147,10 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
((ImageView) localView.findViewById(R.id.waypoint_icon)).setImageDrawable(ps.getDrawable(ctx));
int dist = -1;
if (!wh.isRouteCalculated()) {
dist = (int) MapUtils.getDistance(ctx.getMapView().getLatitude(), ctx.getMapView().getLongitude(),
point.getLatitude(), point.getLongitude());
if (ctx instanceof MapActivity) {
dist = (int) MapUtils.getDistance(((MapActivity) ctx).getMapView().getLatitude(), ((MapActivity) ctx)
.getMapView().getLongitude(), point.getLatitude(), point.getLongitude());
}
} else {
dist = wh.getRouteDistance(ps);
}
@ -357,7 +359,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
if (v == null || v.findViewById(R.id.waypoint_icon) == null) {
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_reached, null);
}
updatePointInfoView(app, (MapActivity) ctx, v, getItem(position), WaypointDialogFragment.this);
updatePointInfoView(app, ctx, v, getItem(position), WaypointDialogFragment.this);
View remove = v.findViewById(R.id.info_close);
if(!edit) {
remove.setVisibility(View.GONE);
@ -434,7 +436,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
if(v == null || v.findViewById(R.id.info_close) == null) {
v = ctx.getLayoutInflater().inflate(R.layout.waypoint_reached, null);
}
updatePointInfoView(app, (MapActivity) ctx, v, (LocationPointWrapper) getItem(position), WaypointDialogFragment.this);
updatePointInfoView(app, ctx, v, (LocationPointWrapper) getItem(position), WaypointDialogFragment.this);
View remove = v.findViewById(R.id.info_close);
if (!edit) {
remove.setVisibility(View.GONE);