Update missing progress bars (#652)

update missing progress bars

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/652
This commit is contained in:
M M Arif
2020-08-18 19:55:34 +02:00
parent 7caff70946
commit 8768c87b8a
6 changed files with 53 additions and 37 deletions

View File

@@ -52,6 +52,7 @@ public class CommitsActivity extends BaseActivity {
private List<Commits> commitsList;
private CommitsAdapter adapter;
private ApiInterface api;
private ProgressBar progressLoadMore;
@Override
protected int getLayoutResourceId() {
@@ -84,6 +85,7 @@ public class CommitsActivity extends BaseActivity {
ImageView closeActivity = findViewById(R.id.close);
noData = findViewById(R.id.noDataCommits);
progressLoadMore = findViewById(R.id.progressLoadMore);
progressBar = findViewById(R.id.progress_bar);
SwipeRefreshLayout swipeRefresh = findViewById(R.id.pullToRefresh);
@@ -176,9 +178,7 @@ public class CommitsActivity extends BaseActivity {
private void loadMore(String token, String repoOwner, String repoName, final int page, String branchName, int resultLimit) {
//add loading progress view
commitsList.add(new Commits("load"));
adapter.notifyItemInserted((commitsList.size() - 1));
progressLoadMore.setVisibility(View.VISIBLE);
Call<List<Commits>> call = api.getRepositoryCommits(token, repoOwner, repoName, page, branchName, resultLimit);
@@ -189,9 +189,6 @@ public class CommitsActivity extends BaseActivity {
if(response.isSuccessful()) {
//remove loading view
commitsList.remove(commitsList.size() - 1);
List<Commits> result = response.body();
assert result != null;
@@ -208,6 +205,7 @@ public class CommitsActivity extends BaseActivity {
}
adapter.notifyDataChanged();
progressLoadMore.setVisibility(View.GONE);
}
else {

View File

@@ -53,6 +53,7 @@ public class RepoForksActivity extends BaseActivity {
private RecyclerView recyclerView;
private List<UserRepositories> forksList;
private RepoForksAdapter adapter;
private ProgressBar progressLoadMore;
@Override
protected int getLayoutResourceId() {
@@ -86,6 +87,7 @@ public class RepoForksActivity extends BaseActivity {
ImageView closeActivity = findViewById(R.id.close);
noData = findViewById(R.id.noData);
progressLoadMore = findViewById(R.id.progressLoadMore);
progressBar = findViewById(R.id.progress_bar);
SwipeRefreshLayout swipeRefresh = findViewById(R.id.pullToRefresh);
@@ -184,9 +186,7 @@ public class RepoForksActivity extends BaseActivity {
private void loadMore(String instanceUrl, String instanceToken, String repoOwner, String repoName, int page, int resultLimit) {
//add loading progress view
forksList.add(new UserRepositories("load"));
adapter.notifyItemInserted((forksList.size() - 1));
progressLoadMore.setVisibility(View.VISIBLE);
Call<List<UserRepositories>> call = RetrofitClient
.getInstance(instanceUrl, ctx)
@@ -219,6 +219,7 @@ public class RepoForksActivity extends BaseActivity {
}
adapter.notifyDataChanged();
progressLoadMore.setVisibility(View.GONE);
}
else {