Java Code Examples for android.support.design.widget.TextInputLayout

The following examples show how to use android.support.design.widget.TextInputLayout. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: AssistantBySDK   Source File: CommonEditDialog.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.i("CommonEditDialog", "onCreate>>limits=" + inputLimits);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.common_edit_dialog);
    findViewById(R.id.ced_confirm).setOnClickListener(this);
    findViewById(R.id.ced_title).setOnClickListener(this);
    ((TextView) findViewById(R.id.ced_confirm)).setText(confirm);
    ((TextView) findViewById(R.id.ced_title)).setText(title);
    textInputLayout = (TextInputLayout) findViewById(R.id.edit_content);
    textInputLayout.getEditText().setText(content);
    textInputLayout.getEditText().setHint(contentHint);
    int textLength = textInputLayout.getEditText().length();
    textInputLayout.getEditText().setSelection(textLength);//设置光标位置
    textInputLayout.getEditText().addTextChangedListener(tw);
    textInputLayout.getEditText().setFilters(new InputFilter[]{new InputFilter.LengthFilter(inputLimits)});
    if (oneButtonOnly) {
        findViewById(R.id.ced_cancel).setVisibility(View.GONE);
    } else {
        ((TextView) findViewById(R.id.ced_cancel)).setText(cancel);
        findViewById(R.id.ced_cancel).setOnClickListener(this);
    }
}
 
Example 2
Source Project: africastalking-android   Source File: BankTextInputLayout.java    License: MIT License 6 votes vote down vote up
private void init() {
    try {
        Field cthField = TextInputLayout.class.getDeclaredField("mCollapsingTextHelper");
        cthField.setAccessible(true);
        collapsingTextHelper = cthField.get(this);


        Field boundsField = collapsingTextHelper.getClass().getDeclaredField("mCollapsedBounds");
        boundsField.setAccessible(true);
        bounds = (Rect) boundsField.get(collapsingTextHelper);

        recalculateMethod = collapsingTextHelper.getClass().getDeclaredMethod("recalculate");

    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
        collapsingTextHelper = null;
        bounds = null;
        recalculateMethod = null;
        e.printStackTrace();
    }
}
 
Example 3
Source Project: Luhn   Source File: PinTextInputLayout.java    License: MIT License 6 votes vote down vote up
private void init() {
    try {
        Field cthField = TextInputLayout.class.getDeclaredField("mCollapsingTextHelper");
        cthField.setAccessible(true);
        collapsingTextHelper = cthField.get(this);


        Field boundsField = collapsingTextHelper.getClass().getDeclaredField("mCollapsedBounds");
        boundsField.setAccessible(true);
        bounds = (Rect) boundsField.get(collapsingTextHelper);

        recalculateMethod = collapsingTextHelper.getClass().getDeclaredMethod("recalculate");

    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
        collapsingTextHelper = null;
        bounds = null;
        recalculateMethod = null;
        e.printStackTrace();
    }
}
 
Example 4
Source Project: VCL-Android   Source File: MRLPanelFragment.java    License: Apache License 2.0 6 votes vote down vote up
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
    ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(R.string.open_mrl_dialog_title);
    View v = inflater.inflate(R.layout.mrl_panel, container, false);
    mRootView = v.findViewById(R.id.mrl_root);
    mEditText = (TextInputLayout) v.findViewById(R.id.mrl_edit);
    mEditText.getEditText().setOnKeyListener(this);
    mEditText.getEditText().setOnEditorActionListener(this);
    mEditText.setHint(getString(R.string.open_mrl_dialog_msg));
    mRecyclerView = (RecyclerView) v.findViewById(R.id.mrl_list);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mAdapter = new MRLAdapter(mHistory);
    mRecyclerView.setAdapter(mAdapter);

    return v;
}
 
