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

[Controls] Remove obsolete methods from Controls #1644

Merged
merged 11 commits into from
Aug 2, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,13 @@ public AttachedStateEffectLabelRenderer(Context context) : base(context)
}
}

public class NativeDroidFlyoutPage : Microsoft.Maui.Controls.Compatibility.Platform.Android.AppCompat.MasterDetailPageRenderer
public class NativeDroidFlyoutPage : FlyoutPageRenderer
{
FlyoutPage _page;
bool _disposed;

public NativeDroidFlyoutPage(Context context) : base(context)
{
System.Diagnostics.Debug.WriteLine($">>>>> NativeDroidMasterDetail NativeDroidMasterDetail 53: This is the obsolete constructor being selected");
}

protected override void OnElementChanged(VisualElement oldElement, VisualElement newElement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.Maui.Controls.Compatibility.ControlGallery
public class AppearingGalleryPage : ContentPage
{
const string NavPageTitle = "NavAppearingPage";
const string MasterPageTitle = "MasterAppearingPage";
const string FlyoutPageTitle = "FlyoutPageAppearingPage";
const string TabbedPageTitle = "TabbedAppearingPage";
const string CarouselPageTitle = "CarouselAppearingPage";

Expand All @@ -27,9 +27,9 @@ public AppearingGalleryPage()
Application.Current.MainPage = new NavAppearingPage(initalPage);
})
},
new Button { Text = MasterPageTitle, Command = new Command (() => {
new Button { Text = FlyoutPageTitle, Command = new Command (() => {
var page = new FlyoutPage {
Title = MasterPageTitle,
Title = FlyoutPageTitle,
Flyout = new ContentPage { Title = "Flyout", BackgroundColor = Colors.Red },
Detail = new NavAppearingPage(initalPage)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ await Navigation.PushAsync(new TabbedPage
});
};

var master = new Button { Text = "MasterDetail" };
var master = new Button { Text = "FlyoutPage" };
master.Clicked += async (sender, args) =>
{
await Navigation.PushModalAsync(new FlyoutPage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class FlyoutPageTabletPage : ContentPage
{
public FlyoutPageTabletPage()
{
Title = "MasterDetail FlyoutLayoutBehavior Gallery";
Title = "FlyoutPage FlyoutLayoutBehavior Gallery";

var btn = new Button { Text = "Default (old behavior)" };
btn.Clicked += async (sender, e) => await Navigation.PushModalAsync(new Issue1461Page(FlyoutLayoutBehavior.Default, null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
</NavigationPage.TitleView>
<ScrollView>
<StackLayout BackgroundColor="Pink">
<Button Clicked="masterDetailsPage_Clicked" Text="Flyout Details Page"></Button>
<Button Clicked="masterDetailsPageIcon_Clicked" Text="Toggle MDP Icon"></Button>
<Button Clicked="flyoutPagesPage_Clicked" Text="Flyout Details Page"></Button>
<Button Clicked="flyoutPagesPageIcon_Clicked" Text="Toggle MDP Icon"></Button>
Copy link
Member

Choose a reason for hiding this comment

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

I see a couple of cases with MDP which should probably also go.

Copy link
Member Author

Choose a reason for hiding this comment

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

We have alotttttt of them.. i think we keep it for now

<Button Clicked="tabbedPage_Clicked" Text="Tabbed Page"></Button>
<Button Clicked="navigationPage_Clicked" Text="Navigation Page"></Button>
<Button Clicked="nextPage_Clicked" Text="Push a Page"></Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public TitleView(bool initialLoad)

if (initialLoad)
{
Device.BeginInvokeOnMainThread(() => masterDetailsPage_Clicked(this, EventArgs.Empty));
Device.BeginInvokeOnMainThread(() => flyoutPagesPage_Clicked(this, EventArgs.Empty));
}
}

Expand All @@ -48,7 +48,7 @@ void swapDetails_Page(object sender, EventArgs e)
}
}

void masterDetailsPage_Clicked(object sender, EventArgs e)
void flyoutPagesPage_Clicked(object sender, EventArgs e)
{
App.Current.MainPage =
new FlyoutPage()
Expand Down Expand Up @@ -195,7 +195,7 @@ static void toggleTitleIcon(Page page)
NavigationPage.SetTitleIconImageSource(page, null);
}

void masterDetailsPageIcon_Clicked(object sender, EventArgs e)
void flyoutPagesPageIcon_Clicked(object sender, EventArgs e)
{
if (App.Current.MainPage is FlyoutPage mdp)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.Issues
[Category(Compatibility.UITests.UITestCategories.Bugzilla)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 30835, "Navigating to and from the Carousel page with MasterDetail page creates an Out of memory exception")]
[Issue(IssueTracker.Bugzilla, 30835, "Navigating to and from the Carousel page with FlyoutPage creates an Out of memory exception")]
public class Bugzilla30835 : TestFlyoutPage // or TestFlyoutPage, etc ...
{
protected override void Init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.Issues
#if UITEST
[NUnit.Framework.Category(Compatibility.UITests.UITestCategories.Bugzilla)]
#endif
[Issue(IssueTracker.Bugzilla, 32776, "MasterDetail page - page title not showing for Windows Phone 8.1 (any orientation) or in Windows 8.1 (portrait orientation).", PlatformAffected.WinRT, NavigationBehavior.PushModalAsync)]
[Issue(IssueTracker.Bugzilla, 32776, "FlyoutPage - page title not showing for Windows Phone 8.1 (any orientation) or in Windows 8.1 (portrait orientation).", PlatformAffected.WinRT, NavigationBehavior.PushModalAsync)]
public class Bugzilla32776
: FlyoutPage
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected override void Init()
}
});

//MASTERDETAIL PAGE
//FLYOUTPAGE PAGE
HomePage = new FlyoutPage()
{
Flyout = MasterPage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 43519, "[UWP] MasterDetail page ArguementException when nested in a TabbedPage and returning from modal page"
[Issue(IssueTracker.Bugzilla, 43519, "[UWP] FlyoutPage ArgumentException when nested in a TabbedPage and returning from modal page"
, PlatformAffected.UWP)]

#if UITEST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.Issues
[NUnit.Framework.Category(Compatibility.UITests.UITestCategories.Bugzilla)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 46494, "Hardware/Software back button from MainPage of type MasterDetail causes crash 'java.lang.IllegalStateException: Activity has been destroyed'", PlatformAffected.Android)]
[Issue(IssueTracker.Bugzilla, 46494, "Hardware/Software back button from MainPage of type FlyoutPage causes crash 'java.lang.IllegalStateException: Activity has been destroyed'", PlatformAffected.Android)]
public class Bugzilla46494 : TestFlyoutPage
{
protected override void Init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.Issues
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 12153, "Setting FontFamily to pre-installed fonts on UWP crashes", PlatformAffected.UWP)]
public class Issue12153 : TestContentPage // or TestMasterDetailPage, etc ...
public class Issue12153 : TestContentPage
{
protected override void Init()
{
Expand Down
12 changes: 6 additions & 6 deletions src/Compatibility/ControlGallery/src/Issues.Shared/Issue1598.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.Issues
{
public class MasterDetailToolbarBug : FlyoutPage
public class FlyoutPageToolbarBug : FlyoutPage
{
public MasterDetailToolbarBug()
public FlyoutPageToolbarBug()
{
Title = "MasterDetailToolbarBug";
Title = "FlyoutPageToolbarBug";

Flyout = new ContentPage()
{
Expand All @@ -26,16 +26,16 @@ public MasterDetailToolbarBug()
[NUnit.Framework.Category(Compatibility.UITests.UITestCategories.Github5000)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 1598, "MasterDetailContainer does not handle adding of views which are already its children", PlatformAffected.Android)]
[Issue(IssueTracker.Github, 1598, "FlyoutPageContainer does not handle adding of views which are already its children", PlatformAffected.Android)]
public class Issue1598 : ContentPage
{
MasterDetailToolbarBug _secondPage = new MasterDetailToolbarBug();
FlyoutPageToolbarBug _secondPage = new FlyoutPageToolbarBug();

public Issue1598()
{
Title = "XamarinTest MainMenu";

var menu1 = new MainMenuCell("MasterDetail - Toolbar bug", "Icon.png");
var menu1 = new MainMenuCell("FlyoutPage - Toolbar bug", "Icon.png");
menu1.Tapped += (o, e) =>
{
Navigation.PushAsync(_secondPage);
Expand Down
42 changes: 21 additions & 21 deletions src/Compatibility/ControlGallery/src/Issues.Shared/Issue2266.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ void InitPageContent()
};

string[] listItems = {
"MasterDetail Navigation",
"MasterDetail Navigation ->> Page 1",
"MasterDetail Navigation ->> Page 2",
"MasterDetail Navigation ->> Page 3"
"FlyoutPage Navigation",
"FlyoutPage Navigation ->> Page 1",
"FlyoutPage Navigation ->> Page 2",
"FlyoutPage Navigation ->> Page 3"
};

var listView = new ListView
Expand All @@ -63,63 +63,63 @@ void InitPageContent()
return;
if (e.SelectedItem.Equals(listItems[0]))
{
Application.Current.MainPage = MasterDetailHost;
Application.Current.MainPage = FlyoutPageHost;
}
else if (e.SelectedItem.Equals(listItems[1]) || e.SelectedItem.Equals(listItems[2]) || e.SelectedItem.Equals(listItems[3]))
{
// MasterDetail Navigation - direct page open
// FlyoutPage Navigation - direct page open
var item = e.SelectedItem.ToString();
var index = int.Parse(item.Substring(item.Length - 1)) - 1;
Application.Current.MainPage = MasterDetailHost;
MasterDetailHost.OpenPage(index);
Application.Current.MainPage = FlyoutPageHost;
FlyoutPageHost.OpenPage(index);
}

listView.SelectedItem = null;
};
}

static MasterDetailNavigation s_masterDetailHost;
static FlyoutPageNavigation s_FlyoutPageHost;

static MasterDetailNavigation MasterDetailHost
static FlyoutPageNavigation FlyoutPageHost
{
get
{
if (s_masterDetailHost == null)
s_masterDetailHost = new MasterDetailNavigation();
return s_masterDetailHost;
if (s_FlyoutPageHost == null)
s_FlyoutPageHost = new FlyoutPageNavigation();
return s_FlyoutPageHost;
}
}



#if UITEST
[Test]
public void SwapMainPageWithMasterDetails()
public void SwapMainPageWithFlyoutPages()
{
RunningApp.WaitForElement(q => q.Text("MasterDetail Navigation"));
RunningApp.Tap(q => q.Text("MasterDetail Navigation"));
RunningApp.WaitForElement(q => q.Text("FlyoutPage Navigation"));
RunningApp.Tap(q => q.Text("FlyoutPage Navigation"));
RunningApp.Tap(q => q.Marked("OpenMaster"));
RunningApp.Tap(q => q.Text("Page 1"));
RunningApp.Tap(q => q.Text("START"));
RunningApp.Tap(q => q.Text("MasterDetail Navigation ->> Page 1"));
RunningApp.Tap(q => q.Text("FlyoutPage Navigation ->> Page 1"));
RunningApp.WaitForElement(q => q.Text("Page 1"));
RunningApp.Tap(q => q.Text("START"));
RunningApp.Tap(q => q.Text("MasterDetail Navigation ->> Page 2"));
RunningApp.Tap(q => q.Text("FlyoutPage Navigation ->> Page 2"));
RunningApp.WaitForElement(q => q.Text("Page 2"));
RunningApp.Tap(q => q.Text("START"));
RunningApp.Tap(q => q.Text("MasterDetail Navigation ->> Page 3"));
RunningApp.Tap(q => q.Text("FlyoutPage Navigation ->> Page 3"));
RunningApp.WaitForElement(q => q.Text("Page 3"));
}
#endif

}

[Preserve(AllMembers = true)]
public class MasterDetailNavigation : FlyoutPage
public class FlyoutPageNavigation : FlyoutPage
{
List<NavigationPage> _pages;

public MasterDetailNavigation()
public FlyoutPageNavigation()
{
InitPages();

Expand Down
Loading