Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
drasticactions committed Dec 25, 2021
1 parent ee00d4c commit ea8d0d3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
1 change: 0 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<LangVersion>preview</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.354">
Expand Down
1 change: 1 addition & 0 deletions DrasticMaui.Contracts/DrasticMaui.Contracts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<AdditionalFiles Include="..\stylecop.json" Link="stylecop.json" />
Expand Down
1 change: 1 addition & 0 deletions DrasticMaui.Mac/DrasticMaui.Mac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net6.0-macos</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion DrasticMaui.Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public static class MauiProgram
/// <returns>MauiApp.</returns>
public static MauiApp CreateMauiApp()
{
var trayService = new DrasticMaui.Tray.TrayService();
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
Expand Down
1 change: 1 addition & 0 deletions DrasticMaui/DrasticMaui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
<UseMaui>true</UseMaui>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down
21 changes: 11 additions & 10 deletions DrasticMaui/Overlays/PageOverlay.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DrasticMaui.Tools;
using Android.App;
using Android.Views;
using AndroidX.CoordinatorLayout.Widget;
using DrasticMaui.Tools;
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Platform;

namespace DrasticMaui.Overlays
{
Expand Down Expand Up @@ -98,13 +99,13 @@ internal void AddNativeElements(Page view)

var pageHandler = view.ToHandler(this.context);
var element = pageHandler?.NativeView;
if (element is not null)
if (element is Android.Views.View aView)
{
element.Touch += this.Element_Touch;
var layerCount = nativeLayer.ChildCount;
var childView = nativeLayer.GetChildAt(1);
nativeLayer.AddView(element, layerCount, new CoordinatorLayout.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent));
element.BringToFront();
aView.Touch += this.Element_Touch;
var layerCount = this.nativeLayer.ChildCount;
var childView = this.nativeLayer.GetChildAt(1);
this.nativeLayer.AddView(aView, layerCount, new CoordinatorLayout.LayoutParams(CoordinatorLayout.LayoutParams.MatchParent, CoordinatorLayout.LayoutParams.MatchParent));
aView.BringToFront();
}
}

Expand All @@ -121,10 +122,10 @@ internal void RemoveNativeElements(Page view)

var pageHandler = view.ToHandler(this.context);
var element = pageHandler?.NativeView;
if (element is not null)
if (element is Android.Views.View aView)
{
element.Touch -= this.Element_Touch;
this.nativeLayer.RemoveView(element);
aView.Touch -= this.Element_Touch;
this.nativeLayer.RemoveView(aView);
}
}

Expand Down

0 comments on commit ea8d0d3

Please sign in to comment.