Android Base MVP Concept

Source link:

Android Base MVP Concept


Requirements :

Min SDK Version 15 Target SDK Version 25 Check the compileSdkVersion, and buildToolsVersion to be the latest Build Tools Version 25.0.2 Java 1.8 

Step by step

Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {

maven {
 url "" 

Step 2. Add the dependency

dependencies {

compile 'com.github.derohimat:android-base-mvp:1.0' 

Step 3. Add this library for version 0.4 and up

//----- The core of Reactive Programming compile 'io.reactivex:rxjava:1.2.5' compile 'io.reactivex:rxandroid:1.2.1' 

Step 4. Change extends MvpView to extends BaseView

Step 5. Modify applicationId " net.derohimat.samplebasemvp" to your package name

Step 6. Profit

Step 7. Star this repository :)

How to implement a new screen following MVP

Imagine you have to implement a sign in screen.

  1. Create a new package under ui called signin
  2. Create an new Activity called ActivitySignIn. You could also use a Fragment.
  3. Define the view interface that your Activity is going to implement. Create a new interface called SignInView that extends BaseView. Add the methods that you think will be necessary, e.g. showSignInSuccessful()
  4. Create a SignInPresenter class that extends BasePresenter<SignInView>
  5. Implement the methods in SignInPresenter that your Activity requires to perform the necessary actions, e.g. signIn(String email). Once the sign in action finishes you should call getView().showSignInSuccessful().
  6. Create a SignInPresenterTest and write unit tests for signIn(email). Remember to mock the SignInView and also the DataManager.
  7. Make your ActivitySignIn implement SignInView and implement the required methods like showSignInSuccessful()
  8. In your activity, inject a new instance of SignInPresenter and call presenter.attachView(this) from onCreate and presenter.detachView() from onDestroy(). Also, set up a click listener in your button that calls presenter.signIn(email).

Library :

Inspired by


Copyright 2016 Deni Rohimat  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  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. 


Android Studio/IntelliJ IDEA Plugin for Android code generation.

Extra "injection" library for Android which uses annotation processing to generate code that does direct field assignment of your extras.

Dart is inspired by ButterKnife.

Using Java Annotations and Reflection, this library will allow you to replace some of annoying boilerplate setup from your Activities, Fragments, and Views with an annotation based approach.

This widget is a customized version of the Android ProgressBar. It provides developers the ability to add a dynamically populated progress circle with gradient.


  • Increase or decrease progress changes
  • Modifiable
    • Ring width
    • Ring background color
    • Ring fill color
    • Ring gradient

SharedPreferenceInspector provides a simple way to see shared preferences and edit them for test. No need to pull shared preferences. Just some simple clicks to see the values stored. Also with test mode to change the values and check the behavior of the app.

android-autobgbutton is a subclass of the Button widget that automatically darkens the button's background drawable when pressed, and sets it to transparent when disabled. This is inspired by iOS' automatic handling of custom background images for buttons.


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes