@Test public void givenBeingSetToHidden_whenSetPasswordVisible_thenPasswordHiddenWithHiddenToggle() { passwordView.setPasswordVisible(true); passwordView.setPasswordVisible(false); assertThat(passwordView) .hasHiddenPassword() .hasToggleHiddenAlpha() .hasDefaultToggle(); }
public void setPasswordVisible(boolean visible) { passwordVisible = visible; setPasswordVisibility(); }
PasswordEditText extends AppCompatEditText { public void setPasswordVisible(boolean visible) { passwordVisible = visible; setPasswordVisibility(); } }
PasswordEditText extends AppCompatEditText { public void setPasswordVisible(boolean visible) { passwordVisible = visible; setPasswordVisibility(); } PasswordEditText(Context context);  PasswordEditText(Context context, AttributeSet attrs);  PasswordEditText(Context context, AttributeSet attrs, int defStyleAttr); }
PasswordEditText extends AppCompatEditText { public void setPasswordVisible(boolean visible) { passwordVisible = visible; setPasswordVisibility(); } PasswordEditText(Context context);  PasswordEditText(Context context, AttributeSet attrs);  PasswordEditText(Context context, AttributeSet attrs, int defStyleAttr); @Override void setInputType(int type); @Override boolean onTouchEvent(MotionEvent event); boolean isPasswordVisible(); void setPasswordVisible(boolean visible); void togglePasswordVisibility(); @ColorInt int getTintColor(); void setTintColor(@ColorInt int tintColor); void setTintColorRes(@ColorRes int tintColorRes); void setShownDrawable(Drawable shownDrawable); void setShownDrawable(@DrawableRes int shownDrawableRes); void setHiddenDrawable(Drawable hiddenDrawable); void setHiddenDrawable(@DrawableRes int hiddenDrawableRes); void setToggleType(@ToggleType int toggleType); }
PasswordEditText extends AppCompatEditText { public void setPasswordVisible(boolean visible) { passwordVisible = visible; setPasswordVisibility(); } PasswordEditText(Context context);  PasswordEditText(Context context, AttributeSet attrs);  PasswordEditText(Context context, AttributeSet attrs, int defStyleAttr); @Override void setInputType(int type); @Override boolean onTouchEvent(MotionEvent event); boolean isPasswordVisible(); void setPasswordVisible(boolean visible); void togglePasswordVisibility(); @ColorInt int getTintColor(); void setTintColor(@ColorInt int tintColor); void setTintColorRes(@ColorRes int tintColorRes); void setShownDrawable(Drawable shownDrawable); void setShownDrawable(@DrawableRes int shownDrawableRes); void setHiddenDrawable(Drawable hiddenDrawable); void setHiddenDrawable(@DrawableRes int hiddenDrawableRes); void setToggleType(@ToggleType int toggleType); static final int TOGGLE_OPACITY; static final int TOGGLE_STRIKETHROUGH; }