Skip to content

Commit f3db2e0

Browse files
committed
experimenting with windows/widgets
1 parent 6717db1 commit f3db2e0

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

MauiApp1/Platforms/Android/Services/MyAccessibilityService.cs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Android;
22
using Android.AccessibilityServices;
33
using Android.App;
4+
using Android.Content;
45
using Android.OS;
56
using Android.Views.Accessibility;
67
using CommunityToolkit.Mvvm.Messaging;
@@ -15,6 +16,8 @@ public class MyAccessibilityService : AccessibilityService
1516
{
1617
private Dictionary<string, Match> dict;
1718
private List<Var> globals;
19+
//private LinearLayout inputLayout;
20+
//private IWindowManager windowManager;
1821
private static readonly char[] separator = [' ', '\n', ','];
1922
//private static readonly char[] wordSeparator = [' ', /*'\n',*/ ','];
2023

@@ -217,5 +220,54 @@ protected override void OnServiceConnected()
217220
{
218221
base.OnServiceConnected();
219222
WeakReferenceMessenger.Default.Send(new AcServiceMessage(("_", null)));
223+
// Create the input layout
224+
//inputLayout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Use native LinearLayout
225+
//inputLayout.SetBackgroundColor(Android.Graphics.Color.White); // Customize as needed
226+
227+
//// Create the Entry for input
228+
//// Create the EditText for input
229+
//EditText inputEditText = new EditText(this) { Hint = "Type here..." }; // Use EditText
230+
//inputEditText.RequestFocus(); // Use RequestFocus instead of Focus
231+
//inputEditText.TextChanged += (sender, e) =>
232+
//{
233+
// // Handle text changes, e.g., send text to other apps
234+
//};
235+
236+
//// Add the EditText to the LinearLayout using AddView
237+
//inputLayout.AddView(inputEditText);
238+
239+
//// Add the Entry to the LinearLayout using AddView
240+
241+
//// Request the overlay permission (if not already granted)
242+
//if (Android.Provider.Settings.CanDrawOverlays(this))
243+
//{
244+
// //Intent intent = new Intent(Android.Provider.Settings.ActionManageOverlayPermission,
245+
// // Android.Net.Uri.Parse("package:" + PackageName));
246+
// //StartActivityForResult(intent, REQUEST_OVERLAY_PERMISSION);
247+
//}
248+
//else
249+
//{
250+
// ShowInputBox();
251+
//}
220252
}
253+
254+
//private void ShowInputBox()
255+
//{
256+
// windowManager = (IWindowManager)GetSystemService(WindowService);
257+
// WindowManagerLayoutParams param = new WindowManagerLayoutParams(
258+
// WindowManagerLayoutParams.WrapContent,
259+
// WindowManagerLayoutParams.WrapContent,
260+
// WindowManagerTypes.AccessibilityOverlay,
261+
// WindowManagerFlags.NotFocusable,
262+
// Android.Graphics.Format.Translucent);
263+
// windowManager.AddView(inputLayout, param);
264+
//}
265+
//public override bool OnUnbind(Intent intent)
266+
//{
267+
// if (inputLayout != null)
268+
// {
269+
// windowManager.RemoveView(inputLayout);
270+
// }
271+
// return base.OnUnbind(intent);
272+
//}
221273
}

MauiApp1/TextComparePro.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,15 @@
4343
</PropertyGroup>
4444

4545
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android34.0|AnyCPU'">
46-
<AndroidPackageFormat>apk</AndroidPackageFormat>
47-
<AndroidCreatePackagePerAbi>True</AndroidCreatePackagePerAbi>
46+
<AndroidPackageFormat>aab</AndroidPackageFormat>
47+
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
48+
<AndroidUseAapt2>True</AndroidUseAapt2>
4849
</PropertyGroup>
4950

5051
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android34.0|AnyCPU'">
51-
<AndroidCreatePackagePerAbi>True</AndroidCreatePackagePerAbi>
52+
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
53+
<AndroidUseAapt2>True</AndroidUseAapt2>
54+
<AndroidPackageFormat>aab</AndroidPackageFormat>
5255
</PropertyGroup>
5356

5457
<ItemGroup>

0 commit comments

Comments
 (0)