Example 5
Source Project: ToDay   Source File: EventEditView.java    License: MIT License 6 votes vote down vote up
public EventEditView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    inflate(context, R.layout.event_edit_view, this);
    int horizontalPadding = context.getResources()
            .getDimensionPixelSize(R.dimen.horizontal_padding),
            verticalPadding = context.getResources()
                    .getDimensionPixelSize(R.dimen.vertical_padding);
    setPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding);
    mTextInputTitle = (TextInputLayout) findViewById(R.id.text_input_title);
    mEditTextTitle = (EditText) findViewById(R.id.edit_text_title);
    mSwitchAllDay = (SwitchCompat) findViewById(R.id.switch_all_day);
    mTextViewStartDate = (TextView) findViewById(R.id.text_view_start_date);
    mTextViewStartTime = (TextView) findViewById(R.id.text_view_start_time);
    mTextViewEndDate = (TextView) findViewById(R.id.text_view_end_date);
    mTextViewEndTime = (TextView) findViewById(R.id.text_view_end_time);
    mTextViewCalendar = (TextView) findViewById(R.id.text_view_calendar);
    mTransparentColor = ContextCompat.getColor(context, android.R.color.transparent);
    if (isInEditMode()) {
        mColors = new int[]{mTransparentColor};
    } else {
        mColors = ViewUtils.getCalendarColors(context);
    }
    setupViews();
    setEvent(mEvent);
}
 
Example 6
private void initViews(View v) {

        mEtEmail = (EditText) v.findViewById(R.id.et_email);
        mEtToken = (EditText) v.findViewById(R.id.et_token);
        mEtPassword = (EditText) v.findViewById(R.id.et_password);
        mBtResetPassword = (Button) v.findViewById(R.id.btn_reset_password);
        mProgressBar = (ProgressBar) v.findViewById(R.id.progress);
        mTvMessage = (TextView) v.findViewById(R.id.tv_message);
        mTiEmail = (TextInputLayout) v.findViewById(R.id.ti_email);
        mTiToken = (TextInputLayout) v.findViewById(R.id.ti_token);
        mTiPassword = (TextInputLayout) v.findViewById(R.id.ti_password);

        mBtResetPassword.setOnClickListener(view -> {
            if (isInit) resetPasswordInit();
            else resetPasswordFinish();
        });
    }
 
Example 7
Source Project: candybar-library   Source File: ReportBugsHelper.java    License: Apache License 2.0 6 votes vote down vote up
public static void prepareReportBugs(@NonNull Context context) {
    MaterialDialog.Builder builder = new MaterialDialog.Builder(context);
    builder.customView(R.layout.dialog_report_bugs, true);
    builder.typeface(
            TypefaceHelper.getMedium(context),
            TypefaceHelper.getRegular(context));
    builder.positiveText(R.string.report_bugs_send);
    builder.negativeText(R.string.close);

    MaterialDialog dialog = builder.build();

    EditText editText = (EditText) dialog.findViewById(R.id.input_desc);
    TextInputLayout inputLayout = (TextInputLayout) dialog.findViewById(R.id.input_layout);

    dialog.getActionButton(DialogAction.POSITIVE).setOnClickListener(view -> {
        if (editText.getText().length() > 0) {
            inputLayout.setErrorEnabled(false);
            ReportBugsTask.start(context, editText.getText().toString(), AsyncTask.THREAD_POOL_EXECUTOR);
            dialog.dismiss();
            return;
        }

        inputLayout.setError(context.getResources().getString(R.string.report_bugs_desc_empty));
    });
    dialog.show();
}
 
Example 8
Source Project: AwesomeValidation   Source File: ValidatorTest.java    License: MIT License 6 votes vote down vote up
public void testSetTextInputLayoutWithActivityAndPattern() {
    Activity mockActivity = mock(Activity.class, RETURNS_DEEP_STUBS);
    int viewId = 1;
    Pattern mockPattern = PowerMockito.mock(Pattern.class);
    int errMsgId = 9;
    String errMsg = "Error";
    TextInputLayout mockTextInputLayout = mock(TextInputLayout.class);
    when(mockActivity.findViewById(eq(viewId))).thenReturn(mockTextInputLayout);
    when(mockActivity.getResources().getString(eq(errMsgId))).thenReturn(errMsg);
    mSpiedValidator.set(mockActivity, viewId, mockPattern, errMsgId);
    assertEquals(1, mSpiedValidator.mValidationHolderList.size());
    ValidationHolder validationHolder = mSpiedValidator.mValidationHolderList.get(0);
    assertEquals(mockTextInputLayout, validationHolder.getTextInputLayout());
    assertEquals(mockPattern, validationHolder.getPattern());
    assertEquals(errMsg, validationHolder.getErrMsg());
}
 
