1
1
using Android ;
2
2
using Android . AccessibilityServices ;
3
3
using Android . App ;
4
+ using Android . Content ;
4
5
using Android . OS ;
5
6
using Android . Views . Accessibility ;
6
7
using CommunityToolkit . Mvvm . Messaging ;
@@ -15,6 +16,8 @@ public class MyAccessibilityService : AccessibilityService
15
16
{
16
17
private Dictionary < string , Match > dict ;
17
18
private List < Var > globals ;
19
+ //private LinearLayout inputLayout;
20
+ //private IWindowManager windowManager;
18
21
private static readonly char [ ] separator = [ ' ' , '\n ' , ',' ] ;
19
22
//private static readonly char[] wordSeparator = [' ', /*'\n',*/ ','];
20
23
@@ -217,5 +220,54 @@ protected override void OnServiceConnected()
217
220
{
218
221
base . OnServiceConnected ( ) ;
219
222
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
+ //}
220
252
}
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
+ //}
221
273
}
0 commit comments