Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bingoogolapple/BGAAdapter-Android

在 AdapterView 和 RecyclerView 中通用的 Adapter 和 ViewHolder。RecyclerView 支持 DataBinding 、多种 Item 类型、添加 Header 和 Footer。RecyclerView 竖直方向通用分割线 BGADivider
https://github.com/bingoogolapple/BGAAdapter-Android

androidx baseadapter recyclerview-divider recyclerview-header recyclerview-section recyclerview-sticky

Last synced: about 2 months ago
JSON representation

在 AdapterView 和 RecyclerView 中通用的 Adapter 和 ViewHolder。RecyclerView 支持 DataBinding 、多种 Item 类型、添加 Header 和 Footer。RecyclerView 竖直方向通用分割线 BGADivider

Awesome Lists containing this project

README

        

:running:BGABaseAdapter-Android:running:
============

## 目录
* [功能介绍](#功能介绍)
* [效果图与示例 apk](#效果图与示例-apk)
* [使用](#使用)
* [感谢](#感谢)
* [关于我](#关于我)
* [打赏支持](#打赏支持)

## 功能介绍
在 AdapterView 和 RecyclerView 中通用的 Adapter 和 ViewHolder。

- [x] BGAAdapterViewAdapter 和 BGAViewHolderHelper 用于简化 AdapterView 的子类(如 ListView、GridView)的适配器的编写
- [x] BGARecyclerViewAdapter 和 BGAViewHolderHelper 用于简化 RecyclerView 的适配器的编写,支持多 Item 类型,支持添加多个 Header 和 Footer,回调接口里的索引位置已经在库里处理了,不需要开发者自己减去 Header 个数
- [x] BGADivider 用于简化 RecyclerView 分割线的编写,以及轻松实现基于 RecyclerView 的吸顶悬浮分类索引
- [x] BGABindingRecyclerViewAdapter 和 BGABindingViewHolder 用于 RecyclerView 结合 DataBinding 使用时简化 RecyclerView 的适配器的编写,支持多 Item 类型,支持添加多个 Header 和 Footer,回调接口里的索引位置已经在库里处理了,不需要开发者自己减去 Header 个数
- [x] BGARVVerticalScrollHelper 用于将 RecyclerView 滚动到指定位置

## 效果图与示例 apk

| 简化 GridView/ListView 适配器 | RecyclerView/Header/Footer/拖拽排序 |
| ------------ | ------------- |
| ![adapterview](https://user-images.githubusercontent.com/8949716/32135569-f0beeb58-bbc6-11e7-94a0-7b1503d3df1a.gif) | ![rv_and_rvbinding](https://user-images.githubusercontent.com/8949716/32135654-3844e17a-bbc8-11e7-92d7-589686ea8b8f.gif) |

| RecyclerView 多 ItemType | 吸顶分类索引 |
| ------------ | ------------- |
| ![rv_multi_item](https://user-images.githubusercontent.com/8949716/32135664-55b3f494-bbc8-11e7-9e13-c33abdce281c.gif) | ![sticky](https://user-images.githubusercontent.com/8949716/32145544-892817a8-bc98-11e7-838d-a16841b1b2f6.gif) |

| 仿美团外卖点餐界面左右联动 |
| ------------ |
| ![cascade](https://user-images.githubusercontent.com/8949716/32145548-94e29532-bc98-11e7-8d5f-c11119f45717.gif) |

[点击下载 BGABaseAdapterDemo.apk](http://fir.im/BGABaseAdapterDemo) 或扫描下面的二维码安装

![BGABaseAdapterDemo apk文件二维码](https://user-images.githubusercontent.com/8949716/31925781-946d8cfc-b850-11e7-9a75-2edda1033a3d.png)

## 使用

### Gradle 依赖

* 把 `maven { url 'https://jitpack.io' }` 添加到 root build.gradle 的 repositories 中
* 在 app build.gradle 中添加如下依赖,末尾的「latestVersion」指的是徽章[![Download](https://jitpack.io/v/bingoogolapple/BGABadgeView-Android.svg)](https://jitpack.io/#bingoogolapple/BGABadgeView-Android)里的版本名称,请自行替换

```groovy
implementation 'androidx.recyclerview:recyclerview:latestVersion'
implementation 'com.github.bingoogolapple:BGABaseAdapter-Android:latestVersion'
```

### 简化 AdapterView 的子类(如 ListView、GridView)的适配器的编写

[AdapterViewAdapter.java](https://github.com/bingoogolapple/BGABaseAdapter-Android/tree/master/demo/src/main/java/cn/bingoogolapple/baseadapter/demo/adapter/AdapterViewAdapter.java)

### 简化 RecyclerView 的适配器的编写

[RvAdapter.java](https://github.com/bingoogolapple/BGABaseAdapter-Android/tree/master/demo/src/main/java/cn/bingoogolapple/baseadapter/demo/adapter/RvAdapter.java)

### RecyclerView 结合 DataBinding 使用时简化 RecyclerView 的适配器的编写

[RvBindingFragment.java](https://github.com/bingoogolapple/BGABaseAdapter-Android/tree/master/demo/src/main/java/cn/bingoogolapple/baseadapter/demo/ui/fragment/RvBindingFragment.java)

### BGADivider 用于简化 RecyclerView 分割线的编写,以及轻松实现基于 RecyclerView 的悬浮分类索引

[RvStickyFragment.java](https://github.com/bingoogolapple/BGABaseAdapter-Android/tree/master/demo/src/main/java/cn/bingoogolapple/baseadapter/demo/ui/fragment/RvStickyFragment.java)

### 仿美团外卖点餐界面左右联动

[RvCascadeFragment.java](https://github.com/bingoogolapple/BGABaseAdapter-Android/tree/master/demo/src/main/java/cn/bingoogolapple/baseadapter/demo/ui/fragment/RvCascadeFragment.java)

### 代码是最好的老师,详细用法请查看 [demo](https://github.com/bingoogolapple/BGABaseAdapter-Android/tree/master/demo):feet:

## 感谢

* [https://github.com/hongyangAndroid/baseAdapter](https://github.com/hongyangAndroid/baseAdapter)
参考该库的为 RecyclerView 添加 Header 和 Footer
* [https://github.com/iPaulPro/Android-ItemTouchHelper-Demo](https://github.com/iPaulPro/Android-ItemTouchHelper-Demo)
参考该库的拖拽排序功能

## 关于我

| 个人主页 | 邮箱 | BGA系列开源库QQ群
| ------------- | ------------ | ------------ |
| bingoogolapple.cn | [email protected] | ![BGA_CODE_CLUB](http://bgashare.bingoogolapple.cn/BGA_CODE_CLUB.png?imageView2/2/w/200) |

## 打赏支持

如果您觉得 BGA 系列开源库帮你节省了大量的开发时间,请扫描下方的二维码随意打赏,要是能打赏个 10.24 :monkey_face:就太:thumbsup:了。您的支持将鼓励我继续创作:octocat:

如果您目前正打算购买通往墙外的梯子,可以使用我的邀请码「YFQ9Q3B」购买 [Lantern](https://github.com/getlantern/forum),双方都赠送三个月的专业版使用时间:beers:



## License

Copyright 2015 bingoogolapple

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.