Bug 1227325 - Part 2: Upgrade PromptInput to use TextInputLayout r=mcomella draft
authorAndrzej Hunt <ahunt@mozilla.com>
Mon, 11 Jan 2016 18:24:20 -0800
changeset 325483 f4c964a0b99cc8b9f09192091d3d38466fde9b6b
parent 325482 c9b3ae2013f931f2d63a8984d2b1d1dda50be79c
child 325484 4a8ca2558940ad2828695ef07ee2447c83dae6d1
push id9978
push userahunt@mozilla.com
push dateMon, 25 Jan 2016 16:58:05 +0000
reviewersmcomella
bugs1227325
milestone46.0a1
Bug 1227325 - Part 2: Upgrade PromptInput to use TextInputLayout r=mcomella
mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptInput.java
@@ -8,20 +8,20 @@ package org.mozilla.gecko.prompts;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
 
 import org.json.JSONObject;
 import org.mozilla.gecko.AppConstants.Versions;
 import org.mozilla.gecko.widget.AllCapsTextView;
 import org.mozilla.gecko.widget.DateTimePicker;
-import org.mozilla.gecko.widget.FloatingHintEditText;
 
 import android.content.Context;
 import android.content.res.Configuration;
+import android.support.design.widget.TextInputLayout;
 import android.support.v7.widget.AppCompatCheckBox;
 import android.text.Html;
 import android.text.InputType;
 import android.text.TextUtils;
 import android.text.format.DateFormat;
 import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup.LayoutParams;
@@ -62,17 +62,17 @@ public class PromptInput {
         public EditInput(JSONObject object) {
             super(object);
             mHint = object.optString("hint");
             mAutofocus = object.optBoolean("autofocus");
         }
 
         @Override
         public View getView(final Context context) throws UnsupportedOperationException {
-            EditText input = new FloatingHintEditText(context);
+            EditText input = new EditText(context);
             input.setInputType(InputType.TYPE_CLASS_TEXT);
             input.setText(mValue);
 
             if (!TextUtils.isEmpty(mHint)) {
                 input.setHint(mHint);
             }
 
             if (mAutofocus) {
@@ -82,17 +82,20 @@ public class PromptInput {
                         if (hasFocus) {
                             ((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(v, 0);
                         }
                     }
                 });
                 input.requestFocus();
             }
 
-            mView = (View)input;
+            TextInputLayout inputLayout = new TextInputLayout(context);
+            inputLayout.addView(input);
+
+            mView = (View) inputLayout;
             return mView;
         }
 
         @Override
         public Object getValue() {
             EditText edit = (EditText)mView;
             return edit.getText();
         }