The 'Mvcs' Principle and Usage - LightSun/Mvcs GitHub Wiki
we know 'MVC' is a tranditional design mode. And 'M' is module, 'V' is view , 'C' is controller. The model is usually entity data. The View is usually visual component. The Controller is usually the brain of the whole project. With the 24 design patterns have a state pattern , And My design idea comes from them. 'S' means state.
compare to 'MVP', presenter is very heavy especially complex layout. of cource you can use multi fragment and split multi IView. Even if it is also be inconvenient to understand and protect the code。 Not to mention the fragment have some problems.
'MVCS' is a new framework of design. it can make your codes be easy to understand or protect . easy to extend. And help us improve development efficiency.
/* <ul>
* <li>State Factory: use {@linkplain #setStateFactory(StateFactory)} to set.
* </li>
* <li>State Parameter Merger: use {@linkplain #setParameterMerger(ParameterMerger)} to set
* merger for state parameter.
* </li>
* <li>State Cache: use {@linkplain #setStateCacheEnabled(boolean)} to enable or disable state cache.
* use {@linkplain #destroyStateCache()} to destroy state cache without current states.
* </li>
* <li>State Stack: use {@linkplain #setStateStackEnable(boolean)} to enable state stack. so that we can
* call {@linkplain #revertToPreviousState()} to previous state. Use {@linkplain #setMaxStateStackSize(int)}
* to control the max state stack size. or use {@linkplain #clearStateStack()} to clear state stack.
* </li>
* <li>Share Parameter: share parameter for multi states. you can use {@linkplain #setShareStateParam(Object)} to
* set share parameter. {@linkplain #getShareStateParam()} to get shared parameter.
* </li>
* <li>State Manager: you can use 'CRUD' methods by calling addXXX() , removeXXX() , clearXXX() ,getXXXState.
* hasXXX() and so on.
* </li>
* <li>Update State and dispose:
* use {@linkplain #notifyStateUpdate(Object)} to update states. and {@linkplain #dispose()}
* to do the final action.
* </li>
* <li> Manage Lock Event: {@linkplain #lockEvent(int...)} , {@linkplain #unlockEvent(int...)} .
* {@linkplain #unlockAllEvent()}.
* </li>
* <li>Controller Owner: {@linkplain #setOwner(Object)} and {@linkplain #getOwner()} .
* </li>
* <li>Mutex States: what is this ? This define the states can split to double groups.
* any state of one group is mutex with any state of the other group. That is if double states is mutex.
* when either one of them called {@linkplain AbstractState#onEnter()}, the other
* state's {@linkplain AbstractState#onExit()} must be called.
* see {@linkplain #setMutexState(int[], int[])} ,and {@linkplain #getMutexState(int)}.
* </li>
* </ul>
*/
base demo: see com.heaven7.android.mvcs.test.sample.MvcsLogSample for detail.