Browse Source

vivo触摸事件处理

huyuguo 5 years ago
parent
commit
40151bb6cc

+ 9 - 7
app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java

5466
                    case MotionEvent.ACTION_DOWN:
5466
                    case MotionEvent.ACTION_DOWN:
5467
                        mPosX = motionEvent.getX();
5467
                        mPosX = motionEvent.getX();
5468
                        mPosY = motionEvent.getY();
5468
                        mPosY = motionEvent.getY();
5469
                        mCurPosX = 0;
5470
                        mCurPosY = 0;
5469
                        break;
5471
                        break;
5470
                    case MotionEvent.ACTION_MOVE:
5472
                    case MotionEvent.ACTION_MOVE:
5471
                        mCurPosX = motionEvent.getX();
5473
                        mCurPosX = motionEvent.getX();
5472
                        mCurPosY = motionEvent.getY();
5474
                        mCurPosY = motionEvent.getY();
5473
                        break;
5475
                        break;
5474
                    case MotionEvent.ACTION_UP:
5476
                    case MotionEvent.ACTION_UP:
5475
                        if (mCurPosY > mPosY && Math.abs(mCurPosY - mPosY) > 25) { // 向下滑动
5477
                        if (mCurPosY != 0 && mCurPosY > mPosY && Math.abs(mCurPosY - mPosY) > 25) { // 向下滑动
5476
                            // 取消气泡选中状态
5478
                            // 取消气泡选中状态
5477
                            if (nMarker != null) {
5479
                            if (nMarker != null) {
5478
                                nMarker.hideInfoWindow();
5480
                                nMarker.hideInfoWindow();
5501
                                    rl_control.setVisibility(View.VISIBLE);
5503
                                    rl_control.setVisibility(View.VISIBLE);
5502
                                }
5504
                                }
5503
                            }, 500);
5505
                            }, 500);
5504
                        } else if (mCurPosY < mPosY && Math.abs(mCurPosY - mPosY) > 25) { // 向上活动
5505
5506
                        } else if (mCurPosX > mPosX && Math.abs(mCurPosX - mPosX) > 25) { // 向右滑动
5507
5508
                        } else if (mCurPosX < mPosX && Math.abs(mCurPosX - mPosX) > 25) { // 向左滑动
5509
5506
                        } else if (mCurPosY != 0 && mCurPosY < mPosY && Math.abs(mCurPosY - mPosY) > 25) { // 向上活动
5507
                            System.out.println("up");
5508
                        } else if (mCurPosX != 0 && mCurPosX > mPosX && Math.abs(mCurPosX - mPosX) > 25) { // 向右滑动
5509
                            System.out.println("right");
5510
                        } else if (mCurPosX != 0 && mCurPosX < mPosX && Math.abs(mCurPosX - mPosX) > 25) { // 向左滑动
5511
                            System.out.println("left");
5510
                        } else { // 点击事件
5512
                        } else { // 点击事件
5511
                            Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class);
5513
                            Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class);
5512
                            intent.putExtra("zhan_id", id);
5514
                            intent.putExtra("zhan_id", id);