Skip to content

Commit

Permalink
update code - change GONE state
Browse files Browse the repository at this point in the history
  • Loading branch information
Reza Amuzadeh committed Nov 15, 2018
1 parent b0d07c1 commit 36c7893
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 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 5
versionName "1.0.5"
versionCode 6
versionName "1.0.6"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down
21 changes: 16 additions & 5 deletions library/src/main/java/com/vasl/recyclerlibrary/MyCustomView.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,23 @@ private void showLoading() {
}

private void hideLoading() {
loadingHolder.setVisibility(GONE);
loadingHolder.setVisibility(INVISIBLE);
}

private void showEmptyView() {
emptyHolder.setVisibility(VISIBLE);
}

private void hideEmptyView() {
emptyHolder.setVisibility(GONE);
emptyHolder.setVisibility(INVISIBLE);
}

private void showRecyclerView() {
recyclerView.setVisibility(VISIBLE);
}

private void hideRecyclerView() {
recyclerView.setVisibility(GONE);
recyclerView.setVisibility(INVISIBLE);
}

private void showSwipe() {
Expand All @@ -161,7 +161,7 @@ private void showError() {
}

private void hideError() {
errorHolder.setVisibility(GONE);
errorHolder.setVisibility(INVISIBLE);
}

public void setStatus(ListStatuse status) {
Expand All @@ -173,6 +173,8 @@ public void setStatus(ListStatuse status) {
hideSwipe();
hideError();

invalidate(); // for redraw

showLoading();
break;
case SUCCESS:
Expand All @@ -182,6 +184,8 @@ public void setStatus(ListStatuse status) {
hideSwipe();
hideError();

invalidate(); // for redraw

showRecyclerView();
break;
case FAILURE:
Expand All @@ -191,6 +195,8 @@ public void setStatus(ListStatuse status) {
hideSwipe();
hideError();

invalidate(); // for redraw

showError();
break;
case EMPTY:
Expand All @@ -200,6 +206,8 @@ public void setStatus(ListStatuse status) {
hideSwipe();
hideError();

invalidate(); // for redraw

showEmptyView();
break;
case UNDEFINE:
Expand All @@ -209,6 +217,8 @@ public void setStatus(ListStatuse status) {
hideSwipe();
hideError();

invalidate(); // for redraw

showError();
break;
default:
Expand All @@ -218,11 +228,12 @@ public void setStatus(ListStatuse status) {
hideSwipe();
hideError();

invalidate(); // for redraw

showError();
break;
}

invalidate();
}

public void setStatus(ListStatuse status, @Nullable String title) {
Expand Down

0 comments on commit 36c7893

Please sign in to comment.