Mosby Model-View-Presenter binding for Conductor

A Model-View-Presenter library for Android apps

License

License

GroupId

GroupId

com.hannesdorfmann.mosby
ArtifactId

ArtifactId

mvp-conductor
Last Version

Last Version

0.8.2
Release Date

Release Date

Type

Type

aar
Description

Description

Mosby Model-View-Presenter binding for Conductor
A Model-View-Presenter library for Android apps
Project URL

Project URL

https://github.com/sockeqwe/mosby-conductor
Source Code Management

Source Code Management

https://github.com/sockeqwe/mosby-conductor

Download mvp-conductor

How to add to project

<!-- https://jarcasting.com/artifacts/com.hannesdorfmann.mosby/mvp-conductor/ -->
<dependency>
    <groupId>com.hannesdorfmann.mosby</groupId>
    <artifactId>mvp-conductor</artifactId>
    <version>0.8.2</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.hannesdorfmann.mosby/mvp-conductor/
implementation 'com.hannesdorfmann.mosby:mvp-conductor:0.8.2'
// https://jarcasting.com/artifacts/com.hannesdorfmann.mosby/mvp-conductor/
implementation ("com.hannesdorfmann.mosby:mvp-conductor:0.8.2")
'com.hannesdorfmann.mosby:mvp-conductor:aar:0.8.2'
<dependency org="com.hannesdorfmann.mosby" name="mvp-conductor" rev="0.8.2">
  <artifact name="mvp-conductor" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.hannesdorfmann.mosby', module='mvp-conductor', version='0.8.2')
)
libraryDependencies += "com.hannesdorfmann.mosby" % "mvp-conductor" % "0.8.2"
[com.hannesdorfmann.mosby/mvp-conductor "0.8.2"]

Dependencies

compile (3)

Group / Artifact Type Version
com.hannesdorfmann.mosby : mvp jar 2.0.1
com.bluelinelabs : conductor jar 2.0.1
com.android.support » appcompat-v7 jar 24.0.0

Project Modules

There are no modules declared in this project.

Mosby - Conductor

Plugin for using Mosby with Conductor, a small, yet full-featured framework that allows building View-based Android applications.

Dependencies

Build Status

For Conductor 2.x with Mosby 3.x use:

dependencies {
    compile 'com.hannesdorfmann.mosby3:mvp-conductor:3.1.0'
    // or
    compile 'com.hannesdorfmann.mosby3:viewstate-conductor:3.1.0' // optional viewstate feature
    // or
    compile 'com.hannesdorfmann.mosby3:mvi-conductor:3.1.0' // Model-View-Intent
}

Snapshot

Latest snapshot (from master branch):

dependencies {
    compile 'com.hannesdorfmann.mosby3:mvi-conductor:3.1.1-SNAPSHOT' // Model-View-Intent
    // or
    compile 'com.hannesdorfmann.mosby3:mvp-conductor:3.1.1-SNAPSHOT'
    // or
    compile 'com.hannesdorfmann.mosby3:viewstate-conductor:3.1.1-SNAPSHOT' // optional viewstate feature

}

You also have to add the url to the snapshot repository:

allprojects {
  repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
  }
}

Usage

Extend your own Conductor Controller from MvpController or from MvpViewStateController if you want to use ViewState feature or from or MviController if you want to use the Model-View-Intent feature.

There are also two base LCE (Loading-Content-Error) Controllers you can extend from: MvpLceController and MvpLceViewStateController.

If you don't want to extend from one of the base controller classes shown above, you can always bring in Mosby easily in any Conductor controller:

class MyController extends Controller
                  implements MvpView, MvpConductorDelegateCallback<V, P> {

  // Initializer block (will be copied into constructor)
  {
    addLifecycleListener(new MvpConductorLifecycleListener<V, P>(this);
  }

  // implement all methods from  MvpConductorDelegateCallback like createPresenter() etc.
  ...

}

If you need ViewState support simply use MvpViewStateConductorLifecycleListener and MvpViewStateConductorDelegateCallback. Do the same for Model-View-Intent but use MviConductorLifecycleListener and MviConductorDelegateCallback.

Lifecycle

Presenter will be created right after Controller.onCreateView() but before Controller.onAttach(). So in onAttach() presenter is ready to be used. View will be detached from Presenter in Controller.onDestroyView() by calling presenter.detachView(true) (true if view is just detached temporarily i.e. screen orientation change, false if view is detached permanently because Controller will be destroyed)

Example

There is a nice external repository that shows how to use Mosby-Conductor. All credit goes to James Shvarts.

This repository contains a simple TO DO List app which is still work in progress.

License

Copyright 2016 Hannes Dorfmann

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.

Versions

Version
0.8.2
0.8.1
0.8.0
0.7.0