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>
93 lines
2.8 KiB
Java
93 lines
2.8 KiB
Java
package org.mian.gitnex.activities;
|
|
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
import android.widget.GridView;
|
|
import android.widget.ImageView;
|
|
import android.widget.ProgressBar;
|
|
import android.widget.TextView;
|
|
import androidx.lifecycle.ViewModelProvider;
|
|
import org.mian.gitnex.R;
|
|
import org.mian.gitnex.adapters.UserGridAdapter;
|
|
import org.mian.gitnex.databinding.ActivityRepoWatchersBinding;
|
|
import org.mian.gitnex.helpers.contexts.RepositoryContext;
|
|
import org.mian.gitnex.viewmodels.RepoWatchersViewModel;
|
|
|
|
/**
|
|
* @author M M Arif
|
|
*/
|
|
|
|
public class RepoWatchersActivity extends BaseActivity {
|
|
|
|
private TextView noDataWatchers;
|
|
private View.OnClickListener onClickListener;
|
|
private UserGridAdapter adapter;
|
|
private GridView mGridView;
|
|
private ProgressBar mProgressBar;
|
|
|
|
private RepositoryContext repository;
|
|
|
|
@Override
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
ActivityRepoWatchersBinding activityRepoWatchersBinding = ActivityRepoWatchersBinding.inflate(getLayoutInflater());
|
|
setContentView(activityRepoWatchersBinding.getRoot());
|
|
|
|
ImageView closeActivity = activityRepoWatchersBinding.close;
|
|
TextView toolbarTitle = activityRepoWatchersBinding.toolbarTitle;
|
|
noDataWatchers = activityRepoWatchersBinding.noDataWatchers;
|
|
mGridView = activityRepoWatchersBinding.gridView;
|
|
mProgressBar = activityRepoWatchersBinding.progressBar;
|
|
|
|
repository = RepositoryContext.fromIntent(getIntent());
|
|
final String repoOwner = repository.getOwner();
|
|
final String repoName = repository.getName();
|
|
|
|
initCloseListener();
|
|
closeActivity.setOnClickListener(onClickListener);
|
|
|
|
toolbarTitle.setText(R.string.repoWatchersInMenu);
|
|
|
|
fetchDataAsync(repoOwner, repoName);
|
|
}
|
|
|
|
private void fetchDataAsync(String repoOwner, String repoName) {
|
|
|
|
RepoWatchersViewModel repoWatchersModel = new ViewModelProvider(this).get(RepoWatchersViewModel.class);
|
|
|
|
repoWatchersModel.getRepoWatchers(repoOwner, repoName, ctx).observe(this, watchersListMain -> {
|
|
|
|
adapter = new UserGridAdapter(ctx, watchersListMain);
|
|
|
|
if(adapter.getCount() > 0) {
|
|
|
|
mGridView.setAdapter(adapter);
|
|
noDataWatchers.setVisibility(View.GONE);
|
|
}
|
|
else {
|
|
|
|
adapter.notifyDataSetChanged();
|
|
mGridView.setAdapter(adapter);
|
|
noDataWatchers.setVisibility(View.VISIBLE);
|
|
}
|
|
|
|
mProgressBar.setVisibility(View.GONE);
|
|
});
|
|
|
|
}
|
|
|
|
private void initCloseListener() {
|
|
|
|
onClickListener = view -> finish();
|
|
}
|
|
|
|
@Override
|
|
public void onResume() {
|
|
super.onResume();
|
|
repository.checkAccountSwitch(this);
|
|
}
|
|
|
|
}
|