Example usage for android.view ViewConfiguration getScaledTouchSlop

List of usage examples for android.view ViewConfiguration getScaledTouchSlop

Introduction

In this page you can find the example usage for android.view ViewConfiguration getScaledTouchSlop.

Prototype

public int getScaledTouchSlop() 

Source Link

Usage

From source file:com.duy.pascal.ui.view.BaseRecycleView.java

public BaseRecycleView(Context context, @Nullable AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    final ViewConfiguration vc = ViewConfiguration.get(getContext());
    mTouchSlop = vc.getScaledTouchSlop();
}

From source file:com.duy.pascal.ui.view.BaseRecycleView.java

@Override
public void setScrollingTouchSlop(int slopConstant) {
    super.setScrollingTouchSlop(slopConstant);
    final ViewConfiguration vc = ViewConfiguration.get(getContext());
    switch (slopConstant) {
    case TOUCH_SLOP_DEFAULT:
        mTouchSlop = vc.getScaledTouchSlop();
        break;/*from w  ww.  j a  va2s . c  o m*/
    case TOUCH_SLOP_PAGING:
        mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(vc);
        break;
    default:
        break;
    }
}

From source file:ngoctdn.vng.gesture.CupcakeGestureDetector.java

public CupcakeGestureDetector(Context context) {
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mTouchSlop = configuration.getScaledTouchSlop();
}

From source file:ngoctdn.vng.gesture.DragGestureDetector.java

public DragGestureDetector(Context context) {
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mTouchSlop = configuration.getScaledTouchSlop();
}

From source file:com.github.shareme.gwsswwipetodismiss.library.SwipeDismissTouchListener.java

/**
 * Constructs a new swipe-to-dismiss touch listener for the given view.
 * //from   w w  w  .j  av a 2 s .c  o m
 * @param view
 *            The view to make dismissable.
 * @param token
 *            An optional token/cookie object to be passed through to the
 *            callback.
 * @param callback
 *            The callback to trigger when the user has indicated that she
 *            would like to dismiss this view.
 */
public SwipeDismissTouchListener(View view, Object token, OnDismissCallback callback) {
    ViewConfiguration vc = ViewConfiguration.get(view.getContext());
    mSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mAnimationTime = view.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime);
    mView = view;
    mToken = token;
    mCallback = callback;
}

From source file:com.nononsenseapps.feeder.ui.SwipeDismissTouchListener.java

/**
 * Constructs a new swipe-to-dismiss touch listener for the given view.
 *
 * @param view     The view to make dismissable.
 * @param token    An optional token/cookie object to be passed through to the callback.
 * @param callbacks The callback to trigger when the user has indicated that she would like to
 *                 dismiss this view./*  ww w  .  jav a2 s. c o m*/
 */
public SwipeDismissTouchListener(View view, Object token, DismissCallbacks callbacks) {
    ViewConfiguration vc = ViewConfiguration.get(view.getContext());
    mSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16;
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mAnimationTime = view.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime);
    mView = view;
    mSwipingView = callbacks.getSwipingView();

    mToken = token;
    mCallbacks = callbacks;

    mInterpolator = new FastOutLinearInInterpolator();
}

From source file:cn.goodjobs.common.view.photodraweeview.ScaleDragDetector.java

public ScaleDragDetector(Context context, OnScaleDragGestureListener scaleDragGestureListener) {
    mScaleDetector = new ScaleGestureDetector(context, this);
    mScaleDragGestureListener = scaleDragGestureListener;

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mTouchSlop = configuration.getScaledTouchSlop();
}

From source file:org.wordcamp.BaseActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_base);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

    ViewCompat.setElevation(findViewById(R.id.header), getResources().getDimension(R.dimen.toolbar_elevation));
    mToolbarView = findViewById(R.id.toolbar);
    mPagerAdapter = new WCPagerAdapter(getSupportFragmentManager());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mPagerAdapter);/*from w w  w.  j  a  va 2  s  .c o  m*/
    final int tabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
    findViewById(R.id.pager_wrapper).setPadding(0, getActionBarSize() + tabHeight, 0, 0);

    SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
    slidingTabLayout.setCustomTabView(R.layout.tab_view, android.R.id.text1);
    slidingTabLayout.setSelectedIndicatorColors(Color.parseColor("#0F85D1"));
    slidingTabLayout.setDistributeEvenly(true);
    slidingTabLayout.setViewPager(mPager);

    ViewConfiguration vc = ViewConfiguration.get(this);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
}

From source file:com.zms.materialdesign.observablescrollview.activity.FlexibleSpaceWithImageWithViewPagerTab2Activity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_flexiblespacewithimagewithviewpagertab2);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

    ViewCompat.setElevation(findViewById(R.id.header), getResources().getDimension(R.dimen.toolbar_elevation));
    mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());
    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setAdapter(mPagerAdapter);/*from w  w w . j a va2  s .co  m*/
    mImageView = findViewById(R.id.image);
    mOverlayView = findViewById(R.id.overlay);
    // Padding for ViewPager must be set outside the ViewPager itself
    // because with padding, EdgeEffect of ViewPager become strange.
    mFlexibleSpaceHeight = getResources().getDimensionPixelSize(R.dimen.flexible_space_image_height);
    mTabHeight = getResources().getDimensionPixelSize(R.dimen.tab_height);
    findViewById(R.id.pager_wrapper).setPadding(0, mFlexibleSpaceHeight, 0, 0);
    mTitleView = (TextView) findViewById(R.id.title);
    mTitleView.setText(getTitle());
    setTitle(null);

    SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
    slidingTabLayout.setCustomTabView(R.layout.tab_indicator, android.R.id.text1);
    slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
    slidingTabLayout.setDistributeEvenly(true);
    slidingTabLayout.setViewPager(mPager);
    ((FrameLayout.LayoutParams) slidingTabLayout.getLayoutParams()).topMargin = mFlexibleSpaceHeight
            - mTabHeight;

    ViewConfiguration vc = ViewConfiguration.get(this);
    mSlop = vc.getScaledTouchSlop();
    mInterceptionLayout = (TouchInterceptionFrameLayout) findViewById(R.id.container);
    mInterceptionLayout.setScrollInterceptionListener(mInterceptionListener);
    ScrollUtils.addOnGlobalLayoutListener(mInterceptionLayout, new Runnable() {
        @Override
        public void run() {
            updateFlexibleSpace();
        }
    });
}

From source file:com.arthurpitman.common.SlidingPanel.java

/**
 * Performs shared initialization of the {@code SlidingPanel}.
 *//*from w  w  w.  j av  a  2  s  . c  om*/
private final void initializeView() {
    scroller = new Scroller(getContext());
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    touchSlop = configuration.getScaledTouchSlop();
    minimumflingVelocity = configuration.getScaledMinimumFlingVelocity() * 4;
}