当前位置: 首页>>代码示例>>Java>>正文


Java ViewConfiguration.getDoubleTapTimeout方法代码示例

本文整理汇总了Java中android.view.ViewConfiguration.getDoubleTapTimeout方法的典型用法代码示例。如果您正苦于以下问题:Java ViewConfiguration.getDoubleTapTimeout方法的具体用法?Java ViewConfiguration.getDoubleTapTimeout怎么用?Java ViewConfiguration.getDoubleTapTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.ViewConfiguration的用法示例。


在下文中一共展示了ViewConfiguration.getDoubleTapTimeout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hideAllInputLayout

import android.view.ViewConfiguration; //导入方法依赖的package包/类
/**
 * 隐藏所有输入布局
 */
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);
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:19,代码来源:InputPanel.java

示例2: onTouchEvent

import android.view.ViewConfiguration; //导入方法依赖的package包/类
@SuppressLint("NewApi")
@Override
public boolean onTouchEvent(MotionEvent event) {
    int action = event.getActionMasked();

    if (isEnabled()) {
        ViewConfiguration vc = ViewConfiguration.get(getContext());
        //final Matrix currentM = mSlate.getMatrix();

        if (action == MotionEvent.ACTION_DOWN
                || action == MotionEvent.ACTION_POINTER_DOWN
                || action == MotionEvent.ACTION_POINTER_UP
                || action == MotionEvent.ACTION_UP) {
            mTouchPoint[0] = mTouchPoint[1] = -1f;
            if (action == MotionEvent.ACTION_DOWN) {
                final long now = event.getEventTime();
                if (now - mTouchTime < ViewConfiguration.getDoubleTapTimeout()) {
                    mTouchTime = 0;
                    doubleClick(event);
                } else {
                    mTouchTime = now;
                }
            } else if (action == MotionEvent.ACTION_POINTER_DOWN) {
                mTouchTime = 0; // no double-tap for other fingers
            }
        } else if (action == MotionEvent.ACTION_MOVE) {
            if (mTouchPoint[0] < 0) {
                mInitialZoomMatrix.set(mSlate.getZoom());
                mSlate.getZoomPos(mInitialPos);

                mInitialSpan = getSpan(event);
                getCenter(event, mTouchPoint);
                mTouchPointDoc[0] = mTouchPoint[0] - mSlate.getZoomPosX();
                mTouchPointDoc[1] = mTouchPoint[1] - mSlate.getZoomPosY();
                mSlate.getZoomInv().mapPoints(mTouchPointDoc);
            }
            if (mInitialSpan != 0) {
                double span = getSpan(event);
                float scale = (float) (span / mInitialSpan);

                if (scale != 0f) {
                    Matrix m = new Matrix(mInitialZoomMatrix);
                    final float currentScale = getScale(m);

                    scale = Math.max(Math.min(scale*currentScale, 20.0f), 0.1f)
                                / currentScale;

                    m.preScale(scale, scale, mTouchPointDoc[0], mTouchPointDoc[1]);

                    mSlate.setZoom(m);
                }
            }

            float[] newCenter = getCenter(event, null);
            final float dx = newCenter[0] - mTouchPoint[0];
            final float dy = newCenter[1] - mTouchPoint[1];
            mSlate.setZoomPos(mInitialPos[0] + dx,
                    mInitialPos[1] + dy);

            if (Math.hypot(dx, dy) > vc.getScaledTouchSlop()) {
                mTouchTime = 0; // no double tap now
            }
        }
        if (DEBUG_OVERLAY) invalidate();
        return true;
    }
    return false;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:69,代码来源:ZoomTouchView.java


注:本文中的android.view.ViewConfiguration.getDoubleTapTimeout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。