Minor improvements

This commit is contained in:
M M Arif
2022-03-27 15:13:04 +05:00
parent 67c0ac5f8c
commit 636117aad9
5 changed files with 6 additions and 25 deletions
@@ -42,9 +42,7 @@ public class AdminGetUsersViewModel extends ViewModel {
public void onResponse(@NonNull Call<List<UserInfo>> call, @NonNull Response<List<UserInfo>> response) {
if (response.isSuccessful()) {
if(response.code() == 200) {
usersList.postValue(response.body());
}
usersList.postValue(response.body());
}
}
@@ -52,7 +50,6 @@ public class AdminGetUsersViewModel extends ViewModel {
public void onFailure(@NonNull Call<List<UserInfo>> call, @NonNull Throwable t) {
Log.e("onFailure", t.toString());
}
});
}
@@ -68,6 +65,7 @@ public class AdminGetUsersViewModel extends ViewModel {
public void onResponse(@NonNull Call<List<UserInfo>> call, @NonNull Response<List<UserInfo>> response) {
if (response.isSuccessful()) {
List<UserInfo> list = usersList.getValue();
assert list != null;
assert response.body() != null;
@@ -77,6 +77,7 @@ public class IssuesViewModel extends ViewModel {
public void onResponse(@NonNull Call<List<Issues>> call, @NonNull Response<List<Issues>> response) {
if (response.isSuccessful()) {
List<Issues> list = issuesList.getValue();
assert list != null;
assert response.body() != null;
@@ -41,12 +41,8 @@ public class RepoStargazersViewModel extends ViewModel {
public void onResponse(@NonNull Call<List<UserInfo>> call, @NonNull Response<List<UserInfo>> response) {
if(response.isSuccessful()) {
if(response.code() == 200) {
stargazersList.postValue(response.body());
}
stargazersList.postValue(response.body());
}
}
@Override
@@ -55,6 +51,5 @@ public class RepoStargazersViewModel extends ViewModel {
}
});
}
}
@@ -41,20 +41,14 @@ public class RepoWatchersViewModel extends ViewModel {
public void onResponse(@NonNull Call<List<UserInfo>> call, @NonNull Response<List<UserInfo>> response) {
if(response.isSuccessful()) {
if(response.code() == 200) {
watchersList.postValue(response.body());
}
watchersList.postValue(response.body());
}
}
@Override
public void onFailure(@NonNull Call<List<UserInfo>> call, Throwable t) {
Log.i("onFailure", t.toString());
}
});
}
}
@@ -46,10 +46,7 @@ public class TeamsByOrgViewModel extends ViewModel {
public void onResponse(@NonNull Call<List<Teams>> call, @NonNull Response<List<Teams>> response) {
if(response.isSuccessful()) {
if(response.code() == 200) {
teamsList.postValue(response.body());
}
teamsList.postValue(response.body());
}
else if(response.code() == 403) {
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
@@ -60,7 +57,6 @@ public class TeamsByOrgViewModel extends ViewModel {
mProgressBar.setVisibility(View.GONE);
noDataTeams.setText(R.string.genericError);
}
}
@Override
@@ -69,9 +65,6 @@ public class TeamsByOrgViewModel extends ViewModel {
mProgressBar.setVisibility(View.GONE);
noDataTeams.setText(R.string.genericError);
}
});
}
}