private void fireClickEvent(VirtualFile file, int startPosition, int endPosition) { ClickEvent e = new ClickEvent(file, startPosition, endPosition); for (ClickListener listener : myClickListeners) { listener.referenceClicked(e); } }
protected void processTouchPressed() { final float x = MathUtils.bringToBounds(0, baseWidth, Touch.getX() - getScreenX()) / baseWidth - 0.5f; final float y = MathUtils.bringToBounds(0, baseHeight, Touch.getY() - getScreenY()) / baseHeight - 0.5f; if (x == 0 && y == 0) { return; } if (MathUtils.abs(x) > MathUtils.abs(y)) { if (x > 0) { this.isRight = true; this.isClick = true; this.centerX = offsetX + x + (baseWidth - dotWidth) / 2 + dotWidth * 0.75f; this.centerY = offsetY + y + (baseHeight - dotHeight) / 2; if (listener != null) { listener.right(); } } else if (x < 0) { this.isLeft = true; this.isClick = true; this.centerX = offsetX + x + (baseWidth - dotWidth) / 2 - dotWidth * 0.75f; this.centerY = offsetY + y + (baseHeight - dotHeight) / 2; if (listener != null) { listener.left(); } } else if (x == 0) { freeClick(); } } else { if (y > 0) { this.isDown = true; this.isClick = true; this.centerX = offsetX + x + (baseWidth - dotWidth) / 2 - 1; this.centerY = offsetY + y + (baseHeight - dotHeight) / 2 + dotHeight * 0.75f; if (listener != null) { listener.down(); } } else if (y < 0) { this.isUp = true; this.isClick = true; this.centerX = offsetX + x + (baseWidth - dotWidth) / 2 - 1; this.centerY = offsetY + y + (baseHeight - dotHeight) / 2 - dotHeight * 0.75f; if (listener != null) { listener.up(); } } else if (y == 0) { freeClick(); } } }
@Override public boolean onLongClick(View v) { // If long clicked, passed last variable as true. clickListener.onClick(v, getAdapterPosition(), true); return true; }
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View child = rv.findChildViewUnder(e.getX(), e.getY()); if (child != null && clickListener != null && gestureDetector.onTouchEvent(e)) { clickListener.onClick(child, rv.getChildPosition(child)); } return false; }
@Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent event) { View child = rv.findChildViewUnder(event.getX(), event.getY()); if (null != child && null != clickListener && gestureDetector.onTouchEvent(event)) { child.onTouchEvent(event); clickListener.onClick(child, rv.getChildPosition(child)); } return false; }
@Override public boolean onInterceptTouchEvent(android.support.v7.widget.RecyclerView rv, MotionEvent e) { View child = rv.findChildViewUnder(e.getX(), e.getY()); RecyclerView.ViewHolder finalChild = rv.findViewHolderForAdapterPosition(rv.getChildAdapterPosition(child)); if (child != null && clickListener != null && gestureDetector.onTouchEvent(e) == true) { clickListener.onClick(finalChild, rv.getChildPosition(child)); } return false; }
void freeClick() { this.isLeft = false; this.isRight = false; this.isDown = false; this.isUp = false; this.isClick = false; if (listener != null) { listener.other(); } }
@Override public void onClick(View v) { if (clickListener != null) { clickListener.onItemClick(getAdapterPosition(), v); } }
@Override public void onClick(View v) { clickListener.onClick(v, getAdapterPosition()); }
{ mClickListener.onClick(); }
@Override public void onClick(View v) { // If not long clicked, pass last variable as false. clickListener.onClick(v, getAdapterPosition(), false); }
@Override public void onClick(View v) { vClickListener.onClick(v, getPosition()); }