getDoubleTapTimeout ( )源码实例Demo

android.view.ViewConfiguration#getDoubleTapTimeout ( )源码实例Demo

下面列出了android.view.ViewConfiguration#getDoubleTapTimeout ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: NIM_Android_UIKit   文件: InputPanel.java
/**
 * 隐藏所有输入布局
 */
private void hideAllInputLayout(boolean immediately) {
    if (hideAllInputLayoutRunnable == null) {
        hideAllInputLayoutRunnable = new Runnable() {

            @Override
            public void run() {
                hideInputMethod();
                hideActionPanelLayout();
                hideEmojiLayout();
            }
        };
    }
    long delay = immediately ? 0 : ViewConfiguration.getDoubleTapTimeout();
    uiHandler.postDelayed(hideAllInputLayoutRunnable, delay);
}
 
源代码2 项目: Dashchan   文件: AttachmentView.java
@Override
public boolean onTouchEvent(MotionEvent event) {
	switch (event.getAction()) {
		case MotionEvent.ACTION_DOWN: {
			if (System.currentTimeMillis() - lastClickTime <= ViewConfiguration.getDoubleTapTimeout()) {
				event.setAction(MotionEvent.ACTION_CANCEL);
				return false;
			}
			break;
		}
		case MotionEvent.ACTION_UP:
		case MotionEvent.ACTION_CANCEL: {
			lastClickTime = System.currentTimeMillis();
			break;
		}
	}
	return super.onTouchEvent(event);
}
 
源代码3 项目: Dashchan   文件: TextFragment.java
@Override
public void onClick(View v) {
	long time = System.currentTimeMillis();
	if (time - lastClickTime < ViewConfiguration.getDoubleTapTimeout()) {
		lastClickTime = 0L;
		textView.startSelection();
	} else {
		lastClickTime = time;
	}
}
 
源代码4 项目: android_9.0.0_r45   文件: InputManagerService.java
private int getDoubleTapTimeout() {
    return ViewConfiguration.getDoubleTapTimeout();
}
 
源代码5 项目: under-the-hood   文件: ArbitraryTapListener.java
@Override
public boolean onTouch(View v, MotionEvent event) {
    if (onClickListener == null) {
        return false;
    }
    boolean consume = false;
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            Log.d(TAG, "down");
            touchDownMs = System.currentTimeMillis();
            break;
        case MotionEvent.ACTION_UP:
            Log.d(TAG, "up");
            if ((System.currentTimeMillis() - touchDownMs) > ViewConfiguration.getTapTimeout()) {
                //it was not a tap
                numberOfTaps = 0;
                lastTapTimeMs = 0;
                Log.d(TAG, "reset");
                break;
            }

            if (numberOfTaps > 0
                    && (System.currentTimeMillis() - lastTapTimeMs) < ViewConfiguration.getDoubleTapTimeout()) {
                numberOfTaps += 1;
                Log.d(TAG, "+1");
                consume = true;
            } else {
                Log.d(TAG, "1");
                numberOfTaps = 1;
            }

            lastTapTimeMs = System.currentTimeMillis();

            if (numberOfTaps >= targetNumberOfTaps) {
                Log.d(TAG, "goal");
                onClickListener.onClick(v);
                numberOfTaps = 0;
                lastTapTimeMs = 0;
                consume = true;
            }
    }
    return consume;
}
 
源代码6 项目: 365browser   文件: ViewConfigurationHelper.java
@CalledByNative
private static int getDoubleTapTimeout() {
    return ViewConfiguration.getDoubleTapTimeout();
}