From 567782917005de9d0329844af9e1c4ff349dca97 Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Fri, 6 Dec 2019 12:00:35 -0700 Subject: [PATCH] Put SwipeView behind experimental flag (#8786) * Put SwipeView behind experimental flag * Update Xamarin.Forms.ControlGallery.Android/FormsAppCompatActivity.cs --- Xamarin.Forms.ControlGallery.Android/FormsAppCompatActivity.cs | 2 +- Xamarin.Forms.ControlGallery.WindowsUniversal/App.xaml.cs | 2 +- Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs | 2 +- Xamarin.Forms.Core/ExperimentalFlags.cs | 1 + Xamarin.Forms.Core/SwipeView.cs | 10 ++++++++++ Xamarin.Forms.Platform.Android/Renderers/SwipeViewRenderer.cs | 1 + Xamarin.Forms.Platform.UAP/SwipeViewRenderer.cs | 1 + Xamarin.Forms.Platform.iOS/Renderers/SwipeViewRenderer.cs | 2 ++ 8 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Xamarin.Forms.ControlGallery.Android/FormsAppCompatActivity.cs b/Xamarin.Forms.ControlGallery.Android/FormsAppCompatActivity.cs index 2ee5a7c..8bbd52a 100644 --- a/Xamarin.Forms.ControlGallery.Android/FormsAppCompatActivity.cs +++ b/Xamarin.Forms.ControlGallery.Android/FormsAppCompatActivity.cs @@ -44,7 +44,7 @@ namespace Xamarin.Forms.ControlGallery.Android // Fake_Flag is here so we can test for flag initialization issues Forms.SetFlags("Fake_Flag"/*, "CollectionView_Experimental", "Shell_Experimental"*/); #else - Forms.SetFlags("UseLegacyRenderers"/*, "CollectionView_Experimental", "Shell_Experimental" */); + Forms.SetFlags("UseLegacyRenderers", "SwipeView_Experimental"); #endif Forms.Init(this, bundle); diff --git a/Xamarin.Forms.ControlGallery.WindowsUniversal/App.xaml.cs b/Xamarin.Forms.ControlGallery.WindowsUniversal/App.xaml.cs index 615c37b..4e5b8cd 100644 --- a/Xamarin.Forms.ControlGallery.WindowsUniversal/App.xaml.cs +++ b/Xamarin.Forms.ControlGallery.WindowsUniversal/App.xaml.cs @@ -70,7 +70,7 @@ namespace Xamarin.Forms.ControlGallery.WindowsUniversal rootFrame.NavigationFailed += OnNavigationFailed; - Forms.SetFlags("Shell_UWP_Experimental"); + Forms.SetFlags("Shell_UWP_Experimental", "SwipeView_Experimental"); Forms.Init (e); //FormsMaps.Init (Controls.App.Config["UWPMapsAuthKey"]); diff --git a/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs b/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs index 2785c00..b780200 100644 --- a/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs +++ b/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs @@ -150,7 +150,7 @@ namespace Xamarin.Forms.ControlGallery.iOS App.IOSVersion = int.Parse(versionPart[0]); Xamarin.Calabash.Start(); - // Forms.SetFlags("CollectionView_Experimental", "Shell_Experimental"); + Forms.SetFlags("SwipeView_Experimental"); Forms.Init(); FormsMaps.Init(); FormsMaterial.Init(); diff --git a/Xamarin.Forms.Core/ExperimentalFlags.cs b/Xamarin.Forms.Core/ExperimentalFlags.cs index 7d6725d..11bc2ba 100644 --- a/Xamarin.Forms.Core/ExperimentalFlags.cs +++ b/Xamarin.Forms.Core/ExperimentalFlags.cs @@ -12,6 +12,7 @@ namespace Xamarin.Forms internal const string IndicatorViewExperimental = "IndicatorView_Experimental"; internal const string ShellUWPExperimental = "Shell_UWP_Experimental"; internal const string CarouselViewExperimental = "CarouselView_Experimental"; + internal const string SwipeViewExperimental = "SwipeView_Experimental"; [EditorBrowsable(EditorBrowsableState.Never)] public static void VerifyFlagEnabled( diff --git a/Xamarin.Forms.Core/SwipeView.cs b/Xamarin.Forms.Core/SwipeView.cs index 561371a..d6e7b4b 100644 --- a/Xamarin.Forms.Core/SwipeView.cs +++ b/Xamarin.Forms.Core/SwipeView.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel; +using System.Runtime.CompilerServices; using Xamarin.Forms.Platform; namespace Xamarin.Forms @@ -15,6 +16,15 @@ namespace Xamarin.Forms _platformConfigurationRegistry = new Lazy>(() => new PlatformConfigurationRegistry(this)); } + + [EditorBrowsable(EditorBrowsableState.Never)] + public static void VerifySwipeViewFlagEnabled( + string constructorHint = null, + [CallerMemberName] string memberName = "") + { + ExperimentalFlags.VerifyFlagEnabled(nameof(SwipeView), ExperimentalFlags.SwipeViewExperimental, memberName: memberName); + } + public static readonly BindableProperty LeftItemsProperty = BindableProperty.Create(nameof(LeftItems), typeof(SwipeItems), typeof(SwipeView), null, BindingMode.OneWay, null, defaultValueCreator: SwipeItemsDefaultValueCreator); public static readonly BindableProperty RightItemsProperty = BindableProperty.Create(nameof(RightItems), typeof(SwipeItems), typeof(SwipeView), null, BindingMode.OneWay, null, defaultValueCreator: SwipeItemsDefaultValueCreator); public static readonly BindableProperty TopItemsProperty = BindableProperty.Create(nameof(TopItems), typeof(SwipeItems), typeof(SwipeView), null, BindingMode.OneWay, null, defaultValueCreator: SwipeItemsDefaultValueCreator); diff --git a/Xamarin.Forms.Platform.Android/Renderers/SwipeViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/SwipeViewRenderer.cs index 72187a2..8c0179d 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/SwipeViewRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/SwipeViewRenderer.cs @@ -45,6 +45,7 @@ namespace Xamarin.Forms.Platform.Android public SwipeViewRenderer(Context context) : base(context) { + Xamarin.Forms.SwipeView.VerifySwipeViewFlagEnabled(nameof(SwipeViewRenderer)); _context = context; AutoPackage = false; diff --git a/Xamarin.Forms.Platform.UAP/SwipeViewRenderer.cs b/Xamarin.Forms.Platform.UAP/SwipeViewRenderer.cs index 81a2247..512b80c 100755 --- a/Xamarin.Forms.Platform.UAP/SwipeViewRenderer.cs +++ b/Xamarin.Forms.Platform.UAP/SwipeViewRenderer.cs @@ -21,6 +21,7 @@ namespace Xamarin.Forms.Platform.UWP public SwipeViewRenderer() { + Xamarin.Forms.SwipeView.VerifySwipeViewFlagEnabled(nameof(SwipeViewRenderer)); AutoPackage = false; } diff --git a/Xamarin.Forms.Platform.iOS/Renderers/SwipeViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/SwipeViewRenderer.cs index 27eb95a..94177fe 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/SwipeViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/SwipeViewRenderer.cs @@ -35,6 +35,8 @@ namespace Xamarin.Forms.Platform.iOS public SwipeViewRenderer() { + Xamarin.Forms.SwipeView.VerifySwipeViewFlagEnabled(nameof(SwipeViewRenderer)); + _tapGestureRecognizer = new UITapGestureRecognizer(OnTap) { CancelsTouchesInView = true -- 2.7.4