Skip to content

Commit

Permalink
Merge pull request #19 from erkutaras/develop
Browse files Browse the repository at this point in the history
update show methods
  • Loading branch information
erkutaras authored Jan 6, 2019
2 parents a48e51a + 2a438e0 commit 8c84034
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ allprojects {
**Step 2.** Add the library dependency to your project build.gradle:
```
dependencies {
implementation 'com.github.erkutaras:StateLayout:1.2.2'
implementation 'com.github.erkutaras:StateLayout:1.2.3'
}
```

Expand All @@ -41,7 +41,7 @@ _If you don't migrate your project with AndroidX yet, you may need to exclude an

```
dependencies {
implementation ('com.github.erkutaras:StateLayout:1.2.2') {
implementation ('com.github.erkutaras:StateLayout:1.2.3') {
exclude group: 'androidx.appcompat'
}
}
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 28
versionCode 17
versionName "1.2.2"
versionCode 18
versionName "1.2.3"

vectorDrawables.useSupportLibrary = true
}
Expand Down
17 changes: 13 additions & 4 deletions library/src/main/java/com/erkutaras/statelayout/StateLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,27 @@ class StateLayout @JvmOverloads constructor(context: Context,
}

fun showLoading(stateInfo: StateInfo?) {
showState(stateInfo)
if (stateInfo?.state == LOADING) showState(stateInfo)
}

fun showContent(stateInfo: StateInfo?) {
showState(stateInfo)
if (stateInfo?.state == CONTENT) showState(stateInfo)
}

fun showInfo(stateInfo: StateInfo?) {
showState(stateInfo)
if (stateInfo?.state == INFO) showState(stateInfo)
}

fun showLoadingWithContent(stateInfo: StateInfo?) {
if (stateInfo?.state == LOADING_WITH_CONTENT) showState(stateInfo)
}

fun showError(stateInfo: StateInfo?) {
if (stateInfo?.state == ERROR) showState(stateInfo)
}

fun showEmpty(stateInfo: StateInfo?) {
showState(stateInfo)
if (stateInfo?.state == EMPTY) showState(stateInfo)
}

fun showState(stateInfo: StateInfo?) {
Expand All @@ -269,6 +277,7 @@ class StateLayout @JvmOverloads constructor(context: Context,
stateInfo.infoTitle?.let { infoTitle(it) }
stateInfo.infoMessage?.let { infoMessage(it) }
stateInfo.infoButtonText?.let { infoButtonText(it) }
stateInfo.onStateLayoutListener?.let { infoButtonListener(it) }
}
null, NONE -> hideAll()
}
Expand Down

0 comments on commit 8c84034

Please sign in to comment.