MultiState
=====================================================================
MultiState 这个库为了管理请求数据的加载中、加载成功、加载失败、数据为空的情况,与MultiType配合使用更合适。
RecyclerViewWrapper
==============================================================================
RecyclerViewWrapper 这个库结合【MultiType】和【MultiState】并使用了SmartRefreshLayout这个库来统一管理各个加载状态并简单封装了下拉刷新、上拉加载更多等相关功能,欢迎下载apk体验。
Sample预览图
Gradle配置
// MultiType
api ‘com.sunfusheng:MultiType:’
// MultiState
api ‘com.sunfusheng:MultiState:’
// RecyclerViewWrapper
compile ‘com.sunfusheng:RecyclerViewWrapper:’
// 如果不想用库里版本的RecyclerView,可这样配置
api ‘com.sunfusheng:RecyclerViewWrapper:’, {
exclude group: ‘com.android.support’
}
// 如果同步不下来库的话,在工程下的 build.gradle 添加:
allprojects {
repositories {
maven { url ‘https://dl.bintray.com/sfsheng0322/maven’ }
}
}
MultiType的使用
MultiTypeRegistry.getInstance().register(News.class, News::getType, News.TYPE_TEXT, new TextBinder());
MultiTypeRegistry.getInstance().register(News.class, News::getType, News.TYPE_BIG_IMAGE, new BigImageBinder());
MultiTypeRegistry.getInstance().register(News.class, News::getType, News.TYPE_RIGHT_IMAGE, new RightImageBinder());
MultiTypeRegistry.getInstance().register(News.class, News::getType, News.TYPE_THREE_IMAGES, new ThreeImagesBinder());
MultiTypeRegistry.getInstance().register(Music.class, new MusicBinder());
MultiTypeRegistry.getInstance().register(Video.class, new VideoBinder());
MultiTypeRegistry.getInstance().registerDefaultBinder(new NonsupportBinder());
MultiTypeAdapter multiTypeAdapter = new MultiTypeAdapter();
multiTypeAdapter.register(News.class, News::getType, News.TYPE_TEXT, new TextBinder());
multiTypeAdapter.register(News.class, News::getType, News.TYPE_BIG_IMAGE, new BigImageBinder());
multiTypeAdapter.register(News.class, News::getType, News.TYPE_RIGHT_IMAGE, new RightImageBinder());
multiTypeAdapter.register(News.class, News::getType, News.TYPE_THREE_IMAGES, new ThreeImagesBinder());
最后这里放上我这段时间复习的资料,这个资料也是偶然一位朋友分享给我的,里面包含了腾讯、字节跳动、阿里、百度2020-2021面试真题解析,并且把每个技术点整理成了视频和PDF(知识脉络 + 诸多细节)。
还有 高级架构技术进阶脑图、高级进阶架构资料 帮助大家学习提升进阶,这里我也免费分享给大家也节省大家在网上搜索资料的时间来学习,也可以分享给身边好友一起学习。
有需要的朋友可以点击:**Android面试资料**免费领取~
一起互勉~
8%AF%95%E6%8B%BF%E9%AB%98%E8%96%AA%EF%BC%81.md)**免费领取~
[外链图片转存中…(img-qYFABeAc-1645004511807)]
[外链图片转存中…(img-gWtaA1GR-1645004511808)]
一起互勉~