Fix infined load on Issues/Pulls if they dont exist (#507)

404 fix for issues

add 404 for pr

Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/507
Reviewed-by: 6543 <6543@noreply.gitea.io>
This commit is contained in:
M M Arif 2020-05-23 18:30:33 +00:00 committed by 6543
parent b30e2da387
commit 34f8f82b63
2 changed files with 26 additions and 4 deletions

View File

@ -180,7 +180,7 @@ public class IssuesFragment extends Fragment {
@Override
public void onResponse(@NonNull Call<List<Issues>> call, @NonNull Response<List<Issues>> response) {
if(response.isSuccessful()) {
if(response.code() == 200) {
assert response.body() != null;
if(response.body().size() > 0) {
@ -192,11 +192,21 @@ public class IssuesFragment extends Fragment {
}
else {
issuesList.clear();
adapter.notifyDataChanged();
noDataIssues.setVisibility(View.VISIBLE);
}
mProgressBar.setVisibility(View.GONE);
}
else if(response.code() == 404) {
noDataIssues.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.GONE);
}
else {
Log.e(TAG, String.valueOf(response.code()));
@ -227,7 +237,7 @@ public class IssuesFragment extends Fragment {
@Override
public void onResponse(@NonNull Call<List<Issues>> call, @NonNull Response<List<Issues>> response) {
if(response.isSuccessful()) {
if(response.code() == 200) {
//remove loading view
issuesList.remove(issuesList.size() - 1);

View File

@ -183,7 +183,7 @@ public class PullRequestsFragment extends Fragment {
@Override
public void onResponse(@NonNull Call<List<PullRequests>> call, @NonNull Response<List<PullRequests>> response) {
if(response.isSuccessful()) {
if(response.code() == 200) {
assert response.body() != null;
if(response.body().size() > 0) {
@ -195,14 +195,26 @@ public class PullRequestsFragment extends Fragment {
}
else {
prList.clear();
adapter.notifyDataChanged();
noData.setVisibility(View.VISIBLE);
}
mProgressBar.setVisibility(View.GONE);
}
else if(response.code() == 404) {
noData.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.GONE);
}
else {
Log.i(TAG, String.valueOf(response.code()));
}
Log.i(TAG, String.valueOf(response.code()));
@ -232,7 +244,7 @@ public class PullRequestsFragment extends Fragment {
@Override
public void onResponse(@NonNull Call<List<PullRequests>> call, @NonNull Response<List<PullRequests>> response) {
if(response.isSuccessful()) {
if(response.code() == 200) {
//remove loading view
prList.remove(prList.size() - 1);