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

https://github.com/farukcankaya/expandablefilter

A simple library that creates an expandable filter with given items. Filter items can be collapsed/expanded. Also, it supports rtl views, changing color, text size, font family, etc...
https://github.com/farukcankaya/expandablefilter

animation expandable filter layout menu rtl

Last synced: about 1 year ago
JSON representation

A simple library that creates an expandable filter with given items. Filter items can be collapsed/expanded. Also, it supports rtl views, changing color, text size, font family, etc...

Awesome Lists containing this project

README

          

# ExpandableFilter
A simple library that creates an expandable filter with given items. Filter items can be collapsed/expanded. Also, it supports rtl views, changing color, text size, font family, etc...

[ ![Download](https://api.bintray.com/packages/farukcankaya/maven/ExpandableFilter/images/download.svg) ](https://bintray.com/farukcankaya/maven/ExpandableFilter/_latestVersion)

| LTR | RTL |
| ------------- |:-------------:|
| | |

# Usage

### Add dependecy
```java
dependencies {
...
compile 'com.farukcankaya:expandablefilter:1.0.1'
}
```

### Add ExpandableFilter to your layout
`emoji`, `label` and `items` attributes are mandatory.

res/values/arrays.xml
```xml


$
$$
$$$
$$$$

```

```xml

```

That's it.

# Customization

You can change many attributes listed below:
### Duration
Default duration is 300ms.
```xml

```

### Font Family
You specify custom font for label and emoji separately. Fonts should be under `assets/font` directory. If you want to use different font for different language, you need to create a directory for that language. For example, we want to use different font for Arabic, we will create `font-ar` directory under `assets` directory. Then, we will put custom font in it.
```xml

```

### Text Size
You specify text size for label and emoji separately.
```xml

```

### Text Color
There are two ways to change text color. We can give color resource:

res/color/text_color.xml
```xml








```
```xml

```

or we can specify default and active text color:
```xml

```
**Note:** `activeTextColor` **and** `defaultTextColor` **attributes override** `itemTextColor`.

### Background color
```xml

```

### Item Padding
You can arrange padding of items. Default it is `8dp`.
```xml

```

### Divider Margin
You can arrange margin between items. Default it is `1dp`.
```xml

```

### Radius
You can arrange radius. Default it is `4dp`.
```xml

```

### Arrange maximum selectable item count
You can arrange arrange maximum selectable item count. Default, all filter items can be selected.
```xml

```

### ExpandableFilter.OnItemSelectListener
You can add listener to ExpandableFilter. If there is no items and filter is selected/deselected, `onSelected` / `onDeselected` methods return `-1` as position.