Skip to content

Commit

Permalink
Merge pull request #14 from AlanCheen/develop
Browse files Browse the repository at this point in the history
release 0.9.1
  • Loading branch information
AlanCheen authored Jan 4, 2019
2 parents b93d2e0 + ead8156 commit a217888
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 24 deletions.
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Flap

[![Download](https://api.bintray.com/packages/alancheen/maven/flap/images/download.svg?version=0.9.0)](https://bintray.com/alancheen/maven/flap/0.9.0/link) [![Build Status](https://travis-ci.org/AlanCheen/Flap.svg?branch=master)](https://travis-ci.org/AlanCheen/Flap) ![RecyclerView](https://img.shields.io/badge/RecyclerView-28.0.0-brightgreen.svg) ![API](https://img.shields.io/badge/API-14%2B-brightgreen.svg?style=flat) [![license](https://img.shields.io/github/license/AlanCheen/Flap.svg)](./LICENSE)
[![Download](https://api.bintray.com/packages/alancheen/maven/flap/images/download.svg?version=0.9.1)](https://bintray.com/alancheen/maven/flap/0.9.1/link) [![Build Status](https://travis-ci.org/AlanCheen/Flap.svg?branch=master)](https://travis-ci.org/AlanCheen/Flap) ![RecyclerView](https://img.shields.io/badge/RecyclerView-28.0.0-brightgreen.svg) ![API](https://img.shields.io/badge/API-14%2B-brightgreen.svg?style=flat) [![license](https://img.shields.io/github/license/AlanCheen/Flap.svg)](./LICENSE) [![Author](https://img.shields.io/badge/%E4%BD%9C%E8%80%85-%E7%A8%8B%E5%BA%8F%E4%BA%A6%E9%9D%9E%E7%8C%BF-blue.svg)](https://github.com/AlanCheen) [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/AlanCheen/Flap/pulls)

**[WIP]WARNING: Flap is still under development.**


## What is Flap

`Flap` is a library that makes `RecyclerView.Adapter` much more easier to use , by keeping you from writing boilerplate codes and providing lots advance features , especially when you have to support lots of different type items.

Have a try !
Expand Down Expand Up @@ -127,25 +130,19 @@ Check [Releases](https://github.com/AlanCheen/Flap/releases) for details.

## Feature List

- [ ] Loadmore feature;
- [ ] Empty and error status;
- [ ] Support load more feature(maybe);
- [ ] Support empty and error status (maybe);
- [ ] Support AsyncListDiffer feature;
- [ ] Support setup global RecycledViewPool;
- [x] Support setup global RecycledViewPool;
- [x] Support Lifecycle for FlapItem;
- [x] Decouple RecyclerView.Adapter and ViewHolder's creating and binding logic.

## Contact Me

Any feedback could be helpful , thanks.
Any feedback would be helpful , feel free to contact me , thanks.

I'm Fitz , an Engineer working at Alibaba living in China .
I'm Fitz , an Engineer working at Alibaba in China .

Follow me on :

- 微信公众号:chengxuyifeiyuan (程序亦非猿的拼音)
- [知乎](https://www.zhihu.com/people/yifeiyuan/activities)
- [新浪微博](https://www.weibo.com/alancheeen)
- [简书](https://www.jianshu.com/u/ec59bd61433a)
- [掘金](https://juejin.im/user/558cc8dae4b0de86abc9cfda)

Feel free to contact me.
- 微信公众号:chengxuyifeiyuan (程序亦非猿的拼音)
2 changes: 1 addition & 1 deletion app/src/main/java/me/yifeiyuan/flapdev/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void createAdvanceTestCase(final RecyclerView recyclerView) {
List<Object> models = mockModels();

FlapAdapter adapter = new FlapAdapter();
adapter.setUseGlobalPool(true)
adapter.setUseFlapItemPool(true)
.setLifecycleEnable(true)
.setLifecycleOwner(this)
.setModels(models);
Expand Down
2 changes: 1 addition & 1 deletion flap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {

apply plugin: "guru.stefma.bintrayrelease"

version = "0.9.0"
version = "0.9.1"
group = "me.yifeiyuan.flap"
androidArtifact {
artifactId = "flap"
Expand Down
8 changes: 4 additions & 4 deletions flap/src/main/java/me/yifeiyuan/flap/FlapAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class FlapAdapter extends RecyclerView.Adapter<FlapItem> {

private boolean lifecycleEnable = true;

private boolean useGlobalPool = true;
private boolean useFlapItemPool = true;

@NonNull
@Override
Expand Down Expand Up @@ -74,7 +74,7 @@ public void onAttachedToRecyclerView(@NonNull final RecyclerView recyclerView) {
if (recyclerView.getContext() instanceof LifecycleOwner && lifecycleOwner == null) {
setLifecycleOwner((LifecycleOwner) recyclerView.getContext());
}
if (useGlobalPool) {
if (useFlapItemPool) {
recyclerView.setRecycledViewPool(flap.getFlapItemPool());
}
}
Expand Down Expand Up @@ -140,8 +140,8 @@ public List<?> getModels() {
*
* @return this
*/
public FlapAdapter setUseGlobalPool(final boolean enable) {
this.useGlobalPool = enable;
public FlapAdapter setUseFlapItemPool(final boolean enable) {
this.useFlapItemPool = enable;
return this;
}

Expand Down
8 changes: 4 additions & 4 deletions flap/src/main/java/me/yifeiyuan/flap/FlapItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ protected final <V extends View> V findViewById(@IdRes int viewId) {
}

/**
* @param flapAdapter
* @param flapAdapter The adapter which is using your FlapItem.
*
* @see FlapAdapter#onViewAttachedToWindow(FlapItem)
*/
protected void onViewAttachedToWindow(final FlapAdapter flapAdapter) {
}

/**
* @param flapAdapter
* @param flapAdapter The adapter which is using your FlapItem.
*
* @see FlapAdapter#onViewDetachedFromWindow(FlapItem)
*/
protected void onViewDetachedFromWindow(final FlapAdapter flapAdapter) {
}

/**
* @param flapAdapter
* @param flapAdapter The adapter which is using your FlapItem.
*
* @see FlapAdapter#onViewRecycled(FlapItem)
*/
Expand All @@ -69,7 +69,7 @@ protected void onViewRecycled(final FlapAdapter flapAdapter) {
}

/**
* @param flapAdapter
* @param flapAdapter The adapter which is using your FlapItem.
*
* @return
* @see FlapAdapter#onFailedToRecycleView(FlapItem)
Expand Down
2 changes: 1 addition & 1 deletion flap/src/main/java/me/yifeiyuan/flap/FlapItemPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* A global RecycledViewPool that can be shared among RecyclerViews , which is enabled by default.
*
* @see FlapAdapter#setUseGlobalPool(boolean)
* @see FlapAdapter#setUseFlapItemPool(boolean)
*/
public class FlapItemPool extends RecyclerView.RecycledViewPool {

Expand Down

0 comments on commit a217888

Please sign in to comment.