public override void ComputeScroll() { if (!mScroller.IsFinished) { if (mScroller.ComputeScrollOffset()) { int oldX = ScrollX; int oldY = ScrollY; int x = mScroller.CurrX; int y = mScroller.CurrY; if (oldX != x || oldY != y) { ScrollTo(x, y); PageScrolled(x); } // Keep on drawing until the animation has finished. Invalidate(); return; } } // Done with scroll, clean up state. CompleteScroll(); }
public override void ComputeScroll() { // if (IsAttachedToWindow) { // TODO [email protected]: This bug causes an exception to be thrown when the scroller is disposes. // this usually happens when starting a remote view // L.E(this, "Tried to compute scroll while swipe menu was not attached to the a window."); // return; // } try { if (isOpen) { if (openScroller.ComputeScrollOffset()) { Swipe(openScroller.CurrX * (int)recyclerView.swipeDirection); PostInvalidate(); } } else { if (closeScroller.ComputeScrollOffset()) { Swipe((int)((baseX - closeScroller.CurrX) * (int)recyclerView.swipeDirection)); PostInvalidate(); } } } catch (Exception e) { L.E(this, "Tried to compute scroll while swipe menu was not attached to a window", e); } }
public bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { var x = e2.GetX(); var y = e2.GetY(); Scroller.Fling((int)x, (int)y, (int)velocityX / 4, (int)velocityY / 4, 0, Width * 5, 0, Height * 5); Device.StartTimer(new TimeSpan(1), () => { if (Scroller.ComputeScrollOffset()) { var xx = Scroller.CurrX; var yy = Scroller.CurrY; Element.ViewPoint = Element.ViewPoint.Offset(-(xx - x) / Element.ViewScale, -(yy - y) / Element.ViewScale); DrawImage = Element.DrawImmageRequest(Element.ViewPoint, Matrix2.Enlargement(ViewSize, 1 / Element.ViewScale, 1 / Element.ViewScale)); Invalidate(); } return(!Scroller.IsFinished); }); return(true); }
public void Run() { try { if (_scroller.IsFinished) { _scroller = null; return; } if (_scroller.ComputeScrollOffset()) { var newX = _scroller.CurrX; var newY = _scroller.CurrY; var transX = newX - _currX; var transY = newY - _currY; _currX = newX; _currY = newY; _view._matrix.PostTranslate(transX, transY); _view.FixTrans(); _view.ImageMatrix = _view._matrix; _view.CompatPostOnAnimation(this); } } catch (System.Exception ex) { AppSettings.Logger.Warning(ex); } }
public void Run() { try { if (_scroller.IsFinished) { _scroller = null; return; } if (_scroller.ComputeScrollOffset()) { var newX = _scroller.CurrX; var newY = _scroller.CurrY; var transX = newX - _currX; var transY = newY - _currY; _currX = newX; _currY = newY; _view._matrix.PostTranslate(transX, transY); _view.FixTrans(); _view.ImageMatrix = _view._matrix; _view.CompatPostOnAnimation(this); } } catch { //todo nothing } }
public override void ComputeScroll() { if (_mScroller.ComputeScrollOffset()) { ScrollTo(_mScroller.CurrX, _mScroller.CurrY); PostInvalidate(); } else if (_mNextScreen != INVALID_SCREEN) { _mCurrentScreen = Math.Max(0, Math.Min(_mNextScreen, ChildCount - 1)); for (int i = 0; i < _pages.Count; i++) { var idx = i; if ((i == _mCurrentScreen) || (i == _mCurrentScreen - 1) || (i == _mCurrentScreen + 1)) { LoadItem(idx); } else { UnloadItem(idx); } } // Notify observer about screen change if (MOnScreenSwitchListener != null) { MOnScreenSwitchListener(this, new ScreenSwitchArgs(_mCurrentScreen)); } _mNextScreen = INVALID_SCREEN; } }
public override void ComputeScroll() { if (mScroller.ComputeScrollOffset()) { int oldX = ScrollX; int oldY = ScrollY; int x = mScroller.CurrX; int y = mScroller.CurrY; if (ChildCount > 0) { View child = GetChildAt(0); scrollTo(clamp(x, Width - PaddingRight - PaddingLeft, (int)(child.Width / mChild.mScaleFactor)), clamp(y, Height + PaddingBottom - PaddingTop, (int)((child.Height + child.PaddingBottom) / mChild.mScaleFactor))); } else { scrollTo(x, y); } if (oldX != ScrollX || oldY != ScrollY) { OnScrollChanged(ScrollX, ScrollY, oldX, oldY); } PostInvalidate(); } }
void View_ComputeScrollEvent(object sender, EventArgs e) { if (Scroller.ComputeScrollOffset()) { _view.ScrollTo(Scroller.CurrX, Scroller.CurrY); _view.PostInvalidate(); } }
public override void ComputeScroll() { if (Scroller != null && Scroller.ComputeScrollOffset()) { ScrollTo(Scroller.CurrX, Scroller.CurrY); PostInvalidate(); } }
public override void ComputeScroll() { if (mScroller.ComputeScrollOffset()) { ScrollTo(mScroller.CurrX, mScroller.CurrY); Invalidate(); } //base.ComputeScroll(); }
private void IncrementSnapback() { if (scroller.IsFinished) { return; } var more = scroller.ComputeScrollOffset(); Header.OffsetTopAndBottom(current_scroll_y - scroller.CurrY); ((View)ContentView).OffsetTopAndBottom(current_scroll_y - scroller.CurrY); current_scroll_y = scroller.CurrY; if (more) { ViewCompat.PostInvalidateOnAnimation(this); } }
public override void ComputeScroll() { if (scroller.ComputeScrollOffset()) { View view = GetChildAt(1); int left = startScrollLeftOffset + scroller.CurrX; view.Layout(left, view.Top, left + view.Width, view.Height); PostInvalidate(); } }
protected void ComputeLayerScroll() { if (layerScroller.ComputeScrollOffset()) { int x = layerScroller.CurrX; int y = layerScroller.CurrY; LayerScrollTo(x, y); UpdateLayerScroll(); } }
public bool computeScrollOffset() { if (isPreGingerbread) { return(scroller.ComputeScrollOffset()); } else { return(overScroller.ComputeScrollOffset()); } }
public override void ComputeScroll() { if (_scroller.ComputeScrollOffset()) { ScrollTo(_scroller.CurrX, _scroller.CurrY); PostInvalidate(); } else if (_nextScreen != INVALID_SCREEN) { _currentScreen = Math.Max(0, Math.Min(_nextScreen, ChildCount - 1)); OnScreenChanged(new EventArgs()); _nextScreen = INVALID_SCREEN; } }
protected override void OnLayout(bool changed, int left, int top, int right, int bottom) { base.OnLayout(changed, left, top, right, bottom); if (null == Adapter) { return; } if (_dataChanged) { var oldCurrentX = CurrentX; InitView(); RemoveAllViewsInLayout(); _nextX = oldCurrentX; _dataChanged = false; } if (Scroller.ComputeScrollOffset()) { _nextX = Scroller.CurrX; } if (_nextX <= 0) { _nextX = 0; Scroller.ForceFinished(true); } if (_nextX >= _maxX) { _nextX = _maxX; Scroller.ForceFinished(true); } var dx = CurrentX - _nextX; RemoveNonVisibleItems(dx); FillList(dx); PositionItems(dx); CurrentX = _nextX; if (!Scroller.IsFinished) { Post(RequestLayout); } }
public override void ComputeScroll() { if (mScroller.ComputeScrollOffset()) { ScrollTo(mScroller.CurrX, mScroller.CurrY); PostInvalidate(); } else if (mNextScreen != INVALID_SCREEN) { mCurrentScreen = Math.Max(0, Math.Min(mNextScreen, this.ChildCount - 1)); OnChanged(EventArgs.Empty); mNextScreen = INVALID_SCREEN; } }
public override void ComputeScroll() { if (mScroller.ComputeScrollOffset()) { ScrollTo(mScroller.CurrX, mScroller.CurrY); if (mOnScrollListener != null) { mOnScrollListener.OnScroll(GetCurrentScreenFraction()); } PostInvalidate(); } else if (mNextScreen != INVALID_SCREEN) { // The scroller has finished. HandleScreenChangeCompletion(Java.Lang.Math.Max(0, Java.Lang.Math.Min(mNextScreen, GetScreenCount() - 1))); mNextScreen = INVALID_SCREEN; } }
public override void ComputeScroll() { if (mScroller.ComputeScrollOffset()) { // This is called at drawing time by ViewGroup. We don't want to // re-show the scrollbars at this point, which scrollTo will do, // so we replicate most of scrollTo here. // // It's a little odd to call onScrollChanged from inside the drawing. // // It is, except when you remember that computeScroll() is used to // animate scrolling. So unless we want to defer the onScrollChanged() // until the end of the animated scrolling, we don't really have a // choice here. // // I agree. The alternative, which I think would be worse, is to post // something and tell the subclasses later. This is bad because there // will be a window where mScrollX/Y is different from what the app // thinks it is. // int oldX = ScrollX; int oldY = ScrollY; int x = mScroller.CurrX; int y = mScroller.CurrY; if (ChildCount > 0) { View child = GetChildAt(0); ScrollTo(Clamp(x, Width - PaddingRight - PaddingLeft, child.Width), Clamp(y, Height - PaddingBottom - PaddingTop, child.Height)); } else { ScrollTo(x, y); } if (oldX != ScrollX || oldY != ScrollY) { OnScrollChanged(ScrollX, ScrollY, oldX, oldY); } // Keep on drawing until the animation has finished. PostInvalidate(); } }
private void RefreshPosition() { if (_dataChanged) { var oldCurrentX = CurrentX; InitView(); RecycleAllItems(); _nextX = oldCurrentX; _dataChanged = false; } if (Scroller.ComputeScrollOffset()) { _nextX = Scroller.CurrX; } if (_nextX <= 0) { _nextX = 0; Scroller.ForceFinished(true); } if (_nextX >= _maxX) { _nextX = _maxX; Scroller.ForceFinished(true); } var dx = CurrentX - _nextX; RemoveNonVisibleItems(dx); FillList(dx); PositionItems(dx); CurrentX = _nextX; if (!Scroller.IsFinished) { Post(RefreshPosition); } }
public void Run() { if (scroller.IsFinished) { scroller = null; return; } if (scroller.ComputeScrollOffset()) { int newX = scroller.CurrX; int newY = scroller.CurrY; int transX = newX - currX; int transY = newY - currY; currX = newX; currY = newY; view.matrix.PostTranslate(transX, transY); view.FixTrans(); view.ImageMatrix = view.matrix; view.CompatPostOnAnimation(this); } }
public override void ComputeScroll() { if (!_scroller.IsFinished) { if (_scroller.ComputeScrollOffset()) { var oldX = ScrollX; var oldY = ScrollY; var x = _scroller.CurrX; var y = _scroller.CurrY; if (oldX != x ||oldY != y) { ScrollTo(x, y); OnPageScrolled(x); } Invalidate(); return; } } CompleteScroll(); }
public override bool ComputeScrollOffset() { return(mScroller.ComputeScrollOffset()); }