mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
Show only issues
This commit is contained in:
parent
da16439975
commit
614e053796
@ -27,10 +27,10 @@ import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.fragments.BottomSheetRepoFragment;
|
||||
import org.mian.gitnex.fragments.BranchesFragment;
|
||||
import org.mian.gitnex.fragments.ClosedIssuesFragment;
|
||||
import org.mian.gitnex.fragments.IssuesClosedFragment;
|
||||
import org.mian.gitnex.fragments.CollaboratorsFragment;
|
||||
import org.mian.gitnex.fragments.FilesFragment;
|
||||
import org.mian.gitnex.fragments.IssuesFragment;
|
||||
import org.mian.gitnex.fragments.IssuesOpenFragment;
|
||||
import org.mian.gitnex.fragments.LabelsFragment;
|
||||
import org.mian.gitnex.fragments.MilestonesFragment;
|
||||
import org.mian.gitnex.fragments.PullRequestsFragment;
|
||||
@ -262,10 +262,10 @@ public class RepoDetailActivity extends BaseActivity implements BottomSheetRepoF
|
||||
case 1: // files
|
||||
return FilesFragment.newInstance(repoOwner, repoName);
|
||||
case 2: // issues
|
||||
fragment = new IssuesFragment();
|
||||
fragment = new IssuesOpenFragment();
|
||||
break;
|
||||
case 3: // closed issues
|
||||
fragment = new ClosedIssuesFragment();
|
||||
fragment = new IssuesClosedFragment();
|
||||
break;
|
||||
case 4: // pull requests
|
||||
fragment = new PullRequestsFragment();
|
||||
|
@ -39,7 +39,7 @@ import retrofit2.Response;
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class ClosedIssuesFragment extends Fragment {
|
||||
public class IssuesClosedFragment extends Fragment {
|
||||
|
||||
private ProgressBar mProgressBarClosed;
|
||||
private RecyclerView recyclerViewClosed;
|
||||
@ -52,6 +52,7 @@ public class ClosedIssuesFragment extends Fragment {
|
||||
private TextView noDataIssuesClosed;
|
||||
private String issueState = "closed";
|
||||
private int resultLimit = 50;
|
||||
private String requestType = "issues" ;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@ -87,7 +88,7 @@ public class ClosedIssuesFragment extends Fragment {
|
||||
public void run() {
|
||||
|
||||
swipeRefresh.setRefreshing(false);
|
||||
loadInitial(instanceToken, repoOwner, repoName, issueState, resultLimit);
|
||||
loadInitial(instanceToken, repoOwner, repoName, issueState, resultLimit, requestType);
|
||||
adapterClosed.notifyDataChanged();
|
||||
|
||||
}
|
||||
@ -106,7 +107,7 @@ public class ClosedIssuesFragment extends Fragment {
|
||||
if(issuesListClosed.size() == 10 || pageSize == 10) {
|
||||
|
||||
int page = (issuesListClosed.size() + 10) / 10;
|
||||
loadMore(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, page, issueState, resultLimit);
|
||||
loadMore(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, page, issueState, resultLimit, requestType);
|
||||
|
||||
}
|
||||
/*else {
|
||||
@ -125,7 +126,7 @@ public class ClosedIssuesFragment extends Fragment {
|
||||
recyclerViewClosed.setAdapter(adapterClosed);
|
||||
|
||||
apiClosed = IssuesService.createService(ApiInterface.class, instanceUrl, getContext());
|
||||
loadInitial(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, issueState, resultLimit);
|
||||
loadInitial(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, issueState, resultLimit, requestType);
|
||||
|
||||
return v;
|
||||
|
||||
@ -145,16 +146,16 @@ public class ClosedIssuesFragment extends Fragment {
|
||||
|
||||
if(tinyDb.getBoolean("resumeClosedIssues")) {
|
||||
|
||||
loadInitial(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, issueState, resultLimit);
|
||||
loadInitial(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, issueState, resultLimit, requestType);
|
||||
tinyDb.putBoolean("resumeClosedIssues", false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void loadInitial(String token, String repoOwner, String repoName, String issueState, int resultLimit) {
|
||||
private void loadInitial(String token, String repoOwner, String repoName, String issueState, int resultLimit, String requestType) {
|
||||
|
||||
Call<List<Issues>> call = apiClosed.getClosedIssues(token, repoOwner, repoName, 1, issueState, resultLimit);
|
||||
Call<List<Issues>> call = apiClosed.getClosedIssues(token, repoOwner, repoName, 1, issueState, resultLimit, requestType);
|
||||
|
||||
call.enqueue(new Callback<List<Issues>>() {
|
||||
|
||||
@ -194,13 +195,13 @@ public class ClosedIssuesFragment extends Fragment {
|
||||
|
||||
}
|
||||
|
||||
private void loadMore(String token, String repoOwner, String repoName, int page, String issueState, int resultLimit){
|
||||
private void loadMore(String token, String repoOwner, String repoName, int page, String issueState, int resultLimit, String requestType){
|
||||
|
||||
//add loading progress view
|
||||
issuesListClosed.add(new Issues("load"));
|
||||
adapterClosed.notifyItemInserted((issuesListClosed.size() - 1));
|
||||
|
||||
Call<List<Issues>> call = apiClosed.getClosedIssues(token, repoOwner, repoName, page, issueState, resultLimit);
|
||||
Call<List<Issues>> call = apiClosed.getClosedIssues(token, repoOwner, repoName, page, issueState, resultLimit, requestType);
|
||||
|
||||
call.enqueue(new Callback<List<Issues>>() {
|
||||
|
@ -39,7 +39,7 @@ import java.util.Objects;
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class IssuesFragment extends Fragment {
|
||||
public class IssuesOpenFragment extends Fragment {
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private RecyclerView recyclerView;
|
||||
@ -51,6 +51,7 @@ public class IssuesFragment extends Fragment {
|
||||
private int pageSize = 1;
|
||||
private TextView noDataIssues;
|
||||
private int resultLimit = 50;
|
||||
private String requestType = "issues" ;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@ -86,7 +87,7 @@ public class IssuesFragment extends Fragment {
|
||||
public void run() {
|
||||
|
||||
swipeRefresh.setRefreshing(false);
|
||||
loadInitial(instanceToken, repoOwner, repoName, resultLimit);
|
||||
loadInitial(instanceToken, repoOwner, repoName, resultLimit, requestType);
|
||||
adapter.notifyDataChanged();
|
||||
|
||||
}
|
||||
@ -105,7 +106,7 @@ public class IssuesFragment extends Fragment {
|
||||
if(issuesList.size() == 10 || pageSize == 10) {
|
||||
|
||||
int page = (issuesList.size() + 10) / 10;
|
||||
loadMore(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, page, resultLimit);
|
||||
loadMore(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, page, resultLimit, requestType);
|
||||
|
||||
}
|
||||
/*else {
|
||||
@ -124,7 +125,7 @@ public class IssuesFragment extends Fragment {
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
api = IssuesService.createService(ApiInterface.class, instanceUrl, getContext());
|
||||
loadInitial(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, resultLimit);
|
||||
loadInitial(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, resultLimit, requestType);
|
||||
|
||||
return v;
|
||||
|
||||
@ -144,16 +145,16 @@ public class IssuesFragment extends Fragment {
|
||||
|
||||
if(tinyDb.getBoolean("resumeIssues")) {
|
||||
|
||||
loadInitial(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, resultLimit);
|
||||
loadInitial(Authorization.returnAuthentication(getContext(), loginUid, instanceToken), repoOwner, repoName, resultLimit, requestType);
|
||||
tinyDb.putBoolean("resumeIssues", false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void loadInitial(String token, String repoOwner, String repoName, int resultLimit) {
|
||||
private void loadInitial(String token, String repoOwner, String repoName, int resultLimit, String requestType) {
|
||||
|
||||
Call<List<Issues>> call = api.getIssues(token, repoOwner, repoName, 1, resultLimit);
|
||||
Call<List<Issues>> call = api.getIssues(token, repoOwner, repoName, 1, resultLimit, requestType);
|
||||
|
||||
call.enqueue(new Callback<List<Issues>>() {
|
||||
|
||||
@ -193,13 +194,13 @@ public class IssuesFragment extends Fragment {
|
||||
|
||||
}
|
||||
|
||||
private void loadMore(String token, String repoOwner, String repoName, int page, int resultLimit){
|
||||
private void loadMore(String token, String repoOwner, String repoName, int page, int resultLimit, String requestType){
|
||||
|
||||
//add loading progress view
|
||||
issuesList.add(new Issues("load"));
|
||||
adapter.notifyItemInserted((issuesList.size() - 1));
|
||||
|
||||
Call<List<Issues>> call = api.getIssues(token, repoOwner, repoName, page, resultLimit);
|
||||
Call<List<Issues>> call = api.getIssues(token, repoOwner, repoName, page, resultLimit, requestType);
|
||||
|
||||
call.enqueue(new Callback<List<Issues>>() {
|
||||
|
@ -90,10 +90,10 @@ public interface ApiInterface {
|
||||
Call<UserRepositories> getUserRepository(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName);
|
||||
|
||||
@GET("repos/{owner}/{repo}/issues") // get issues by repo
|
||||
Call<List<Issues>> getIssues(@Header("Authorization") String token, @Path("owner") String owner, @Path("repo") String repo, @Query("page") int page, @Query("limit") int limit);
|
||||
Call<List<Issues>> getIssues(@Header("Authorization") String token, @Path("owner") String owner, @Path("repo") String repo, @Query("page") int page, @Query("limit") int limit, @Query("type") String requestType);
|
||||
|
||||
@GET("repos/{owner}/{repo}/issues") // get closed issues by repo
|
||||
Call<List<Issues>> getClosedIssues(@Header("Authorization") String token, @Path("owner") String owner, @Path("repo") String repo, @Query("page") int page, @Query("state") String issueState, @Query("limit") int limit);
|
||||
Call<List<Issues>> getClosedIssues(@Header("Authorization") String token, @Path("owner") String owner, @Path("repo") String repo, @Query("page") int page, @Query("state") String issueState, @Query("limit") int limit, @Query("type") String requestType);
|
||||
|
||||
@GET("repos/{owner}/{repo}/issues/{index}") // get issue by id
|
||||
Call<Issues> getIssueByIndex(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("index") int issueIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user