summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r--Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.Android/PlatformRenderer.cs2
-rw-r--r--Xamarin.Forms.Platform.Android/ViewRenderer.cs14
3 files changed, 15 insertions, 3 deletions
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
index 7edbffb2..dd1c033d 100644
--- a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs
@@ -625,6 +625,8 @@ namespace Xamarin.Forms.Platform.Android.AppCompat
});
}
+ Context.HideKeyboard(this);
+
// 200ms is how long the animations are, and they are "reversible" in the sense that starting another one slightly before it's done is fine
return tcs.Task;
diff --git a/Xamarin.Forms.Platform.Android/PlatformRenderer.cs b/Xamarin.Forms.Platform.Android/PlatformRenderer.cs
index 4fbc0293..f31b0702 100644
--- a/Xamarin.Forms.Platform.Android/PlatformRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/PlatformRenderer.cs
@@ -61,7 +61,7 @@ namespace Xamarin.Forms.Platform.Android
break;
Context.HideKeyboard(currentView);
- RequestFocus();
+ ((Activity)Context).Window.DecorView.ClearFocus();
} while (false);
return result;
diff --git a/Xamarin.Forms.Platform.Android/ViewRenderer.cs b/Xamarin.Forms.Platform.Android/ViewRenderer.cs
index f5c094ba..0415ce93 100644
--- a/Xamarin.Forms.Platform.Android/ViewRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/ViewRenderer.cs
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel;
using Android.App;
+using Android.OS;
using Android.Views;
using AView = Android.Views.View;
@@ -149,11 +150,20 @@ namespace Xamarin.Forms.Platform.Android
if (Control == null)
return;
+ e.Result = true;
+
if (e.Focus)
- e.Result = Control.RequestFocus();
+ {
+ // use post being BeginInvokeOnMainThread will not delay on android
+ Looper looper = Context.MainLooper;
+ var handler = new Handler(looper);
+ handler.Post(() =>
+ {
+ Control?.RequestFocus();
+ });
+ }
else
{
- e.Result = true;
Control.ClearFocus();
}