Home:ALL Converter>SOLID - The Interface Segregation Principle

SOLID - The Interface Segregation Principle

Ask Time:2019-06-25T18:51:44         Author:Adam Ri

Json Formatter

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) {

        }
    });

Author:Adam Ri,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/56752388/solid-the-interface-segregation-principle
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
yy