Skip to content

Commit

Permalink
convert provide methods to static factory methods
Browse files Browse the repository at this point in the history
  • Loading branch information
erkutaras committed Nov 26, 2018
1 parent 4ff5877 commit a9d97c3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 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.1.0'
implementation 'com.github.erkutaras:StateLayout:1.1.1'
}
```

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 17
targetSdkVersion 27
versionCode 11
versionName "1.1.0"
versionCode 12
versionName "1.1.1"

vectorDrawables.useSupportLibrary = true
}
Expand Down
29 changes: 22 additions & 7 deletions library/src/main/java/com/erkutaras/statelayout/StateLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,28 @@ class StateLayout @JvmOverloads constructor(context: Context,
return this
}

fun provideLoadingStateInfo() = StateInfo(state = LOADING)
fun provideContentStateInfo() = StateInfo(state = CONTENT)
fun provideErrorStateInfo() = StateInfo(state = ERROR)
fun provideLoadingWithContentStateInfo() = StateInfo(state = LOADING_WITH_CONTENT)
fun provideInfoStateInfo() = StateInfo(state = INFO)
fun provideEmptyStateInfo() = StateInfo(state = EMPTY)
fun provideNoneStateInfo() = StateInfo(state = NONE)
companion object {
@JvmStatic
fun provideLoadingStateInfo() = StateInfo(state = LOADING)

@JvmStatic
fun provideContentStateInfo() = StateInfo(state = CONTENT)

@JvmStatic
fun provideErrorStateInfo() = StateInfo(state = ERROR)

@JvmStatic
fun provideLoadingWithContentStateInfo() = StateInfo(state = LOADING_WITH_CONTENT)

@JvmStatic
fun provideInfoStateInfo() = StateInfo(state = INFO)

@JvmStatic
fun provideEmptyStateInfo() = StateInfo(state = EMPTY)

@JvmStatic
fun provideNoneStateInfo() = StateInfo(state = NONE)
}

interface OnStateLayoutListener {
fun onStateLayoutInfoButtonClick()
Expand Down

0 comments on commit a9d97c3

Please sign in to comment.