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

Shell Android Handler #979

Merged
merged 2 commits into from Jul 23, 2021
Merged

Shell Android Handler #979

merged 2 commits into from Jul 23, 2021

Conversation

PureWeen
Copy link
Member

@PureWeen PureWeen commented May 7, 2021

Description of Change

Move Android Shell implementation, and related classes, into Controls.Core

Manage your expectations a bit on this one. This is mainly to get Shell inside the Maui.Controls library and then we can start fixing issues

  • Converted TabLayout to use the newer ViewPager2
  • Removed the code that removes handlers from pages so now as you navigate tabs/flyout items it doesn't dispose of stuff which should make navigation much faster.
  • Copied over all the shell bits and just renamed them to views. This also keeps all the legacy shell renderer code intact

Known Issues

The flyout items don't layout correctly because of
#746
#1049

@rmarinho
Copy link
Member

D:\repos\dotnet\maui\src\Controls\src\Core\Platform\Android\Shell\ShellContentFragment.cs(16,85): error CS0246: The t
ype or namespace name 'IShellObservableFragment' could not be found (are you missing a using directive or an assembly r
eference?) [D:\repos\dotnet\maui\src\Controls\src\Core\Controls.Core-net6.csproj]

@PureWeen PureWeen changed the base branch from release/6.0.1xx-preview4 to main May 17, 2021 19:06
@PureWeen PureWeen force-pushed the shell_android branch 2 times, most recently from 2e94ad6 to 46896a3 Compare May 18, 2021 16:11
Platform.Android.AppCompat.Platform.SetRenderer(
VisualElementRenderer.Element,
null);
if (VisualElementRenderer.Element != null)
Copy link
Member Author

Choose a reason for hiding this comment

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

If the renderer has already been cleared then don't try to clear it again


namespace Microsoft.Maui.Controls.Compatibility.Platform.Android
{
public interface IShellContext
public interface IShellContext : Microsoft.Maui.Controls.Platform.IShellContext
Copy link
Member Author

Choose a reason for hiding this comment

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

This will allow peoples custom shell renderers to shim and register correctly

@@ -272,7 +272,7 @@ protected virtual void SwitchFragment(FragmentManager manager, AView targetView,
FragmentTransaction transaction = manager.BeginTransactionEx();

if (animate)
transaction.SetTransitionEx((int)global::Android.App.FragmentTransit.EnterMask);
transaction.SetTransitionEx((int)global::Android.App.FragmentTransit.FragmentOpen);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is to fix a crash that happens on newer versions of AndroidX

@PureWeen PureWeen marked this pull request as ready for review May 18, 2021 17:15
@PureWeen PureWeen force-pushed the shell_android branch 3 times, most recently from 1a75876 to 7dfc9dc Compare July 2, 2021 22:25
@PureWeen PureWeen changed the title Shell android [WiP] Shell android Jul 2, 2021
@PureWeen PureWeen changed the title [WiP] Shell android Shell Android Handler Jul 3, 2021
@@ -20,20 +21,5 @@ public FormsViewPager(Context context, IAttributeSet attrs) : base(context, attr
protected FormsViewPager(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
{
}

public bool EnableGesture { get; set; } = true;
Copy link
Member Author

Choose a reason for hiding this comment

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

These are all inside MauiViewPager now

@PureWeen PureWeen force-pushed the shell_android branch 2 times, most recently from a533492 to 7863dec Compare July 15, 2021 14:53
@PureWeen PureWeen force-pushed the shell_android branch 2 times, most recently from 78078cb to caf0c42 Compare July 20, 2021 23:40
@Redth Redth added this to the 6.0.100-preview.7 milestone Jul 21, 2021
@Redth Redth merged commit f3d24c1 into main Jul 23, 2021
@Redth Redth deleted the shell_android branch July 23, 2021 14:00
pjcollins pushed a commit that referenced this pull request Jul 23, 2021
* Android Shell Handler

* - fix resource references on compatibility
@samhouts samhouts added platform/android 🤖 area/shell 🐢 Shell Navigation, Routes, Tabs, Flyout labels Jul 20, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/shell 🐢 Shell Navigation, Routes, Tabs, Flyout platform/android 🤖
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants