handle LongPress in ItemizedLayer
This commit is contained in:
parent
6c830575c9
commit
978b5ead44
@ -31,11 +31,13 @@ import org.oscim.event.GestureListener;
|
|||||||
import org.oscim.event.MotionEvent;
|
import org.oscim.event.MotionEvent;
|
||||||
import org.oscim.map.Map;
|
import org.oscim.map.Map;
|
||||||
import org.oscim.map.Viewport;
|
import org.oscim.map.Viewport;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer<Item>
|
public class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer<Item>
|
||||||
implements GestureListener {
|
implements GestureListener {
|
||||||
|
|
||||||
//static final Logger log = LoggerFactory.getLogger(ItemizedIconOverlay.class);
|
static final Logger log = LoggerFactory.getLogger(ItemizedLayer.class);
|
||||||
|
|
||||||
protected final List<Item> mItemList;
|
protected final List<Item> mItemList;
|
||||||
protected final Point mTmpPoint = new Point();
|
protected final Point mTmpPoint = new Point();
|
||||||
@ -137,30 +139,20 @@ public class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer<Item>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// @Override
|
protected boolean onLongPressHelper(int index, Item item) {
|
||||||
// public boolean onLongPress(MotionEvent event, MapPosition pos) {
|
return this.mOnItemGestureListener.onItemLongPress(index, item);
|
||||||
// return activateSelectedItems(event, mActiveItemLongPress);
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// protected boolean onLongPressHelper(int index, Item item) {
|
private final ActiveItem mActiveItemLongPress = new ActiveItem() {
|
||||||
// return this.mOnItemGestureListener.onItemLongPress(index, item);
|
@Override
|
||||||
// }
|
public boolean run(final int index) {
|
||||||
//
|
final ItemizedLayer<Item> that = ItemizedLayer.this;
|
||||||
// private final ActiveItem mActiveItemLongPress = new ActiveItem() {
|
if (that.mOnItemGestureListener == null) {
|
||||||
// @Override
|
return false;
|
||||||
// public boolean run(final int index) {
|
}
|
||||||
// final ItemizedIconLayer<Item> that = ItemizedIconLayer.this;
|
return onLongPressHelper(index, that.mItemList.get(index));
|
||||||
// if (that.mOnItemGestureListener == null) {
|
}
|
||||||
// return false;
|
};
|
||||||
// }
|
|
||||||
// return onLongPressHelper(index, getItem(index));
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public boolean onPress(MotionEvent e, MapPosition pos) {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When a content sensitive action is performed the content item needs to be
|
* When a content sensitive action is performed the content item needs to be
|
||||||
@ -250,6 +242,9 @@ public class ItemizedLayer<Item extends MarkerItem> extends MarkerLayer<Item>
|
|||||||
if (g instanceof Gesture.Tap)
|
if (g instanceof Gesture.Tap)
|
||||||
return activateSelectedItems(e, mActiveItemSingleTap);
|
return activateSelectedItems(e, mActiveItemSingleTap);
|
||||||
|
|
||||||
|
if (g instanceof Gesture.LongPress)
|
||||||
|
return activateSelectedItems(e, mActiveItemLongPress);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user