I am wondering how to implement Interface Segregation Principle from SOLID for the TextWatcher.
More specific: How to remove the not needed functions:
beforeTextChanged(),
afterTextChanged()
as I only need:
onTextChanged()
passwordinput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
presenter.validateCredentials(emailinput.getText().toString(), passwordinput.getText().toString());
}
@Override
public void afterTextChanged(Editable s) {
}
});
adam yong :
Create a class NewClass that inherits from MyTextWatcher\nand \n\npasswordinput.addTextChangedListener(new New Class() {\n\n @Override\n public void onTextChanged(CharSequence s, int start, int before, int count) {\n presenter.validateCredentials(emailinput.getText().toString(), passwordinput.getText().toString());\n }\n\n });\n",
2019-06-25T11:03:49