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


Java ViewConfiguration.getScaledMaximumFlingVelocity方法代码示例

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


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

示例1: init

import android.view.ViewConfiguration; //导入方法依赖的package包/类
/**
 * Initializes various states for this workspace.
 */
protected void init() {
    mScroller = new LauncherScroller(getContext());
    setDefaultInterpolator(new ScrollInterpolator());
    mCurrentPage = 0;

    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledPagingTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

    float density = getResources().getDisplayMetrics().density;
    mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * density);
    mMinFlingVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * density);
    setOnHierarchyChangeListener(this);
    setWillNotDraw(false);
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:20,代码来源:PagedView.java

示例2: AbstractDragTabsEventHandler

import android.view.ViewConfiguration; //导入方法依赖的package包/类
/**
 * Creates a new drag handler, which allows to calculate the position and state of tabs on touch
 * events.
 *
 * @param tabSwitcher
 *         The tab switcher, whose tabs' positions and states should be calculated by the drag
 *         handler, as an instance of the class {@link TabSwitcher}. The tab switcher may not be
 *         null
 * @param arithmetics
 *         The arithmetics, which should be used to calculate the position, size and rotation of
 *         tabs, as an instance of the type {@link Arithmetics}. The arithmetics may not be
 *         null
 * @param swipeEnabled
 *         True, if tabs can be swiped on the orthogonal axis, false otherwise
 */
public AbstractDragTabsEventHandler(@NonNull final TabSwitcher tabSwitcher,
                                    @NonNull final Arithmetics arithmetics,
                                    final boolean swipeEnabled) {
    super(MIN_PRIORITY, tabSwitcher,
            tabSwitcher.getResources().getDimensionPixelSize(R.dimen.drag_threshold));
    ensureNotNull(arithmetics, "The arithmetics may not be null");
    this.arithmetics = arithmetics;
    this.swipeEnabled = swipeEnabled;
    Resources resources = tabSwitcher.getResources();
    this.swipeDragHelper =
            new DragHelper(resources.getDimensionPixelSize(R.dimen.swipe_threshold));
    this.callback = null;
    ViewConfiguration configuration = ViewConfiguration.get(tabSwitcher.getContext());
    this.minFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    this.maxFlingVelocity = configuration.getScaledMaximumFlingVelocity();
    this.minSwipeVelocity = resources.getDimensionPixelSize(R.dimen.min_swipe_velocity);
    resetDragging();
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:34,代码来源:AbstractDragTabsEventHandler.java

示例3: AbstractDragHandler

import android.view.ViewConfiguration; //导入方法依赖的package包/类
/**
 * Creates a new drag handler, which allows to calculate the position and state of tabs on touch
 * events.
 *
 * @param tabSwitcher
 *         The tab switcher, whose tabs' positions and states should be calculated by the drag
 *         handler, as an instance of the class {@link TabSwitcher}. The tab switcher may not be
 *         null
 * @param arithmetics
 *         The arithmetics, which should be used to calculate the position, size and rotation of
 *         tabs, as an instance of the type {@link Arithmetics}. The arithmetics may not be
 *         null
 * @param swipeEnabled
 *         True, if tabs can be swiped on the orthogonal axis, false otherwise
 */
public AbstractDragHandler(@NonNull final TabSwitcher tabSwitcher,
                           @NonNull final Arithmetics arithmetics, final boolean swipeEnabled) {
    ensureNotNull(tabSwitcher, "The tab switcher may not be null");
    ensureNotNull(arithmetics, "The arithmetics may not be null");
    this.tabSwitcher = tabSwitcher;
    this.arithmetics = arithmetics;
    this.swipeEnabled = swipeEnabled;
    this.dragHelper = new DragHelper(0);
    Resources resources = tabSwitcher.getResources();
    this.swipeDragHelper =
            new DragHelper(resources.getDimensionPixelSize(R.dimen.swipe_threshold));
    this.callback = null;
    ViewConfiguration configuration = ViewConfiguration.get(tabSwitcher.getContext());
    this.minFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    this.maxFlingVelocity = configuration.getScaledMaximumFlingVelocity();
    this.minSwipeVelocity = resources.getDimensionPixelSize(R.dimen.min_swipe_velocity);
    resetDragging(resources.getDimensionPixelSize(R.dimen.drag_threshold));
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:34,代码来源:AbstractDragHandler.java

示例4: GooglePhotosGestureDetector

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public GooglePhotosGestureDetector(@Nullable Context context, @NonNull GooglePhotosGestureListener listener) {
    this.gestureListener = listener;
    gestureHandler = new GestureHandler();
    if (context == null) {
        MIN_FLING_VELOCITY = ViewConfiguration.getMinimumFlingVelocity();
        MAX_FLING_VELOCITY = ViewConfiguration.getMaximumFlingVelocity();
        DOUBLE_TAP_SLOP = 100;
        SCALE_SPAN_SLOP = 16;
    } else {
        ViewConfiguration config = ViewConfiguration.get(context);
        MIN_FLING_VELOCITY = config.getScaledMinimumFlingVelocity();
        MAX_FLING_VELOCITY = config.getScaledMaximumFlingVelocity();
        DOUBLE_TAP_SLOP = config.getScaledDoubleTapSlop();
        SCALE_SPAN_SLOP = config.getScaledTouchSlop() * 2;
    }
}
 
开发者ID:xyzxqs,项目名称:XphotoView,代码行数:17,代码来源:GooglePhotosGestureDetector.java

示例5: BottomSheet

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public BottomSheet(Context context, AttributeSet attrs, int defStyle) 
{
       super(context, attrs, defStyle);
      
	final ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
	final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BottomSheet);
	
	MIN_FLING_VELOCITY = viewConfiguration.getScaledMinimumFlingVelocity();
       MAX_FLING_VELOCITY = viewConfiguration.getScaledMaximumFlingVelocity();
	
	final boolean enableOutsideCancelable = typedArray.getBoolean(R.styleable.BottomSheet_outsideCancelable, outsideCancelable);

	if (enableOutsideCancelable)
	{
		setOutsideCancelable();
	}
   }
 
开发者ID:MSay2,项目名称:Mire,代码行数:18,代码来源:BottomSheet.java

示例6: 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:longtaoge,项目名称:SelectName,代码行数:29,代码来源:ViewDragHelper.java

示例7: initAbsListView

import android.view.ViewConfiguration; //导入方法依赖的package包/类
private void initAbsListView() {
	setClickable(true);
	setFocusableInTouchMode(true);
	setWillNotDraw(false);
	setAlwaysDrawnWithCacheEnabled(false);
	setScrollingCacheEnabled(true);

	final ViewConfiguration configuration = ViewConfiguration
			.get(getContext());
	mTouchSlop = configuration.getScaledTouchSlop();
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
	mOverscrollDistance = configuration.getScaledOverscrollDistance();
	mOverflingDistance = configuration.getScaledOverflingDistance();
	mViewHelper = ViewHelperFactory.create(this);
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:17,代码来源:AbsHListView.java

示例8: initViewPager

import android.view.ViewConfiguration; //导入方法依赖的package包/类
void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);

    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:28,代码来源:ViewPagerCompat.java

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

示例10: initViewPager

import android.view.ViewConfiguration; //导入方法依赖的package包/类
void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;

    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mTopEdge = new EdgeEffectCompat(context);
    mBottomEdge = new EdgeEffectCompat(context);

    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);

    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());

    if (ViewCompat.getImportantForAccessibility(this)
            == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this,
                ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:VerticalViewPager.java

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

示例12: CalendarLayout

import android.view.ViewConfiguration; //导入方法依赖的package包/类
public CalendarLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    setOrientation(LinearLayout.VERTICAL);
    TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.CalendarLayout);
    mContentViewId = array.getResourceId(R.styleable.CalendarLayout_calendar_content_view_id, 0);
    array.recycle();
    //setSelectPosition(6);
    mVelocityTracker = VelocityTracker.obtain();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
 
