Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
unaisulhadi authored Jun 24, 2021
1 parent cbe59cd commit 5c3aba6
Showing 1 changed file with 62 additions and 5 deletions.
67 changes: 62 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,84 @@
# EmojiRatingBar
[![Kotlin Version](https://img.shields.io/badge/Kotlin-v1.5.10-blue.svg)](https://kotlinlang.org) [![Platform](https://img.shields.io/badge/Platform-Android-green.svg?style=flat)](https://www.android.com/) [![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21)
<br/>

A simple Emoji Rating Bar View in Android completely written in Kotlin.
#### A simple Emoji Rating Bar View in Android completely written in Kotlin.

<img src="https://raw.githubusercontent.com/unaisulhadi/EmojiRatingBar/master/art/Rating.png">

## Installation
<!-- ## 🛠 Installation
Add this line to your module gradle.
```bash
implementation "com.hadi.emojiratingbar:1.0.0"
```
-->
## ⌨️ Usage

## Usage
- Add this in your layout xml file.

```python
```xml
<com.hadi.emojiratingbar.EmojiRatingBar
android:id="@+id/emoji_rating_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:showText="true"/>
```
## License
- Set ```showText``` value accordingly if you need Emoji Title
```
app:showText="true" //XML
emojiRatingBar.setShowText(true) //Kotlin
```
- Get/Set current status of EmojiRatingBar, returns enum
[ AWFUL,BAD,OKAY,GOOD,GREAT]
```kotlin
emojiRatingBar.getCurrentRateStatus().toString() //GET
emojiRatingBar.setCurrentRateStatus(RateStatus.GOOD) //SET

```
- Use OnRateChangeListener for observing Rate Changes
```kotlin
emojiRatingBar.setRateChangeListener(object : EmojiRatingBar.OnRateChangeListener {
override fun onRateChanged(rateStatus: RateStatus) {
//Do you Stuff
}
})
```
- Do your stuff for separate values
```kotlin
emojiRatingBar.setRateChangeListener(object : EmojiRatingBar.OnRateChangeListener {
override fun onRateChanged(rateStatus: RateStatus) {

when (rateStatus) {

RateStatus.AWFUL -> {
//Do your code
}
RateStatus.BAD -> {
//Do your code
}
RateStatus.OKAY -> {
//Do your code
}
RateStatus.GOOD -> {
//Do your code
}
RateStatus.GREAT -> {
//Do your code
}

}
}
})
```

## ✍️ Author
* <b>Unaisul Hadi</b>
* Email: unaisulhadi@gmail.com


## 📝 License

```
MIT License
Expand Down

0 comments on commit 5c3aba6

Please sign in to comment.