當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。