diff options
author | kingces95 <kingces95@users.noreply.github.com> | 2016-04-07 14:55:19 -0700 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-04-07 22:55:19 +0100 |
commit | 870f9c98ffccce86d80c6ff7a05de7238fc1b0e8 (patch) | |
tree | 5d754265da426d5afef51ce2001257ae07acfa56 /Xamarin.Forms.Platform.Android | |
parent | e9eaacff4a1ee16729ae434d44fe0f9846712ef3 (diff) | |
download | xamarin-forms-870f9c98ffccce86d80c6ff7a05de7238fc1b0e8.tar.gz xamarin-forms-870f9c98ffccce86d80c6ff7a05de7238fc1b0e8.tar.bz2 xamarin-forms-870f9c98ffccce86d80c6ff7a05de7238fc1b0e8.zip |
[A, iOS] CarouselView Bug Fixes (#49)
* CarouselView programatic scrolling fixes; swipe back fixes
* Make iOS CarouselView events consistant with Android
* bump swipe distance; add Screenshot on Exception
* Formatting. No logical change.
* Comment out [Test] on UITest and fix TestCloud failures later.
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r-- | Xamarin.Forms.Platform.Android/Renderers/CarouselViewRenderer.cs | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/CarouselViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/CarouselViewRenderer.cs index b44ef3e6..12a1157a 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/CarouselViewRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/CarouselViewRenderer.cs @@ -267,7 +267,7 @@ namespace Xamarin.Forms.Platform.Android internal override bool CanScrollHorizontally => true; internal override bool CanScrollVertically => false; - internal override IntRectangle GetBounds(int originPosition, RecyclerView.State state) => + internal override IntRectangle GetBounds(int originPosition, State state) => new IntRectangle( LayoutItem(originPosition, 0).Location, new IntSize(_itemSize.Width * state.ItemCount, _itemSize.Height) @@ -583,7 +583,7 @@ namespace Xamarin.Forms.Platform.Android } // initialize properties - VisualElementController.SetValueFromRenderer(CarouselView.PositionProperty, 0); + _position = Element.Position; // initialize events Element.CollectionChanged += OnCollectionChanged; @@ -778,10 +778,7 @@ namespace Xamarin.Forms.Platform.Android AdapterChangeType _adapterChangeType; #endregion - public PhysicalLayoutManager( - Context context, - VirtualLayoutManager virtualLayout, - int positionOrigin) + internal PhysicalLayoutManager(Context context, VirtualLayoutManager virtualLayout, int positionOrigin) { _positionOrigin = positionOrigin; _context = context; @@ -793,7 +790,7 @@ namespace Xamarin.Forms.Platform.Android _scroller = new SeekAndSnapScroller( context: context, vectorToPosition: adapterPosition => { - var end = virtualLayout.LayoutItem(positionOrigin, adapterPosition).Center(); + var end = virtualLayout.LayoutItem(_positionOrigin, adapterPosition).Center(); var begin = Viewport.Center(); return end - begin; } @@ -853,24 +850,24 @@ namespace Xamarin.Forms.Platform.Android base.Dispose(disposing); } - public event Action<int> OnAppearing; - public event Action<int> OnBeginScroll; - public event Action<int> OnDisappearing; - public event Action<int> OnEndScroll; + internal event Action<int> OnAppearing; + internal event Action<int> OnBeginScroll; + internal event Action<int> OnDisappearing; + internal event Action<int> OnEndScroll; - public IntVector Velocity => _samples.Aggregate((o, a) => o + a) / _samples.Count; - public void Layout(int width, int height) + internal IntVector Velocity => _samples.Aggregate((o, a) => o + a) / _samples.Count; + internal void Layout(int width, int height) { // e.g. when rotated the width and height are updated the virtual layout will // need to resize and provide a new viewport offset given the current one. _virtualLayout.Layout(_positionOrigin, new IntSize(width, height), ref _locationOffset); } - public IntRectangle Viewport => Rectangle + _locationOffset; - public IEnumerable<int> VisiblePositions() + internal IntRectangle Viewport => Rectangle + _locationOffset; + internal IEnumerable<int> VisiblePositions() { return _visibleAdapterPosition; } - public IEnumerable<AndroidView> Views() + internal IEnumerable<AndroidView> Views() { return _viewByAdaptorPosition.Values; } |