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


Java ViewConfiguration.getScaledTouchSlop方法代码示例

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


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

示例1: ViewDragHelper

import android.view.ViewConfiguration; //导入方法依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:Zweihui,项目名称:Aurora,代码行数:29,代码来源:ViewDragHelper.java

示例2: SlideBottomPanel

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public SlideBottomPanel(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mContext = context;
    mDensity = getResources().getDisplayMetrics().density;

    ViewConfiguration vc = ViewConfiguration.get(mContext);
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mTouchSlop = vc.getScaledTouchSlop();

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SlideBottomPanel, defStyleAttr, 0);

    mBackgroundId = a.getResourceId(R.styleable.SlideBottomPanel_sbp_background_layout, DEFAULT_BACKGROUND_ID);
    mPanelHeight = a.getDimension(R.styleable.SlideBottomPanel_sbp_panel_height, dp2px(DEFAULT_PANEL_HEIGHT));
    mBoundary = a.getBoolean(R.styleable.SlideBottomPanel_sbp_boundary, DEFAULT_BOUNDARY);
    MAX_CLICK_DISTANCE = mTitleHeightNoDisplay = a.getDimension(R.styleable.SlideBottomPanel_sbp_title_height_no_display,dp2px(DEFAULT_TITLE_HEIGHT_NO_DISPLAY));
    mMoveDistanceToTrigger = a.getDimension(R.styleable.SlideBottomPanel_sbp_move_distance_trigger, dp2px(DEFAULT_MOVE_DISTANCE_TO_TRIGGER));
    mAnimationDuration = a.getInt(R.styleable.SlideBottomPanel_sbp_animation_duration, DEFAULT_ANIMATION_DURATION);
    mHidePanelTitle = a.getBoolean(R.styleable.SlideBottomPanel_sbp_hide_panel_title, DEFAULT_HIDE_PANEL_TITLE);
    mIsFade = a.getBoolean(R.styleable.SlideBottomPanel_sbp_fade, DEFAULT_FADE);

    a.recycle();

    initBackgroundView();
}
 
开发者ID:stytooldex,项目名称:pius1,代码行数:27,代码来源:SlideBottomPanel.java

示例3: ItemTouchListener

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public ItemTouchListener(RecyclerView recyclerView) {
    ViewConfiguration configuration = ViewConfiguration.get(recyclerView.getContext());
    int touchSlop = configuration.getScaledTouchSlop();
    mTouchSlopSquare = touchSlop * touchSlop;
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();

    mHandler = new GestureHandler();
    isScrolling = false;
    mScroller = new Scroller(recyclerView.getContext(), new AccelerateDecelerateInterpolator());
    mRecyclerView = recyclerView;

    mLeftViewWidthList = new ArrayList<>();
    mRightViewWidthList = new ArrayList<>();
}
 
开发者ID:qinhehu,项目名称:Gesture,代码行数:16,代码来源:ItemTouchListener.java

示例4: init

import android.view.ViewConfiguration; //导入方法依赖的package包/类
private void init() {
    setOverScrollMode(OVER_SCROLL_NEVER);
    mFlexibleEffect = new FlexibleEffect(this);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
 
开发者ID:teisun,项目名称:SunmiUI,代码行数:8,代码来源:FlexibleScrollView.java

示例5: SwipeListViewTouchListener

import android.view.ViewConfiguration; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param swipeListView  SwipeListView
 * @param swipeFrontView front view Identifier
 * @param swipeBackView  back view Identifier
 */
public SwipeListViewTouchListener(SwipeListView swipeListView, int swipeFrontView, int swipeBackView) {
    this.swipeFrontView = swipeFrontView;
    this.swipeBackView = swipeBackView;
    ViewConfiguration vc = ViewConfiguration.get(swipeListView.getContext());
    slop = vc.getScaledTouchSlop();
    minFlingVelocity = vc.getScaledMinimumFlingVelocity();
    maxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    configShortAnimationTime = swipeListView.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime);
    animationTime = configShortAnimationTime;
    this.swipeListView = swipeListView;
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:19,代码来源:SwipeListViewTouchListener.java

示例6: ScrollableChartView

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public ScrollableChartView(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);

  mScroller = ScrollerCompat.create(context, new DecelerateInterpolator());
  ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
  mMaximumVelocity = viewConfiguration.getScaledMaximumFlingVelocity();
  mMinimumVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
  mTouchSlop = viewConfiguration.getScaledTouchSlop();
}
 
开发者ID:littleGnAl,项目名称:ScrollableChart,代码行数:10,代码来源:ScrollableChartView.java

示例7: init

