AndroidMVP
AndroidMVP is a library for using MVP more easy in android.
Install / Use
/learn @liuguangqiang/AndroidMVPREADME
AndroidMVP
AndroidMVP is a library for using MVP more easy in android.
##MVP Model–view–presenter (MVP) is a derivation of the model–view–controller (MVC) architectural pattern, and is used mostly for building user interfaces.
MVP is a user interface architectural pattern engineered to facilitate automated unit testing and improve the separation of concerns in presentation logic:
The model is an interface defining the data to be displayed or otherwise acted upon in the user interface. The view is a passive interface that displays data (the model) and routes user commands (events) to the presenter to act upon that data. The presenter acts upon the model and the view. It retrieves data from repositories (the model), and formats it for display in the view.
##Sample.
###Model
public class MainModel {
public String getShowHello() {
return "Hi! I am MVP.";
}
public String getSuccessTxt() {
return "Congratulation!";
}
}
###View
public interface MainUi extends BaseUi<MainUiCallback> {
void showHello(String HelloMVP);
void showSignSuccess(String txt);
}
###Presenter
public class MainPresenter extends Presenter<MainUi, MainUiCallback> {
private MainModel mMainModel;
public MainPresenter(Context context) {
mMainModel = new MainModel();
}
@Override
protected void populateUi(MainUi ui) {
ui.showHello(mMainModel.getShowHello());
}
@Override
protected MainUiCallback createUiCallback(final MainUi ui) {
return new MainUiCallback() {
@Override
public void login(String username, String password) {
//TODO implement login
ui.showSignSuccess(mMainModel.getSuccessTxt());
}
};
}
}
##Usage
###Gradle
dependencies {
compile 'com.github.liuguangqiang.mvp:library:+'
}
###Maven
<dependency>
<groupId>com.github.liuguangqiang.mvp</groupId>
<artifactId>library</artifactId>
<version>1.0.0</version>
<type>aar</type>
</dependency>
Related Skills
node-connect
349.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
