Skip to content

Commit

Permalink
added subTitle support for error and empty view
Browse files Browse the repository at this point in the history
  • Loading branch information
Reza Amuzadeh committed Sep 7, 2019
1 parent 37e2972 commit 03460df
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 15 deletions.
4 changes: 1 addition & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 26
versionName "1.2.6"
versionCode 27
versionName "1.2.7"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -29,7 +29,7 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// SUPPORT LIBRARY
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.cardview:cardview:1.0.0'
Expand Down
55 changes: 49 additions & 6 deletions library/src/main/java/com/vasl/recyclerlibrary/MyCustomView.java
Original file line number Diff line number Diff line change
Expand Up @@ -374,53 +374,96 @@ public void setStatus(ListStatus status) {
showError();
break;
}

}

public void setStatus(ListStatus status, @Nullable String title) {
public void setStatus(ListStatus status, @Nullable String subTitle) {
switch (status) {
case LOADING:
showLoading();
hideLoading();
hideLoadingBottom();
hideEmptyView();
hideRecyclerView();
hideSwipe();
hideError();

invalidate(); // for redraw

showLoading();
break;
case SUCCESS:
hideLoading();
hideLoadingBottom();
hideEmptyView();
showRecyclerView();
hideRecyclerView();
hideSwipe();
hideError();

invalidate(); // for redraw

showRecyclerView();
break;
case FAILURE:
hideLoading();
hideLoadingBottom();
hideEmptyView();
hideRecyclerView();
hideSwipe();
setErrorTitle(title);
hideError();
setErrorSubTitle(subTitle);

invalidate(); // for redraw

showError();
break;
case EMPTY:
hideLoading();
hideLoadingBottom();
hideEmptyView();
hideRecyclerView();
hideSwipe();
hideError();
setEmptyTitle(title);
setEmptySubTitle(subTitle);

invalidate(); // for redraw

showEmptyView();
break;
case UNDEFINE:
hideLoading();
hideLoadingBottom();
hideEmptyView();
hideRecyclerView();
hideSwipe();
hideError();

invalidate(); // for redraw

showError();
break;

case LOADING_BOTTOM:
hideLoading();
hideLoadingBottom();
hideEmptyView();
// hideRecyclerView();
hideSwipe();
hideError();

invalidate(); // for redraw

showLoadingBottom();
break;

default:
hideLoading();
hideLoadingBottom();
hideEmptyView();
hideRecyclerView();
hideSwipe();
hideError();

invalidate(); // for redraw

showError();
break;
}
Expand Down

0 comments on commit 03460df

Please sign in to comment.