Skip to content

Commit f3d24c1

Browse files
authored
Shell Android Handler (#979)
* Android Shell Handler * - fix resource references on compatibility
1 parent f0e8ea7 commit f3d24c1

File tree

114 files changed

+6569
-465
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+6569
-465
lines changed

src/Compatibility/ControlGallery/src/Android/CustomRenderers.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@
5959

6060
namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.Android
6161
{
62-
public class ShellWithCustomRendererDisabledAnimationsRenderer : ShellRenderer
62+
public class ShellWithCustomRendererDisabledAnimationsRenderer : ShellView
6363
{
6464
public ShellWithCustomRendererDisabledAnimationsRenderer(Context context) : base(context)
6565
{
6666
}
6767

68-
protected override IShellItemRenderer CreateShellItemRenderer(ShellItem shellItem)
68+
protected override IShellItemView CreateShellItemView(ShellItem shellItem)
6969
{
7070
return new ShellWithCustomRendererDisabledAnimationsShellItemRenderer(this);
7171
}
7272

73-
public class ShellWithCustomRendererDisabledAnimationsShellItemRenderer : ShellItemRenderer
73+
public class ShellWithCustomRendererDisabledAnimationsShellItemRenderer : ShellItemView
7474
{
75-
public ShellWithCustomRendererDisabledAnimationsShellItemRenderer(IShellContext shellContext) : base(shellContext)
75+
public ShellWithCustomRendererDisabledAnimationsShellItemRenderer(Controls.Platform.IShellContext shellContext) : base(shellContext)
7676
{
7777
}
7878

src/Compatibility/Core/src/Android/AppCompat/FlyoutPageRenderer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,20 +216,20 @@ void SetupAutomationDefaults()
216216
if (!_defaultAutomationSet)
217217
{
218218
_defaultAutomationSet = true;
219-
AutomationPropertiesProvider.SetupDefaults(this, ref _defaultContentDescription);
219+
Controls.Platform.AutomationPropertiesProvider.SetupDefaults(this, ref _defaultContentDescription);
220220
}
221221
}
222222

223223
protected virtual void SetAutomationId(string id)
224224
{
225225
SetupAutomationDefaults();
226-
AutomationPropertiesProvider.SetAutomationId(this, Element, id);
226+
Controls.Platform.AutomationPropertiesProvider.SetAutomationId(this, Element, id);
227227
}
228228

229229
protected virtual void SetContentDescription()
230230
{
231231
SetupAutomationDefaults();
232-
AutomationPropertiesProvider.SetContentDescription(this, Element, _defaultContentDescription, null);
232+
Controls.Platform.AutomationPropertiesProvider.SetContentDescription(this, Element, _defaultContentDescription, null);
233233
}
234234

235235
protected override void Dispose(bool disposing)

src/Compatibility/Core/src/Android/AppCompat/FormsAppCompatActivity.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using AndroidX.AppCompat.App;
1212
using Microsoft.Maui.Controls.Compatibility.Platform.Android.AppCompat;
1313
using Microsoft.Maui.Controls.Internals;
14+
using Microsoft.Maui.Controls.Platform;
1415
using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;
1516
using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific.AppCompat;
1617
using AColor = Android.Graphics.Color;

src/Compatibility/Core/src/Android/AppCompat/FormsFragmentPagerAdapter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using AndroidX.Fragment.App;
66
using Java.Lang;
77
using Microsoft.Maui.Controls.Internals;
8+
using Microsoft.Maui.Controls.Platform;
89
using FragmentTransit = Android.App.FragmentTransit;
910

1011
namespace Microsoft.Maui.Controls.Compatibility.Platform.Android.AppCompat

src/Compatibility/Core/src/Android/AppCompat/FormsViewPager.cs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
using Android.Util;
55
using Android.Views;
66
using AndroidX.ViewPager.Widget;
7+
using Microsoft.Maui.Controls.Platform;
78

89
namespace Microsoft.Maui.Controls.Compatibility.Platform.Android.AppCompat
910
{
10-
internal class FormsViewPager : ViewPager
11+
internal class FormsViewPager : MauiViewPager
1112
{
1213
public FormsViewPager(Context context) : base(context)
1314
{
@@ -20,20 +21,5 @@ public FormsViewPager(Context context, IAttributeSet attrs) : base(context, attr
2021
protected FormsViewPager(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
2122
{
2223
}
23-
24-
public bool EnableGesture { get; set; } = true;
25-
26-
public override bool OnInterceptTouchEvent(MotionEvent ev)
27-
{
28-
// Same as:
29-
// if (!EnableGesture) return false;
30-
// However this is, at least in theory a tidge faster which in this particular area is good
31-
return EnableGesture && base.OnInterceptTouchEvent(ev);
32-
}
33-
34-
public override bool OnTouchEvent(MotionEvent e)
35-
{
36-
return EnableGesture && base.OnTouchEvent(e);
37-
}
3824
}
3925
}

src/Compatibility/Core/src/Android/AppCompat/NavigationPageRenderer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ void RegisterToolbar()
655655

656656
_drawerLayout = renderer;
657657

658-
FastRenderers.AutomationPropertiesProvider.GetDrawerAccessibilityResources(context, _flyoutPage, out int resourceIdOpen, out int resourceIdClose);
658+
Controls.Platform.AutomationPropertiesProvider.GetDrawerAccessibilityResources(context, _flyoutPage, out int resourceIdOpen, out int resourceIdClose);
659659

660660
if (_drawerToggle != null)
661661
{
@@ -910,18 +910,18 @@ void UpdateMenu()
910910

911911
_currentMenuItems.Clear();
912912
_currentMenuItems = new List<IMenuItem>();
913-
_toolbar.UpdateMenuItems(_toolbarTracker?.ToolbarItems, Context, null, OnToolbarItemPropertyChanged, _currentMenuItems, _currentToolbarItems, UpdateMenuItemIcon);
913+
_toolbar.UpdateMenuItems(_toolbarTracker?.ToolbarItems, Element.FindMauiContext(), null, OnToolbarItemPropertyChanged, _currentMenuItems, _currentToolbarItems, UpdateMenuItemIcon);
914914
}
915915

916916
protected virtual void OnToolbarItemPropertyChanged(object sender, PropertyChangedEventArgs e)
917917
{
918918
var items = _toolbarTracker?.ToolbarItems?.ToList();
919-
_toolbar.OnToolbarItemPropertyChanged(e, (ToolbarItem)sender, items, Context, null, OnToolbarItemPropertyChanged, _currentMenuItems, _currentToolbarItems, UpdateMenuItemIcon);
919+
_toolbar.OnToolbarItemPropertyChanged(e, (ToolbarItem)sender, items, Element.FindMauiContext(), null, OnToolbarItemPropertyChanged, _currentMenuItems, _currentToolbarItems, UpdateMenuItemIcon);
920920
}
921921

922922
protected virtual void UpdateMenuItemIcon(Context context, IMenuItem menuItem, ToolbarItem toolBarItem)
923923
{
924-
ToolbarExtensions.UpdateMenuItemIcon(context, menuItem, toolBarItem, null);
924+
ToolbarExtensions.UpdateMenuItemIcon(Element.FindMauiContext(), menuItem, toolBarItem, null);
925925
}
926926

927927
void UpdateToolbar()
@@ -1055,7 +1055,7 @@ void UpdateTitleIcon()
10551055
_ = this.ApplyDrawableAsync(currentPage, NavigationPage.TitleIconImageSourceProperty, Context, drawable =>
10561056
{
10571057
_titleIconView.SetImageDrawable(drawable);
1058-
FastRenderers.AutomationPropertiesProvider.AccessibilitySettingsChanged(_titleIconView, source);
1058+
AutomationPropertiesProvider.AccessibilitySettingsChanged(_titleIconView, source);
10591059
});
10601060
}
10611061
}

src/Compatibility/Core/src/Android/AppCompat/RadioButtonRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class RadioButtonRenderer : AppCompatRadioButton,
2828
bool _isDisposed;
2929
bool _inputTransparent;
3030
Lazy<TextColorSwitcher> _textColorSwitcher;
31-
AutomationPropertiesProvider _automationPropertiesProvider;
31+
FastRenderers.AutomationPropertiesProvider _automationPropertiesProvider;
3232
VisualElementTracker _tracker;
3333
VisualElementRenderer _visualElementRenderer;
3434
BorderBackgroundManager _backgroundTracker;
@@ -235,7 +235,7 @@ internal void SendVisualElementInitialized(VisualElement element, AView nativeVi
235235

236236
void Initialize()
237237
{
238-
_automationPropertiesProvider = new AutomationPropertiesProvider(this);
238+
_automationPropertiesProvider = new FastRenderers.AutomationPropertiesProvider(this);
239239
_backgroundTracker = new BorderBackgroundManager(this);
240240

241241
SoundEffectsEnabled = false;

src/Compatibility/Core/src/Android/AppCompat/TabbedPageRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ void SetupBottomNavigationView(NotifyCollectionChangedEventArgs e)
658658
items,
659659
currentIndex,
660660
_bottomNavigationView,
661-
Context);
661+
Element.FindMauiContext());
662662

663663
if (Element.CurrentPage == null && Element.Children.Count > 0)
664664
Element.CurrentPage = Element.Children[0];
@@ -863,7 +863,7 @@ public bool OnNavigationItemSelected(IMenuItem item)
863863
if (id == BottomNavigationViewUtils.MoreTabId)
864864
{
865865
var items = CreateTabList();
866-
var bottomSheetDialog = BottomNavigationViewUtils.CreateMoreBottomSheet(OnMoreItemSelected, Context, items, _bottomNavigationView.MaxItemCount);
866+
var bottomSheetDialog = BottomNavigationViewUtils.CreateMoreBottomSheet(OnMoreItemSelected, Element.FindMauiContext(), items, _bottomNavigationView.MaxItemCount);
867867
bottomSheetDialog.DismissEvent += OnMoreSheetDismissed;
868868
bottomSheetDialog.Show();
869869
}

src/Compatibility/Core/src/Android/CellAdapter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using AActionMode = global::AndroidX.AppCompat.View.ActionMode;
1010
using AListView = Android.Widget.ListView;
1111
using AView = Android.Views.View;
12+
using Microsoft.Maui.Controls.Platform;
1213
#if NET6_0
1314
using AMenu = Android.Views.IMenu;
1415
#else

src/Compatibility/Core/src/Android/Cells/EntryCellView.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Android.Widget;
77
using AndroidX.Core.Widget;
88
using Java.Lang;
9+
using Microsoft.Maui.Controls.Platform;
910
using Microsoft.Maui.Graphics;
1011

1112
namespace Microsoft.Maui.Controls.Compatibility.Platform.Android

0 commit comments

Comments
 (0)