A Model-View-Presenter and Model-View-Intent library for Android apps.
dependencies {
compile 'com.hannesdorfmann.mosby3:mvi:3.1.1' // Model-View-Intent
// or
compile 'com.hannesdorfmann.mosby3:mvp:3.1.1' // Plain MVP
// or
compile 'com.hannesdorfmann.mosby3:viewstate:3.1.1' // MVP + ViewState support
}
Additional modules:
dependencies {
// MVP + ViewState + LCE Views
compile 'com.hannesdorfmann.mosby3:mvp-lce:3.1.1'
// Null Object Presenter for MVP
compile 'com.hannesdorfmann.mosby3:mvp-nullobject-presenter:3.1.1'
// Queuing Presenter for MVP
compile 'com.hannesdorfmann.mosby3:mvp-queuing-presenter:3.1.1'
}
SNAPSHOT:
dependencies {
compile 'com.hannesdorfmann.mosby3:mvi:3.1.2-SNAPSHOT'
compile 'com.hannesdorfmann.mosby3:mvp:3.1.2-SNAPSHOT'
compile 'com.hannesdorfmann.mosby3:viewstate:3.1.2-SNAPSHOT'
compile 'com.hannesdorfmann.mosby3:mvp-lce:3.1.2-SNAPSHOT'
compile 'com.hannesdorfmann.mosby3:mvp-nullobject-presenter:3.1.2-SNAPSHOT'
compile 'com.hannesdorfmann.mosby3:mvp-queuing-presenter:3.1.2-SNAPSHOT'
}
You also have to add the url to the snapshot repository:
allprojects {
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}
See the project website.
For Model-View-Intent check out this blog post series.
The changelog can be found in the release section
In Mosby 3.0 we have changed the package name from com.hannesdorfmann.mosby
to com.hannesdorfmann.mosby3
(note the 3 at the end).Migrating a Mosby 2.x based app to Mosby 3.0 should be straightforward:Just replace all import statements of your app in android studio with Edit -> Find -> Replace in Path ...
and set find import com.hannesdorfmann.mosby
replace with import com.hannesdorfmann.mosby3
.There were also some minor API changes (see changelog),but most apps should be fine by replacing the import statements.
Mosby has a plugin for Conductor. You can find it here: https://github.com/sockeqwe/mosby-conductor
Copyright 2015 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.
github 地址 官方文档地址 Model-View-Presenter library for android 总的来说是一个轻量级的用于android的mvp库,里面没有任何三方库(三方库需要维护成本)。 解决的是MVC模式下,activity既承担了UI工作,又承担了业务逻辑,过于臃肿的问题。 MVP模式下,Activity承担UI操作,Presenter承担业务逻辑,Model数据模型。
在app下的build.gradle 中添加 implementation 'com.hannesdorfmann.mosby3:mvp:3.1.1' 1.view package com.example.mosbydemo; /** * Created by Yangzb on 2019/4/29 14:24 * E-mail:yangzongbin@si-top.com * Descr
//首先Gradle中引入Mvp框架 compile ‘com.hannesdorfmann.mosby:mvp:2.0.1’ compile ‘com.hannesdorfmann.mosby:viewstate:2.0.1’ **//mainActivity中** public class MainActivity extends MvpActivity<LoginView, Log
github 地址 官方文档地址 Model-View-Presenter library for android 总的来说是一个轻量级的用于android的mvp库,里面没有任何三方库(三方库需要维护成本)。 解决的是MVC模式下,activity既承担了UI工作,又承担了业务逻辑,过于臃肿的问题。 MVP模式下,Activity承担UI操作,Presenter承担业务逻辑,Model数据模型。