Giter Site home page Giter Site logo

1057642496 / fastlib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arieshoo/fastlib

0.0 1.0 0.0 237.91 MB

一个Android项目级快速开发框架,节约大部分写常用功能时间以实现更多项目业务功能及体验上的优化..有问题欢迎issue。主要实现功能: 1、基于Retrofit2.x及RxJava2.x的网络请求封装、网络请求与生命周期绑定、快速观察者、快速loading观察者、快速返回常用错误 2、 常用功能库二次封装方便调用:Glide加载图片封装、TabLayout+ViewPager Fragment切换封装、Logger日志打印封装 3、 多种常用界面布局:标题+多状态+下拉刷新+列表、标题+ViewPager等方便快速创建常用布局增加layout复用 4、Fragment 懒加载封装 5、 快速实现Activity滑动返回、下拉刷新加载更多、沉浸式等

License: Apache License 2.0

Java 100.00%

fastlib's Introduction

FastLib-一个快捷实现UI搭建及网络请求的Android开发库


API GitHub license

简介:

一个Android项目级快速开发框架,节约大部分写常用功能时间以实现更多项目业务功能及体验上的优化.有问题欢迎issue。

Demo中使用到的网络请求api来源于豆瓣API V2 版权及最终解释权归d豆瓣所有,如有侵权请联系删除!

主要功能

  • 基于Retrofit2.x及RxJava2.x的网络请求封装、网络请求与生命周期绑定、快速观察者、快速loading观察者、快速返回常用错误
  • 常用功能库二次封装方便调用:Glide加载图片封装、TabLayout+ViewPager Fragment切换封装、Logger日志打印封装
  • 多种常用界面布局:标题+多状态+下拉刷新+列表、标题+ViewPager等方便快速创建常用布局增加layout复用
  • Fragment 懒加载封装
  • 快速实现Activity滑动返回、下拉刷新加载更多、沉浸式等

其它功能请在demo中发现

[Download]

Gradle集成-尽量使用正式版本

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}
dependencies {
     implementation 'com.github.AriesHoo:FastLib:2.2.1'
}

Maven集成

   	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>
	<dependency>
	    <groupId>com.github.AriesHoo</groupId>
	    <artifactId>FastLib</artifactId>
	    <version>2.2.1</version>
	</dependency>

Compile集成

implementation project(':fastLib')

包含第三方库

    compileSdkVersion = 27
    buildToolsVersion = "27.0.2"
    minSdkVersion = 15
    targetSdkVersion = 27
    supportVersion = "27.0.2"
dependencies {
        compileOnly 'com.android.support:design:'.concat(supportVersion)
        compileOnly 'com.android.support:appcompat-v7:'.concat(supportVersion)
        compileOnly 'com.android.support:recyclerview-v7:'.concat(supportVersion)
        //万能适配器
        compileOnly 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.40'
        //webView库
        compileOnly 'com.just.agentweb:agentweb:4.0.2'
        //下拉刷新库
        compileOnly 'com.scwang.smartrefresh:SmartRefreshLayout:1.0.5.1'
        //图片加载
        compileOnly 'com.github.bumptech.glide:glide:4.5.0'
        //常用UI控件(TitleBarView、RadiusView等)
        api 'com.github.AriesHoo.UIWidget:widget-core:3.2.6'
        //日志打印
        api 'com.orhanobut:logger:2.1.1'
        //注解
        api 'com.jakewharton:butterknife:8.8.1'
        //retrofit+rxjava 网络请求及数据解析相关
        api "io.reactivex.rxjava2:rxjava:2.1.14"
        api 'io.reactivex.rxjava2:rxandroid:2.0.1'
        api 'com.squareup.retrofit2:retrofit:2.3.0'
        api 'com.squareup.retrofit2:converter-gson:2.3.0'
        api 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
        api 'com.squareup.okhttp3:logging-interceptor:3.8.0'
        api 'com.google.code.gson:gson:2.8.5'
        //处理rxjava内存泄漏-生命周期绑定
        api 'com.trello.rxlifecycle2:rxlifecycle-components:2.1.0'
        //滑动返回Activity
        api 'cn.bingoogolapple:bga-swipebacklayout:1.1.8@aar'
        //快速Tab库
        api 'com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar'
        //页面事件交互
        api 'org.simple:androideventbus:1.0.5.1'
        //多状态视图切换
        api 'com.github.Bakumon:StatusLayoutManager:1.0.4'
}

