Closed drshavit closed 6 years ago
so a callout is just like a marker but disappears on touch. you probably just want to use addMarker
instead of addCallout
.
if you look at the source for CalloutManager
you'll see there's very little going on there.
ok so I needed the callout functionality since I wanted the view to be removed after further interaction with the TileView.
So this is what I did:
@Override
public void onLongPress(MotionEvent event)
{
longPressed = true;
float scale = getScale();
double relX = getCoordinateTranslater().translateAndScaleAbsoluteToRelativeX(getScrollX() + event.getX(), scale);
double relY = getCoordinateTranslater().translateAndScaleAbsoluteToRelativeY(getScrollY() + event.getY(), scale);
callback.LongPress(relX, relY);
}
@Override
public boolean onTouchEvent(MotionEvent event)
{
switch (event.getAction())
{
case MotionEvent.ACTION_MOVE:
if (longPressed)
return true;
break;
case MotionEvent.ACTION_UP:
if (longPressed)
{
longPressed = false;
return true;
}
break;
}
return super.onTouchEvent(event);
}
Maybe you should consider adding it so that the callouts will have LongPress functionality, but not that important.
Thanks again!
Hi,
I'm trying to add a callout after a long press:
then on the activity:
After I long-press, the view is visibile, but then disappears right away. I use the same code on
MarkerTapListener
and the view stays visible after the tap, so my guess is that some other event is triggered that is causing the view to vanish. My guess was that it'sonTouchEvent
, so I tried setting a flag totrue
ononLongPress
and then catch theACTION_UP
MotionEvent and return true so that the event will be consumed, but that did not change anything.Any advice to help me with the actual event chain?