Skip to content

Commit

Permalink
fix things
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Jul 12, 2023
1 parent eeb5563 commit b312e3a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
12 changes: 5 additions & 7 deletions src/Controls/src/Core/Editor/Editor.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ namespace Microsoft.Maui.Controls
{
public partial class Editor
{
public static void MapText(EditorHandler handler, Editor editor)
public static void MapText(EditorHandler handler, Editor editor) =>
MapText((IEditorHandler)handler, editor);

public static void MapText(IEditorHandler handler, Editor editor)
{
if (handler.DataFlowDirection == DataFlowDirection.FromPlatform)
if (handler is ViewHandler viewHandler && viewHandler.DataFlowDirection == DataFlowDirection.FromPlatform)
{
Platform.EditTextExtensions.UpdateTextFromPlatform(handler.PlatformView, editor);
return;
}

MapText((IEditorHandler)handler, editor);
}

public static void MapText(IEditorHandler handler, Editor editor)
{
Platform.EditTextExtensions.UpdateText(handler.PlatformView, editor);
}

Expand Down
16 changes: 7 additions & 9 deletions src/Controls/src/Core/Entry/Entry.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,8 @@ public partial class Entry
public static void MapImeOptions(EntryHandler handler, Entry entry) =>
MapImeOptions((IEntryHandler)handler, entry);

public static void MapText(EntryHandler handler, Entry entry)
{
if (handler.DataFlowDirection == DataFlowDirection.FromPlatform)
{
Platform.EditTextExtensions.UpdateTextFromPlatform(handler.PlatformView, entry);
return;
}

public static void MapText(EntryHandler handler, Entry entry) =>
MapText((IEntryHandler)handler, entry);
}

public static void MapImeOptions(IEntryHandler handler, Entry entry)
{
Expand All @@ -29,6 +21,12 @@ public static void MapImeOptions(IEntryHandler handler, Entry entry)

public static void MapText(IEntryHandler handler, Entry entry)
{
if (handler is ViewHandler viewHandler && viewHandler.DataFlowDirection == DataFlowDirection.FromPlatform)
{
Platform.EditTextExtensions.UpdateTextFromPlatform(handler.PlatformView, entry);
return;
}

Platform.EditTextExtensions.UpdateText(handler.PlatformView, entry);
}

Expand Down
1 change: 1 addition & 0 deletions src/Core/src/Handlers/Entry/EntryHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ void OnTextChanged(object? sender, TextChangedEventArgs e)

// Let the mapping know that the update is coming from changes to the platform control
DataFlowDirection = DataFlowDirection.FromPlatform;

VirtualView.UpdateText(e);

// Reset to the default direction
Expand Down

0 comments on commit b312e3a

Please sign in to comment.