您的位置:首页 > 移动开发

[Android入门]从零构建Android app之天气——3.配置项目环境

2016-11-24 18:09 441 查看

框架模式

选用目前比较流行的MVP框架模式。



Model:负责处理业务逻辑,数据加载,算法;

View:负责控制视图,处理交互;

Presenter:负责链接Model和View,把Model加载好的数据传递到View中展示,把View中的交互数据请求发送给Model进行处理。注意了,Presenter层由于链接了另外两个模块,在开发过程中很容易误把它们的逻辑代码放到这里,特别是Model模块的逻辑!这是应该被禁止的行为,在Presenter中编程时要好好的考虑!

配置依赖库

ButterKnife注解绑定View

Retrofit2配合OkHttp3构建网络请求Retrofit+OkHttp3的使用

Fresco用于展示绝大部分图片

Gson用于Json的转换

RxJava用于处理异步任务RxJava使用

Junit用于进行单元测试有关单元测试的使用

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'io.reactivex:rxjava:1.1.9'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.facebook.fresco:fresco:0.12.0'
compile 'junit:junit:4.12'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.squareup.okhttp3:okhttp-ws:3.3.1'
compile 'com.umeng.analytics:analytics:latest.integration'
}


目前先这么多,后面有需要再更新吧。

配置使用Lambda

配置参考我的这篇教程

规划项目结构



项目地址GitHub

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android mvp app 框架 新手