GithubHelp home page GithubHelp logo

base_dev's Introduction

安卓开发框架(MVP+主流框架+基类+工具类)

简介

使用MVP模式Retrofit(网络请求)+RxJava(异步操作)、GreenDAO(数据库操作)、Fresco(图片加载)、EventBus(事件通信)、ButterKnife(资源绑定)、基类工具类搭建的一个安卓开发框架。

包含了开发中常用的模块,以便日后可在其基础上进行新项目的快速开发

demo

demo大致的流程如下:

  1. 使用Retrofit+Rxjava请求豆瓣电影API,获取“正在上映”和“即将上映”的电影数据。
  2. 将数据通过两个Fragment以列表的形式进行展示,其中图片的显示使用Fresco进行加载。
  3. 点击列表项,使用GreenDAO将该电影插入到本地数据库中,并且刷新Toolbar右侧收藏的数量。
  4. 点击toolbar右侧的收藏,进入收藏页面,使用GreenDAO从本地数据库中获取数据并进行展示。
  5. 点击列表项,则将该电影从本地数据库中移除并刷新列表展示,同时使用EventBus通知上个页面刷新Toolbar右侧的收藏数量。
  6. 以上过程中,使用ButterKnife进行视图绑定,按照MVP模式进行开发,穿插使用了各种基类、工具类。

demo运行图:

demo演示效果1

demo演示效果2

包结构

项目代码整体分为5个包,如下图所示:

包结构

其中,
app包:存放全局性文件。如Application类,常量类等。
model包:存放数据处理/模型相关的文件。如实体类,数据库相关文件,网络请求相关文件等。
presenter包:存放业务逻辑服务相关的文件。
util包:存放工具类。
view包:存放视图相关的文件。如activity,fragment,adapter,自定义控件等。

可以建多一个other包,用来存放Service,BroadcastReceiver,蓝牙,友盟等其他内容模块。

base_dev's People

Contributors

fay77 avatar

Watchers

Choshim avatar

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.