List of usage examples for android.view ViewConfiguration getScaledMinimumFlingVelocity
public int getScaledMinimumFlingVelocity()
From source file:cn.com.zzwfang.view.directionalviewpager.DirectionalViewPager.java
void initViewPager() { setWillNotDraw(false);//from w ww .java2 s . c om mScroller = new Scroller(getContext()); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.lgq.rssreader.controls.SwipeListViewTouchListener.java
/** * Constructor//from ww w . j av a 2 s . c o m * * @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; }
From source file:com.hynet.mergepay.components.widget.panellayout.ViewDragHelper.java
private ViewDragHelper(Context context, ViewGroup forParent, Interpolator interpolator, Callback cb) { if (forParent == null) { throw new IllegalArgumentException("Parent view may not be null"); }//from w w w. ja v a 2 s .c o m 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, interpolator != null ? interpolator : sInterpolator); }
From source file:info.ipeanut.youngsamples.third.viewgroup.directionalViewPager.DirectionalViewPager.java
void initViewPager() { ////from w w w .j av a 2s . c o m setWillNotDraw(false); mScroller = new Scroller(getContext()); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();//Fling mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); //crush // setPageTransformer(false,new DefaultTransformer()); }
From source file:org.telegram.ui.Components.NumberPicker.java
private void init() { mSolidColor = 0;// ww w . j ava2 s . c om mSelectionDivider = new ColorDrawable(ContextCompat.getColor(getContext(), R.color.colorAccent) & 0x00ffffff | (0x9f << 24)) /*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(); }
From source file:android.support.v7.widget.SwitchCompat.java
/** * Construct a new Switch with a default style determined by the given theme attribute, * overriding specific style attributes as requested. * * @param context The Context that will determine this widget's theming. * @param attrs Specification of attributes that should deviate from the default styling. * @param defStyleAttr An attribute in the current theme that contains a * reference to a style resource that supplies default values for * the view. Can be 0 to not look for defaults. *///from www . j av a2s . co m public SwitchCompat(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); final Resources res = getResources(); mTextPaint.density = res.getDisplayMetrics().density; final TintTypedArray a = TintTypedArray.obtainStyledAttributes(context, attrs, R.styleable.SwitchCompat, defStyleAttr, 0); mThumbDrawable = a.getDrawable(R.styleable.SwitchCompat_android_thumb); if (mThumbDrawable != null) { mThumbDrawable.setCallback(this); } mTrackDrawable = a.getDrawable(R.styleable.SwitchCompat_track); if (mTrackDrawable != null) { mTrackDrawable.setCallback(this); } mTextOn = a.getText(R.styleable.SwitchCompat_android_textOn); mTextOff = a.getText(R.styleable.SwitchCompat_android_textOff); mShowText = a.getBoolean(R.styleable.SwitchCompat_showText, true); mThumbTextPadding = a.getDimensionPixelSize(R.styleable.SwitchCompat_thumbTextPadding, 0); mSwitchMinWidth = a.getDimensionPixelSize(R.styleable.SwitchCompat_switchMinWidth, 0); mSwitchPadding = a.getDimensionPixelSize(R.styleable.SwitchCompat_switchPadding, 0); mSplitTrack = a.getBoolean(R.styleable.SwitchCompat_splitTrack, false); final int appearance = a.getResourceId(R.styleable.SwitchCompat_switchTextAppearance, 0); if (appearance != 0) { setSwitchTextAppearance(context, appearance); } mTintManager = a.getTintManager(); a.recycle(); final ViewConfiguration config = ViewConfiguration.get(context); mTouchSlop = config.getScaledTouchSlop(); mMinFlingVelocity = config.getScaledMinimumFlingVelocity(); // Refresh display with current params refreshDrawableState(); setChecked(isChecked()); }
From source file:com.example.zhangyipeng.swipelibrary.SwipeListViewTouchListener2.java
/** * Constructor/*w w w .j a v a 2 s. c om*/ * * @param swipeListView SwipeListView * @param swipeFrontView front view Identifier * @param swipeBackView back view Identifier */ public SwipeListViewTouchListener2(SwipeListView2 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; }
From source file:com.fortysevendeg.swipelistview.ExpandableSwipeListViewTouchListener.java
/** * Constructor// w w w. j av a2 s .c om * * @param swipeListView SwipeListView * @param swipeFrontView front view Identifier * @param swipeBackView back view Identifier */ public ExpandableSwipeListViewTouchListener(ExpandableSwipeListView swipeListView, int swipeFrontView, int swipeBackView, int swipeGroupView) { this.swipeFrontView = swipeFrontView; this.swipeBackView = swipeBackView; this.swipeGroupView = swipeGroupView; 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; }
From source file:com.praisehim.koraildelay.SwipeLibrary.SwipeListViewTouchListener.java
/** * Constructor//from w ww . j a v a 2 s. co m * * @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_longAnimTime); animationTime = configShortAnimationTime; this.swipeListView = swipeListView; }
From source file:com.example.zhangyipeng.swipelibrary.SwipeRecycleViewTouchListener.java
/** * Constructor/*from w w w.j a v a 2 s .c o m*/ * * @param swipeRecycleView SwipeListView * @param swipeFrontView front view Identifier * @param swipeBackView back view Identifier */ public SwipeRecycleViewTouchListener(SwipeRecycleView swipeRecycleView, int swipeFrontView, int swipeBackView) { this.swipeFrontView = swipeFrontView; this.swipeBackView = swipeBackView; ViewConfiguration vc = ViewConfiguration.get(swipeRecycleView.getContext()); slop = vc.getScaledTouchSlop(); minFlingVelocity = vc.getScaledMinimumFlingVelocity(); maxFlingVelocity = vc.getScaledMaximumFlingVelocity(); configShortAnimationTime = swipeRecycleView.getContext().getResources() .getInteger(android.R.integer.config_shortAnimTime); animationTime = configShortAnimationTime; this.swipeRecycleView = swipeRecycleView; }