import android.view.ViewConfiguration; //导入方法依赖的package包/类
private void init(Context context) {
    setOrientation(VERTICAL);

    mOverScroller = new OverScroller(context);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:BGAStickyNavLayout.java

示例8: Switch

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public Switch(Context context) {
    super(context);

    mThumbDrawable = context.getResources().getDrawable(R.drawable.switch_thumb);
    if (mThumbDrawable != null) {
        mThumbDrawable.setCallback(this);
    }
    mTrackDrawable = context.getResources().getDrawable(R.drawable.switch_track);
    if (mTrackDrawable != null) {
        mTrackDrawable.setCallback(this);
    }

    if (AndroidUtilities.density < 1) {
        mSwitchMinWidth = AndroidUtilities.dp(30);
    } else {
        mSwitchMinWidth = 0;
    }

    mSwitchPadding = 0;
    mSplitTrack = false;

    final ViewConfiguration config = ViewConfiguration.get(context);
    mTouchSlop = config.getScaledTouchSlop();
    mMinFlingVelocity = config.getScaledMinimumFlingVelocity();

    refreshDrawableState();
    setChecked(isChecked());
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:29,代码来源:Switch.java

示例9: DragLayout

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public DragLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.app, 0, 0);
    bottomDragVisibleHeight = (int) a.getDimension(R.styleable.app_bottomDragVisibleHeight, 0);
    bototmExtraIndicatorHeight = (int) a.getDimension(R.styleable.app_bototmExtraIndicatorHeight, 0);
    a.recycle();

    mDragHelper = ViewDragHelper
            .create(this, 10f, new DragHelperCallback());
    mDragHelper.setEdgeTrackingEnabled(ViewDragHelper.EDGE_TOP);
    moveDetector = new GestureDetectorCompat(context, new MoveDetector());
    moveDetector.setIsLongpressEnabled(false); // 不处理长按事件

    // 滑动的距离阈值由系统提供
    ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:DragLayout.java

示例10: SwipeMenuLayout

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public SwipeMenuLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.SwipeMenuLayout);
    mLeftViewId = typedArray.getResourceId(R.styleable.SwipeMenuLayout_leftViewId, mLeftViewId);
    mContentViewId = typedArray.getResourceId(R.styleable.SwipeMenuLayout_contentViewId, mContentViewId);
    mRightViewId = typedArray.getResourceId(R.styleable.SwipeMenuLayout_rightViewId, mRightViewId);
    typedArray.recycle();

    ViewConfiguration mViewConfig = ViewConfiguration.get(getContext());
    mScaledTouchSlop = mViewConfig.getScaledTouchSlop();
    mScroller = new OverScroller(getContext());
    mScaledMinimumFlingVelocity = mViewConfig.getScaledMinimumFlingVelocity();
    mScaledMaximumFlingVelocity = mViewConfig.getScaledMaximumFlingVelocity();
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:16,代码来源:SwipeMenuLayout.java

示例11: setupCallbacks

import android.view.ViewConfiguration; //导入方法依赖的package包/类
private void setupCallbacks() {
    ViewConfiguration vc = ViewConfiguration.get(mRecyclerView.getContext());
    mSlop = vc.getScaledTouchSlop();
    mRecyclerView.addItemDecoration(this);
    mRecyclerView.addOnItemTouchListener(mOnItemTouchListener);
    mRecyclerView.addOnChildAttachStateChangeListener(this);
    initGestureDetector();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:9,代码来源:ItemTouchHelper.java

示例12: QMUIPullRefreshLayout

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public QMUIPullRefreshLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setWillNotDraw(false);

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMiniVelocity = vc.getScaledMinimumFlingVelocity();
    mSystemTouchSlop = vc.getScaledTouchSlop();
    mTouchSlop = QMUIDisplayHelper.px2dp(context, mSystemTouchSlop); //系统的值是8dp,如何配置?

    mScroller = new Scroller(getContext());
    mScroller.setFriction(getScrollerFriction());

    addRefreshView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);

    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

    TypedArray array = context.obtainStyledAttributes(attrs,
            R.styleable.QMUIPullRefreshLayout, defStyleAttr, 0);

    try {
        mRefreshInitOffset = array.getDimensionPixelSize(
                R.styleable.QMUIPullRefreshLayout_qmui_refresh_init_offset, Integer.MIN_VALUE);
        mRefreshEndOffset = array.getDimensionPixelSize(
                R.styleable.QMUIPullRefreshLayout_qmui_refresh_end_offset, Integer.MIN_VALUE);
        mTargetInitOffset = array.getDimensionPixelSize(
                R.styleable.QMUIPullRefreshLayout_qmui_target_init_offset, 0);
        mTargetRefreshOffset = array.getDimensionPixelSize(
                R.styleable.QMUIPullRefreshLayout_qmui_target_refresh_offset,
                QMUIDisplayHelper.dp2px(getContext(), 72));
        mAutoCalculateRefreshInitOffset = mRefreshInitOffset == Integer.MIN_VALUE ||
                array.getBoolean(R.styleable.QMUIPullRefreshLayout_qmui_auto_calculate_refresh_init_offset, false);
        mAutoCalculateRefreshEndOffset = mRefreshEndOffset == Integer.MIN_VALUE ||
                array.getBoolean(R.styleable.QMUIPullRefreshLayout_qmui_auto_calculate_refresh_end_offset, false);
        mEqualTargetRefreshOffsetToRefreshViewHeight = array.getBoolean(R.styleable.QMUIPullRefreshLayout_qmui_equal_target_refresh_offset_to_refresh_view_height, false);
    } finally {
        array.recycle();
    }
    mRefreshCurrentOffset = mRefreshInitOffset;
    mTargetCurrentOffset = mTargetInitOffset;
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:43,代码来源:QMUIPullRefreshLayout.java

示例13: CupcakeGestureDetector

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public CupcakeGestureDetector(Context context) {
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mTouchSlop = configuration.getScaledTouchSlop();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:CupcakeGestureDetector.java

示例14: CupcakeDetector

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public CupcakeDetector(Context context) {
	final ViewConfiguration configuration = ViewConfiguration.get(context);
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	mTouchSlop = configuration.getScaledTouchSlop();
}
 
开发者ID:liuke2016,项目名称:filepicker,代码行数:6,代码来源:VersionedGestureDetector.java

示例15: init

import android.view.ViewConfiguration; //导入方法依赖的package包/类
protected void init() {
    ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
    this.touchSlop = viewConfiguration.getScaledTouchSlop();
    this.childHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
 
开发者ID:marshi,项目名称:NestedWebView,代码行数:7,代码来源:NestedWebView.java


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