dmdevgo / Moxy

Moxy is Android library based on MVP pattern

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Moxy

Moxy is Android library based on MVP pattern.

Main idea of using Moxy: schemmatic using What's happened here:

  1. At View happened action blue square, that is passed to Presenter
  2. Presenter sends command red circle in ViewState
  3. Presenter starts async request green square to Model
  4. ViewState adds a command red circle in commands queue, and then passes it in View
  5. View brings itself into a state specified in the command red circle
  6. Presenter receives result of request green square from Model
  7. Presenter sends two commands green circle and blue circle in ViewState
  8. ViewState saves commands green circle and blue circle in commads queue and send them in View
  9. View brings itself into a state specified in the commands green circle and blue circle
  10. New/recreated View attach to existing Presenter
  11. ViewState sends queue of saved commands to new/recreate View
  12. New/recreated View brings itself into a state specified in the commands red circle, green circle and blue circle

Capabilities

Moxy has a few killer features on other ways:

  • Presenter stay alive when Activity recreated(it simplify work with multithreading)
  • Automatically restore all what user see when Activity recreated(including dynamic content is added)
  • Capability to changes of many Views from one Presenter

Sample

You can find the sample project here

Wiki

For all information check Moxy Wiki

References

[RU] Moxy — реализация MVP под Android с щепоткой магии

[EN] Android without Lifecycle: MPVsV approach with Moxy

Integration

Maven integration:

<dependencies>
  <dependency>
    <groupId>com.arello-mobile</groupId>
    <artifactId>moxy</artifactId>
    <version>0.5.4</version>
  </dependency>
  <dependency>
    <groupId>com.arello-mobile</groupId>
    <artifactId>moxy-android</artifactId>
    <version>0.5.4</version>
  </dependency>
  <dependency>
    <groupId>com.arello-mobile</groupId>
    <artifactId>moxy-compiler</artifactId>
    <version>0.5.4</version>
    <optional>true</optional>
  </dependency>
</dependencies>

Gradle integration:

dependencies {
  ...
  compile 'com.arello-mobile:moxy:0.5.4'
  compile 'com.arello-mobile:moxy-android:0.5.4'
  provided 'com.arello-mobile:moxy-compiler:0.5.4'
}

Android studio templates

In order to avoid boilerplate code creating for binding activity,fragments and its presentation part, we propose to use Android Studio templates for Moxy.

Templates located in /moxy-templates

License

The MIT License (MIT)

Copyright (c) 2016 Arello Mobile

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

Moxy is Android library based on MVP pattern

License:MIT License


Languages

Language:Java 95.1%Language:FreeMarker 4.9%