开发者ID:yhyonghao,项目名称:CalendarView_master,代码行数:13,代码来源:CalendarLayout.java

示例13: initScrollView

import android.view.ViewConfiguration; //导入方法依赖的package包/类
private void initScrollView() {
    mScroller = ScrollerCompat.create(getContext(), null);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}
 
开发者ID:ccrama,项目名称:Slide-RSS,代码行数:8,代码来源:NestedWebView.java

示例14: initCustomViewAbove

import android.view.ViewConfiguration; //导入方法依赖的package包/类
void initCustomViewAbove()
{
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    setInternalPageChangeListener(new SimpleOnPageChangeListener()
    {
        public void onPageSelected(int position)
        {
            if (mViewBehind != null)
            {
                switch (position)
                {
                    case 0:
                    case 2:
                        mViewBehind.setChildrenEnabled(true);
                        break;
                    case 1:
                        mViewBehind.setChildrenEnabled(false);
                        break;
                }
            }
        }
    });

    final float density = context.getResources().getDisplayMetrics().density;
    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
}
 
开发者ID:HueToYou,项目名称:ChatExchange-old,代码行数:35,代码来源:CustomViewAbove.java

示例15: init

import android.view.ViewConfiguration; //导入方法依赖的package包/类
private void init() {
    mSolidColor = 0;
    mSelectionDivider = getResources().getDrawable(R.drawable.numberpicker_selection_divider);

    mSelectionDividerHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT, getResources().getDisplayMetrics());
    mSelectionDividersDistance = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE, getResources().getDisplayMetrics());

    mMinHeight = SIZE_UNSPECIFIED;

    mMaxHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180, getResources().getDisplayMetrics());
    if (mMinHeight != SIZE_UNSPECIFIED && mMaxHeight != SIZE_UNSPECIFIED && mMinHeight > mMaxHeight) {
        throw new IllegalArgumentException("minHeight > maxHeight");
    }

    mMinWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 64, getResources().getDisplayMetrics());

    mMaxWidth = SIZE_UNSPECIFIED;
    if (mMinWidth != SIZE_UNSPECIFIED && mMaxWidth != SIZE_UNSPECIFIED && mMinWidth > mMaxWidth) {
        throw new IllegalArgumentException("minWidth > maxWidth");
    }

    mComputeMaxWidth = (mMaxWidth == SIZE_UNSPECIFIED);

    mVirtualButtonPressedDrawable = getResources().getDrawable(R.drawable.item_background_holo_light);

    mPressedStateHelper = new PressedStateHelper();

    setWillNotDraw(false);

    mInputText = new TextView(getContext());
    addView(mInputText);
    mInputText.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mInputText.setGravity(Gravity.CENTER);
    mInputText.setSingleLine(true);
    mInputText.setBackgroundResource(0);
    mInputText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);

    ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity() / SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT;
    mTextSize = (int) mInputText.getTextSize();

    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setTextAlign(Align.CENTER);
    paint.setTextSize(mTextSize);
    paint.setTypeface(mInputText.getTypeface());
    ColorStateList colors = mInputText.getTextColors();
    int color = colors.getColorForState(ENABLED_STATE_SET, Color.WHITE);
    paint.setColor(color);
    mSelectorWheelPaint = paint;

    mFlingScroller = new Scroller(getContext(), null, true);
    mAdjustScroller = new Scroller(getContext(), new DecelerateInterpolator(2.5f));

    updateInputTextView();
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:59,代码来源:NumberPicker.java


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