android.widget.OverScroller Java Examples
The following examples show how to use
android.widget.OverScroller.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CompactCalendarController.java From CompactCalendarView with MIT License | 6 votes |
CompactCalendarController(Paint dayPaint, OverScroller scroller, Rect textSizeRect, AttributeSet attrs, Context context, int currentDayBackgroundColor, int calenderTextColor, int currentSelectedDayBackgroundColor, VelocityTracker velocityTracker, int multiEventIndicatorColor, EventsContainer eventsContainer, Locale locale, TimeZone timeZone) { this.dayPaint = dayPaint; this.scroller = scroller; this.textSizeRect = textSizeRect; this.currentDayBackgroundColor = currentDayBackgroundColor; this.calenderTextColor = calenderTextColor; this.currentSelectedDayBackgroundColor = currentSelectedDayBackgroundColor; this.otherMonthDaysTextColor = calenderTextColor; this.velocityTracker = velocityTracker; this.multiEventIndicatorColor = multiEventIndicatorColor; this.eventsContainer = eventsContainer; this.locale = locale; this.timeZone = timeZone; this.displayOtherMonthDays = false; loadAttributes(attrs, context); init(context); }
Example #2
Source File: Viewport.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 6 votes |
/** * creates the viewport * * @param graphView graphview */ Viewport(ChartView graphView) { mScroller = new OverScroller(graphView.getContext()); mEdgeEffectTop = new EdgeEffectCompat(graphView.getContext()); mEdgeEffectBottom = new EdgeEffectCompat(graphView.getContext()); mEdgeEffectLeft = new EdgeEffectCompat(graphView.getContext()); mEdgeEffectRight = new EdgeEffectCompat(graphView.getContext()); mGestureDetector = new GestureDetector(graphView.getContext(), mGestureListener); mScaleGestureDetector = new ScaleGestureDetector(graphView.getContext(), mScaleGestureListener); mGraphView = graphView; mXAxisBoundsStatus = AxisBoundsStatus.INITIAL; mYAxisBoundsStatus = AxisBoundsStatus.INITIAL; mBackgroundColor = Color.TRANSPARENT; mPaint = new Paint(); }
Example #3
Source File: WeekDatePicker.java From WeekDatePicker with MIT License | 6 votes |
private void computeScrollX() { OverScroller scroller = flingScrollerX; if(scroller.isFinished()) { scroller = adjustScrollerX; if(scroller.isFinished()) { return; } } if(scroller.computeScrollOffset()) { int currentScrollerX = scroller.getCurrX(); if(previousScrollerX == Integer.MIN_VALUE) { previousScrollerX = scroller.getStartX(); } scrollBy(currentScrollerX - previousScrollerX, 0); previousScrollerX = currentScrollerX; if(scroller.isFinished()) { onScrollerFinishedX(scroller); } postInvalidate(); } }
Example #4
Source File: SwipeFrameLayout.java From iBeebo with GNU General Public License v3.0 | 5 votes |
private void init() { scroller = new OverScroller(getContext(), new DecelerateInterpolator()); setBackgroundDrawable(ThemeUtility.getDrawable(android.R.attr.windowBackground)); this.activity = (Activity) getContext(); this.topView = ((View) (activity.findViewById(android.R.id.content).getParent())); this.max_motion_event_down_x_position = Utility.dip2px(25); this.gestureDetector = new GestureDetector(getContext(), new SwipeRightToCloseOnGestureListener()); this.setId(R.id.swipe_framelayout); }
Example #5
Source File: QiscusTouchImageView.java From qiscus-sdk-android with Apache License 2.0 | 5 votes |
public CompatScroller(Context context) { if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) { isPreGingerbread = true; scroller = new Scroller(context); } else { isPreGingerbread = false; overScroller = new OverScroller(context); } }
Example #6
Source File: ScalableView.java From Android_UE with Apache License 2.0 | 5 votes |
private void init() { // 图片的大小 mImageSize = Utils.dp2px(300); // 获取图片 mBitmap = Utils.getDrawableBitmap(getContext(), R.drawable.icon_android_road, mImageSize); // 画笔 mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); // gestureDetectorCompat = new GestureDetectorCompat(getContext(), this); gestureDetectorCompat.setOnDoubleTapListener(this); scroller = new OverScroller(getContext()); scaleGestureDetector = new ScaleGestureDetector(getContext(), new ScaleImageScaleGestureDetector()); }
Example #7
Source File: IRefreshNowView.java From RefreshNow with Apache License 2.0 | 5 votes |
public Helper(final View view, final Context context, final AttributeSet attrs, final int defStyle) { if (!(view instanceof IRefreshNowView)) throw new IllegalArgumentException("this view instance must implement IRefreshNowView"); mConfig = new RefreshNowConfig.Builder(context).build(); mView = view; mEventProcessor = new MotionEventProcessor(context, this); mScroller = new OverScroller(context); setRefreshMode(RefreshMode.BOTH); }
Example #8
Source File: TouchManager.java From scissors with Apache License 2.0 | 5 votes |
@Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { velocityX /= 2; velocityY /= 2; if(Math.abs(velocityX) < MINIMUM_FLING_VELOCITY) { velocityX = 0; } if(Math.abs(velocityY) < MINIMUM_FLING_VELOCITY) { velocityY = 0; } if(velocityX == 0 && velocityY == 0) { return true; } int width = (int) (imageBounds.right * scale); int height = (int) (imageBounds.bottom * scale); OverScroller scroller = new OverScroller(imageView.getContext()); scroller.fling((int) e1.getX(), (int) e1.getY(), (int) velocityX, (int) velocityY, -width, width, -height, height); TouchPoint target = new TouchPoint(scroller.getFinalX(), scroller.getFinalY()); float x = velocityX == 0 ? position.getX() : target.getX() * scale; float y = velocityY == 0 ? position.getY() : target.getY() * scale; gestureAnimator.animateTranslation(position.getX(), x, position.getY(), y); return true; }
Example #9
Source File: PullToRefreshView.java From Bailan with Apache License 2.0 | 5 votes |
public PullToRefreshView(Context context, AttributeSet attrs) { super(context, attrs); mInflater = LayoutInflater.from(context); mScroller = new OverScroller(context); //获取自定义属性 TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.PullToRefresh); if (ta.hasValue(R.styleable.PullToRefresh_header_indicator)) { mHeaderIndicatorClassName = ta.getString(R.styleable.PullToRefresh_header_indicator); } if (ta.hasValue(R.styleable.PullToRefresh_footer_indicator)) { mFooterIndicatorClassName = ta.getString(R.styleable.PullToRefresh_footer_indicator); } ta.recycle(); }
Example #10
Source File: PanView.java From wear-notify-for-reddit with Apache License 2.0 | 5 votes |
public PanView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Sets up interactions mGestureDetector = new GestureDetector(context, new ScrollFlingGestureListener()); mScroller = new OverScroller(context); mEdgeEffectLeft = new EdgeEffect(context); mEdgeEffectTop = new EdgeEffect(context); mEdgeEffectRight = new EdgeEffect(context); mEdgeEffectBottom = new EdgeEffect(context); mDrawBlurredPaint = new Paint(); mDrawBlurredPaint.setDither(true); }
Example #11
Source File: MatrixView.java From WidgetCase with Apache License 2.0 | 5 votes |
public MatrixView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); mBitmap = Util.getAvatar(getResources(), DensityUtil.dp2px(220)); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mScreenW = getResources().getDisplayMetrics().widthPixels; mScreenH = getResources().getDisplayMetrics().heightPixels; LogUtil.logD("初始化", "mBitmap.H = " + mBitmap .getHeight() + "->屏幕宽高 = " + mScreenW + "-" + mScreenH); mDetector = new GestureDetectorCompat(context, this); mOverScroller = new OverScroller(context); }
Example #12
Source File: ZoomImageView.java From Theogony with MIT License | 5 votes |
public void forceFinished(boolean finished) { if (isOld) { ((Scroller) scroller).forceFinished(finished); } else { ((OverScroller) scroller).forceFinished(finished); } }
Example #13
Source File: TouchImageView.java From styT with Apache License 2.0 | 5 votes |
public CompatScroller(Context context) { if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) { isPreGingerbread = true; scroller = new Scroller(context); } else { isPreGingerbread = false; overScroller = new OverScroller(context); } }
Example #14
Source File: TouchImageView.java From oneHookLibraryAndroid with Apache License 2.0 | 5 votes |
public CompatScroller(Context context) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) { isPreGingerbread = true; scroller = new Scroller(context); } else { isPreGingerbread = false; overScroller = new OverScroller(context); } }
Example #15
Source File: TouchImageView.java From TouchNews with Apache License 2.0 | 5 votes |
public CompatScroller(Context context) { if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) { isPreGingerbread = true; scroller = new Scroller(context); } else { isPreGingerbread = false; overScroller = new OverScroller(context); } }
Example #16
Source File: TouchImageView.java From Document-Scanner with GNU General Public License v3.0 | 5 votes |
public CompatScroller(Context context) { if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) { isPreGingerbread = true; scroller = new Scroller(context); } else { isPreGingerbread = false; overScroller = new OverScroller(context); } }
Example #17
Source File: SwipeMenuLayout.java From NewFastFrame with Apache License 2.0 | 5 votes |
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(); }
Example #18
Source File: TouchImageView.java From PhotoPicker with Apache License 2.0 | 5 votes |
public CompatScroller(Context context) { if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) { isPreGingerbread = true; scroller = new Scroller(context); } else { isPreGingerbread = false; overScroller = new OverScroller(context); } }
Example #19
Source File: PhotoView.java From SprintNBA with Apache License 2.0 | 5 votes |
Transform() { Context ctx = getContext(); mTranslateScroller = new OverScroller(ctx, mInterpolatorProxy); mScaleScroller = new Scroller(ctx, mInterpolatorProxy); mFlingScroller = new OverScroller(ctx, mInterpolatorProxy); mClipScroller = new Scroller(ctx, mInterpolatorProxy); mRotateScroller = new Scroller(ctx, mInterpolatorProxy); }
Example #20
Source File: OrientationStrategy.java From swipe-maker with Apache License 2.0 | 5 votes |
public OrientationStrategy(View view, int touchSlop) { mView = view; Context context = view.getContext(); mTouchSlop = touchSlop; mHelperScroller = new ScrollerHelper(new OverScroller(context)); mPositionInfo = new Position(); }
Example #21
Source File: ZoomImageView.java From ZoomImageView with Apache License 2.0 | 5 votes |
public void forceFinished(boolean finished) { if (isOld) { ((Scroller) scroller).forceFinished(finished); } else { ((OverScroller) scroller).forceFinished(finished); } }
Example #22
Source File: ZoomImageView.java From Gank-Veaer with GNU General Public License v3.0 | 5 votes |
public void forceFinished(boolean finished) { if (isOld) { ((Scroller) scroller).forceFinished(finished); } else { ((OverScroller) scroller).forceFinished(finished); } }
Example #23
Source File: TouchImageView.java From MultiView with Apache License 2.0 | 5 votes |
public CompatScroller(Context context) { if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) { isPreGingerbread = true; scroller = new Scroller(context); } else { isPreGingerbread = false; overScroller = new OverScroller(context); } }
Example #24
Source File: PagingOverScroller.java From ProjectX with Apache License 2.0 | 4 votes |
PagingOverScroller(@NonNull Context context) { mScroller = new OverScroller(context, PublicRecyclerView.getScrollerInterpolator()); }
Example #25
Source File: ScrollerCompatGingerbread.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
public static boolean computeScrollOffset(Object scroller) { return ((OverScroller) scroller).computeScrollOffset(); }
Example #26
Source File: ScrollerCompatGingerbread.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
public static void abortAnimation(Object scroller) { ((OverScroller) scroller).abortAnimation(); }
Example #27
Source File: TowPagerViewPager2.java From Android_UE with Apache License 2.0 | 4 votes |
private void init() { velocityTracker = VelocityTracker.obtain(); viewConfiguration = ViewConfiguration.get(getContext()); overScroller = new OverScroller(getContext()); }
Example #28
Source File: SwipeLeftHorizontal.java From SwipeRecyclerView-master with Apache License 2.0 | 4 votes |
@Override public void autoOpenMenu(OverScroller scroller, int scrollX, int duration) { scroller.startScroll(Math.abs(scrollX), 0, getMenuView().getWidth() - Math.abs(scrollX), 0, duration); }
Example #29
Source File: ScrollerCompatGingerbread.java From CodenameOne with GNU General Public License v2.0 | 4 votes |
public static int getCurrX(Object scroller) { return ((OverScroller) scroller).getCurrX(); }
Example #30
Source File: ScrollerCompatGingerbread.java From guideshow with MIT License | 4 votes |
public static void fling(Object scroller, int startX, int startY, int velX, int velY, int minX, int maxX, int minY, int maxY) { ((OverScroller) scroller).fling(startX, startY, velX, velY, minX, maxX, minY, maxY); }