Browse Source

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

404 fix for issues

add 404 for pr

Reviewed-on: #507
Reviewed-by: 6543 <6543@noreply.gitea.io>
tags/3.0.0-rc1
parent
commit
34f8f82b63
2 changed files with 26 additions and 4 deletions
  1. +12
    -2
      app/src/main/java/org/mian/gitnex/fragments/IssuesFragment.java
  2. +14
    -2
      app/src/main/java/org/mian/gitnex/fragments/PullRequestsFragment.java

+ 12
- 2
app/src/main/java/org/mian/gitnex/fragments/IssuesFragment.java 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);


+ 14
- 2
app/src/main/java/org/mian/gitnex/fragments/PullRequestsFragment.java 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);