Selected point menu styling
This commit is contained in:
parent
0b992d2b5d
commit
d336451b30
3 changed files with 47 additions and 2 deletions
|
@ -299,6 +299,9 @@ public class MeasurementToolFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onSelectPoint() {
|
||||
if (pointsListOpened) {
|
||||
hidePointsList();
|
||||
}
|
||||
openSelectedPointMenu(mapActivity);
|
||||
}
|
||||
});
|
||||
|
@ -366,7 +369,19 @@ public class MeasurementToolFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onItemClick(View view) {
|
||||
measurementLayer.moveMapToPoint(pointsRv.indexOfChild(view));
|
||||
int position = pointsRv.indexOfChild(view);
|
||||
if (pointsListOpened) {
|
||||
hidePointsList();
|
||||
}
|
||||
OsmandMapTileView tileView = mapActivity.getMapView();
|
||||
if (portrait) {
|
||||
previousMapPosition = tileView.getMapPosition();
|
||||
tileView.setMapPosition(MIDDLE_TOP_CONSTANT);
|
||||
}
|
||||
mapActivity.refreshMap();
|
||||
measurementLayer.moveMapToPoint(position);
|
||||
measurementLayer.selectPoint(position);
|
||||
openSelectedPointMenu(mapActivity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -437,6 +452,11 @@ public class MeasurementToolFragment extends Fragment {
|
|||
}
|
||||
enterAddPointBeforeMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCloseMenu() {
|
||||
setPreviousMapPosition();
|
||||
}
|
||||
});
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), SelectedPointMenuBottomSheetDialogFragment.TAG);
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
|||
private void selectPoint(double x, double y) {
|
||||
clearSelection();
|
||||
RotatedTileBox tb = view.getCurrentRotatedTileBox();
|
||||
double lowestDistance = AndroidUtils.dpToPx(view.getContext(), 10);
|
||||
double lowestDistance = AndroidUtils.dpToPx(view.getContext(), 20);
|
||||
for (int i = 0; i < measurementPoints.size(); i++) {
|
||||
WptPt pt = measurementPoints.get(i);
|
||||
if (tb.containsLatLon(pt.getLatitude(), pt.getLongitude())) {
|
||||
|
@ -192,6 +192,12 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
|||
}
|
||||
}
|
||||
|
||||
public void selectPoint(int position) {
|
||||
clearSelection();
|
||||
selectedCachedPoint = new WptPt(measurementPoints.get(position));
|
||||
selectedPointPos = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas, RotatedTileBox tb, DrawSettings settings) {
|
||||
if (inMeasurementMode) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.measurementtool;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -161,6 +162,22 @@ public class SelectedPointMenuBottomSheetDialogFragment extends BottomSheetDialo
|
|||
return getIcon(id, nightMode ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (listener != null) {
|
||||
listener.onCloseMenu();
|
||||
}
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
if (listener != null) {
|
||||
listener.onCloseMenu();
|
||||
}
|
||||
super.onCancel(dialog);
|
||||
}
|
||||
|
||||
interface SelectedPointOptionOnClickListener {
|
||||
|
||||
void moveOnClick();
|
||||
|
@ -170,5 +187,7 @@ public class SelectedPointMenuBottomSheetDialogFragment extends BottomSheetDialo
|
|||
void addPointAfterOnClick();
|
||||
|
||||
void addPointBeforeOnClick();
|
||||
|
||||
void onCloseMenu();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue