shitou9999 / FastLib

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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


fir.im API GitHub license

简介:

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

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

主要功能

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

说明:

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

2、V2.1.5版本及以后新增众多全局设置TitleBarView属性、Adapter加载动画、SmartRefreshLayout刷新配置、Glide加载占位Drawable属性等控制的FastCofig类用于全局设置应用通用属性并减少部分冗余代码及冗余drawable资源文件

其它功能请在demo中发现

[Sample PC Download]

[Sample Mobile Download]

Gradle集成

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

Compile集成

compile project(':fastLib')

包含第三方库

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

实现功能

  • 网络请求与Activity/Fragment生命周期绑定--通过RxLifeCycle2.x
  • Retrofit2.x+RxJava2.x 网络请求简要封装
  • Basis开头是通用基类:BasisActivityBasisFragment
  • Fast开头的是快速创建常见功能页面:FastMainActivity-快速创建包含tab主Activity;FastTitleActivity-快速创建包含TitleBarView的Activity;FastRefreshLoadActivity-快速创建包含TitleBarView及下拉刷新、多状态切换的Activity;FastWebActivity快速创建应用内webView的Activity;FastTitleFragment-快速创建包含TitleBarView的Fragment;FastRefreshLoadFragment-快速实现下拉刷新的Fragment;FastTitleRefreshLoadFragment-快速实现包含TitleBarView及下拉刷新与多状态切换Fragment
  • FastApplication:快速配置ToastUtil及滑动关闭Activity的Application可以根据需要继承(需要滑动关闭Activity需要参考初始化)
  • 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
  • 创建支持手势返回的Activity:继承BasisActivity一行代码实现-参考SwipeBackActivity
  • 沉浸式状态栏:继承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

注意事项

录屏预览

虚拟导航栏控制-参考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.

About

一个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


Languages

Language:Java 100.0%