mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2023-12-13 20:50:18 +01:00
6a84e4d897
Extend CI workflows (-> https://codeberg.org/gitnex/GitNex/issues/1099) 1. pull translations and push them again on every pull @mmarif this needs the secrets and `BOT_TOKEN` the code for this comes from tea4j-autodeploy 2. add a **template** for a check workflow which only does some static checks right now. It is disabled because it requires some investigation and discussion on how we should deal with these issues. The checks are currently (if we would enable it): 1. check code style and formatting according to the project file in `.idea/` 2. make sure every Java file has an `@author` annotation I would wait until you reviewed with enabling them because we have to reformat all the files which results in changes with a few thousand changed lines (tried this once). Closes https://codeberg.org/gitnex/GitNex/issues/141 Co-authored-by: qwerty287 <ndev@web.de> Co-authored-by: M M Arif <mmarif@noreply.codeberg.org> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1155 Reviewed-by: 6543 <6543@noreply.codeberg.org> Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org> Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
109 lines
3.3 KiB
Java
109 lines
3.3 KiB
Java
package org.mian.gitnex.activities;
|
|
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
import org.gitnex.tea4j.v2.models.Repository;
|
|
import org.mian.gitnex.R;
|
|
import org.mian.gitnex.adapters.TeamRepositoriesAdapter;
|
|
import org.mian.gitnex.clients.RetrofitClient;
|
|
import org.mian.gitnex.databinding.AddNewTeamRepositoryBinding;
|
|
import org.mian.gitnex.helpers.Constants;
|
|
import org.mian.gitnex.helpers.Toasty;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import retrofit2.Call;
|
|
import retrofit2.Callback;
|
|
import retrofit2.Response;
|
|
|
|
/**
|
|
* @author M M Arif
|
|
*/
|
|
|
|
public class AddNewTeamRepoActivity extends BaseActivity {
|
|
|
|
private AddNewTeamRepositoryBinding addNewTeamRepositoryBinding;
|
|
private View.OnClickListener onClickListener;
|
|
private List<Repository> dataList;
|
|
private TeamRepositoriesAdapter adapter;
|
|
private int resultLimit;
|
|
|
|
private long teamId;
|
|
private String teamName;
|
|
|
|
@Override
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
addNewTeamRepositoryBinding = AddNewTeamRepositoryBinding.inflate(getLayoutInflater());
|
|
setContentView(addNewTeamRepositoryBinding.getRoot());
|
|
|
|
resultLimit = Constants.getCurrentResultLimit(ctx);
|
|
initCloseListener();
|
|
addNewTeamRepositoryBinding.close.setOnClickListener(onClickListener);
|
|
|
|
teamId = getIntent().getLongExtra("teamId", 0);
|
|
teamName = getIntent().getStringExtra("teamName");
|
|
|
|
addNewTeamRepositoryBinding.recyclerViewTeamRepos.setHasFixedSize(true);
|
|
addNewTeamRepositoryBinding.recyclerViewTeamRepos.setLayoutManager(new LinearLayoutManager(ctx));
|
|
|
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(addNewTeamRepositoryBinding.recyclerViewTeamRepos.getContext(), DividerItemDecoration.VERTICAL);
|
|
addNewTeamRepositoryBinding.recyclerViewTeamRepos.addItemDecoration(dividerItemDecoration);
|
|
|
|
dataList = new ArrayList<>();
|
|
|
|
loadRepos();
|
|
}
|
|
|
|
public void loadRepos() {
|
|
|
|
Call<List<Repository>> call = RetrofitClient.getApiInterface(ctx).orgListRepos(getIntent().getStringExtra("orgName"), 1, resultLimit);
|
|
|
|
addNewTeamRepositoryBinding.progressBar.setVisibility(View.VISIBLE);
|
|
|
|
call.enqueue(new Callback<>() {
|
|
|
|
@Override
|
|
public void onResponse(@NonNull Call<List<Repository>> call, @NonNull Response<List<Repository>> response) {
|
|
|
|
if(response.isSuccessful()) {
|
|
|
|
assert response.body() != null;
|
|
if(response.body().size() > 0) {
|
|
|
|
dataList.clear();
|
|
dataList.addAll(response.body());
|
|
|
|
adapter = new TeamRepositoriesAdapter(dataList, ctx, Math.toIntExact(teamId), getIntent().getStringExtra("orgName"), teamName);
|
|
|
|
addNewTeamRepositoryBinding.recyclerViewTeamRepos.setAdapter(adapter);
|
|
addNewTeamRepositoryBinding.noData.setVisibility(View.GONE);
|
|
}
|
|
else {
|
|
|
|
addNewTeamRepositoryBinding.noData.setVisibility(View.VISIBLE);
|
|
}
|
|
|
|
addNewTeamRepositoryBinding.progressBar.setVisibility(View.GONE);
|
|
}
|
|
else {
|
|
Toasty.error(ctx, getString(R.string.genericError));
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onFailure(@NonNull Call<List<Repository>> call, @NonNull Throwable t) {
|
|
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
|
}
|
|
});
|
|
}
|
|
|
|
private void initCloseListener() {
|
|
onClickListener = view -> finish();
|
|
}
|
|
}
|