Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gjiazhe/WaveSideBar
An Index Side Bar With Wave Effect
https://github.com/gjiazhe/WaveSideBar
Last synced: about 1 month ago
JSON representation
An Index Side Bar With Wave Effect
- Host: GitHub
- URL: https://github.com/gjiazhe/WaveSideBar
- Owner: gjiazhe
- License: mit
- Created: 2016-08-23T14:34:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-05T06:48:07.000Z (over 7 years ago)
- Last Synced: 2024-10-30T02:37:13.087Z (about 1 month ago)
- Language: Java
- Homepage:
- Size: 617 KB
- Stars: 1,265
- Watchers: 32
- Forks: 195
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-github-android-ui - WaveSideBar - 波浪效果索引侧边栏 (SideBar)
README
# WaveSideBar
You can use WaveSideBar in the contacts page of your application.
Refer to [AlexLiuSheng/AnimSideBar](https://github.com/AlexLiuSheng/AnimSideBar).## Screenshot
![Screenshot](screenshot/gif.gif)## Include the WaveSideBar to Your Project
With gradle:```groovy
dependencies {
compile 'com.gjiazhe:wavesidebar:1.3'
}
```## Use WaveSideBar in Layout File
```xml```
## Description of Attributes
| Attributes | Format | Default | Description |
| :--------------------: | :------------------------: | :--------: | :--------------------------------------: |
| sidebar_text_color | color | Color.GRAY | Text color of side bar. |
| sidebar_text_size | dimension | 14sp | Text size of side bar. |
| sidebar_max_offset | dimension | 80dp | Offset of the selected item. |
| sidebar_position | enum {right, left} | right | Be placed on left or right in the view. |
| sidebar_text_alignment | enum {center, left, right} | center | Alignment of items. |
| sidebar_lazy_respond | boolean | false | If __true__, the listener will not be called until the finger __up__. If __false__, the listener will be called when the finger __down__, __move__ and __up__. |You can set these attributes in the layout file, or in the java code:
```java
WaveSideBar sideBar = (WaveSideBar) findViewById(R.id.side_bar);
sideBar.setTextColor(Color.BLACK);
sideBar.setMaxOffset(100);
sideBar.setPosition(WaveSideBar.POSITION_LEFT);
sideBar.setTextAlign(WaveSideBar.TEXT_ALIGN_CENTER);
sideBar.setLazyRespond(true);
```## Set the Listener to Observe WaveSideBar
```java
WaveSideBar sideBar = (WaveSideBar) findViewById(R.id.side_bar);
sideBar.setOnSelectIndexItemListener(new WaveSideBar.OnSelectIndexItemListener() {
@Override
public void onSelectIndexItem(String index) {
Log.d("WaveSideBar", index);
// Do something here ....
}
});
```## Customize the indexes
Use **setIndexItems** to Customize the indexes.
```java
sideBar.setIndexItems("あ", "か", "さ", "た", "な", "は", "ま", "や", "ら", "わ");
```
## Use Left Hand?
Use **setPosition** to change the position of side bar.
```java
sideBar.setPosition(WaveSideBar.POSITION_LEFT);
```## Lazy respond
use **setLazyRespond** to set whether the side bar should respond lazily to your touch events.
```java
sideBar.setLazyRespond(true);
```
![Screenshot](screenshot/lazy_respond.gif)