Android 技术选型(持续更新中...)
log打印
经典库logger的优化版
https://www.zybuluo.com/shark0017/note/163330
https://github.com/tianzhijiexian/logger
网络请求
我希望达到的目标是,对着接口文档,api链式调用着配置一下,一个请求就完成了.
懒得去记具体框架里的类啊注解啊什么的,
甚至,http协议的一些复杂内容我也不想涉及,比如缓存控制->把常用的那些缓存模式变成几个int值给我选就行了,我才懒得用的时候考虑请求头响应头什么的.
一句话,傻瓜式使用.
所以,从这个角度看,retrofit不是好的选择.
okhttp + chuck
对okhttp的封装:
https://github.com/hss01248/HttpUtilForAndroid :我花最多精力维护的一个库,深度结合android平台特点,使用时爽得飞起.
https://github.com/jeasonlzy/okhttp-OkGo 这个很多人用,也是傻瓜式使用.
https://github.com/jgilfelt/chuck 通过拦截器的方式拿到请求和响应信息,然后显示在一个单独的activity中算是应用内抓包
图片加载
包括普通图片加载和大图加载,以及大图轮播,以及图片的一些特殊效果,比如圆角,圆形,高斯模糊等等.
https://github.com/hss01248/ImageLoader
此库基于glide和fresco封装,实现了图片的常见特殊效果.
优化了sumsamplingImageView的大图轮播,使轮播时内存占用也一直维持在20M的水平.
配置全部链式api调用
本地图片选择,裁剪,压缩
系统intent被国产rom搞得不能用,各种兼容性bug,必须用框架
https://github.com/hss01248/PhotoOut 用链式api串起几个优秀的开源库,从而串起了整个流程.
https://github.com/crazycodeboy/TakePhoto/ 这个star很多,也是将整个流程串起来了.
提示性UI
toast:
Toasty : https://github.com/hss01248/Toasty
带有状态的toast,有succes.error,warn,info,normal 五种,以及debug一种(只在debug模式下弹出).
dialog :
DialogUtil : https://github.com/hss01248/DialogUtil
囊括所有常见的通用型dialog,既有ios风格又有android风格.不需要activity引用即可弹出.
https://github.com/saiwu-bigkoo/Android-AlertView ios风格的dialog
notification
NotifyUtil: https://github.com/hss01248/NotifyUtil
api链式调用,摆脱原生的难用的api.封装了常用的通知模式.
必用的UI小组件
选择器:
https://github.com/Bigkoo/Android-PickerView
内置时间日期选择器,UI自定义配置很丰富
还有三级,二级,一级联动选择器
https://github.com/gzu-liyujiang/AndroidPicker
各种丰富的内置选择器:
包括日期选择器、时间选择器、单项选择器、城市地址选择器、车牌号选择器、数字选择器、星座选择器、生肖选择器、颜色选择器、文件选择器、目录选择器等
https://github.com/yangxu4536/MeiTuanLocateCity
仿美团城市选择界面,可直接用在实际项目中
https://github.com/Bigkoo/EasySideBar
一款按字母排序库,已封装好城市数据,风格仿美团,可定制化强。
多条件筛选菜单
https://github.com/dongjunkun/DropDownMenu
类似美团,爱奇艺电影票下拉菜单
优惠券效果
https://github.com/dongjunkun/CouponView
轮播图
https://github.com/glassLake/AndroidImageSliderByFresco 第一次进入有快速滚动两张的bug
https://github.com/saiwu-bigkoo/Android-ConvenientBanner
https://github.com/youth5201314/banner
多种模式 Android广告图片轮播控件,支持无限循环和多种主题,可以灵活设置轮播样式、动画、轮播和切换时间、位置、图片加载框架等!
快速分组侧边栏
https://github.com/saiwu-bigkoo/Android-QuickSideBar
https://github.com/CaMnter/EasyRecyclerViewSidebar
https://github.com/gjiazhe/WaveSideBar
给图片打标签
https://github.com/saiwu-bigkoo/Android-PictureTagView
滚动刻度尺
https://github.com/LichFaker/ScaleView
加减号控制数字增减
https://github.com/saiwu-bigkoo/Android-SnappingStepper
状态栏变色
毫无疑问是这个:
https://github.com/jgilfelt/SystemBarTint
api封装一下,简化使用:
StatusbarUtil.java
文件下载
https://github.com/lingochamp/FileDownloader
专注于文件下载,各种高级特性.适用于对文件下载业务要求较高的项目
数据库
greendao太难用,还是ormlite好.
https://github.com/j256/ormlite-android
数据库调试方式:
无需root.在浏览器端通过http请求的方式直接查看和操作数据库,方便快捷
https://github.com/amitshekhariitbhu/Android-Debug-Database
页面状态管理
https://github.com/hss01248/PageStateManager
工具类库
这个也没有疑问,就是这个高大全的库了:
https://github.com/Blankj/AndroidUtilCode
Rx全家桶
为什么没有retrofit? 因为它的api太难用了啊.设计很优美,但是使用起来坑太多,又繁琐.
RxAndroid
让你随意地切换线程
RxBinding
从此摆脱频繁点击导致的重复操作的烦恼
RxLifecycle
生命周期管理,减少内存泄漏
RxPermissions
6.0运行时权限
Rx Preferences
通过 RxJava 的方式来访问 SharedPreferences
键盘监听
键盘监听是android一大坑.
防止自动弹出键盘:
activity 标签里加android:windowSoftInputMode="stateHidden|stateAlwaysHidden"
https://github.com/yshrsmz/KeyboardVisibilityEvent
屏幕适配
https://github.com/hongyangAndroid/AndroidAutoLayout
UI特效
水波纹效果
https://github.com/traex/RippleEffect 兼容到api9
动画
https://github.com/florent37/ViewAnimator
A fluent Android animation library
换皮肤主题
https://github.com/hongyangAndroid/ChangeSkin
文件和缓存相关
https://github.com/vincentbrison/dualcache
This android library provide a cache with 2 layers, one in RAM in top of one disk.
https://github.com/baoyongzhang/Treasure
Very easy to use wrapper library for Android SharePreferences
content-provider
https://github.com/EverythingMe/easy-content-providers
原生组件的扩展
edittext
https://github.com/rengwuxian/MaterialEditText
viewpager
https://github.com/Devlight/InfiniteCycleViewPager
listview和recycleview
https://github.com/CymChad/BaseRecyclerViewAdapterHelper
第三方分享和登录,统计
使用友盟的sdk,然后再封装一层
参见第三方登录/分享最佳实践
自己封装的一个:
https://github.com/hss01248/UmengUtil
对umeng分享,第三方登录以及统计的api的封装,避免再出现api大幅改动而到处改源码.真正的一行代码完成分享和登录
注:上面最佳实践的一些好的思路还没有整合到这个库中,目前只集成了qq,weixin,sina三家.
第三方推送
集成第三方推送最佳实践
一句话来,小米rom就用小米推送,其他用友盟推送,更细致一点,还可以华为rom用华为推送
权限申请
6.0以下的悬浮窗权限申请,以及判断:
https://github.com/hss01248/FloatWindowPermission
6.0以上,运行时权限,还包括悬浮窗权限,以及读写sd卡权限(非运行时,但华为手机和平板要求):
RxPermissions:
https://github.com/tbruyelle/RxPermissions
音频录制和播放
音频录制
当然是录制成跨平台的mp3格式:
https://github.com/hss01248/AndroidMP3Recorder
基于start最多的AndroidMP3Recorder项目改进,经受了一个实际线上项目两年的考验
特点: 边录边转码,暂停可播,方法安全,回调丰富,6.0以下权限也适配了
音频播放
mediaplayer 难用得你想死,有木有?路径设置很多rom互相不承认.操作方法不安全,各种异常.
据同学说这个还可以,我没有实际用过.
https://github.com/Piasy/RxAndroidAudio
视频相关
短视频录制和播放:
第三方的趣拍已经收费了,一年5万,略贵.下面这个是开源中比较好的,不过没有特效.
https://github.com/mabeijianxi/small-video-record
有特效的要收费,比如这个,录制过程中有滤镜,录制后贴图,加音乐.
https://github.com/rdsdk/rdVideoEditSDK-for-Android
视频播放
Vitamio
支持格式较多,稳定性高,性能较高,功能强大,开发难度低。个人使用免费,商业使用收费.但是,已经停止更新了.
https://github.com/yixia/VitamioBundleijkplayer
目前国内最火的,bilibili开源的.
https://github.com/Bilibili/ijkplayer
基于ijk的丰富的功能封装库:
https://github.com/CarGuo/GSYVideoPlayer
基于ijk的界面封装:
https://github.com/jjdxmashl/jjdxm_ijkplayer
作者:水牛