|
@@ -63,10 +63,11 @@ public abstract class AbstractPopup {
|
|
@Override
|
|
@Override
|
|
public boolean onTouch(View view, MotionEvent event) {
|
|
public boolean onTouch(View view, MotionEvent event) {
|
|
if(event.getAction() == MotionEvent.ACTION_DOWN){
|
|
if(event.getAction() == MotionEvent.ACTION_DOWN){
|
|
- item.onItemDown(event);
|
|
|
|
- } else if (event.getAction() == MotionEvent.ACTION_UP){
|
|
|
|
- item.onItemUp(event);
|
|
|
|
-
|
|
|
|
|
|
+ item.onItemSelect(event);
|
|
|
|
+ } else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_MOVE){
|
|
|
|
+ item.onItemDeselect(event);
|
|
|
|
+ } else if (event.getAction() == MotionEvent.ACTION_UP){
|
|
|
|
+ item.onItemDeselect(event);
|
|
AbstractPopup.this.onPopupItemClickListener.onItemClick(item.onClickedResult(event));
|
|
AbstractPopup.this.onPopupItemClickListener.onItemClick(item.onClickedResult(event));
|
|
AbstractPopup.this.popupWindow.dismiss();
|
|
AbstractPopup.this.popupWindow.dismiss();
|
|
}
|
|
}
|
|
@@ -135,44 +136,6 @@ public abstract class AbstractPopup {
|
|
this.popupWindow.setHeight(height);
|
|
this.popupWindow.setHeight(height);
|
|
this.popupWindow.showAtLocation(anchorView, Gravity.NO_GRAVITY, x, y-smallBottomOffset);
|
|
this.popupWindow.showAtLocation(anchorView, Gravity.NO_GRAVITY, x, y-smallBottomOffset);
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- // TO SET THE REAL SIZE
|
|
|
|
- ViewTreeObserver viewTreeObserver = this.rootView.getViewTreeObserver();
|
|
|
|
- if (viewTreeObserver != null && viewTreeObserver.isAlive()) {
|
|
|
|
- viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onGlobalLayout() {
|
|
|
|
- ViewTreeObserver observer= AbstractPopup.this.rootView.getViewTreeObserver();
|
|
|
|
- if (observer != null)observer.removeOnGlobalLayoutListener(this);
|
|
|
|
-
|
|
|
|
- View rootView = AbstractPopup.this.rootView;
|
|
|
|
-
|
|
|
|
- int width = rootView.getWidth();
|
|
|
|
- int height = rootView.getHeight();
|
|
|
|
-
|
|
|
|
- int x = position[0] + (anchorWidth / 2) - (width / 2);
|
|
|
|
- int y = position[1] - height;
|
|
|
|
-
|
|
|
|
- x = Math.min(0,x);
|
|
|
|
- x = Math.max(windowFrame.width() - width, x);
|
|
|
|
-
|
|
|
|
- y = Math.min(0,y);
|
|
|
|
- y = Math.max(windowFrame.height() - height, y);
|
|
|
|
-
|
|
|
|
- AbstractPopup.this.configureView(rootView);
|
|
|
|
-
|
|
|
|
- int smallBottomOffset = 10;
|
|
|
|
- AbstractPopup.this.popupWindow.dismiss();
|
|
|
|
- AbstractPopup.this.popupWindow.setWidth(width);
|
|
|
|
- AbstractPopup.this.popupWindow.setHeight(height + smallBottomOffset);
|
|
|
|
- AbstractPopup.this.popupWindow.showAtLocation(anchorView, Gravity.NO_GRAVITY, x, y-smallBottomOffset);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- */
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|