From 9bc7892e71262708b7aabf7b5a805b5e683965bd Mon Sep 17 00:00:00 2001 From: BeepBeepBopBop Date: Fri, 22 Nov 2024 11:53:58 +0100 Subject: [PATCH] Revert "adding CustomEditor control, removing plainer package reference" This reverts commit 5348a24591e890e986b99f3d1e206db9bcaa81fc. --- LM-Kit-Maestro/Controls/CustomEditor.cs | 5 -- LM-Kit-Maestro/Controls/CustomEntry.cs | 27 ++++---- .../Handlers/CustomEditorHandler.cs | 69 ------------------- .../MauiHandlerCollectionExtensions.cs | 1 - LM-Kit-Maestro/LM-Kit-Maestro.csproj | 1 + LM-Kit-Maestro/MauiProgram.cs | 2 + LM-Kit-Maestro/UI/ChatConversationsView.xaml | 1 + LM-Kit-Maestro/UI/ChatSettingsView.xaml | 19 ++--- LM-Kit-Maestro/UI/ChatView.xaml | 1 + .../UI/ConversationListItemView.xaml | 1 + LM-Kit-Maestro/UI/Pages/ModelsPage.xaml | 3 +- .../Popups/ChatConversationActionPopup.xaml | 1 + 12 files changed, 33 insertions(+), 98 deletions(-) delete mode 100644 LM-Kit-Maestro/Controls/CustomEditor.cs delete mode 100644 LM-Kit-Maestro/Handlers/CustomEditorHandler.cs diff --git a/LM-Kit-Maestro/Controls/CustomEditor.cs b/LM-Kit-Maestro/Controls/CustomEditor.cs deleted file mode 100644 index 8738f6a..0000000 --- a/LM-Kit-Maestro/Controls/CustomEditor.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace LMKitMaestro.Controls; - -class CustomEditor : Editor -{ -} diff --git a/LM-Kit-Maestro/Controls/CustomEntry.cs b/LM-Kit-Maestro/Controls/CustomEntry.cs index 4e19d52..c4e0fd8 100644 --- a/LM-Kit-Maestro/Controls/CustomEntry.cs +++ b/LM-Kit-Maestro/Controls/CustomEntry.cs @@ -3,28 +3,29 @@ using Windows.System; #endif -namespace LMKitMaestro.Controls; - -class CustomEntry : Entry +namespace LMKitMaestro.Controls { - protected override void OnHandlerChanged() + class CustomEntry : Entry { - base.OnHandlerChanged(); + protected override void OnHandlerChanged() + { + base.OnHandlerChanged(); #if WINDOWS - TextBox textBox = (TextBox)Handler!.PlatformView!; + TextBox textBox = (TextBox)Handler!.PlatformView!; - textBox.KeyDown += OnKeyDown; + textBox.KeyDown += OnKeyDown; #endif - } + } #if WINDOWS - private void OnKeyDown(object sender, Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e) - { - if (e.Key == VirtualKey.Enter) + private void OnKeyDown(object sender, Microsoft.UI.Xaml.Input.KeyRoutedEventArgs e) { - Unfocus(); + if (e.Key == VirtualKey.Enter) + { + Unfocus(); + } } - } #endif + } } diff --git a/LM-Kit-Maestro/Handlers/CustomEditorHandler.cs b/LM-Kit-Maestro/Handlers/CustomEditorHandler.cs deleted file mode 100644 index 4f1d15e..0000000 --- a/LM-Kit-Maestro/Handlers/CustomEditorHandler.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using Microsoft.Maui.Handlers; -using Microsoft.Maui.Platform; - -#if ANDROID -using Android.Graphics.Drawables; -using AndroidX.AppCompat.Widget; -using Microsoft.Maui.Controls.Platform; -using Microsoft.Maui.Controls.Compatibility.Platform.Android; -#endif - -#if WINDOWS -using Microsoft.UI.Xaml.Controls; -#endif - -namespace LMKitMaestro.Handlers; - -public partial class CustomEditorHandler : EditorHandler -{ - public CustomEditorHandler() - { - } - - public CustomEditorHandler(IPropertyMapper mapper = null) : base(mapper) - { - } -} - -#if ANDROID -public partial class EditorViewHandler : EditorHandler -{ - protected override AppCompatEditText CreatePlatformView() - { - var nativeView = base.CreatePlatformView(); - - using (var gradientDrawable = new GradientDrawable()) - { - gradientDrawable.SetColor(global::Android.Graphics.Color.Transparent); - nativeView.SetBackground(gradientDrawable); - nativeView.BackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(Colors.Transparent.ToAndroid()); - } - - return nativeView; - } -} -#endif - -#if IOS || MACCATALYST -public partial class EditorViewHandler : EditorHandler -{ - /* No any custom implementation required - * Just keeping this handler to prevent build errors. - */ -} -#endif - -#if WINDOWS -public partial class EditorViewHandler : EditorHandler -{ - protected override TextBox CreatePlatformView() - { - var nativeView = base.CreatePlatformView(); - - nativeView.BorderThickness = new Microsoft.UI.Xaml.Thickness(0); - nativeView.Style = null; - return nativeView; - } -} -#endif \ No newline at end of file diff --git a/LM-Kit-Maestro/Handlers/MauiHandlerCollectionExtensions.cs b/LM-Kit-Maestro/Handlers/MauiHandlerCollectionExtensions.cs index 4478318..c3c38c5 100644 --- a/LM-Kit-Maestro/Handlers/MauiHandlerCollectionExtensions.cs +++ b/LM-Kit-Maestro/Handlers/MauiHandlerCollectionExtensions.cs @@ -7,7 +7,6 @@ public static class MauiHandlerCollectionExtensions public static IMauiHandlersCollection AddCustomHandlers(this IMauiHandlersCollection handlers) { handlers.AddHandler(typeof(CustomEntry), typeof(CustomEntryHandler)); - handlers.AddHandler(typeof(CustomEditor), typeof(CustomEditorHandler)); handlers.AddHandler(typeof(StatefulContentView), typeof(StatefulContentViewHandler)); return handlers; diff --git a/LM-Kit-Maestro/LM-Kit-Maestro.csproj b/LM-Kit-Maestro/LM-Kit-Maestro.csproj index 8604d79..ca90dcb 100644 --- a/LM-Kit-Maestro/LM-Kit-Maestro.csproj +++ b/LM-Kit-Maestro/LM-Kit-Maestro.csproj @@ -79,6 +79,7 @@ + diff --git a/LM-Kit-Maestro/MauiProgram.cs b/LM-Kit-Maestro/MauiProgram.cs index 16b4453..5de6140 100644 --- a/LM-Kit-Maestro/MauiProgram.cs +++ b/LM-Kit-Maestro/MauiProgram.cs @@ -4,6 +4,7 @@ using LMKitMaestro.ViewModels; using LMKitMaestro.Services; using LMKitMaestro.Data; +using Plainer.Maui; using SimpleToolkit.SimpleShell; using LMKitMaestro.Handlers; using MetroLog.MicrosoftExtensions; @@ -46,6 +47,7 @@ public static MauiApp CreateMauiApp() .ConfigureMauiHandlers(handlers => { handlers.AddCustomHandlers(); + handlers.AddPlainer(); }); builder.Services.AddMauiBlazorWebView(); diff --git a/LM-Kit-Maestro/UI/ChatConversationsView.xaml b/LM-Kit-Maestro/UI/ChatConversationsView.xaml index 7aa8ff4..f95a6a9 100644 --- a/LM-Kit-Maestro/UI/ChatConversationsView.xaml +++ b/LM-Kit-Maestro/UI/ChatConversationsView.xaml @@ -7,6 +7,7 @@ xmlns:vm="clr-namespace:LMKitMaestro.ViewModels" xmlns:controls="clr-namespace:LMKitMaestro.Controls" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" + xmlns:plainer="clr-namespace:Plainer.Maui.Controls;assembly=Plainer.Maui" x:DataType="vm:ChatPageViewModel" x:Class="LMKitMaestro.UI.ChatConversationsView" x:Name="chatConversationsView" diff --git a/LM-Kit-Maestro/UI/ChatSettingsView.xaml b/LM-Kit-Maestro/UI/ChatSettingsView.xaml index acc513d..1f2e921 100644 --- a/LM-Kit-Maestro/UI/ChatSettingsView.xaml +++ b/LM-Kit-Maestro/UI/ChatSettingsView.xaml @@ -8,6 +8,7 @@ xmlns:vm="clr-namespace:LMKitMaestro.ViewModels" xmlns:services="clr-namespace:LMKitMaestro.Services" xmlns:controls="clr-namespace:LMKitMaestro.Controls" + xmlns:plainer="clr-namespace:Plainer.Maui.Controls;assembly=Plainer.Maui" xmlns:local="clr-namespace:LMKitMaestro" x:DataType="vm:SettingsViewModel" x:Name="chatSettingsView" @@ -187,13 +188,13 @@ @@ -223,7 +224,7 @@ - - +