Say we have to code a custom View for a toggle button.
A toggle button typically has these two characteristics: - Is clickcable (i.e. will somehow report click events) - Has a state (on/off)
Where should we put the piece of code that makes the toggle button switch state whenever clicked? Does it belong to the custom View itself? Should the View be totally 'dumb' instead and just report clicks letting the business logic set its on/off state instead (e.g. via a setState() API on the View). What are the pros and cons of both approaches?
Let's assume in our codebase we want to strive to let the business logic handle the application state as much as possible and let the Views just handle their "rendering": How the answers to the questions above will change in this respect?