MosbyMVP Save

Exploring Mosby and Mosby plugin for Conductor for building Android apps with MVP

Project README

Getting Started with Mosby MVP

Build Status

My Medium article to accompany this repo is here: Get your MVP right with Mosby

This repo explores Mosby and Mosby Conductor plugin implementing MVP pattern.

Both Mosby and Conductor have excellent documentation on GitHub and at Hannes Dorfmann's blog.

Why use a library to implement MVP?

Model-View-Presenter (MVP) is hard to implement correctly (bug-free). Handling view state is another big challenge. There are many different implementations of MVP out there.

If there is a library that manages MVP wiring and view state for you so you can concentrate on your app logic and UI, why not check it out?

Definitions

  • ViewState is used to preserve current view data such as loading in progress, data displayed, error displayed, etc. after configuration changes such as device rotation. More details at ViewState
  • LCE describes Loading-Content-Error flow typical of many Android apps where loading indicator (such as ProgressBar) is followed by displaying content or error.
  • Delegate Callbacks is a set of interfaces that Mosby uses internally which you are welcome to implement yourself instead of inheriting from base MVP classes. For instance, instead of extending MvpActivity, implement MvpDelegateCallback or instead of extending MvpViewStateController implement MvpViewStateConductorDelegateCallback and so forth.
  • MvpNullObjectBasePresenter is a special kind of Presenter which implements the Null Object Pattern. It makes it unnecessary for you to check if the View is attached prior to calling methods on it. Any calls on the View that is not attached will do nothing (no op); no NullPointerExceptions will be thrown.
  • MvpQueuingBasePresenter is a special kind of Presenter which lets you queue the calls on the View and replay them in same order once the View becomes available.

Modules in this repo

All examples implement MVP pattern

  • Hello World
    • Simple Hello World sample. [link]
  • Hello World with ViewState
    • Hello World with ViewState preserved across configuration changes. [link]
  • LCE pull-to-refresh with ViewState
    • Todo-style notes screen using RecyclerView with ViewState preserved across configuration changes. [link]
  • Mosby Conductor Hello World
    • Mosby with Conductor plugin sample. [link]
  • Mosby Conductor Hello World with ViewState
    • Mosby with Conductor plugin with ViewState preserved across configuration changes. [link]
  • Mosby Conductor LCE pull-to-refresh with ViewState
    • Mosby with Conductor plugin LCE pull-to-refresh with ViewState preserved across configuration changes. [link]
  • Mosby Conductor Dagger Sample
    • Mosby with Conductor plugin used in a small Clean Architecture sample app with Dagger and Retrofit. Uses custom Dagger scopes. [link]

License

Copyright 2017 James Shvarts

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Open Source Agenda is not affiliated with "MosbyMVP" Project. README Source: jshvarts/MosbyMVP
Stars
26
Open Issues
1
Last Commit
5 years ago
Repository

Open Source Agenda Badge

Open Source Agenda Rating