From 820eb696475513b103c4beb59fd9cfbcb4ee9bce Mon Sep 17 00:00:00 2001 From: Andrzej Hunt Date: Fri, 29 Jan 2016 15:33:18 -0800 Subject: [PATCH] Bug 1243354 - Part 1: Correctly handle TextInputLayout in PromptInput r=mcomella --HG-- extra : commitid : 4qDwuU4XQ2l --- .../mozilla/gecko/prompts/PromptInput.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java index d381db1c5c3b..c315df8cdcbe 100644 --- a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java +++ b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java @@ -96,8 +96,8 @@ public class PromptInput { @Override public Object getValue() { - EditText edit = (EditText)mView; - return edit.getText(); + final TextInputLayout inputLayout = (TextInputLayout) mView; + return inputLayout.getEditText().getText(); } } @@ -109,7 +109,8 @@ public class PromptInput { @Override public View getView(final Context context) throws UnsupportedOperationException { - EditText input = (EditText) super.getView(context); + final TextInputLayout inputLayout = (TextInputLayout) super.getView(context); + final EditText input = inputLayout.getEditText(); input.setRawInputType(Configuration.KEYBOARD_12KEY); input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED); @@ -125,17 +126,11 @@ public class PromptInput { @Override public View getView(Context context) throws UnsupportedOperationException { - EditText input = (EditText) super.getView(context); - input.setInputType(InputType.TYPE_CLASS_TEXT | + final TextInputLayout inputLayout = (TextInputLayout) super.getView(context); + inputLayout.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); - return input; - } - - @Override - public Object getValue() { - EditText edit = (EditText)mView; - return edit.getText(); + return inputLayout; } }