Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,25 @@ public Issue21109(TestDevice device) : base(device) { }

public override string Issue => "[Android] MAUI 8.0.3 -> 8.0.6 regression: custom handler with key listener no longer works";

[Test]
[Test,Order(1)]
[Category(UITestCategories.Entry)]
public void EntryReturnTypeWorks()
public void VerifyInitialEntryReturnTypeChange()
{
App.WaitForElement("WaitForStubControl");
//On InitialLoading returnType should work.
App.Tap("SearchEntry");
VerifyScreenshot();
}

[Test,Order(2)]
[Category(UITestCategories.Entry)]
public void VerifyDynamicEntryReturnTypeChange()
{
App.WaitForElement("WaitForStubControl");

// Verify that ReturnType works as expected.
if (App.IsKeyboardShown())
App.DismissKeyboard();
App.DismissKeyboard();

var returnType1 = App.FindElement("ReturnTypeResult").GetText();
App.Tap("ReturnTypeEntry");
Expand Down
10 changes: 10 additions & 0 deletions src/Core/src/Handlers/Entry/EntryHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public override void SetVirtualView(IView view)
// TODO: NET8 issoto - Change the return type to MauiAppCompatEditText
protected override void ConnectHandler(AppCompatEditText platformView)
{
platformView.ViewAttachedToWindow += OnViewAttachedToWindow;
platformView.TextChanged += OnTextChanged;
platformView.FocusChange += OnFocusedChange;
platformView.Touch += OnTouch;
Expand All @@ -52,6 +53,7 @@ protected override void ConnectHandler(AppCompatEditText platformView)
protected override void DisconnectHandler(AppCompatEditText platformView)
{
_clearButtonDrawable = null;
platformView.ViewAttachedToWindow -= OnViewAttachedToWindow;
platformView.TextChanged -= OnTextChanged;
platformView.FocusChange -= OnFocusedChange;
platformView.Touch -= OnTouch;
Expand All @@ -64,6 +66,14 @@ protected override void DisconnectHandler(AppCompatEditText platformView)
_set = false;
}

void OnViewAttachedToWindow(object? sender, ViewAttachedToWindowEventArgs e)
{
if (PlatformView is null || VirtualView is null)
return;

PlatformView.UpdateReturnType(VirtualView);
}

public static void MapBackground(IEntryHandler handler, IEntry entry) =>
handler.PlatformView?.UpdateBackground(entry);

Expand Down
1 change: 0 additions & 1 deletion src/Core/src/Platform/Android/EditTextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ public static void UpdateClearButtonVisibility(this EditText editText, IEntry en

public static void UpdateReturnType(this EditText editText, IEntry entry)
{
editText.SetInputType(entry);
editText.ImeOptions = entry.ReturnType.ToPlatform();

// Restart the input on the current focused EditText
Expand Down