use of android.view.ViewConfiguration in project UltimateAndroid by cymcsg.
the class ViewDragHelper method setSensitivity.
/**
* Sets the sensitivity of the dragger.
*
* @param context The application context.
* @param sensitivity value between 0 and 1, the final value for touchSlop =
* ViewConfiguration.getScaledTouchSlop * (1 / s);
*/
public void setSensitivity(Context context, float sensitivity) {
float s = Math.max(0f, Math.min(1.0f, sensitivity));
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
mTouchSlop = (int) (viewConfiguration.getScaledTouchSlop() * (1 / s));
}
use of android.view.ViewConfiguration in project GreenDroid by cyrilmottier.
the class PagedView method initPagedView.
private void initPagedView() {
final Context context = getContext();
mScroller = new Scroller(context, new DecelerateInterpolator());
final ViewConfiguration conf = ViewConfiguration.get(context);
// getScaledPagingTouchSlop() only available in API Level 8
mPagingTouchSlop = conf.getScaledTouchSlop() * 2;
mMaximumVelocity = conf.getScaledMaximumFlingVelocity();
final DisplayMetrics metrics = context.getResources().getDisplayMetrics();
mMinimumVelocity = (int) (metrics.density * MINIMUM_PAGE_CHANGE_VELOCITY + 0.5f);
}
use of android.view.ViewConfiguration in project mobile-android by photo.
the class HorizontalFixedListView method initView.
/**
* Inits the view.
*/
private synchronized void initView() {
if (Build.VERSION.SDK_INT > 8) {
try {
mFlingRunnable = (IFlingRunnable) ReflectionUtils.newInstance("com.aviary.android.feather.widget.Fling9Runnable", new Class<?>[] { FlingRunnableView.class, int.class }, this, mAnimationDuration);
} catch (ReflectionException e) {
mFlingRunnable = new Fling8Runnable(this, mAnimationDuration);
}
} else {
mFlingRunnable = new Fling8Runnable(this, mAnimationDuration);
}
mLeftViewIndex = -1;
mRightViewIndex = 0;
mMaxX = 0;
mMinX = 0;
mChildWidth = 0;
mChildHeight = 0;
mRightEdge = 0;
mLeftEdge = 0;
mGesture = new GestureDetector(getContext(), mGestureListener);
mGesture.setIsLongpressEnabled(true);
setFocusable(true);
setFocusableInTouchMode(true);
ViewConfiguration configuration = ViewConfiguration.get(getContext());
mTouchSlop = configuration.getScaledTouchSlop();
mDragTolerance = mTouchSlop;
mOverscrollDistance = 10;
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
}
use of android.view.ViewConfiguration in project android-support-v4-googlemaps by petedoyle.
the class ViewPager method initViewPager.
void initViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
mScroller = new Scroller(context, sInterpolator);
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mLeftEdge = new EdgeEffectCompat(context);
mRightEdge = new EdgeEffectCompat(context);
final float density = context.getResources().getDisplayMetrics().density;
mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
mCloseEnough = (int) (CLOSE_ENOUGH * density);
mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);
ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
}
use of android.view.ViewConfiguration in project superCleanMaster by joyoyao.
the class ViewDragHelper method setSensitivity.
/**
* Sets the sensitivity of the dragger.
*
* @param context The application context.
* @param sensitivity value between 0 and 1, the final value for touchSlop =
* ViewConfiguration.getScaledTouchSlop * (1 / s);
*/
public void setSensitivity(Context context, float sensitivity) {
float s = Math.max(0f, Math.min(1.0f, sensitivity));
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
mTouchSlop = (int) (viewConfiguration.getScaledTouchSlop() * (1 / s));
}
Aggregations