11using Android ;
22using Android . AccessibilityServices ;
33using Android . App ;
4+ using Android . Content ;
45using Android . OS ;
56using Android . Views . Accessibility ;
67using 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}
0 commit comments