maui icon indicating copy to clipboard operation
maui copied to clipboard

[Android] Map FlowDirection of shell to PlatformView on Android

Open mohsenbgi opened this issue 1 year ago • 7 comments
trafficstars

Description of Change

I mapped FlowDirection of shell to PlatformView on Android. this PR fixes #15221 on Android

https://github.com/dotnet/maui/assets/85581484/3fdefbf1-efe0-490b-a45d-314af39f3654

Issues Fixed

Fixes #15221

mohsenbgi avatar Jul 07 '24 10:07 mohsenbgi

/azp run

rmarinho avatar Jul 09 '24 15:07 rmarinho

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jul 09 '24 15:07 azure-pipelines[bot]

hi is there any Workaround to this Issue !?

Kremed avatar Aug 22 '24 20:08 Kremed

hi is there any Workaround to this Issue !?

I fixed it on Android, but it still hasn't been merged.

mohsenbgi avatar Aug 25 '24 18:08 mohsenbgi

Should I wait for merger approval, any tips to fix the issue separately on my project side?

Kremed avatar Aug 26 '24 02:08 Kremed

Should I wait for merger approval, any tips to fix the issue separately on my project side?

You can do it as shown below in the AppShell.xaml.cs file:

public partial class AppShell : Shell
{
    public AppShell()
    {
        InitializeComponent();
    }

    protected override void OnHandlerChanged()
    {
        base.OnHandlerChanged();

        #if ANDROID
        
        var platformView = Handler.PlatformView;
        var shellFlyoutRenderer = (ShellFlyoutRenderer)platformView;
        shellFlyoutRenderer.LayoutDirection = Android.Views.LayoutDirection.Rtl;
        
        #elif IOS || MACCATALYST
        
        FlowDirection = FlowDirection.RightToLeft;
        
        #endif
    }
}

I couldn't find any way to correct it on Windows

mohsenbgi avatar Aug 26 '24 07:08 mohsenbgi

Should I wait for merger approval, any tips to fix the issue separately on my project side?

You can do it as shown below in the AppShell.xaml.cs file:

public partial class AppShell : Shell
{
    public AppShell()
    {
        InitializeComponent();
    }

    protected override void OnHandlerChanged()
    {
        base.OnHandlerChanged();

        #if ANDROID
        
        var platformView = Handler.PlatformView;
        var shellFlyoutRenderer = (ShellFlyoutRenderer)platformView;
        shellFlyoutRenderer.LayoutDirection = Android.Views.LayoutDirection.Rtl;
        
        #elif IOS || MACCATALYST
        
        FlowDirection = FlowDirection.RightToLeft;
        
        #endif
    }
}

I couldn't find any way to correct it on Windows

The operation went as planned, and I am grateful for your support, truly it saved my day

Kremed avatar Aug 27 '24 21:08 Kremed

/rebase

jfversluis avatar Feb 19 '25 11:02 jfversluis

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Feb 19 '25 13:02 azure-pipelines[bot]

Sorry it took a while @mohsenbgi! I think this looks good, thank you so much for your very first .NET MAUI contribution!

I think it might be good to add maybe some (snapshot) tests for this, but lets do that as a follow up.

jfversluis avatar Feb 20 '25 10:02 jfversluis

Congrats @mohsenbgi! Go update your social media profiles with .NET MAUI contributor extraordinaire!

Thank you so much for your efforts on this! and your patience...

jfversluis avatar Feb 20 '25 14:02 jfversluis