Example 9
Source Project: openshop.io-android   Source File: Utils.java    License: MIT License 6 votes vote down vote up
/**
 * Method checks if text input layout exist and contains some value.
 * If layout is empty, then show error value under the textInputLayout.
 *
 * @param textInputLayout textInputFiled for check.
 * @param errorValue      value displayed when ext input is empty.
 * @return true if everything ok.
 */
public static boolean checkTextInputLayoutValueRequirement(TextInputLayout textInputLayout, String errorValue) {
    if (textInputLayout != null && textInputLayout.getEditText() != null) {
        String text = Utils.getTextFromInputLayout(textInputLayout);
        if (text == null || text.isEmpty()) {
            textInputLayout.setErrorEnabled(true);
            textInputLayout.setError(errorValue);
            Timber.d("Input field %s missing text.", textInputLayout.getHint());
            return false;
        } else {
            textInputLayout.setErrorEnabled(false);
            Timber.d("Input field: %s OK.", textInputLayout.getHint());
            return true;
        }
    } else {
        Timber.e(new RuntimeException(), "Checking null input field during order send.");
        return false;
    }
}
 
Example 10
Source Project: place-search-dialog   Source File: PlaceSearchDialog.java    License: Apache License 2.0 6 votes vote down vote up
public void init() {

        locationET = (AppCompatAutoCompleteTextView) findViewById(R.id.place_search_dialog_location_ET);
        locationTIL = (TextInputLayout) findViewById(R.id.place_search_dialog_location_TIL);
        cancelTV = (AppCompatTextView) findViewById(R.id.place_search_dialog_cancel_TV);
        okTV = (AppCompatTextView) findViewById(R.id.place_search_dialog_ok_TV);
        headerImageIV = (ImageView) findViewById(R.id.place_search_dialog_header_image_IV);

        okTV.setOnClickListener(this);
        cancelTV.setOnClickListener(this);

        buildDialog();

        locationET.setOnItemClickListener(mAutocompleteClickListener);
        mAdapter = new PlaceAutocompleteAdapter(context, mGoogleApiClient, BOUNDS_WORLD, null);
        locationET.setThreshold(3);
        locationET.setAdapter(mAdapter);
    }
 
Example 11
Source Project: mv2m   Source File: DataBindingConverters.java    License: Apache License 2.0 5 votes vote down vote up
@BindingAdapter({"app:error"})
public static void bindValidationError(TextInputLayout textInputLayout, int errorRes) {
    if (errorRes != 0) {
        textInputLayout.setError(textInputLayout.getResources().getString(errorRes));
    } else {
        textInputLayout.setError(null);
    }
}
 
Example 12
Source Project: AnimatedPieView   Source File: PopupSetting.java    License: Apache License 2.0 5 votes vote down vote up
private long getTextLong(TextInputLayout v, long defaultValue) {
    try {
        long value = Long.parseLong(v.getEditText().getText().toString().trim());
        return value;
    } catch (Exception e) {
        return defaultValue;
    }
}
 
Example 13
Source Project: AnimatedPieView   Source File: PopupSetting.java    License: Apache License 2.0 5 votes vote down vote up
private float getTextFloat(TextInputLayout v, float defaultValue) {
    try {
        float value = Float.parseFloat(v.getEditText().getText().toString().trim());
        return value;
    } catch (Exception e) {
        return defaultValue;
    }
}
 
