Skip to content

Commit

Permalink
remove focus feedback from InputView when on touch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lbalmaceda committed Oct 11, 2017
1 parent d0907f0 commit 6261ba9
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ public void onCheckedChanged(ImageButton view, boolean isChecked) {
input.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
updateBorder(true);
if (!isInTouchMode()) {
updateBorder(true);
}
}
});
}
Expand Down Expand Up @@ -297,12 +299,6 @@ private void setupInputValidation() {
icon.setImageResource(inputIcon);
}

@Override
public boolean hasFocus() {
//Focus on this View is given by the actual EditText view.
return input != null && input.hasFocus();
}

/**
* Updates the view knowing if the input is valid or not.
*
Expand All @@ -315,7 +311,8 @@ protected void updateBorder(boolean isValid) {
GradientDrawable gd = bg == null ? new GradientDrawable() : (GradientDrawable) bg;
gd.setCornerRadius(getResources().getDimensionPixelSize(R.dimen.com_auth0_lock_widget_corner_radius));

int strokeColor = isValid ? (hasFocus() ? R.color.com_auth0_lock_input_field_border_focused : R.color.com_auth0_lock_input_field_border_normal) : R.color.com_auth0_lock_input_field_border_error;
boolean isFocused = input.hasFocus() && !isInTouchMode();
int strokeColor = isValid ? (isFocused ? R.color.com_auth0_lock_input_field_border_focused : R.color.com_auth0_lock_input_field_border_normal) : R.color.com_auth0_lock_input_field_border_error;
gd.setStroke(getResources().getDimensionPixelSize(R.dimen.com_auth0_lock_input_field_stroke_width), ContextCompat.getColor(getContext(), strokeColor));
gd.setColor(ContextCompat.getColor(getContext(), R.color.com_auth0_lock_input_field_border_normal));
ViewUtils.setBackground(parent, gd);
Expand Down

0 comments on commit 6261ba9

Please sign in to comment.