List of usage examples for android.view ViewConfiguration getTapTimeout
public static int getTapTimeout()
From source file:Main.java
/** * Checks if touch event is treat as single tap * * @param context android context// w w w. java 2 s.c om * @param downTime the time when touch down * @param upTime the time when touch up * @param downX axis x of touch down * @param downY axis y of touch down * @param upX axis x of touch up * @param upY axis y of touch up * @return true if it's single tap, otherwise false */ public static boolean isSingleTap(Context context, long downTime, long upTime, float downX, float downY, float upX, float upY) { if (upTime - downTime > ViewConfiguration.getTapTimeout()) { return false; } int touchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); final int deltaX = (int) (downX - upX); final int deltaY = (int) (downY - upY); int distance = (deltaX * deltaX) + (deltaY * deltaY); return distance <= touchSlop * touchSlop; }
From source file:android.support.v7.widget.ForwardingListener.java
public ForwardingListener(View src) { mSrc = src;/*ww w .ja v a 2 s .c o m*/ mScaledTouchSlop = ViewConfiguration.get(src.getContext()).getScaledTouchSlop(); mTapTimeout = ViewConfiguration.getTapTimeout(); // Use a medium-press timeout. Halfway between tap and long-press. mLongPressTimeout = (mTapTimeout + ViewConfiguration.getLongPressTimeout()) / 2; }
From source file:org.holoeverywhere.widget.datetimepicker.time.RadialPickerLayout.java
public RadialPickerLayout(Context context, AttributeSet attrs) { super(context, attrs); setOnTouchListener(this); ViewConfiguration vc = ViewConfiguration.get(context); TOUCH_SLOP = vc.getScaledTouchSlop(); TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); mDoingMove = false;/* w ww. j a v a 2 s. c o m*/ mCircleView = new CircleView(context); addView(mCircleView); mAmPmCirclesView = new AmPmCirclesView(context); addView(mAmPmCirclesView); mHourRadialTextsView = new RadialTextsView(context); addView(mHourRadialTextsView); mMinuteRadialTextsView = new RadialTextsView(context); addView(mMinuteRadialTextsView); mHourRadialSelectorView = new RadialSelectorView(context); addView(mHourRadialSelectorView); mMinuteRadialSelectorView = new RadialSelectorView(context); addView(mMinuteRadialSelectorView); // Prepare mapping to snap touchable degrees to selectable degrees. preparePrefer30sMap(); if (context.getPackageManager().checkPermission(Manifest.permission.VIBRATE, context.getPackageName()) == PackageManager.PERMISSION_GRANTED) { mVibrator = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE); } mLastVibrate = 0; mLastValueSelected = -1; mInputEnabled = true; mGrayBox = new View(context); mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mGrayBox.setBackgroundColor(0x7F000000); mGrayBox.setVisibility(View.INVISIBLE); addView(mGrayBox); mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); mTimeInitialized = false; }
From source file:com.a.mirko.android.datetimepicker.time.RadialPickerLayout.java
public RadialPickerLayout(Context context, AttributeSet attrs) { super(context, attrs); setOnTouchListener(this); ViewConfiguration vc = ViewConfiguration.get(context); TOUCH_SLOP = vc.getScaledTouchSlop(); TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); mDoingMove = false;//www. ja va 2 s . com mCircleView = new CircleView(context); addView(mCircleView); mAmPmCirclesView = new AmPmCirclesView(context); addView(mAmPmCirclesView); mHourRadialTextsView = new RadialTextsView(context); addView(mHourRadialTextsView); mMinuteRadialTextsView = new RadialTextsView(context); addView(mMinuteRadialTextsView); mHourRadialSelectorView = new RadialSelectorView(context); addView(mHourRadialSelectorView); mMinuteRadialSelectorView = new RadialSelectorView(context); addView(mMinuteRadialSelectorView); // Prepare mapping to snap touchable degrees to selectable degrees. preparePrefer30sMap(); mVibrator = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE); mLastVibrate = 0; mLastValueSelected = -1; mInputEnabled = true; mGrayBox = new View(context); mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mGrayBox.setBackgroundColor(getResources().getColor(R.color.transparent_black)); mGrayBox.setVisibility(View.INVISIBLE); addView(mGrayBox); mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); mTimeInitialized = false; }
From source file:com.doomonafireball.betterpickers.radialtimepicker.RadialPickerLayout.java
public RadialPickerLayout(Context context, AttributeSet attrs) { super(context, attrs); setOnTouchListener(this); ViewConfiguration vc = ViewConfiguration.get(context); TOUCH_SLOP = vc.getScaledTouchSlop(); TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); mDoingMove = false;/* w ww.ja v a2 s. c om*/ mCircleView = new CircleView(context); addView(mCircleView); mAmPmCirclesView = new AmPmCirclesView(context); addView(mAmPmCirclesView); mHourRadialTextsView = new RadialTextsView(context); addView(mHourRadialTextsView); mMinuteRadialTextsView = new RadialTextsView(context); addView(mMinuteRadialTextsView); mHourRadialSelectorView = new RadialSelectorView(context); addView(mHourRadialSelectorView); mMinuteRadialSelectorView = new RadialSelectorView(context); addView(mMinuteRadialSelectorView); // Prepare mapping to snap touchable degrees to selectable degrees. preparePrefer30sMap(); mLastValueSelected = -1; mInputEnabled = true; mGrayBox = new View(context); mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mGrayBox.setBackgroundColor(getResources().getColor(R.color.transparent_black)); mGrayBox.setVisibility(View.INVISIBLE); addView(mGrayBox); mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); mTimeInitialized = false; }
From source file:com.codetroopers.betterpickers.radialtimepicker.RadialPickerLayout.java
public RadialPickerLayout(Context context, AttributeSet attrs) { super(context, attrs); setOnTouchListener(this); ViewConfiguration vc = ViewConfiguration.get(context); TOUCH_SLOP = vc.getScaledTouchSlop(); TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); mDoingMove = false;//from ww w . ja va2 s .c o m mCircleView = new CircleView(context); addView(mCircleView); mAmPmCirclesView = new AmPmCirclesView(context); addView(mAmPmCirclesView); mHourRadialTextsView = new RadialTextsView(context); addView(mHourRadialTextsView); mMinuteRadialTextsView = new RadialTextsView(context); addView(mMinuteRadialTextsView); mHourRadialSelectorView = new RadialSelectorView(context); addView(mHourRadialSelectorView); mMinuteRadialSelectorView = new RadialSelectorView(context); addView(mMinuteRadialSelectorView); // Prepare mapping to snap touchable degrees to selectable degrees. preparePrefer30sMap(); mLastValueSelected = -1; mInputEnabled = true; mGrayBox = new View(context); mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mGrayBox.setBackgroundColor(getResources().getColor(R.color.bpTransparent_black)); mGrayBox.setVisibility(View.INVISIBLE); addView(mGrayBox); mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); mTimeInitialized = false; }
From source file:com.android.yijiang.kzx.widget.betterpickers.radialtimepicker.RadialPickerLayout.java
public RadialPickerLayout(Context context, AttributeSet attrs) { super(context, attrs); setOnTouchListener(this); ViewConfiguration vc = ViewConfiguration.get(context); touchSlop = vc.getScaledTouchSlop(); tapTimeout = ViewConfiguration.getTapTimeout(); mDoingMove = false;/* ww w .j a v a2s . c o m*/ mCircleView = new CircleView(context); addView(mCircleView); mAmPmCirclesView = new AmPmCirclesView(context); addView(mAmPmCirclesView); mHourRadialTextsView = new RadialTextsView(context); addView(mHourRadialTextsView); mMinuteRadialTextsView = new RadialTextsView(context); addView(mMinuteRadialTextsView); mHourRadialSelectorView = new RadialSelectorView(context); addView(mHourRadialSelectorView); mMinuteRadialSelectorView = new RadialSelectorView(context); addView(mMinuteRadialSelectorView); // Prepare mapping to snap touchable degrees to selectable degrees. preparePrefer30sMap(); mVibrator = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE); mLastVibrate = 0; mLastValueSelected = -1; mInputEnabled = true; mGrayBox = new View(context); mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mGrayBox.setBackgroundColor(getResources().getColor(R.color.transparent_black)); mGrayBox.setVisibility(View.INVISIBLE); addView(mGrayBox); mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); mTimeInitialized = false; }
From source file:com.redinput.datetimepickercompat.time.RadialPickerLayout.java
public RadialPickerLayout(Context context, AttributeSet attrs) { super(context, attrs); setOnTouchListener(this); ViewConfiguration vc = ViewConfiguration.get(context); TOUCH_SLOP = vc.getScaledTouchSlop(); TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); mDoingMove = false;/*from w w w . jav a 2s.c o m*/ mCircleView = new CircleView(context); addView(mCircleView); mAmPmCirclesView = new AmPmCirclesView(context); addView(mAmPmCirclesView); mHourRadialTextsView = new RadialTextsView(context); addView(mHourRadialTextsView); mMinuteRadialTextsView = new RadialTextsView(context); addView(mMinuteRadialTextsView); mHourRadialSelectorView = new RadialSelectorView(context); addView(mHourRadialSelectorView); mMinuteRadialSelectorView = new RadialSelectorView(context); addView(mMinuteRadialSelectorView); // Prepare mapping to snap touchable degrees to selectable degrees. preparePrefer30sMap(); mVibrator = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE); mLastVibrate = 0; mLastValueSelected = -1; mInputEnabled = true; mGrayBox = new View(context); mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mGrayBox.setBackgroundColor(getResources().getColor(R.color.transparent_black)); mGrayBox.setVisibility(View.INVISIBLE); addView(mGrayBox); mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); mTimeInitialized = false; installAccessibilityDelegate(); }
From source file:com.borax12.materialdaterangepicker.single.time.RadialPickerLayout.java
public RadialPickerLayout(Context context, AttributeSet attrs) { super(context, attrs); setOnTouchListener(this); ViewConfiguration vc = ViewConfiguration.get(context); TOUCH_SLOP = vc.getScaledTouchSlop(); TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); mDoingMove = false;//from w ww . java2s . co m mCircleView = new CircleView(context); addView(mCircleView); mAmPmCirclesView = new AmPmCirclesView(context); addView(mAmPmCirclesView); mHourRadialSelectorView = new RadialSelectorView(context); addView(mHourRadialSelectorView); mMinuteRadialSelectorView = new RadialSelectorView(context); addView(mMinuteRadialSelectorView); mSecondRadialSelectorView = new RadialSelectorView(context); addView(mSecondRadialSelectorView); mHourRadialTextsView = new RadialTextsView(context); addView(mHourRadialTextsView); mMinuteRadialTextsView = new RadialTextsView(context); addView(mMinuteRadialTextsView); mSecondRadialTextsView = new RadialTextsView(context); addView(mSecondRadialTextsView); // Prepare mapping to snap touchable degrees to selectable degrees. preparePrefer30sMap(); mLastValueSelected = null; mInputEnabled = true; mGrayBox = new View(context); mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mGrayBox.setBackgroundColor(ContextCompat.getColor(context, R.color.mdtp_transparent_black)); mGrayBox.setVisibility(View.INVISIBLE); addView(mGrayBox); mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); mTimeInitialized = false; }
From source file:com.android.datetimepicker.time.RadialPickerLayout.java
public RadialPickerLayout(Context context, AttributeSet attrs) { super(context, attrs); setOnTouchListener(this); ViewConfiguration vc = ViewConfiguration.get(context); TOUCH_SLOP = vc.getScaledTouchSlop(); TAP_TIMEOUT = ViewConfiguration.getTapTimeout(); mDoingMove = false;//from www. ja va 2s. c o m mCircleView = new CircleView(context); addView(mCircleView); mAmPmCirclesView = new AmPmCirclesView(context); addView(mAmPmCirclesView); mHourRadialTextsView = new RadialTextsView(context); addView(mHourRadialTextsView); mMinuteRadialTextsView = new RadialTextsView(context); addView(mMinuteRadialTextsView); mHourRadialSelectorView = new RadialSelectorView(context); addView(mHourRadialSelectorView); mMinuteRadialSelectorView = new RadialSelectorView(context); addView(mMinuteRadialSelectorView); // Prepare mapping to snap touchable degrees to selectable degrees. preparePrefer30sMap(); mLastValueSelected = -1; mInputEnabled = true; mGrayBox = new View(context); mGrayBox.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); mGrayBox.setBackgroundColor(getResources().getColor(R.color.transparent_black)); mGrayBox.setVisibility(View.INVISIBLE); addView(mGrayBox); mAccessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); mTimeInitialized = false; installAccessibilityDelegate(); }