Example 14
Source Project: AnimatedPieView   Source File: PopupSetting.java    License: Apache License 2.0 5 votes vote down vote up
private int getTextInt(TextInputLayout v, int defaultValue) {
    try {
        int value = Integer.parseInt(v.getEditText().getText().toString().trim());
        return value;
    } catch (Exception e) {
        return defaultValue;
    }
}
 
Example 15
Source Project: AndroidSDK   Source File: AddDeviceActivity.java    License: MIT License 5 votes vote down vote up
private boolean checkInput(TextInputLayout textInputLayout, int errorResId) {
    String text = textInputLayout.getEditText().getText().toString();
    if (TextUtils.isEmpty(text)) {
        textInputLayout.setError(getResources().getString(errorResId));
        textInputLayout.requestFocus();
        return false;
    }
    return true;
}
 
Example 16
Source Project: q-municate-android   Source File: ValidationUtils.java    License: Apache License 2.0 5 votes vote down vote up
public boolean isChangePasswordDataValid(TextInputLayout oldPasswordTextInputLayout,
                                         TextInputLayout newPasswordTextInputLayout, String oldPassword, String newPassword) {
    boolean isOldPasswordEntered = !TextUtils.isEmpty(oldPassword.trim());
    boolean isNewPasswordEntered = !TextUtils.isEmpty(newPassword.trim());

    if (isOldPasswordEntered && isNewPasswordEntered) {
        if (!qbUser.getPassword().equals(oldPassword)) {
            oldPasswordTextInputLayout.setError(context.getString(R.string.change_password_old_password_wrong));
        } else {
            return true;
        }
    } else if (!isOldPasswordEntered && !isNewPasswordEntered) {
        oldPasswordTextInputLayout.setError(context.getString(R.string.change_password_all_fields_not_entered));
        newPasswordTextInputLayout.setError(context.getString(R.string.change_password_all_fields_not_entered));
    } else {
        if (!isOldPasswordEntered) {
            oldPasswordTextInputLayout
                    .setError(context.getString(R.string.change_password_old_password_not_entered));
        }
        if (!isNewPasswordEntered) {
            newPasswordTextInputLayout
                    .setError(context.getString(R.string.change_password_new_password_not_entered));
        }
    }

    return false;
}
 
Example 17
Source Project: AndroidSchool   Source File: InputLayoutErrorMatcher.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected boolean matchesSafely(View item) {
    if (!(item instanceof TextInputLayout)) {
        return false;
    }

    String expectedError = item.getResources().getString(mErrorTextId);
    TextInputLayout layout = (TextInputLayout) item;
    return TextUtils.equals(expectedError, layout.getError());
}
 
Example 18
@SuppressWarnings("ConstantConditions")
private void setupClientConfigurationForm() {

    useOAuthSwitch = (SwitchCompat) findViewById(R.id.useOauth2Switch);

    validateClientButton = (Button) findViewById(R.id.setOIDCClientButton);
    validateClientButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            saveClientConfigurationForm(v);
        }
    });
    flowTypeSpinner = (Spinner) findViewById(R.id.flowTypeSpinner);
    FlowTypesAdapter adapter = new FlowTypesAdapter(this, R.layout.spinner_selected_item, OIDCRequestManager.Flows.values());
    flowTypeSpinner.setAdapter(adapter);

    clientIdInputLayout = (TextInputLayout) findViewById(R.id.clientIdInputLayout);
    clientIdInputLayout.getEditText().addTextChangedListener(new OIDCOptionsTextWatcher(clientIdInputLayout));
    clientIdEdit = (EditText) findViewById(R.id.clientIdEditText);

    clientSecretInputLayout = (TextInputLayout) findViewById(R.id.clientSecretInputLayout);
    clientSecretInputLayout.getEditText().addTextChangedListener(new OIDCOptionsTextWatcher(clientSecretInputLayout));
    clientSecretEdit = (EditText) findViewById(R.id.clientSecretEditText);

    redirectUriInputLayout = (TextInputLayout) findViewById(R.id.redirectUriInputLayout);
    redirectUriInputLayout.getEditText().addTextChangedListener(new OIDCOptionsTextWatcher(redirectUriInputLayout));
    redirectUriEdit = (EditText) findViewById(R.id.redirectUriEditText);

    issuerInputLayout = (TextInputLayout) findViewById(R.id.issuerInputLayout);
    issuerInputLayout.getEditText().addTextChangedListener(new OIDCOptionsTextWatcher(issuerInputLayout));
    issuerEdit = (EditText) findViewById(R.id.issuerEditText);

    scopesInputLayout = (TextInputLayout) findViewById(R.id.scopesInputLayout);
    scopesInputLayout.getEditText().addTextChangedListener(new OIDCOptionsTextWatcher(scopesInputLayout));
    scopesEdit = (EditText) findViewById(R.id.scopesEditText);
}
 
