ViewFlipper에 손가락으로 플리킹하며 다음 이미지를 넘기고자 하는 작업을 하는 기능을 모두 구현했습니다. 그런데, toolbar 한번 터치를 했을 경우, 그냥 터치인지 손가락으로 플리킹하는 액션인지에 대해 명확한 구분을 주고싶습니다. 방법이 없을까요?
if(event.getAction() == MotionEvent.ACTION_DOWN) {
if(topToolbar.getVisibility() == View.VISIBLE){
System.out.println("toolbar is visible, than unvisible");
showToolbars(false);
}
else if(topToolbar.getVisibility() == View.GONE) {
System.out.println("toolbar is unvisible, than visible");
showToolbars(true);
}
m_nPreTouchPosX = (int)event.getX();
}
if(event.getAction() == MotionEvent.ACTION_UP) { // 한번 터치를 했을때
int nTouchPosX = (int)event.getX();
if(nTouchPosX < m_nPreTouchPosX) {
MoveNextView();
}
else if(nTouchPosX > m_nPreTouchPosX) {
MovewPreviousView();
}
m_nPreTouchPosX = nTouchPosX;
}
return true;
코드는 이와같습니다.