Search in sources :

Example 76 with ViewConfiguration

use of android.view.ViewConfiguration in project android_frameworks_base by DirtyUnicorns.

the class StackView method initStackView.

private void initStackView() {
    configureViewAnimator(NUM_ACTIVE_VIEWS, 1);
    setStaticTransformationsEnabled(true);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mActivePointerId = INVALID_POINTER;
    mHighlight = new ImageView(getContext());
    mHighlight.setLayoutParams(new LayoutParams(mHighlight));
    addViewInLayout(mHighlight, -1, new LayoutParams(mHighlight));
    mClickFeedback = new ImageView(getContext());
    mClickFeedback.setLayoutParams(new LayoutParams(mClickFeedback));
    addViewInLayout(mClickFeedback, -1, new LayoutParams(mClickFeedback));
    mClickFeedback.setVisibility(INVISIBLE);
    mStackSlider = new StackSlider();
    if (sHolographicHelper == null) {
        sHolographicHelper = new HolographicHelper(mContext);
    }
    setClipChildren(false);
    setClipToPadding(false);
    // This sets the form of the StackView, which is currently to have the perspective-shifted
    // views above the active view, and have items slide down when sliding out. The opposite is
    // available by using ITEMS_SLIDE_UP.
    mStackMode = ITEMS_SLIDE_DOWN;
    // This is a flag to indicate the the stack is loading for the first time
    mWhichChild = -1;
    // Adjust the frame padding based on the density, since the highlight changes based
    // on the density
    final float density = mContext.getResources().getDisplayMetrics().density;
    mFramePadding = (int) Math.ceil(density * FRAME_PADDING);
}
Also used : ViewConfiguration(android.view.ViewConfiguration)

Example 77 with ViewConfiguration

use of android.view.ViewConfiguration in project android_frameworks_base by ParanoidAndroid.

the class WebViewClassic method init.

private void init() {
    OnTrimMemoryListener.init(mContext);
    mWebView.setWillNotDraw(false);
    mWebView.setClickable(true);
    mWebView.setLongClickable(true);
    final ViewConfiguration configuration = ViewConfiguration.get(mContext);
    int slop = configuration.getScaledTouchSlop();
    mTouchSlopSquare = slop * slop;
    slop = configuration.getScaledDoubleTapSlop();
    mDoubleTapSlopSquare = slop * slop;
    final float density = WebViewCore.getFixedDisplayDensity(mContext);
    // use one line height, 16 based on our current default font, for how
    // far we allow a touch be away from the edge of a link
    mNavSlop = (int) (16 * density);
    mZoomManager.init(density);
    mMaximumFling = configuration.getScaledMaximumFlingVelocity();
    // Compute the inverse of the density squared.
    DRAG_LAYER_INVERSE_DENSITY_SQUARED = 1 / (density * density);
    mOverscrollDistance = configuration.getScaledOverscrollDistance();
    mOverflingDistance = configuration.getScaledOverflingDistance();
    setScrollBarStyle(mWebViewPrivate.super_getScrollBarStyle());
    // Initially use a size of two, since the user is likely to only hold
    // down two keys at a time (shift + another key)
    mKeysPressed = new Vector<Integer>(2);
    mHTML5VideoViewProxy = null;
}
Also used : ViewConfiguration(android.view.ViewConfiguration) Paint(android.graphics.Paint) Point(android.graphics.Point)

Example 78 with ViewConfiguration

use of android.view.ViewConfiguration in project android_frameworks_base by ParanoidAndroid.

the class StackView method initStackView.

