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;
protected String searchAddressStr;
protected String addressNotFoundStr;
protected String searchAddressStr = "";
protected String addressNotFoundStr = "";
@Nullable
public abstract MapActivity getMapActivity();

View file

@ -215,7 +215,9 @@ public class SelectFileBottomSheet extends BottomSheetBehaviourDialogFragment {
private void sortFileList() {
List<GPXInfo> gpxInfoList = gpxInfoMap.get(selectedFolder);
sortSelected(gpxInfoList);
if (gpxInfoList != null) {
sortSelected(gpxInfoList);
}
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());
fileName = FileUtils.createUniqueFileName(app, suggestedName, IndexConstants.GPX_INDEX_DIR, GPX_FILE_EXT);
} else {
fileName = new File(paramsBuilder.getFile().path).getName();
fileName = AndroidUtils.trimExtension(new File(paramsBuilder.getFile().path).getName());
}
SaveAsNewTrackBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager(),
ChooseRouteFragment.this, null, fileName,

View file

@ -132,7 +132,7 @@ public class GpxGeometryWay extends GeometryWay<GpxGeometryWayContext, GeometryW
@Override
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
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;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
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 java.util.ArrayList;
import java.util.List;
public class GpxGeometryWayDrawer extends GeometryWayDrawer<GpxGeometryWayContext> {
private static final float DIRECTION_ARROW_CIRCLE_MULTIPLIER = 1.5f;
public GpxGeometryWayDrawer(GpxGeometryWayContext context) {
super(context);
}
@ -33,16 +30,23 @@ public class GpxGeometryWayDrawer extends GeometryWayDrawer<GpxGeometryWayContex
void draw(Canvas canvas, GeometryWayContext context) {
if (style instanceof GeometryArrowsStyle) {
GeometryArrowsStyle arrowsWayStyle = (GeometryArrowsStyle) style;
Bitmap bitmap = style.getPointBitmap();
float arrowWidth = style.getPointBitmap().getWidth();
if (arrowWidth > arrowsWayStyle.getTrackWidth()) {
Paint paint = context.getPaintIcon();
paint.setColor(arrowsWayStyle.getTrackColor());
paint.setStrokeWidth(arrowWidth * DIRECTION_ARROW_CIRCLE_MULTIPLIER);
canvas.drawPoint(x, y, paint);
}
float newWidth = arrowsWayStyle.getTrackWidth() / 2f;
float paintH2 = bitmap.getHeight() / 2f;
float paintW2 = newWidth / 2f;
Matrix matrix = getMatrix();
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);
}
}
}