當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewConfiguration.getScaledMinimumFlingVelocity方法代碼示例

本文整理匯總了Java中android.view.ViewConfiguration.getScaledMinimumFlingVelocity方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewConfiguration.getScaledMinimumFlingVelocity方法的具體用法?Java ViewConfiguration.getScaledMinimumFlingVelocity怎麽用?Java ViewConfiguration.getScaledMinimumFlingVelocity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.ViewConfiguration的用法示例。


在下文中一共展示了ViewConfiguration.getScaledMinimumFlingVelocity方法的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:Vinetos,項目名稱:Hello-Music-droid,代碼行數:29,代碼來源:ViewDragHelper.java

示例2: init

import android.view.ViewConfiguration; //導入方法依賴的package包/類
private void init(Context context) {
    if (context == null) {
        throw new IllegalArgumentException("Context must not be null");
    } else if (this.mListener == null) {
        throw new IllegalArgumentException("OnGestureListener must not be null");
    } else {
        this.mIsLongpressEnabled = true;
        ViewConfiguration configuration = ViewConfiguration.get(context);
        int touchSlop = configuration.getScaledTouchSlop();
        int doubleTapSlop = configuration.getScaledDoubleTapSlop();
        this.mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
        this.mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity();
        this.mTouchSlopSquare = touchSlop * touchSlop;
        this.mDoubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:17,代碼來源:GestureDetectorCompat.java

示例3: ViewDragHelper

import android.view.ViewConfiguration; //導入方法依賴的package包/類
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    } else if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    } else {
        this.mParentView = forParent;
        this.mCallback = cb;
        ViewConfiguration vc = ViewConfiguration.get(context);
        this.mEdgeSize = (int) ((20.0f * context.getResources().getDisplayMetrics().density)
                + 0.5f);
        this.mTouchSlop = vc.getScaledTouchSlop();
        this.mMaxVelocity = (float) vc.getScaledMaximumFlingVelocity();
        this.mMinVelocity = (float) vc.getScaledMinimumFlingVelocity();
        this.mScroller = ScrollerCompat.create(context, sInterpolator);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:18,代碼來源:ViewDragHelper.java

示例4: 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:eventtus,項目名稱:photo-editor-android,代碼行數:29,代碼來源:ViewDragHelper.java

示例5: KDragViewHelper

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 KDragViewHelper(Context context, ViewGroup forParent, android.support.v4.widget.ViewDragHelper.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:Kaufland,項目名稱:andswipeframework,代碼行數:29,代碼來源:KDragViewHelper.java

示例6: initAbsListView

import android.view.ViewConfiguration; //導入方法依賴的package包/類
private void initAbsListView() {
    setClickable(true);
    setFocusableInTouchMode(true);
    setWillNotDraw(false);
    setAlwaysDrawnWithCacheEnabled(false);
    setScrollingCacheEnabled(true);
    ViewConfiguration configuration = ViewConfiguration.get(getContext());
    this.mTouchSlop = configuration.getScaledTouchSlop();
    this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    this.mOverscrollDistance = configuration.getScaledOverscrollDistance() + 200;
    this.mOverflingDistance = configuration.getScaledOverflingDistance() + 100;
    this.mViewHelper = ViewHelperFactory.create(this);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:15,代碼來源:AbsHListView.java

示例7: LargeImageView

import android.view.ViewConfiguration; //導入方法依賴的package包/類
public LargeImageView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mScroller = ScrollerCompat.create(getContext(), null);
    scaleHelper = new ScaleHelper();
    setFocusable(true);
    setWillNotDraw(false);
    gestureDetector = new GestureDetector(context, simpleOnGestureListener);
    scaleGestureDetector = new ScaleGestureDetector(context, onScaleGestureListener);

    imageBlockLoader = new BlockImageLoader(context);
    imageBlockLoader.setOnImageLoadListener(this);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
 
開發者ID:jeasinlee,項目名稱:AndroidBasicLibs,代碼行數:16,代碼來源:LargeImageView.java

示例8: RecyclerView

import android.view.ViewConfiguration; //導入方法依賴的package包/類
public RecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    setScrollContainer(true);
    setFocusableInTouchMode(true);
    final int version = Build.VERSION.SDK_INT;
    mPostUpdatesOnAnimation = version >= 16;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    setWillNotDraw(ViewCompat.getOverScrollMode(this) == ViewCompat.OVER_SCROLL_NEVER);

    mItemAnimator.setListener(mItemAnimatorListener);
    initAdapterManager();
    initChildrenHelper();
    // If not explicitly specified this view is important for accessibility.
    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
    mAccessibilityManager = (AccessibilityManager) getContext()
            .getSystemService(Context.ACCESSIBILITY_SERVICE);
    setAccessibilityDelegateCompat(new RecyclerViewAccessibilityDelegate(this));
    // Create the layoutManager if specified.

    // Re-set whether nested scrolling is enabled so that it is set on all API levels
    setNestedScrollingEnabled(true);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:31,代碼來源:RecyclerView.java

示例9: CupcakeGestureDetector

import android.view.ViewConfiguration; //導入方法依賴的package包/類
public CupcakeGestureDetector(Context context) {
    ViewConfiguration configuration = ViewConfiguration.get(context);
    this.mMinimumVelocity = (float) configuration.getScaledMinimumFlingVelocity();
    this.mTouchSlop = (float) configuration.getScaledTouchSlop();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:6,代碼來源:CupcakeGestureDetector.java

示例10: CupcakeDetector

import android.view.ViewConfiguration; //導入方法依賴的package包/類
public CupcakeDetector(Context context) {
	final ViewConfiguration configuration = ViewConfiguration.get(context);
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	mTouchSlop = configuration.getScaledTouchSlop();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:6,代碼來源:VersionedGestureDetector.java

示例11: 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

示例12: WheelPicker_New

import android.view.ViewConfiguration; //導入方法依賴的package包/類
public WheelPicker_New(Context context, AttributeSet attrs) {
    super(context, attrs);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.WheelPicker);
    int idData = a.getResourceId(R.styleable.WheelPicker_wheel_data, 0);
    mData = Arrays.asList(getResources()
            .getStringArray(idData == 0 ? R.array.WheelArrayDefault : idData));
    mItemTextSize = a.getDimensionPixelSize(R.styleable.WheelPicker_wheel_item_text_size,
            getResources().getDimensionPixelSize(R.dimen.WheelItemTextSize));
    mVisibleItemCount = a.getInt(R.styleable.WheelPicker_wheel_visible_item_count, 7);
    mSelectedItemPosition = a.getInt(R.styleable.WheelPicker_wheel_selected_item_position, 0);
    hasSameWidth = a.getBoolean(R.styleable.WheelPicker_wheel_same_width, false);
    mTextMaxWidthPosition =
            a.getInt(R.styleable.WheelPicker_wheel_maximum_width_text_position, -1);
    mMaxWidthText = a.getString(R.styleable.WheelPicker_wheel_maximum_width_text);
    mSelectedItemTextColor = a.getColor
            (R.styleable.WheelPicker_wheel_selected_item_text_color, -1);
    mItemTextColor = a.getColor(R.styleable.WheelPicker_wheel_item_text_color, 0xFF888888);
    mItemSpace = a.getDimensionPixelSize(R.styleable.WheelPicker_wheel_item_space,
            getResources().getDimensionPixelSize(R.dimen.WheelItemSpace));
    isCyclic = a.getBoolean(R.styleable.WheelPicker_wheel_cyclic, false);
    hasIndicator = a.getBoolean(R.styleable.WheelPicker_wheel_indicator, false);
    mIndicatorColor = a.getColor(R.styleable.WheelPicker_wheel_indicator_color, 0xFFEE3333);
    mIndicatorSize = a.getDimensionPixelSize(R.styleable.WheelPicker_wheel_indicator_size,
            getResources().getDimensionPixelSize(R.dimen.WheelIndicatorSize));
    hasCurtain = a.getBoolean(R.styleable.WheelPicker_wheel_curtain, false);
    mCurtainColor = a.getColor(R.styleable.WheelPicker_wheel_curtain_color, 0x88FFFFFF);
    hasAtmospheric = a.getBoolean(R.styleable.WheelPicker_wheel_atmospheric, false);
    isCurved = a.getBoolean(R.styleable.WheelPicker_wheel_curved, false);
    mItemAlign = a.getInt(R.styleable.WheelPicker_wheel_item_align, ALIGN_CENTER);
    a.recycle();

    // 可見數據項改變後更新與之相關的參數
    // Update relevant parameters when the count of visible item changed
    updateVisibleItemCount();

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG | Paint.LINEAR_TEXT_FLAG);
    mPaint.setTextSize(mItemTextSize);

    // 更新文本對齊方式
    // Update alignment of text
    updateItemTextAlign();

    // 計算文本尺寸
    // Correct sizes of text
    computeTextSize();

    mScroller = new Scroller(getContext());

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.DONUT) {
        ViewConfiguration conf = ViewConfiguration.get(getContext());
        mMinimumVelocity = conf.getScaledMinimumFlingVelocity();
        mMaximumVelocity = conf.getScaledMaximumFlingVelocity();
        mTouchSlop = conf.getScaledTouchSlop();
    }
    mRectDrawn = new Rect();

    mRectIndicatorHead = new Rect();
    mRectIndicatorFoot = new Rect();

    mRectCurrentItem = new Rect();

    mCamera = new Camera();

    mMatrixRotate = new Matrix();
    mMatrixDepth = new Matrix();
}
 
開發者ID:yzzslow0,項目名稱:Ec2m,代碼行數:68,代碼來源:WheelPicker_New.java

示例13: VerticalFlingDetector

import android.view.ViewConfiguration; //導入方法依賴的package包/類
public VerticalFlingDetector(Context context) {
    ViewConfiguration vc = ViewConfiguration.get(context);
    mMinimumFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mCustomTouchSlop = CUSTOM_SLOP_MULTIPLIER * vc.getScaledTouchSlop();
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:7,代碼來源:VerticalFlingDetector.java

示例14: initView

import android.view.ViewConfiguration; //導入方法依賴的package包/類
private void initView(Context context, AttributeSet attrs) {
    setClipToPadding(false);

    DensityUtil density = new DensityUtil();
    ViewConfiguration configuration = ViewConfiguration.get(context);

    mKernel = new RefreshKernelImpl();
    mScroller = new Scroller(context);
    mVelocityTracker = VelocityTracker.obtain();
    mScreenHeightPixels = context.getResources().getDisplayMetrics().heightPixels;
    mReboundInterpolator = new ViscousFluidInterpolator();
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);

    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SmartRefreshLayout);

    ViewCompat.setNestedScrollingEnabled(this, ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableNestedScrolling, false));
    mDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlDragRate, mDragRate);
    mHeaderMaxDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlHeaderMaxDragRate, mHeaderMaxDragRate);
    mFooterMaxDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlFooterMaxDragRate, mFooterMaxDragRate);
    mHeaderTriggerRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlHeaderTriggerRate, mHeaderTriggerRate);
    mFooterTriggerRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlFooterTriggerRate, mFooterTriggerRate);
    mEnableRefresh = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableRefresh, mEnableRefresh);
    mReboundDuration = ta.getInt(R.styleable.SmartRefreshLayout_srlReboundDuration, mReboundDuration);
    mEnableLoadmore = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableLoadmore, mEnableLoadmore);
    mHeaderHeight = ta.getDimensionPixelOffset(R.styleable.SmartRefreshLayout_srlHeaderHeight, density.dip2px(100));
    mFooterHeight = ta.getDimensionPixelOffset(R.styleable.SmartRefreshLayout_srlFooterHeight, density.dip2px(60));
    mDisableContentWhenRefresh = ta.getBoolean(R.styleable.SmartRefreshLayout_srlDisableContentWhenRefresh, mDisableContentWhenRefresh);
    mDisableContentWhenLoading = ta.getBoolean(R.styleable.SmartRefreshLayout_srlDisableContentWhenLoading, mDisableContentWhenLoading);
    mEnableHeaderTranslationContent = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableHeaderTranslationContent, mEnableHeaderTranslationContent);
    mEnableFooterTranslationContent = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableFooterTranslationContent, mEnableFooterTranslationContent);
    mEnablePreviewInEditMode = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnablePreviewInEditMode, mEnablePreviewInEditMode);
    mEnableAutoLoadmore = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableAutoLoadmore, mEnableAutoLoadmore);
    mEnableOverScrollBounce = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableOverScrollBounce, mEnableOverScrollBounce);
    mEnablePureScrollMode = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnablePureScrollMode, mEnablePureScrollMode);
    mEnableScrollContentWhenLoaded = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableScrollContentWhenLoaded, mEnableScrollContentWhenLoaded);
    mEnableLoadmoreWhenContentNotFull = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableLoadmoreWhenContentNotFull, mEnableLoadmoreWhenContentNotFull);
    mEnableFooterFollowWhenLoadFinished = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableFooterFollowWhenLoadFinished, mEnableFooterFollowWhenLoadFinished);
    mEnableOverScrollDrag = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableOverScrollDrag, mEnableOverScrollDrag);
    mFixedHeaderViewId = ta.getResourceId(R.styleable.SmartRefreshLayout_srlFixedHeaderViewId, View.NO_ID);
    mFixedFooterViewId = ta.getResourceId(R.styleable.SmartRefreshLayout_srlFixedFooterViewId, View.NO_ID);

    mManualLoadmore = ta.hasValue(R.styleable.SmartRefreshLayout_srlEnableLoadmore);
    mManualNestedScrolling = ta.hasValue(R.styleable.SmartRefreshLayout_srlEnableNestedScrolling);
    mHeaderHeightStatus = ta.hasValue(R.styleable.SmartRefreshLayout_srlHeaderHeight) ? DimensionStatus.XmlLayoutUnNotify : mHeaderHeightStatus;
    mFooterHeightStatus = ta.hasValue(R.styleable.SmartRefreshLayout_srlFooterHeight) ? DimensionStatus.XmlLayoutUnNotify : mFooterHeightStatus;

    mHeaderExtendHeight = (int) Math.max((mHeaderHeight * (mHeaderMaxDragRate - 1)), 0);
    mFooterExtendHeight = (int) Math.max((mFooterHeight * (mFooterMaxDragRate - 1)), 0);

    int accentColor = ta.getColor(R.styleable.SmartRefreshLayout_srlAccentColor, 0);
    int primaryColor = ta.getColor(R.styleable.SmartRefreshLayout_srlPrimaryColor, 0);
    if (primaryColor != 0) {
        if (accentColor != 0) {
            mPrimaryColors = new int[]{primaryColor, accentColor};
        } else {
            mPrimaryColors = new int[]{primaryColor};
        }
    }

    ta.recycle();

}
 
開發者ID:penghuanliang,項目名稱:Rxjava2.0Demo,代碼行數:68,代碼來源:SmartRefreshLayout.java

示例15: AViewParams

import android.view.ViewConfiguration; //導入方法依賴的package包/類
public AViewParams(Context context) {
    mContext = context;
    final ViewConfiguration configuration = ViewConfiguration.get(mContext);
    maxVelocity = configuration.getScaledMaximumFlingVelocity();
    minVelocity = configuration.getScaledMinimumFlingVelocity();
}
 
開發者ID:anmingyu11,項目名稱:OverScrollableRecyclerView-Method1,代碼行數:7,代碼來源:AViewParams.java


注:本文中的android.view.ViewConfiguration.getScaledMinimumFlingVelocity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。