Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Flyout Page support for IconImageSource #22099

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Apr 27, 2024

Description of Change

When the IconImageSource property was set on the Flyout page in the mobile application, there was an inconsistency between the Android and iOS platforms. While iOS correctly displays the specified icon, Android shows a default hamburger icon instead.

Fixes #15211

<FlyoutPage
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="Maui.Controls.Sample.MainPage"
    x:Name="Self"
    xmlns:local="clr-namespace:Maui.Controls.Sample">
    <FlyoutPage.Flyout>
        <ContentPage Title="Flyout" IconImageSource="groceries.png"/>
    </FlyoutPage.Flyout>
    <FlyoutPage.Detail>
        <NavigationPage>
            <x:Arguments>
                <local:DetailPage />
            </x:Arguments>
        </NavigationPage>
    </FlyoutPage.Detail>
</FlyoutPage>
Before After
Screen.Recording.2024-04-27.at.20.39.08.mov
Screen.Recording.2024-04-27.at.20.31.50.mov

@kubaflo kubaflo requested a review from a team as a code owner April 27, 2024 18:40
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Apr 27, 2024
Copy link
Contributor

Hey there @kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho
Copy link
Member

/azp run

@rmarinho rmarinho requested a review from PureWeen April 29, 2024 13:41
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. This is a new API and will need a bit more checks before we can merge. I also am going to dump some questions that popped into my head for anyone to answer.

However, how did this work with iOS?

I am not sure if I recall correctly, but this was done before via the page icon. This new API makes more sense though.

I assume sine this works on iOS, we are using that flow to get the icon? Should we use the same here? Or, should we use this new thing and make iOS also use this?

What about Windows?

/// <summary>
/// Gets the flyout custom icon.
/// </summary>
IImageSource FlyoutIcon { get; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new API on the interface, so it is breaking. Maybe we can add it like this for net9, but maybe not.

Would a default implementation of null be OK? Or should this be a IIconFlyoutView : IFlyoutVIew to avoid breaks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah null would be okay as in that case, the icon would behave as previously, so it would use a default drawer icon

@kubaflo
Copy link
Contributor Author

kubaflo commented Apr 29, 2024

Thanks for the PR. This is a new API and will need a bit more checks before we can merge. I also am going to dump some questions that popped into my head for anyone to answer.

However, how did this work with iOS?

I am not sure if I recall correctly, but this was done before via the page icon. This new API makes more sense though.

I assume sine this works on iOS, we are using that flow to get the icon? Should we use the same here? Or, should we use this new thing and make iOS also use this?

What about Windows?

Hi @mattleibow,

It worked on iOS before, so I didn't change anything... Maybe I should make changes for iOS to match the logic with Android. The biggest problem is that iOS operates on the flyout page in Controls/compatibility while other platforms in core/handlers

iOS content of FlyoutViewHandler.iOS.cs

        public partial class FlyoutViewHandler : ViewHandler<IFlyoutView, UIKit.UIView>
	{
		protected override UIKit.UIView CreatePlatformView()
		{
			throw new System.NotImplementedException();
		}
	}

Maybe the iOS flyout implementation should be migrated to core/handlers as well?

I believe changes made to Android in this PR should be propagated to Windows as well, but I cannot do it because of lack of a Windows device 😅

@Eilon Eilon added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Apr 30, 2024
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flyout Page: IconImageSource doesn't work on Android
5 participants