I noticed I never talked here (or anywhere for that matter) about my take on MVP, called revamp, that I started coding/using almost 2 years ago.

It is a tiny framework that has been pivotal on the development of my personal apps.

It comes with a couple of goodies that have proven to be pretty useful:

  • Presenters on Activities and Fragments are persisted across rotations, and expose methods to retain whatever else you want in those situations.
  • ViewComponents (MVP's Views) get attached on onCreate and detached on onDestroy, thus providing a longer lifecycle compared to other libraries that do that on onStart/onResume.
  • It doesn't force you to handle lifecycle events in the Presenter (yuck).
  • ViewComponents, when not attached, are provided with an empty implementation, so there are no unwanted NPEs when the presenter invokes something on the view in the middle of a rotation or in unwanted moments.

I have been using it in production for a while, and keep improving from time to time. Feel free to give it a try!

Tags

revamp , android , mvp

About the author
comments powered by Disqus