From 4debbff83750fc2fe6a44974896423fe97dce80e Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Fri, 13 Aug 2021 10:52:42 -0500 Subject: [PATCH 1/3] Update to Latest Android X Libraries --- .nuspec/Xamarin.Forms.Visual.Material.nuspec | 4 ++-- .nuspec/Xamarin.Forms.nuspec | 18 +++++++++--------- .../DualScreen.Android.csproj | 6 +++--- .../Embedding.Droid/Directory.Build.targets | 10 +++++----- ....Forms.Platform.Android (Forwarders).csproj | 4 ++-- .../Directory.Build.targets | 10 +++++----- .../Nuget.Build.targets | 10 +++++----- ...Xamarin.Forms.ControlGallery.Android.csproj | 12 ++++++------ .../Xamarin.Forms.DualScreen.csproj | 6 +++--- .../Xamarin.Forms.Maps.Android.csproj | 8 ++++---- .../Xamarin.Forms.Material.Android.csproj | 4 ++-- .../AppCompat/TabbedPageRenderer.cs | 9 +++++---- .../SelectableItemsViewAdapter.cs | 2 +- .../CollectionView/SelectableViewHolder.cs | 2 +- .../Renderers/ShellItemRenderer.cs | 13 +++++++------ .../Xamarin.Forms.Platform.Android.csproj | 8 ++++---- 16 files changed, 64 insertions(+), 62 deletions(-) diff --git a/.nuspec/Xamarin.Forms.Visual.Material.nuspec b/.nuspec/Xamarin.Forms.Visual.Material.nuspec index 891a129bb3a..c739e16e691 100644 --- a/.nuspec/Xamarin.Forms.Visual.Material.nuspec +++ b/.nuspec/Xamarin.Forms.Visual.Material.nuspec @@ -22,8 +22,8 @@ - - + + diff --git a/.nuspec/Xamarin.Forms.nuspec b/.nuspec/Xamarin.Forms.nuspec index a0ac1e1581c..bc6422d5b49 100644 --- a/.nuspec/Xamarin.Forms.nuspec +++ b/.nuspec/Xamarin.Forms.nuspec @@ -15,18 +15,18 @@ © Microsoft Corporation. All rights reserved. - - - - + + + + - - - - - + + + + + diff --git a/DualScreen/DualScreen.Android/DualScreen.Android.csproj b/DualScreen/DualScreen.Android/DualScreen.Android.csproj index c9c07905b56..7ea90bc1d41 100644 --- a/DualScreen/DualScreen.Android/DualScreen.Android.csproj +++ b/DualScreen/DualScreen.Android/DualScreen.Android.csproj @@ -115,9 +115,9 @@ - - - + + + diff --git a/EmbeddingTestBeds/Embedding.Droid/Directory.Build.targets b/EmbeddingTestBeds/Embedding.Droid/Directory.Build.targets index 5c7a9c4722c..2e6346118c4 100644 --- a/EmbeddingTestBeds/Embedding.Droid/Directory.Build.targets +++ b/EmbeddingTestBeds/Embedding.Droid/Directory.Build.targets @@ -1,9 +1,9 @@ - - - - - + + + + + diff --git a/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj b/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj index 9757188accf..97f5dbb95a9 100644 --- a/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj +++ b/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj @@ -24,7 +24,7 @@ - - + + diff --git a/Xamarin.Forms.ControlGallery.Android/Directory.Build.targets b/Xamarin.Forms.ControlGallery.Android/Directory.Build.targets index c86812492cd..5e7e9c273f7 100644 --- a/Xamarin.Forms.ControlGallery.Android/Directory.Build.targets +++ b/Xamarin.Forms.ControlGallery.Android/Directory.Build.targets @@ -1,10 +1,10 @@ - - - - - + + + + + diff --git a/Xamarin.Forms.ControlGallery.Android/Nuget.Build.targets b/Xamarin.Forms.ControlGallery.Android/Nuget.Build.targets index a1950cc229f..62c111be027 100644 --- a/Xamarin.Forms.ControlGallery.Android/Nuget.Build.targets +++ b/Xamarin.Forms.ControlGallery.Android/Nuget.Build.targets @@ -5,10 +5,10 @@ - - - - - + + + + + diff --git a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj index b9c34c9aa09..00ed8618261 100644 --- a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj +++ b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj @@ -349,12 +349,12 @@ 3.0.2 - - - - - - + + + + + + diff --git a/Xamarin.Forms.DualScreen/Xamarin.Forms.DualScreen.csproj b/Xamarin.Forms.DualScreen/Xamarin.Forms.DualScreen.csproj index 51dd3ede703..6f819a70129 100644 --- a/Xamarin.Forms.DualScreen/Xamarin.Forms.DualScreen.csproj +++ b/Xamarin.Forms.DualScreen/Xamarin.Forms.DualScreen.csproj @@ -55,8 +55,8 @@ - - - + + + diff --git a/Xamarin.Forms.Maps.Android/Xamarin.Forms.Maps.Android.csproj b/Xamarin.Forms.Maps.Android/Xamarin.Forms.Maps.Android.csproj index 17b192a95b8..0f5619a65f4 100644 --- a/Xamarin.Forms.Maps.Android/Xamarin.Forms.Maps.Android.csproj +++ b/Xamarin.Forms.Maps.Android/Xamarin.Forms.Maps.Android.csproj @@ -20,9 +20,9 @@ - - - - + + + + diff --git a/Xamarin.Forms.Material.Android/Xamarin.Forms.Material.Android.csproj b/Xamarin.Forms.Material.Android/Xamarin.Forms.Material.Android.csproj index 51730a6d519..0b58bb2c438 100644 --- a/Xamarin.Forms.Material.Android/Xamarin.Forms.Material.Android.csproj +++ b/Xamarin.Forms.Material.Android/Xamarin.Forms.Material.Android.csproj @@ -15,8 +15,8 @@ - - + + diff --git a/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs index 8b0625e7f51..511e7938c48 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/TabbedPageRenderer.cs @@ -12,6 +12,7 @@ using AndroidX.ViewPager.Widget; using Google.Android.Material.BottomNavigation; using Google.Android.Material.BottomSheet; +using Google.Android.Material.Navigation; using Google.Android.Material.Tabs; using Xamarin.Forms.Internals; using Xamarin.Forms.PlatformConfiguration.AndroidSpecific; @@ -26,7 +27,7 @@ public class TabbedPageRenderer : VisualElementRenderer, #pragma warning disable CS0618 // Type or member is obsolete TabLayout.IOnTabSelectedListener, #pragma warning restore CS0618 // Type or member is obsolete - ViewPager.IOnPageChangeListener, IManageFragments, BottomNavigationView.IOnNavigationItemSelectedListener + ViewPager.IOnPageChangeListener, IManageFragments, NavigationBarView.IOnItemSelectedListener { Drawable _backgroundDrawable; Drawable _wrappedBackgroundDrawable; @@ -197,7 +198,7 @@ protected override void Dispose(bool disposing) if (_bottomNavigationView != null) { - _bottomNavigationView.SetOnNavigationItemSelectedListener(null); + _bottomNavigationView.SetOnItemSelectedListener(null); _bottomNavigationView.Dispose(); _bottomNavigationView = null; } @@ -267,7 +268,7 @@ protected override void OnElementChanged(ElementChangedEventArgs e) if (_bottomNavigationView != null) { _relativeLayout.RemoveView(_bottomNavigationView); - _bottomNavigationView.SetOnNavigationItemSelectedListener(null); + _bottomNavigationView.SetOnItemSelectedListener(null); } var bottomNavigationViewLayoutParams = new AWidget.RelativeLayout.LayoutParams( @@ -470,7 +471,7 @@ void OnChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs else { SetupBottomNavigationView(e); - bottomNavigationView.SetOnNavigationItemSelectedListener(this); + bottomNavigationView.SetOnItemSelectedListener(this); } UpdateIgnoreContainerAreas(); diff --git a/Xamarin.Forms.Platform.Android/CollectionView/SelectableItemsViewAdapter.cs b/Xamarin.Forms.Platform.Android/CollectionView/SelectableItemsViewAdapter.cs index 913bf4e03e0..217d6fd4979 100644 --- a/Xamarin.Forms.Platform.Android/CollectionView/SelectableItemsViewAdapter.cs +++ b/Xamarin.Forms.Platform.Android/CollectionView/SelectableItemsViewAdapter.cs @@ -67,7 +67,7 @@ internal void MarkNativeSelection(object selectedItem) for (int i = 0; i < _currentViewHolders.Count; i++) { - if (_currentViewHolders[i].AdapterPosition == position) + if (_currentViewHolders[i].BindingAdapterPosition == position) { _currentViewHolders[i].IsSelected = true; return; diff --git a/Xamarin.Forms.Platform.Android/CollectionView/SelectableViewHolder.cs b/Xamarin.Forms.Platform.Android/CollectionView/SelectableViewHolder.cs index cb8d304d205..8ae2ce3bfd0 100644 --- a/Xamarin.Forms.Platform.Android/CollectionView/SelectableViewHolder.cs +++ b/Xamarin.Forms.Platform.Android/CollectionView/SelectableViewHolder.cs @@ -40,7 +40,7 @@ public void OnClick(global::Android.Views.View view) { if (_isSelectionEnabled) { - OnViewHolderClicked(AdapterPosition); + OnViewHolderClicked(BindingAdapterPosition); } } diff --git a/Xamarin.Forms.Platform.Android/Renderers/ShellItemRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ShellItemRenderer.cs index b4d23e8ff45..10c6eff06cc 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ShellItemRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ShellItemRenderer.cs @@ -9,6 +9,7 @@ using Android.Widget; using Google.Android.Material.BottomNavigation; using Google.Android.Material.BottomSheet; +using Google.Android.Material.Navigation; using AColor = Android.Graphics.Color; using AView = Android.Views.View; using IMenu = Android.Views.IMenu; @@ -17,16 +18,16 @@ namespace Xamarin.Forms.Platform.Android { - public class ShellItemRenderer : ShellItemRendererBase, BottomNavigationView.IOnNavigationItemSelectedListener, IAppearanceObserver + public class ShellItemRenderer : ShellItemRendererBase, NavigationBarView.IOnItemSelectedListener, IAppearanceObserver { - #region IOnNavigationItemSelectedListener + #region IOnItemSelectedListener - bool BottomNavigationView.IOnNavigationItemSelectedListener.OnNavigationItemSelected(IMenuItem item) + bool NavigationBarView.IOnItemSelectedListener.OnNavigationItemSelected(IMenuItem item) { return OnItemSelected(item); } - #endregion IOnNavigationItemSelectedListener + #endregion IOnItemSelectedListener #region IAppearanceObserver @@ -63,7 +64,7 @@ public override AView OnCreateView(LayoutInflater inflater, ViewGroup container, _navigationArea = _outerLayout.FindViewById(Resource.Id.bottomtab_navarea); _bottomView.SetBackgroundColor(Color.White.ToAndroid()); - _bottomView.SetOnNavigationItemSelectedListener(this); + _bottomView.SetOnItemSelectedListener(this); if (ShellItem == null) throw new InvalidOperationException("Active Shell Item not set. Have you added any Shell Items to your Shell?"); @@ -102,7 +103,7 @@ void Destroy() if (_bottomView != null) { - _bottomView?.SetOnNavigationItemSelectedListener(null); + _bottomView.SetOnItemSelectedListener(null); _bottomView?.Background?.Dispose(); _bottomView?.Dispose(); } diff --git a/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj b/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj index e90e3195c99..8df97fbc105 100644 --- a/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj +++ b/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android.csproj @@ -43,10 +43,10 @@ - - - - + + + + From 5b90fe20b109f6f2c58fc7612febb7e65abefb39 Mon Sep 17 00:00:00 2001 From: Shane Neuville Date: Fri, 13 Aug 2021 10:58:23 -0500 Subject: [PATCH 2/3] - fix android forwarders --- .../Xamarin.Forms.Platform.Android (Forwarders).csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj b/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj index 97f5dbb95a9..45b86261bc5 100644 --- a/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj +++ b/Stubs/Xamarin.Forms.Platform.Android/Xamarin.Forms.Platform.Android (Forwarders).csproj @@ -22,8 +22,8 @@ - - + + From bc10a9639e383a063c093b30c7d558858d337f46 Mon Sep 17 00:00:00 2001 From: Gerald Versluis Date: Tue, 7 Sep 2021 16:23:42 +0200 Subject: [PATCH 3/3] Moar updates --- .../Xamarin.Forms.Platform.Android.AppLinks.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Xamarin.Forms.Platform.Android.AppLinks/Xamarin.Forms.Platform.Android.AppLinks.csproj b/Xamarin.Forms.Platform.Android.AppLinks/Xamarin.Forms.Platform.Android.AppLinks.csproj index ad25a785e5d..99f434d6475 100644 --- a/Xamarin.Forms.Platform.Android.AppLinks/Xamarin.Forms.Platform.Android.AppLinks.csproj +++ b/Xamarin.Forms.Platform.Android.AppLinks/Xamarin.Forms.Platform.Android.AppLinks.csproj @@ -25,7 +25,7 @@ - - + +