android MVP旗舰版

在看过吴七禁写的关于android MVP架构系列文章之后,照着文章实现了MVP旗舰版的源码

Github:https://github.com/Cool-Boys/MVPDemo

本Demo是androidx版本,使用了对okhttp3封装请求的okgo,recyclerview刷新插件SmartRefreshLayout,底部导航EasyNavigation,androidx版Butterknife

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    implementation 'com.jakewharton:butterknife:10.0.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
    implementation 'com.squareup.okhttp3:okhttp:3.8.1'
    implementation 'com.squareup.okio:okio:1.13.0'
    implementation 'com.lzy.net:okgo:3.0.4'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    implementation 'com.github.forvv231:EasyNavigation:1.0.2'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    //1.1.0 androidx 版本
    implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-andx-4'
    implementation 'com.scwang.smartrefresh:SmartRefreshHeader:1.1.0-andx-4'
    implementation 'androidx.cardview:cardview:1.0.0'

}

在引入butterknife时注意要指定java JDK版本:

android {
  ...
  // Butterknife requires Java 8.
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

dependencies {
  implementation 'com.jakewharton:butterknife:10.1.0'
  annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
}

 在文章的基础上加入了对MvpView接口中采用泛型化定义,以及bean层,使得将请求到的数据通过bean层在view层进行操作使用。

文章通过登录的实现,以及在Fragment中加载数据信息体现MVP在开发中的实际运用。

登录
登录
主界面加载数据中
主界面加载数据中
加载数据完成
加载数据完成
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yxlalm

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值