for example, a UI is particularly complex and will show text in four cases, where click events are not the same.
void updateUI() {
if (mIsA) {
if (mIsB) {
mTextView.setText("111111");
} else {
mTextView.setText("33333");
}
} else {
if (mIsC) {
mTextView.setText("222222");
} else {
mTextView.setText("444444");
}
}
}
it would be too repetitive if I wrote exactly the same judgment on the click event.
onClick(View v) {
if (mIsA) {
if (mIsB) {
// do thing 11111
} else {
// do thing 3333333
}
} else {
if (mIsC) {
// do thing 222222
} else {
// do thing 44444
}
}
}
the way I want to do this is to update the UI and deal with the UI presentation with different onclicklistener on the corresponding settings