You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3 KiB

  1. using Android.Content;
  2. using Android.Views;
  3. using GMCabsDriverAssistantSolution.CustomControls;
  4. using GMCabsDriverAssistantSolution.Platforms.Android.CustomRenderer;
  5. using Microsoft.Maui.Controls.Compatibility;
  6. using Microsoft.Maui.Controls.Compatibility.Platform.Android;
  7. using Microsoft.Maui.Controls.Platform;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. [assembly: ExportRenderer(typeof(OtpEntry), typeof(OtpEntryRenderer))]
  14. namespace GMCabsDriverAssistantSolution.Platforms.Android.CustomRenderer
  15. {
  16. public class OtpEntryRenderer : EntryRenderer
  17. {
  18. public OtpEntryRenderer(Context context) : base(context)
  19. {
  20. }
  21. public override bool DispatchKeyEvent(KeyEvent e)
  22. {
  23. if (e.Action == KeyEventActions.Down)
  24. {
  25. if (e.KeyCode == Keycode.Del)
  26. {
  27. if (string.IsNullOrWhiteSpace(Control.Text))
  28. {
  29. var entry = (OtpEntry)Element;
  30. entry.OnBackspacePressed();
  31. }
  32. }
  33. }
  34. return base.DispatchKeyEvent(e);
  35. }
  36. protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
  37. {
  38. base.OnElementChanged(e);
  39. }
  40. }
  41. }