| | |
| | | view.setOnTouchListener(new View.OnTouchListener() {
|
| | | @Override
|
| | | public boolean onTouch(View view, MotionEvent motionEvent) {
|
| | | View popLayout = view.findViewById(R.id.pop_single_ll);
|
| | | int top = popLayout.getTop();
|
| | | int bottom = popLayout.getBottom();
|
| | | int left = popLayout.getLeft();
|
| | | int right = popLayout.getRight();
|
| | | int y = (int) motionEvent.getY();
|
| | | int x = (int) motionEvent.getX();
|
| | | if (motionEvent.getAction() == MotionEvent.ACTION_UP){
|
| | | if (y<top || y> bottom){
|
| | | dismiss();
|
| | | }
|
| | | if (x < left || x > right){
|
| | | dismiss();
|
| | | }
|
| | |
|
| | | View popLayout = view.findViewById(R.id.pop_single_ll);
|
| | | int top = popLayout.getTop();
|
| | | int bottom = popLayout.getBottom();
|
| | | int left = popLayout.getLeft();
|
| | | int right = popLayout.getRight();
|
| | | int y = (int) motionEvent.getY();
|
| | | int x = (int) motionEvent.getX();
|
| | | if (motionEvent.getAction() == MotionEvent.ACTION_UP){
|
| | | if (y<top || y> bottom){
|
| | | dismiss();
|
| | | }
|
| | | return true;
|
| | | if (x < left || x > right){
|
| | | dismiss();
|
| | | }
|
| | |
|
| | | }
|
| | | return true;
|
| | | }
|
| | | });
|
| | |
|
| | |
| | | break;
|
| | | case R.id.pop_single_confirm:
|
| | | for (OkButtonClickedListener okButtonClickedListener : okButtonClickedListeners) {
|
| | | Object o = mList.get(mWheelView.getCurrentPosition());
|
| | | String item = "";
|
| | | if (o instanceof Dictionary) {
|
| | | item = ((Dictionary) o).getName();
|
| | | } else {
|
| | | item = o+"";
|
| | | if (mWheelView.getCurrentPosition() >= 0) {
|
| | | Object o = mList.get(mWheelView.getCurrentPosition());
|
| | | String item = "";
|
| | | if (o instanceof Dictionary) {
|
| | | item = ((Dictionary) o).getName();
|
| | | } else {
|
| | | item = o+"";
|
| | | }
|
| | | okButtonClickedListener.onItemSelected(mWheelView.getCurrentPosition(), o, item);
|
| | | }
|
| | | okButtonClickedListener.onItemSelected(mWheelView.getCurrentPosition(), o, item);
|
| | | }
|
| | | dismiss();
|
| | | break;
|