Code Monkey home page Code Monkey logo

zhihudaily's Introduction

ZhihuDaily

This is a project to learn how to build an app with different architecture. The tags in master shows the evolution of the project step-by-step, You will see this project becomes more clear than before after using the MVP.The branch shows the other implementation. As well, the project is continue refactoring.

该项目是知乎日报的一个实现,主要用来学习各种项目架构.从最基本的代码(全部代码在Activity中)到MVP等,之后依然会持续更新. 使用tag来表明一步一步重构代码进化过程,从这些分支上可以看到使用MVP的代码是多么清晰. 项目代码会不断更新,不断进行重构。

Version

  • v1.5

    make the componentization more beautiful to run. every component can run alone, and can be run with other components, also each components is separate from each other. 完善组件化。通过配置runalone.json使各个组件能单独运行;各个组件能选取依赖项;各个组件互相隔离;

  • v1.4

    make it componentization, better than before. But there is still some problem with component. The component cannot compile other components,it must be run as a single application, which means the project must run as all in application or an application with other modules. 将项目初步进行组件化。 这种结构下的组件化不能做到组件依赖其他组件运行。因为当前项目运行的状态要么是全是application,或者是一个application和其他module.

  • v1.3

    review with RxJava, based on the MVP,also with Retrofit 在MVP基础上使用RxJava重构,同时网络框架替换为Retrofit.

    • 添加Presenter生命周期方法,attachView()和 detachView()方法对 Subscription 解绑.
    • 此中不把Activity当做Controller,因为这样做限制太大,直接在Fragment中进行创建和attachView
  • v1.2

    review with mvp,making the View and Logic separating from each other.It is so great,and looks more elegant. 使用MVP重构,List页面参考Google samples的三层架构,Detail页面没有把remote和locale分开,你可以看到这两者的区别.

  • v1.1

    pull all codes out from activity into fragment 将部分代码抽离到Fragment中,为下一步打基础

  • v1.0

    version 1.0,all codes are in the Activity and with no fragments, the basic code for all variants. 全部代码在Activity中,作为重构的基础

Branches

  • the master has a lot of tags, and the first version code is on it.
  • the branch_mvp_variant is a variant of MVP,which use Fragment/Activity as Presenter. In this way, you can do it with no interfaces, using Generic to decoupled(little hard to understand), and I put clickListeners in Presenters, so it looks more clearly. (This branch does not merge into master. I prefer the normal one.)
  • the branch_rxcache replace GreenDao with RxCache to save data

中文版:

  • master分支上的tag表示每次重构后的完整代码
  • branch_mvp_variant分支是 MVP变种 分支,使用Fragment作为Presenter,我把点击事件当做逻辑放在Presenter中,代码简化了不少
  • the branch_rxcache 替换了GreenDao,使用RxCache来做缓存

ScreenShot

ZhihuDaily

TODO

  • 17/10/26 使用GreenDao造成了多个实体类,如在项目中GreenDao生成的SavedStory一系列,和Story重复,而此时又没有使用Clean架构来使用该bean,造成重复和难以理解。 所以这也算GreenDao的一个弊端吧。 将会使用liteOrm或其他一些数据库来解决该问题。

  • 17/11/1 在v1.4版本基础上,需要再次进行组件化,使用gradle插件将组件完全分离。 模仿DDComponentForAndroid

ThanksTo

知乎日报API
PureZhihuD

文章总结

Android 项目框架 使用MVP开发
Android 网络框架 Retrofit2.0介绍、使用和封装
Android 项目框架 使用RxJava开发
Android 依赖注入框架 Dagger2使用

Download

fir.im downLoad

zhihudaily's People

Contributors

baiiu avatar

Stargazers

 avatar Farhad avatar mundane avatar  avatar Qiaoidea avatar jiaopenghui avatar  avatar  avatar 安诺爱思考 avatar Dawish avatar Pranav Lathigara avatar  avatar  avatar  avatar ango avatar  avatar duxiao avatar YuQiYang avatar Diors Zhang avatar  avatar hunting for a job avatar  avatar allen avatar zzz avatar 小coder avatar chenguoquan avatar chaowen avatar Neyo avatar Struggle_li avatar Andust avatar  avatar

Watchers

James Cloos avatar  avatar chuanxing avatar

zhihudaily's Issues

编译的时候报错了=-=

12-06 01:56:54.829 13599-13599/com.baiiu.zhihudaily E/PRETTYLOGGER: ╔════════════════════════════════════════════════════════════════════════════════════════
12-06 01:56:54.830 13599-13599/com.baiiu.zhihudaily E/PRETTYLOGGER: ║ Thread: main
12-06 01:56:54.830 13599-13599/com.baiiu.zhihudaily E/PRETTYLOGGER: ╟────────────────────────────────────────────────────────────────────────────────────────
12-06 01:56:54.830 13599-13599/com.baiiu.zhihudaily E/PRETTYLOGGER: ║ NewsListPresenter.access$lambda$2 (NewsListPresenter.java:0)
12-06 01:56:54.830 13599-13599/com.baiiu.zhihudaily E/PRETTYLOGGER: ║ NewsListPresenter.lambda$loadNewsList$2 (NewsListPresenter.java:60)
12-06 01:56:54.830 13599-13599/com.baiiu.zhihudaily E/PRETTYLOGGER: ╟────────────────────────────────────────────────────────────────────────────────────────
12-06 01:56:54.830 13599-13599/com.baiiu.zhihudaily E/PRETTYLOGGER: ║ java.net.UnknownHostException: Unable to resolve host "news-at.zhihu.com": No address associated with hostname
12-06 01:56:54.830 13599-13599/com.baiiu.zhihudaily E/PRETTYLOGGER: ╚══════════════════════════════════════════════════════════

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.