实现功能-多看注释及版本修改说明

  • 支持全局多种参数配置(加载更多+多状态页面+网络加载Loading+下拉刷新头+TitleBarView属性设置+Activity滑动关闭-类微信+http网络返回及错误处理+Activity与Fragment生命周期监听+主页返回键控制) 参看FastManager 实现及 App配置
  • 支持修改三方库 TitleBar 及虚拟导航栏沉浸式 及 Activity滑动关闭功能
  • 网络请求与Activity/Fragment生命周期绑定--通过RxLifeCycle2.x
  • Retrofit2.x+RxJava2.x 网络请求简要封装支持多BaseUrl、支持快速下载、快速上传文件功能 参看FastRetrofit
  • Basis开头是通用基类:BasisActivityBasisFragment
  • Fast开头的是快速创建常见功能页面:FastMainActivity-快速创建包含tab主Activity;FastTitleActivity-快速创建包含TitleBarView的Activity;FastRefreshLoadActivity-快速创建包含TitleBarView及下拉刷新、多状态切换的Activity;FastWebActivity快速创建应用内webView的Activity;FastTitleFragment-快速创建包含TitleBarView的Fragment;FastRefreshLoadFragment-快速实现下拉刷新的Fragment;FastTitleRefreshLoadFragment-快速实现包含TitleBarView及下拉刷新与多状态切换Fragment
  • Manager类是三方库二次封装:目前有GlideManager-图片加载库Glide库封装;LoggerManager-日志打印logger库封装;RxJavaManager-RxJava实现timer;TabLayoutManager-FlycoTabLayout+ViewPager使用:包括CommonTabLayout、SlidingTabLayout、SegmentTabLayout在FragmentActivity与Fragment中使用的封装
  • Util类为常用工具:FastStackUtil-应用Activity栈管理类;FastUtil-部分应用常用功能类;SizeUtil-尺寸转换类;SPUtil -SharedPreferences使用类;TimeFormatUtil-时间转换类;ToastUtil-单例模式toast工具类:可配置是否后台显示
  • Delegate为代理类:FastTitleDelegate-快速实现包含TitleBarView的Fragment/Activity;FastRefreshLoadDelegate-快速实现下拉刷新、上拉加载更多、多状态切换的Fragment/Activity
  • 沉浸式状态栏:继承FastTitleActivity/FastRefreshLoadActivity/FastWebActivity/FastTitleFragment/FastTitleRefreshLoadFragment 无需额外代码即可实现
  • 状态栏白底黑字模式:同沉浸式状态栏功能继承,只需重写父类实现接口isLightStatusBarEnable即可实现;MIUI V6、Flyme 4.0、Android 6.0以上:参考UIWidget-StatusBarUtil
  • 快速创建圆角、全圆、按下、不可点击状态的TextView、EditText、FrameLayout、LinearLayout、RelativeLayout、RadioButton、CheckBox减少shape文件创建设置:参考库UIWidget
  • Activity/Fragment 页面事件交互(支持设置TAG)
  • 万能适配器(ListView、GridView,RecyclerView):可添加多个Header和Footer
  • Fragment懒加载,Activity可见时加载--统一了普通Fragment及与ViewPager配合滑动的用户可见回调
  • 下拉刷新、上拉加载:支持多种效果的刷新头及自定义刷新头-参考库SmartRefreshLayout

注意事项

重大更新日志 其它版本参看Release

  • 2.2.10-beta6  

    • 重大变更:重构大部分代码及实现方式删除许多类及实现方法包括三方库慎重升级与之前版本有很大差异
    • 优化:BasisFragment 控制是否为单Fragment 方法     
    • 优化:调整ActivityFragmentControl 将状态栏及导航栏控制增加
    • 优化:多状态管理StatusLayoutManager调整完成
    • 优化:滑动返回控制swipeBack功能新增各种回调功能
    • 优化:将原默认配置方法调整到最终实现类功能
    • 新增:增加友盟统计功能演示
    • 新增:新增首页演示其它三方库状态栏及导航栏功能控制
    • 新增:个人MineFragment中选择头像功能三方库状态栏及导航栏控制示例
    • 优化:UI全局控制相关回调并调整三方库Activity控制
    • 优化:新增FastRetrofit 下载/上传功能
    • 优化:新增FastRetrofit 控制多BaseUrl方式
    • 新增:新增Demo检查版本功能试验下载文件功能
    • 删除:删除原多状态布局相关配置
    • 修复:修改FastRefreshActivity 设置Adapter错误BUG
  • 2.2.9-beta6        

    • 重构设置全局TitleBarView设置方式(通过TitleBarViewControl实现可参看AppImpl实现类)
  • 2.2.9-beta5        

    • library 直接compile UIWidget core 3.1.0版本
  • 2.1.5 更新        

    • 新增众多全局设置TitleBarView属性、Adapter加载动画、SmartRefreshLayout刷新配置、Glide加载占位Drawable属性等控制的FastConfig类用于全局设置应用通用属性并减少部分冗余代码及冗余drawable资源文件
  • 2.1.0 更新        

    • 将部分系统及第三方库在FastLib里使用provided编译,实际项目中需要根据项目需要compile合适的版本避免版本重复

录屏预览

虚拟导航栏控制-参考AppImpl类 NavigationBarControl接口实现注释说明

开启GPU过度绘制检测+GPU呈现模式分析

鸣谢

License

Copyright 2017 Aries Hoo

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.

fastlib's People

Contributors

arieshoo avatar puyunfeng avatar

Watchers

 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.