Skip to content

Commit

Permalink
Added -
Browse files Browse the repository at this point in the history
- Added README.md
  • Loading branch information
shazDroid authored and ShazInnoctive committed Jun 18, 2021
1 parent 0f7c5af commit e5fc116
Showing 1 changed file with 139 additions and 1 deletion.
140 changes: 139 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,139 @@
# stateLayout
<!-- logo -->
<p align="center">
<img width='300' src="img/logo-and-text.svg">
</p>

<!-- tag line -->
<h3 align='center'> StateLayout Android ! </h3>


## ☒️ What's a State-Layout ?

StateLayout can be used to manage the UI state of activity or fragment with very amazing animation using lottie.
e.g showing loading, error, empty screen(no data found), and content.

<strong>Need more state kindly ask me i will do implement it 😊

<br/>



## 🌻 Usage

Please note StateLayout can have only one direct child.

```xml
<com.shazdroid.statelayout.StateLayout
android:id="@+id/stateLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:state_backgroundColor="@color/white"
app:state_textColor="@color/black">

<!--Your main content goes here-->
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/contentView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


</androidx.appcompat.widget.LinearLayoutCompat>
<!--Content end-->
</com.shazdroid.statelayout.StateLayout>
```
There are some custom options below.

* To set background colour of stateLayout
```xml
app:state_backgroundColor="@color/white"
```
* To set the text colour
```xml
app:state_textColor="@color/black"
```


## Kotlin
```kotlin
val stateLayout = findViewById<StateLayout>(R.id.stateLayout)

// show loading UI //
stateLayout.showLoadingView()

// show loading UI with params //
stateLayout.showLoadingView("Your loading message",R.raw.lottie_animation_file)

// show error UI //
stateLayout.showErrorView()

// show error UI with param //
stateLayout.showErrorView("Your error message",R.raw.lottie_animation_file)

// error UI also support retry option just pass the retry listener the button will be shown automatically //
stateLayout.showErrorView("Your error message",R.raw.lottie_animation_file,this)

// need to change retry button text you can do it as well //
stateLayout.showErrorView("Your error message",R.raw.lottie_animation_file,"Retry button text",this)

// show empty UI basically used in case if there is no search result or recycler view/list is empty //
stateLayout.showEmptyView()

// show empty UI with param //
stateLayout.showEmptyView("Your message",R.raw.lottie_animation_file)

// show your content //
stateLayout.showContent()

```



<br/>


## Installation
```gradle
dependencies {
implementation 'com.github.shazDroid:stateLayout:0.1.0'
}
```
<br/>


## πŸ’™ Contributing

PR's are welcome !

Found a Bug ? Create an Issue.

<br/>




## πŸ’– Like this project ?

Leave a ⭐ If you think this project is cool.

[Share with the world](https://github.com/shazDroid/stateLayout) ✨

<br/>




## πŸ‘¨β€πŸ’» Author

### Shahbaz Ansari

shahbazansari52@gmail.com

<br/>




## 🍁 Licence

**MIT**

0 comments on commit e5fc116

Please sign in to comment.