Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using AView = Android.Views.View;
using Color = Microsoft.Maui.Graphics.Color;
using LP = Android.Views.ViewGroup.LayoutParams;
using LD = Android.Views.LayoutDirection;
using Paint = Android.Graphics.Paint;

namespace Microsoft.Maui.Controls.Platform.Compatibility
Expand Down Expand Up @@ -144,6 +145,7 @@ public ShellFlyoutRenderer(IShellContext shellContext, Context context) : base(c

Shell.PropertyChanged += OnShellPropertyChanged;
ShellController.AddAppearanceObserver(this, Shell);
UpdateFlowDirection();

this.DrawerClosed += OnDrawerClosed;
this.DrawerSlide += OnDrawerSlide;
Expand Down Expand Up @@ -273,6 +275,10 @@ protected virtual void OnShellPropertyChanged(object sender, PropertyChangedEven

UpdateDrawerState();
}
else if(e.PropertyName == Shell.FlowDirectionProperty.PropertyName)
{
UpdateFlowDirection();
}
}

void UpdateDrawerState()
Expand All @@ -290,6 +296,11 @@ void UpdateDrawerState()
}
}

void UpdateFlowDirection()
{
LayoutDirection = _shellContext.Shell.FlowDirection.ToLayoutDirection();
}

void OnDualScreenServiceScreenChanged(object sender, EventArgs e)
{
UpdateFlyoutSize();
Expand Down
13 changes: 13 additions & 0 deletions src/Core/src/Platform/Android/FlowDirectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ internal static FlowDirection ToFlowDirection(this ALayoutDirection direction)
}
}

internal static ALayoutDirection ToLayoutDirection(this FlowDirection direction)
{
switch (direction)
{
case FlowDirection.LeftToRight:
return ALayoutDirection.Ltr;
case FlowDirection.RightToLeft:
return ALayoutDirection.Rtl;
default:
return ALayoutDirection.Inherit;
}
}

internal static ATextDirection ToTextDirection(this ALayoutDirection direction)
{
switch (direction)
Expand Down
Loading