summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android
diff options
context:
space:
mode:
authorPaul DiPietro <pauldipietro@users.noreply.github.com>2016-10-20 15:01:50 -0500
committerGitHub <noreply@github.com>2016-10-20 15:01:50 -0500
commit4042f39f0007dd80f6ca3f8273e4cc155cf8123c (patch)
tree4d9a282508d809645d1c00b05f3d2376c61c1330 /Xamarin.Forms.Platform.Android
parentd24f3e5438c300242d553e81817b57045f00bf4f (diff)
downloadxamarin-forms-4042f39f0007dd80f6ca3f8273e4cc155cf8123c.tar.gz
xamarin-forms-4042f39f0007dd80f6ca3f8273e4cc155cf8123c.tar.bz2
xamarin-forms-4042f39f0007dd80f6ca3f8273e4cc155cf8123c.zip
[Android] Add Platform Specific features for setting TabbedPage swipe paging and OffscreenPageLimit (#409)
* [Android] Add Platform Specific feature for setting TabbedPage swipe paging * [Android] Add Platform Specific feature for OffscreenPageLimit * Update docs
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs19
1 files changed, 18 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs
index 54002525..2fa1e441 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs
@@ -11,6 +11,7 @@ using Android.Support.Design.Widget;
using Android.Support.V4.App;
using Android.Support.V4.View;
using Android.Views;
+using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
namespace Xamarin.Forms.Platform.Android.AppCompat
{
@@ -182,6 +183,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
((IPageController)tabbedPage).InternalChildren.CollectionChanged += OnChildrenCollectionChanged;
UpdateBarBackgroundColor();
UpdateBarTextColor();
+ UpdateSwipePaging();
+ UpdateOffscreenPageLimit();
}
}
@@ -190,12 +193,16 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
base.OnElementPropertyChanged(sender, e);
if (e.PropertyName == nameof(TabbedPage.CurrentPage))
- if(Element.CurrentPage != null)
+ {
+ if (Element.CurrentPage != null)
ScrollToCurrentPage();
+ }
else if (e.PropertyName == NavigationPage.BarBackgroundColorProperty.PropertyName)
UpdateBarBackgroundColor();
else if (e.PropertyName == NavigationPage.BarTextColorProperty.PropertyName)
UpdateBarTextColor();
+ else if (e.PropertyName == PlatformConfiguration.AndroidSpecific.TabbedPage.IsSwipePagingEnabledProperty.PropertyName)
+ UpdateSwipePaging();
}
protected override void OnLayout(bool changed, int l, int t, int r, int b)
@@ -283,6 +290,16 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
child.IgnoresContainerArea = child is NavigationPage;
}
+ void UpdateOffscreenPageLimit()
+ {
+ _viewPager.OffscreenPageLimit = Element.OnThisPlatform().OffscreenPageLimit();
+ }
+
+ void UpdateSwipePaging()
+ {
+ _viewPager.EnableGesture = Element.OnThisPlatform().IsSwipePagingEnabled();
+ }
+
void UpdateTabBarTranslation(int position, float offset)
{
TabLayout tabs = _tabLayout;