'Lock'에 해당되는 글 1건

  1. 2013.07.08 touch block
2013.07.08 12:16

setTouchable(false, 500);


//////////////////////////////////////

private boolean mIsTouchable = false;

private Handler mTouchHandler = new Handler();

private Runnable mTouchRelease = new Runnable(){

    @Override

    public void run() {

        mIsTouchable = true;

    }

};

public void setTouchable(boolean isTouchable, long touchLockTime){

    if(!isTouchable && touchLockTime < 0){

        return;

    }


    mIsTouchable = isTouchable;

    if(!mIsTouchable && touchLockTime > 0){

        mTouchHandler.removeCallbacks(mTouchRelease);

        mTouchHandler.postDelayed(mTouchRelease, touchLockTime);

    }

}


@Override

public boolean dispatchKeyEvent(KeyEvent event) {

    if(!mIsTouchable){

        return true;

    }

    return super.dispatchKeyEvent(event);

}


@Override

public boolean dispatchTouchEvent(MotionEvent arg0) {

    if(!mIsTouchable){

        return true;

    }

    return super.dispatchTouchEvent(arg0);

}



저작자 표시 비영리 변경 금지
신고

'programmer > android' 카테고리의 다른 글

AlertDialog Message with List(Custom View)  (0) 2013.07.08
Using context menu on Linearlayout  (0) 2013.07.08
touch block  (0) 2013.07.08
status bar  (0) 2013.07.08
highlighting via keyboad  (0) 2013.07.04
popupwindow example  (0) 2013.07.03
Posted by ocsoosoo

댓글을 달아 주세요

이전버튼 1 이전버튼