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 |
status bar (0) | 2013.07.08 |
highlighting via keyboad (0) | 2013.07.04 |
popupwindow example (0) | 2013.07.03 |