Skip to content

Commit

Permalink
:memo update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCheen committed Sep 27, 2020
1 parent 76b4c08 commit fcf7a0e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 38 deletions.
3 changes: 1 addition & 2 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
What's the PR for?
这个 PR 的目的是什么?
这个 PR 是做什么的?(What's the PR for? )
65 changes: 29 additions & 36 deletions README_EN.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
# 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.


[![Build Status](https://travis-ci.org/AlanCheen/Flap.svg?branch=master)](https://travis-ci.org/AlanCheen/Flap) ![AndroidX](https://img.shields.io/badge/AndroidX-Migrated-brightgreen) ![RecyclerView](https://img.shields.io/badge/RecyclerView-1.1.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)

------



[![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)

[中文指南看这里(点我点我)](./README.md)

`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.


### Latest Version



| module | flap | flap-annotations | flap-compiler |
| ------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| Version | [![Download](https://api.bintray.com/packages/alancheen/maven/flap/images/download.svg)](https://bintray.com/alancheen/maven/flap/_latestVersion) | [![Download](https://api.bintray.com/packages/alancheen/maven/flap-annotations/images/download.svg)](https://bintray.com/alancheen/maven/flap-annotations/_latestVersion) | [![Download](https://api.bintray.com/packages/alancheen/maven/flap-compiler/images/download.svg)](https://bintray.com/alancheen/maven/flap-compiler/_latestVersion) |

| module | flap | flap-annotations | flap-compiler | Flap-plugin |
| ------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| Version | [![Download](https://api.bintray.com/packages/alancheen/maven/flap/images/download.svg)](https://bintray.com/alancheen/maven/flap/_latestVersion) | [![Download](https://api.bintray.com/packages/alancheen/maven/flap-annotations/images/download.svg)](https://bintray.com/alancheen/maven/flap-annotations/_latestVersion) | [![Download](https://api.bintray.com/packages/alancheen/maven/flap-compiler/images/download.svg)](https://bintray.com/alancheen/maven/flap-compiler/_latestVersion) | [![Download](https://api.bintray.com/packages/alancheen/maven/flap-plugin/images/download.svg)](https://bintray.com/alancheen/maven/flap-plugin/_latestVersion) |


## Getting Started



### Integrate Flap



Add the latest `Flap` to your dependencies:

```groovy
dependencies {
implementation 'me.yifeiyuan.flap:flap:$lastest_version'
implementation 'me.yifeiyuan.flap:flap-annotations:$lastest_version'
annotationProcessor 'me.yifeiyuan.flap:flap-compiler:$lastest_version'
//add recyclerview also
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation "me.yifeiyuan.flap:flap:$lastest_version"
implementation "me.yifeiyuan.flap:flap-annotations:$lastest_version"
annotationProcessor "me.yifeiyuan.flap:flap-compiler:$lastest_version"
}
```

If you are using kotlin , replace `annotationProcessor` with `kapt` :

```groovy
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
dependencies {
implementation "me.yifeiyuan.flap:flap:$lastest_version"
implementation "me.yifeiyuan.flap:flap-annotations:$lastest_version"
kapt "me.yifeiyuan.flap:flap-compiler:$lastest_version"
}
```


### Usage
Expand All @@ -56,7 +56,6 @@ dependencies {
#### Step 1 : Create a model class :



```java
public class SimpleTextModel {

Expand All @@ -70,29 +69,23 @@ public class SimpleTextModel {
```



#### Step 2 : Create a custom `FlapComponent` :


NOTE: `FlapComponent` is the base `ViewHolder` that `Flap` is using internally.
#### Step 2 : Create a custom `Component` :

Here is a sample :

```java
@Component(layoutId = R.layout.flap_item_simple_text)
public class SimpleTextItem extends FlapComponent<SimpleTextModel> {

private static final String TAG = "SimpleTextItem";
@Proxy(layoutName = "flap_item_simple_text")
public class SimpleTextComponent extends Component<SimpleTextModel> {

private TextView tvContent;

public SimpleTextItem(final View itemView) {
public SimpleTextComponent(final View itemView) {
super(itemView);
tvContent = findViewById(R.id.tv_content);
}

@Override
protected void onBind(@NonNull final SimpleTextModel model, @NonNull final FlapAdapter adapter, @NonNull final List<Object> payloads) {
protected void onBind(@NonNull final SimpleTextModel model) {
tvContent.setText(model.content);
}
}
Expand Down

0 comments on commit fcf7a0e

Please sign in to comment.