PasswordEditText extends AppCompatEditText { public void setTintColorRes(@ColorRes int tintColorRes) { tintColor = ContextCompat.getColor(getContext(), tintColorRes); 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; }
@Test public void whenSetTintColorRes_thenDrawableTinted() { passwordView.setTintColorRes(R.color.ma_amber_100); assertThat(passwordView) .hasTintColorRes(R.color.ma_amber_100); }