summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android/Renderers
diff options
context:
space:
mode:
authoradrianknight89 <adrianknight89@outlook.com>2017-01-26 11:24:37 -0600
committerE.Z. Hart <hartez@users.noreply.github.com>2017-01-26 10:24:37 -0700
commitc013452734ea5c8745f3ee849a40e0c65332fb82 (patch)
treeff5e6de8e61e6f69d9bf52c573f338345e860307 /Xamarin.Forms.Platform.Android/Renderers
parent52fc04724fc163c68c54cf33a5931871f8c1ee8e (diff)
downloadxamarin-forms-c013452734ea5c8745f3ee849a40e0c65332fb82.tar.gz
xamarin-forms-c013452734ea5c8745f3ee849a40e0c65332fb82.tar.bz2
xamarin-forms-c013452734ea5c8745f3ee849a40e0c65332fb82.zip
[Android] Keyboard should not change layout while dismissing on Entry and Editor (#663)
* handle keyboard on entry * add sample code * editor changes * change text * better fix * changes
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Renderers')
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/EditorEditText.cs13
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/EntryEditText.cs13
2 files changed, 12 insertions, 14 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/EditorEditText.cs b/Xamarin.Forms.Platform.Android/Renderers/EditorEditText.cs
index 24273121..4a6428eb 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/EditorEditText.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/EditorEditText.cs
@@ -23,13 +23,12 @@ namespace Xamarin.Forms.Platform.Android
public override bool OnKeyPreIme(Keycode keyCode, KeyEvent e)
{
- if (keyCode == Keycode.Back && e.Action == KeyEventActions.Down)
- {
- EventHandler handler = OnBackKeyboardPressed;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
- return base.OnKeyPreIme(keyCode, e);
+ if (keyCode != Keycode.Back || e.Action != KeyEventActions.Down)
+ return base.OnKeyPreIme(keyCode, e);
+
+ this.HideKeyboard();
+ OnBackKeyboardPressed?.Invoke(this, EventArgs.Empty);
+ return true;
}
public override bool RequestFocus(FocusSearchDirection direction, Rect previouslyFocusedRect)
diff --git a/Xamarin.Forms.Platform.Android/Renderers/EntryEditText.cs b/Xamarin.Forms.Platform.Android/Renderers/EntryEditText.cs
index de03a414..5c0b7c0e 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/EntryEditText.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/EntryEditText.cs
@@ -23,13 +23,12 @@ namespace Xamarin.Forms.Platform.Android
public override bool OnKeyPreIme(Keycode keyCode, KeyEvent e)
{
- if (keyCode == Keycode.Back && e.Action == KeyEventActions.Down)
- {
- EventHandler handler = OnKeyboardBackPressed;
- if (handler != null)
- handler(this, EventArgs.Empty);
- }
- return base.OnKeyPreIme(keyCode, e);
+ if (keyCode != Keycode.Back || e.Action != KeyEventActions.Down)
+ return base.OnKeyPreIme(keyCode, e);
+
+ this.HideKeyboard();
+ OnKeyboardBackPressed?.Invoke(this, EventArgs.Empty);
+ return true;
}
public override bool RequestFocus(FocusSearchDirection direction, Rect previouslyFocusedRect)