Fix pin visibility for track menu
This commit is contained in:
parent
7775338364
commit
6991d7add7
3 changed files with 28 additions and 17 deletions
|
@ -42,7 +42,7 @@ public class SelectedGpxMenuController extends MenuController {
|
||||||
leftTitleButtonController = new TitleButtonController() {
|
leftTitleButtonController = new TitleButtonController() {
|
||||||
@Override
|
@Override
|
||||||
public void buttonPressed() {
|
public void buttonPressed() {
|
||||||
mapContextMenu.hide(false);
|
mapContextMenu.close();
|
||||||
WptPt wptPt = selectedGpxPoint.selectedPoint;
|
WptPt wptPt = selectedGpxPoint.selectedPoint;
|
||||||
LatLon latLon = new LatLon(wptPt.lat, wptPt.lon);
|
LatLon latLon = new LatLon(wptPt.lat, wptPt.lon);
|
||||||
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
|
SelectedGpxFile selectedGpxFile = selectedGpxPoint.getSelectedGpxFile();
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -270,8 +269,9 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
MapContextMenu contextMenu = mapActivity.getContextMenu();
|
MapContextMenu contextMenu = mapActivity.getContextMenu();
|
||||||
if (contextMenu.isActive() && contextMenu.getPointDescription() != null
|
PointDescription pointDescription = contextMenu.getPointDescription();
|
||||||
&& contextMenu.getPointDescription().isGpxPoint()) {
|
if (pointDescription != null && pointDescription.isGpxPoint()) {
|
||||||
|
contextMenu.init(contextMenu.getLatLon(), pointDescription, contextMenu.getObject());
|
||||||
contextMenu.show();
|
contextMenu.show();
|
||||||
} else if (Algorithms.objectEquals(callingFragmentTag, QuickSearchDialogFragment.TAG)) {
|
} else if (Algorithms.objectEquals(callingFragmentTag, QuickSearchDialogFragment.TAG)) {
|
||||||
mapActivity.showQuickSearch(ShowQuickSearchMode.CURRENT, false);
|
mapActivity.showQuickSearch(ShowQuickSearchMode.CURRENT, false);
|
||||||
|
@ -296,6 +296,10 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
: app.getResources().getString(R.string.shared_string_currently_recording_track);
|
: app.getResources().getString(R.string.shared_string_currently_recording_track);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LatLon getLatLon() {
|
||||||
|
return latLon;
|
||||||
|
}
|
||||||
|
|
||||||
public GPXFile getGpx() {
|
public GPXFile getGpx() {
|
||||||
return displayHelper.getGpx();
|
return displayHelper.getGpx();
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,12 +268,19 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
canvas.translate(box.getPixWidth() / 2 - contextMarker.getWidth() / 2, box.getPixHeight() / 2 - contextMarker.getHeight());
|
canvas.translate(box.getPixWidth() / 2 - contextMarker.getWidth() / 2, box.getPixHeight() / 2 - contextMarker.getHeight());
|
||||||
contextMarker.draw(canvas);
|
contextMarker.draw(canvas);
|
||||||
mAddGpxPointBottomSheetHelper.onDraw(box);
|
mAddGpxPointBottomSheetHelper.onDraw(box);
|
||||||
} else if (menu.isActive() && !markerCustomized) {
|
} else if (!markerCustomized) {
|
||||||
LatLon latLon = menu.getLatLon();
|
LatLon latLon = null;
|
||||||
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
if (menu.isActive()) {
|
||||||
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
latLon = menu.getLatLon();
|
||||||
canvas.translate(x - contextMarker.getWidth() / 2, y - contextMarker.getHeight());
|
} else if (activity.getTrackMenuFragment() != null) {
|
||||||
contextMarker.draw(canvas);
|
latLon = activity.getTrackMenuFragment().getLatLon();
|
||||||
|
}
|
||||||
|
if (latLon != null) {
|
||||||
|
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||||
|
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
|
||||||
|
canvas.translate(x - contextMarker.getWidth() / 2, y - contextMarker.getHeight());
|
||||||
|
contextMarker.draw(canvas);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +290,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
public void updateContextMenu() {
|
public void updateContextMenu() {
|
||||||
for (OsmandMapLayer layer : view.getLayers()) {
|
for (OsmandMapLayer layer : view.getLayers()) {
|
||||||
if (layer instanceof ContextMenuLayer.IMoveObjectProvider && ((ContextMenuLayer.IMoveObjectProvider) layer).isObjectMovable(selectedObject)) {
|
if (layer instanceof IMoveObjectProvider && ((IMoveObjectProvider) layer).isObjectMovable(selectedObject)) {
|
||||||
selectedObjectContextMenuProvider = (IContextMenuProvider) layer;
|
selectedObjectContextMenuProvider = (IContextMenuProvider) layer;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -361,8 +368,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
public boolean isObjectMoveable(Object o) {
|
public boolean isObjectMoveable(Object o) {
|
||||||
if (o != null && selectedObjectContextMenuProvider != null
|
if (o != null && selectedObjectContextMenuProvider != null
|
||||||
&& selectedObjectContextMenuProvider instanceof ContextMenuLayer.IMoveObjectProvider) {
|
&& selectedObjectContextMenuProvider instanceof IMoveObjectProvider) {
|
||||||
final IMoveObjectProvider l = (ContextMenuLayer.IMoveObjectProvider) selectedObjectContextMenuProvider;
|
final IMoveObjectProvider l = (IMoveObjectProvider) selectedObjectContextMenuProvider;
|
||||||
if (l.isObjectMovable(o)) {
|
if (l.isObjectMovable(o)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -860,7 +867,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
for (OsmandMapLayer lt : view.getLayers()) {
|
for (OsmandMapLayer lt : view.getLayers()) {
|
||||||
if (lt instanceof ContextMenuLayer.IContextMenuProvider) {
|
if (lt instanceof IContextMenuProvider) {
|
||||||
if (((IContextMenuProvider) lt).disableSingleTap()) {
|
if (((IContextMenuProvider) lt).disableSingleTap()) {
|
||||||
res = true;
|
res = true;
|
||||||
break;
|
break;
|
||||||
|
@ -878,7 +885,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
for (OsmandMapLayer lt : view.getLayers()) {
|
for (OsmandMapLayer lt : view.getLayers()) {
|
||||||
if (lt instanceof ContextMenuLayer.IContextMenuProvider) {
|
if (lt instanceof IContextMenuProvider) {
|
||||||
if (((IContextMenuProvider) lt).disableLongPressOnMap()) {
|
if (((IContextMenuProvider) lt).disableLongPressOnMap()) {
|
||||||
res = true;
|
res = true;
|
||||||
break;
|
break;
|
||||||
|
@ -924,9 +931,9 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
Map<Object, IContextMenuProvider> selectedObjects = new HashMap<>();
|
Map<Object, IContextMenuProvider> selectedObjects = new HashMap<>();
|
||||||
List<Object> s = new ArrayList<>();
|
List<Object> s = new ArrayList<>();
|
||||||
for (OsmandMapLayer lt : view.getLayers()) {
|
for (OsmandMapLayer lt : view.getLayers()) {
|
||||||
if (lt instanceof ContextMenuLayer.IContextMenuProvider) {
|
if (lt instanceof IContextMenuProvider) {
|
||||||
s.clear();
|
s.clear();
|
||||||
final IContextMenuProvider l = (ContextMenuLayer.IContextMenuProvider) lt;
|
final IContextMenuProvider l = (IContextMenuProvider) lt;
|
||||||
l.collectObjectsFromPoint(point, tileBox, s, unknownLocation);
|
l.collectObjectsFromPoint(point, tileBox, s, unknownLocation);
|
||||||
for (Object o : s) {
|
for (Object o : s) {
|
||||||
selectedObjects.put(o, l);
|
selectedObjects.put(o, l);
|
||||||
|
|
Loading…
Reference in a new issue