Example 19
Source Project: AndroidSDK   Source File: AddDataStreamActivity.java    License: MIT License 5 votes vote down vote up
private boolean checkInput(TextInputLayout textInputLayout, int errorResId) {
    String text = textInputLayout.getEditText().getText().toString();
    if (TextUtils.isEmpty(text)) {
        textInputLayout.setError(getResources().getString(errorResId));
        textInputLayout.requestFocus();
        return false;
    }
    return true;
}
 
Example 20
Source Project: canarinho   Source File: ValorMonetarioWatcherTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    final ActivityController<Activity> activityController = buildActivity(Activity.class);
    final Activity activity = activityController.create().get();
    activityController.start().resume().visible();

    TextInputLayout textInputLayout;
    activity.setContentView(textInputLayout = new TextInputLayout(activity));
    textInputLayout.addView(editText = new EditText(activity));
    editText.setText("0,00");
}
 
Example 21
Source Project: AwesomeValidation   Source File: TextInputLayoutValidator.java    License: MIT License 5 votes vote down vote up
@Override
public void execute(ValidationHolder validationHolder, Matcher matcher) {
    TextInputLayout textInputLayout = validationHolder.getTextInputLayout();
    textInputLayout.setErrorTextAppearance(mErrorTextAppearance);
    textInputLayout.setErrorEnabled(true);
    textInputLayout.setError(validationHolder.getErrMsg());
}
 