private void initStackView() {
    configureViewAnimator(NUM_ACTIVE_VIEWS, 1);
    setStaticTransformationsEnabled(true);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mActivePointerId = INVALID_POINTER;
    mHighlight = new ImageView(getContext());
    mHighlight.setLayoutParams(new LayoutParams(mHighlight));
    addViewInLayout(mHighlight, -1, new LayoutParams(mHighlight));
    mClickFeedback = new ImageView(getContext());
    mClickFeedback.setLayoutParams(new LayoutParams(mClickFeedback));
    addViewInLayout(mClickFeedback, -1, new LayoutParams(mClickFeedback));
    mClickFeedback.setVisibility(INVISIBLE);
    mStackSlider = new StackSlider();
    if (sHolographicHelper == null) {
        sHolographicHelper = new HolographicHelper(mContext);
    }
    setClipChildren(false);
    setClipToPadding(false);
    // This sets the form of the StackView, which is currently to have the perspective-shifted
    // views above the active view, and have items slide down when sliding out. The opposite is
    // available by using ITEMS_SLIDE_UP.
    mStackMode = ITEMS_SLIDE_DOWN;
    // This is a flag to indicate the the stack is loading for the first time
    mWhichChild = -1;
    // Adjust the frame padding based on the density, since the highlight changes based
    // on the density
    final float density = mContext.getResources().getDisplayMetrics().density;
    mFramePadding = (int) Math.ceil(density * FRAME_PADDING);
}
Also used : ViewConfiguration(android.view.ViewConfiguration)

Example 79 with ViewConfiguration

use of android.view.ViewConfiguration in project android_frameworks_base by ParanoidAndroid.

the class HorizontalScrollView method initScrollView.

private void initScrollView() {
    mScroller = new OverScroller(getContext());
    setFocusable(true);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setWillNotDraw(false);
    final ViewConfiguration configuration = ViewConfiguration.get(mContext);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mOverscrollDistance = configuration.getScaledOverscrollDistance();
    mOverflingDistance = configuration.getScaledOverflingDistance();
}
Also used : ViewConfiguration(android.view.ViewConfiguration)

Example 80 with ViewConfiguration

use of android.view.ViewConfiguration in project android_packages_apps_DUI by DirtyUnicorns.

the class FlingGestureDetector method init.

private void init(Context context) {
    if (mListener == null) {
        throw new NullPointerException("OnGestureListener must not be null");
    }
    mIsLongpressEnabled = true;
    // Fallback to support pre-donuts releases
    int touchSlop, doubleTapSlop, doubleTapTouchSlop;
    float touchSlopIncreaseFactor;
    if (context == null) {
        //noinspection deprecation
        touchSlop = ViewConfiguration.getTouchSlop();
        // Hack rather than adding a hiden method for this
        doubleTapTouchSlop = touchSlop;
        doubleTapSlop = ViewConfiguration.getDoubleTapSlop();
        //noinspection deprecation
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();
    } else {
        final ViewConfiguration configuration = ViewConfiguration.get(context);
        touchSlopIncreaseFactor = context.getResources().getFloat(R.dimen.config_fling_touchslop_increase_factor);
        final int slop = configuration.getScaledTouchSlop();
        touchSlop = Math.round(slop * touchSlopIncreaseFactor);
        doubleTapTouchSlop = configuration.getScaledDoubleTapTouchSlop();
        doubleTapSlop = configuration.getScaledDoubleTapSlop();
        mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
    }
    mTouchSlopSquare = touchSlop * touchSlop;
    mDoubleTapTouchSlopSquare = doubleTapTouchSlop * doubleTapTouchSlop;
    mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
}
Also used : ViewConfiguration(android.view.ViewConfiguration)

Aggregations

ViewConfiguration (android.view.ViewConfiguration)186 Scroller (android.widget.Scroller)41 Context (android.content.Context)28 TypedArray (android.content.res.TypedArray)23 EdgeEffectCompat (android.support.v4.widget.EdgeEffectCompat)16 Point (android.graphics.Point)12 View (android.view.View)12 OverScroller (android.widget.OverScroller)10 Field (java.lang.reflect.Field)9 Resources (android.content.res.Resources)8 Paint (android.graphics.Paint)7 RectF (android.graphics.RectF)7 DisplayMetrics (android.util.DisplayMetrics)7 Drawable (android.graphics.drawable.Drawable)6 GestureDetector (android.view.GestureDetector)6 PointF (android.graphics.PointF)5 ImageView (android.widget.ImageView)5 FlingAnimationUtils (com.android.systemui.statusbar.FlingAnimationUtils)5 SlidingTabLayout (com.google.samples.apps.iosched.ui.widget.SlidingTabLayout)4 TimeInterpolator (android.animation.TimeInterpolator)3