Skip to content

Commit

Permalink
experimenting with windows/widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
lochidev committed Jan 29, 2024
1 parent 6717db1 commit f3db2e0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
52 changes: 52 additions & 0 deletions MauiApp1/Platforms/Android/Services/MyAccessibilityService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Android;
using Android.AccessibilityServices;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Views.Accessibility;
using CommunityToolkit.Mvvm.Messaging;
Expand All @@ -15,6 +16,8 @@ public class MyAccessibilityService : AccessibilityService
{
private Dictionary<string, Match> dict;
private List<Var> globals;
//private LinearLayout inputLayout;
//private IWindowManager windowManager;
private static readonly char[] separator = [' ', '\n', ','];
//private static readonly char[] wordSeparator = [' ', /*'\n',*/ ','];

Expand Down Expand Up @@ -217,5 +220,54 @@ protected override void OnServiceConnected()
{
base.OnServiceConnected();
WeakReferenceMessenger.Default.Send(new AcServiceMessage(("_", null)));
// Create the input layout
//inputLayout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Use native LinearLayout
//inputLayout.SetBackgroundColor(Android.Graphics.Color.White); // Customize as needed

//// Create the Entry for input
//// Create the EditText for input
//EditText inputEditText = new EditText(this) { Hint = "Type here..." }; // Use EditText
//inputEditText.RequestFocus(); // Use RequestFocus instead of Focus
//inputEditText.TextChanged += (sender, e) =>
//{
// // Handle text changes, e.g., send text to other apps
//};

//// Add the EditText to the LinearLayout using AddView
//inputLayout.AddView(inputEditText);

//// Add the Entry to the LinearLayout using AddView

//// Request the overlay permission (if not already granted)
//if (Android.Provider.Settings.CanDrawOverlays(this))
//{
// //Intent intent = new Intent(Android.Provider.Settings.ActionManageOverlayPermission,
// // Android.Net.Uri.Parse("package:" + PackageName));
// //StartActivityForResult(intent, REQUEST_OVERLAY_PERMISSION);
//}
//else
//{
// ShowInputBox();
//}
}

//private void ShowInputBox()
//{
// windowManager = (IWindowManager)GetSystemService(WindowService);
// WindowManagerLayoutParams param = new WindowManagerLayoutParams(
// WindowManagerLayoutParams.WrapContent,
// WindowManagerLayoutParams.WrapContent,
// WindowManagerTypes.AccessibilityOverlay,
// WindowManagerFlags.NotFocusable,
// Android.Graphics.Format.Translucent);
// windowManager.AddView(inputLayout, param);
//}
//public override bool OnUnbind(Intent intent)
//{
// if (inputLayout != null)
// {
// windowManager.RemoveView(inputLayout);
// }
// return base.OnUnbind(intent);
//}
}
9 changes: 6 additions & 3 deletions MauiApp1/TextComparePro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@
</PropertyGroup>

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

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android34.0|AnyCPU'">
<AndroidCreatePackagePerAbi>True</AndroidCreatePackagePerAbi>
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
<AndroidUseAapt2>True</AndroidUseAapt2>
<AndroidPackageFormat>aab</AndroidPackageFormat>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit f3db2e0

Please sign in to comment.