Merge branch 'r3.8' into plan_route_fixes

This commit is contained in:
Vitaliy 2020-09-25 10:29:12 +03:00
commit a833524875
6 changed files with 29 additions and 23 deletions

View file

@ -25,8 +25,8 @@ public abstract class MenuTitleController {
private AddressLookupRequest addressLookupRequest; private AddressLookupRequest addressLookupRequest;
protected String searchAddressStr; protected String searchAddressStr = "";
protected String addressNotFoundStr; protected String addressNotFoundStr = "";
@Nullable @Nullable
public abstract MapActivity getMapActivity(); public abstract MapActivity getMapActivity();

View file

@ -215,7 +215,9 @@ public class SelectFileBottomSheet extends BottomSheetBehaviourDialogFragment {
private void sortFileList() { private void sortFileList() {
List<GPXInfo> gpxInfoList = gpxInfoMap.get(selectedFolder); List<GPXInfo> gpxInfoList = gpxInfoMap.get(selectedFolder);
if (gpxInfoList != null) {
sortSelected(gpxInfoList); sortSelected(gpxInfoList);
}
adapter.setGpxInfoList(gpxInfoList != null ? gpxInfoList : new ArrayList<GPXInfo>()); adapter.setGpxInfoList(gpxInfoList != null ? gpxInfoList : new ArrayList<GPXInfo>());
} }

View file

@ -487,7 +487,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date()); String suggestedName = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).format(new Date());
fileName = FileUtils.createUniqueFileName(app, suggestedName, IndexConstants.GPX_INDEX_DIR, GPX_FILE_EXT); fileName = FileUtils.createUniqueFileName(app, suggestedName, IndexConstants.GPX_INDEX_DIR, GPX_FILE_EXT);
} else { } else {
fileName = new File(paramsBuilder.getFile().path).getName(); fileName = AndroidUtils.trimExtension(new File(paramsBuilder.getFile().path).getName());
} }
SaveAsNewTrackBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager(), SaveAsNewTrackBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager(),
ChooseRouteFragment.this, null, fileName, ChooseRouteFragment.this, null, fileName,

View file

@ -132,7 +132,7 @@ public class GpxGeometryWay extends GeometryWay<GpxGeometryWayContext, GeometryW
@Override @Override
public double getPointStepPx(double zoomCoef) { public double getPointStepPx(double zoomCoef) {
return getPointBitmap().getHeight() * DIRECTION_ARROW_DISTANCE_MULTIPLIER * zoomCoef; return getPointBitmap().getHeight() + trackWidth * 1.5f;
} }
} }
} }

View file

@ -15,6 +15,6 @@ public class GpxGeometryWayContext extends GeometryWayContext {
@Override @Override
protected int getArrowBitmapResId() { protected int getArrowBitmapResId() {
return R.drawable.mm_special_arrow_up; return R.drawable.ic_action_direction_arrow;
} }
} }

View file

@ -1,19 +1,16 @@
package net.osmand.plus.views.layers.geometry; package net.osmand.plus.views.layers.geometry;
import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import net.osmand.data.RotatedTileBox;
import net.osmand.plus.views.layers.geometry.GeometryWayDrawer.PathPoint;
import net.osmand.plus.views.layers.geometry.GpxGeometryWay.GeometryArrowsStyle; import net.osmand.plus.views.layers.geometry.GpxGeometryWay.GeometryArrowsStyle;
import java.util.ArrayList;
import java.util.List;
public class GpxGeometryWayDrawer extends GeometryWayDrawer<GpxGeometryWayContext> { public class GpxGeometryWayDrawer extends GeometryWayDrawer<GpxGeometryWayContext> {
private static final float DIRECTION_ARROW_CIRCLE_MULTIPLIER = 1.5f;
public GpxGeometryWayDrawer(GpxGeometryWayContext context) { public GpxGeometryWayDrawer(GpxGeometryWayContext context) {
super(context); super(context);
} }
@ -33,16 +30,23 @@ public class GpxGeometryWayDrawer extends GeometryWayDrawer<GpxGeometryWayContex
void draw(Canvas canvas, GeometryWayContext context) { void draw(Canvas canvas, GeometryWayContext context) {
if (style instanceof GeometryArrowsStyle) { if (style instanceof GeometryArrowsStyle) {
GeometryArrowsStyle arrowsWayStyle = (GeometryArrowsStyle) style; GeometryArrowsStyle arrowsWayStyle = (GeometryArrowsStyle) style;
Bitmap bitmap = style.getPointBitmap();
float arrowWidth = style.getPointBitmap().getWidth(); float newWidth = arrowsWayStyle.getTrackWidth() / 2f;
if (arrowWidth > arrowsWayStyle.getTrackWidth()) { float paintH2 = bitmap.getHeight() / 2f;
Paint paint = context.getPaintIcon(); float paintW2 = newWidth / 2f;
paint.setColor(arrowsWayStyle.getTrackColor());
paint.setStrokeWidth(arrowWidth * DIRECTION_ARROW_CIRCLE_MULTIPLIER); Matrix matrix = getMatrix();
canvas.drawPoint(x, y, paint); matrix.reset();
matrix.postScale(newWidth / bitmap.getWidth(), 1);
matrix.postRotate((float) angle, paintW2, paintH2);
matrix.postTranslate(x - paintW2, y - paintH2);
Paint paint = context.getPaintIconCustom();
Integer pointColor = style.getPointColor();
paint.setColorFilter(new PorterDuffColorFilter(pointColor, PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, matrix, paint);
} }
} }
super.draw(canvas, context);
}
} }
} }