- Updated dependencies (gradle, build tools, support library).
- We decided it's time for 1.0.0 release after a lot of use in production projects.
- Made getViewModel() as NonNull to prevent a lot of unncessary null checks. It will now throw an IllegalStateException in case it's null (should not happen under normal conditions. Only if you call it too soon - before Activity.onCreate or Fragment.onCreate).
- Breaking change: AbstractViewModel method saveState was renamed to onSaveInstanceState, bindView to onBindView and onModelRemoved to onDestroy. You may need to update your Models if you are overriding those methods.
- Added ViewModelBaseEmptyActivity - which you can extend in case you don't need a ViewModel in your activity (but your fragments have ViewModels).
- Added a sanity check if setModelView() was called - an error will be logged in case you forget to call it.
- The ViewModel instances are now kept within the Activity (onRetainCustomNonConfigurationInstance). All ViewModels in the activity (including fragment ViewModels) will be cleared if you leave the activity.
- If you are not extending ViewModelBaseActivity and instead you are using your own implementation, then you need to update your base Activity. The ViewModelBaseActivity.onCreate() changed and the activity now implements IViewModelProver interface.
Breaking changes:
- Add setModelView() method which has to be called in every Fragment/Activity after the view was initialized. This is usually on the end of onCreate / onViewCreated - commit
Bugfixes:
- Fix ViewModel ID clashes after the application was restored due to low memory - commit