Example 22
Source Project: Android-skin-support   Source File: SkinMaterialTextInputLayout.java    License: MIT License 5 votes vote down vote up
private TextView getCounterView() {
    try {
        Field counterView = TextInputLayout.class.getDeclaredField("mCounterView");
        counterView.setAccessible(true);
        return (TextView) counterView.get(this);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
Example 23
Source Project: AwesomeValidation   Source File: Validator.java    License: MIT License 5 votes vote down vote up
public void set(Activity activity, int viewId, SimpleCustomValidation simpleCustomValidation, int errMsgId) {
    View view = activity.findViewById(viewId);
    String errMsg = activity.getResources().getString(errMsgId);
    if (view instanceof EditText) {
        set((EditText) view, simpleCustomValidation, errMsg);
    } else if (view instanceof TextInputLayout) {
        set((TextInputLayout) view, simpleCustomValidation, errMsg);
    }
}
 
Example 24
Source Project: Android-skin-support   Source File: SkinMaterialTextInputLayout.java    License: MIT License 5 votes vote down vote up
private void updateEditTextBackgroundInternal() {
    try {
        Method updateEditTextBackground = TextInputLayout.class.getDeclaredMethod("updateEditTextBackground");
        updateEditTextBackground.setAccessible(true);
        updateEditTextBackground.invoke(this);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 25
Source Project: AwesomeValidation   Source File: Validator.java    License: MIT License 5 votes vote down vote up
public void set(Activity activity, int viewId, NumericRange numericRange, int errMsgId) {
    View view = activity.findViewById(viewId);
    String errMsg = activity.getResources().getString(errMsgId);
    if (view instanceof EditText) {
        set((EditText) view, numericRange, errMsg);
    } else if (view instanceof TextInputLayout) {
        set((TextInputLayout) view, numericRange, errMsg);
    }
}
 
Example 26
Source Project: Android-skin-support   Source File: SkinMaterialTextInputLayout.java    License: MIT License 5 votes vote down vote up
private void setFocusedTextColor(ColorStateList colors) {
    try {
        Field focusedTextColor = TextInputLayout.class.getDeclaredField("mFocusedTextColor");
        focusedTextColor.setAccessible(true);
        focusedTextColor.set(this, colors);
        updateLabelState();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 27
Source Project: android-login   Source File: SignUpFragment.java    License: MIT License 5 votes vote down vote up
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  if (view != null) {
    view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.color_sign_up));
    caption.setText(getString(R.string.sign_up_label));
    for (TextInputEditText editText : views) {
      if (editText.getId() == R.id.password_input_edit) {
        final TextInputLayout inputLayout = ButterKnife.findById(view, R.id.password_input);
        final TextInputLayout confirmLayout = ButterKnife.findById(view, R.id.confirm_password);
        Typeface boldTypeface = Typeface.defaultFromStyle(Typeface.BOLD);
        inputLayout.setTypeface(boldTypeface);
        confirmLayout.setTypeface(boldTypeface);
        editText.addTextChangedListener(new TextWatcherAdapter() {
          @Override
          public void afterTextChanged(Editable editable) {
            inputLayout.setPasswordVisibilityToggleEnabled(editable.length() > 0);
          }
        });
      }
      editText.setOnFocusChangeListener((temp, hasFocus) -> {
        if (!hasFocus) {
          boolean isEnabled = editText.getText().length() > 0;
          editText.setSelected(isEnabled);
        }
      });
    }
    caption.setVerticalText(true);
    foldStuff();
    caption.setTranslationX(getTextPadding());
  }
}
 
Example 28
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    final InputConnection ic = super.onCreateInputConnection(outAttrs);
    if (ic != null && outAttrs.hintText == null) {
        // If we don't have a hint and our parent is a TextInputLayout, use it's hint for the
        // EditorInfo. This allows us to display a hint in 'extract mode'.
        final ViewParent parent = getParent();
        if (parent instanceof TextInputLayout) {
            outAttrs.hintText = ((TextInputLayout) parent).getHint();
        }
    }
    return ic;
}
 
Example 29
Source Project: MarkdownEditors   Source File: FolderManagerFragment.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 新建文件夹
 * Create folder.
 */
public void createFolder() {


    //显示重命名对话框
    View rootView = LayoutInflater.from(mContext).inflate(R.layout.view_common_input_view, null);

    AlertDialog mInputDialog = new AlertDialog.Builder(mContext)
            .setTitle("新建文件夹")
            .setView(rootView)
            .show();

    TextInputLayout textInputLayout = (TextInputLayout) rootView.findViewById(R.id.inputHint);
    EditText text = (EditText) rootView.findViewById(R.id.text);
    textInputLayout.setHint("请输入文件夹名");
    rootView.findViewById(R.id.sure).setOnClickListener(v -> {
        String result = text.getText().toString().trim();

        if (Check.isEmpty(result)) {
            textInputLayout.setError("不能为空");
            return;
        }
        if (mPresenter.createFoloderIsExists(result)) {
            textInputLayout.setError("文件已经存在");
            return;
        }
        mPresenter.createFolder(result);
        mInputDialog.dismiss();
    });
    rootView.findViewById(R.id.cancel).setOnClickListener(v -> {
        mInputDialog.dismiss();
    });
    mInputDialog.show();
}
 
Example 30
Source Project: BrainPhaser   Source File: TextFragment.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Setups the view
 *
 * @param inflater           Inflates the fragment
 * @param container          Container to inflate the fragment
 * @param savedInstanceState Ignored
 * @return Return the inflated view
 */
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_challenge_text, container, false);
    mAnswerInput = (EditText) view.findViewById(R.id.answerText);
    mAnswerInputLayout = (TextInputLayout) view.findViewById(R.id.input_answer_layout);
    mAnswerInput.setOnEditorActionListener(this);
    return view;
}