GankClient-Kotlin

Introduction: kotlin 实现的干货集中营 Android 客户端 MVP+Dagger2+Databinding+Rxjava+Retrofit+Okhttp3
More: Author   ReportBugs   
Tags:
Kotlin-

image

image image

gank.io kotlin 实现的干货集中营客户端

风格采用了 Material Design. 多数控件都是 design 包里面的。

项目模式

Kotlin

让你的代码量大大减少,函数式编程让你爽到飞上天!如果你想学习 Kotlin,本项目应该会给你不少帮助。

MVP

通过契约类 Contract 管理 View Model Presenter 接口。

  • Model -- 主要处理业务,用于数据的获取(如网络、本地缓存)。
  • View -- 用于把数据展示,并且提供交互。
  • Presenter -- View 和 Model 交互的桥梁,二者通过 Presenter 建立联系。

    主要流程如下: 用户与 View 交互,View 得知用户需要加载数据,告知 Presenter,Presenter 则告知 Model,Model 拿到数据反交于 Prsenter,Presenter 将数据交给 View 进行展示。

Dagger2

项目中,主要进行 presenter、model、retrofit Api 等类的注入操作。

ApiComponent

主 Component、用于注入 AppComponent、便于提供子 Component 依赖。

 依赖于:

 1.ApiModule(提供 okhttpClient、Retrofit、Api 等)

 2.AppModule(提供 context 对象(okhttp 拦截器所需))

FuckGoodsComponent

父 Component 为 ApiComponent 用于注入 FuckGoodsPresenter

 依赖于: FuckGoodsModule(提供 FuckGoodsView)

RandomComponent

父 Component 为 ApiComponent 用于注入 RandomPresenter

依赖于 : RandomModule(提供 RandomView) 

Rxjava + Retrofit + okhttp3

主要用于网络访问。

DeepLinkDispatch

基于路由进行页面转发。

GankClientUri 定义一些路由规则、URI 等

GankRouter 统一由此进行路由操作

GSON

用于 json 的解析操作。

Glide

用于图片的加载。

ByeBurGer

用于导航栏以及悬浮按钮滑动隐藏。

License

Copyright 2016 androidwing1992

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.
Apps
About Me
GitHub: Trinea
Facebook: Dev Tools