2019-06-03 23:25:05 +02:00
|
|
|
package org.mian.gitnex.activities;
|
|
|
|
|
2020-10-23 20:13:13 +02:00
|
|
|
import android.content.Intent;
|
2022-03-18 09:56:49 +01:00
|
|
|
import android.content.res.ColorStateList;
|
2019-06-03 23:25:05 +02:00
|
|
|
import android.graphics.Color;
|
|
|
|
import android.graphics.Typeface;
|
2023-03-10 19:50:15 +01:00
|
|
|
import android.os.Build;
|
2019-06-03 23:25:05 +02:00
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Handler;
|
2020-10-09 17:47:52 +02:00
|
|
|
import android.os.Looper;
|
2019-06-03 23:25:05 +02:00
|
|
|
import android.util.Log;
|
2022-08-26 19:00:08 +02:00
|
|
|
import android.view.Gravity;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuInflater;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
2019-06-03 23:25:05 +02:00
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.ScrollView;
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
import androidx.activity.result.ActivityResultLauncher;
|
|
|
|
import androidx.activity.result.contract.ActivityResultContracts;
|
2020-04-30 12:42:22 +02:00
|
|
|
import androidx.annotation.NonNull;
|
2021-01-26 16:10:31 +01:00
|
|
|
import androidx.core.content.res.ResourcesCompat;
|
|
|
|
import androidx.core.text.HtmlCompat;
|
2022-03-18 09:56:49 +01:00
|
|
|
import androidx.core.widget.ImageViewCompat;
|
2020-04-30 12:42:22 +02:00
|
|
|
import androidx.lifecycle.ViewModelProvider;
|
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
2019-06-03 23:25:05 +02:00
|
|
|
import com.amulyakhare.textdrawable.TextDrawable;
|
2022-08-07 21:34:02 +02:00
|
|
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
2019-06-03 23:25:05 +02:00
|
|
|
import com.vdurmont.emoji.EmojiParser;
|
2022-09-21 07:43:00 +02:00
|
|
|
import java.text.DateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.LinkedHashSet;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Locale;
|
|
|
|
import java.util.Objects;
|
2022-08-26 19:00:08 +02:00
|
|
|
import org.gitnex.tea4j.v2.models.EditIssueOption;
|
|
|
|
import org.gitnex.tea4j.v2.models.Issue;
|
|
|
|
import org.gitnex.tea4j.v2.models.IssueLabelsOption;
|
|
|
|
import org.gitnex.tea4j.v2.models.Label;
|
|
|
|
import org.gitnex.tea4j.v2.models.PullRequest;
|
|
|
|
import org.gitnex.tea4j.v2.models.Repository;
|
|
|
|
import org.gitnex.tea4j.v2.models.User;
|
|
|
|
import org.gitnex.tea4j.v2.models.WatchInfo;
|
2019-06-03 23:25:05 +02:00
|
|
|
import org.mian.gitnex.R;
|
2020-10-09 17:47:52 +02:00
|
|
|
import org.mian.gitnex.actions.AssigneesActions;
|
|
|
|
import org.mian.gitnex.actions.LabelsActions;
|
|
|
|
import org.mian.gitnex.adapters.AssigneesListAdapter;
|
2019-06-03 23:25:05 +02:00
|
|
|
import org.mian.gitnex.adapters.IssueCommentsAdapter;
|
2020-10-09 17:47:52 +02:00
|
|
|
import org.mian.gitnex.adapters.LabelsListAdapter;
|
2020-04-01 13:26:32 +02:00
|
|
|
import org.mian.gitnex.clients.PicassoService;
|
2019-06-03 23:25:05 +02:00
|
|
|
import org.mian.gitnex.clients.RetrofitClient;
|
2020-10-09 17:47:52 +02:00
|
|
|
import org.mian.gitnex.databinding.ActivityIssueDetailBinding;
|
|
|
|
import org.mian.gitnex.databinding.CustomAssigneesSelectionDialogBinding;
|
|
|
|
import org.mian.gitnex.databinding.CustomLabelsSelectionDialogBinding;
|
2022-08-07 21:34:02 +02:00
|
|
|
import org.mian.gitnex.databinding.CustomPrInfoDialogBinding;
|
2020-10-12 20:11:23 +02:00
|
|
|
import org.mian.gitnex.fragments.BottomSheetReplyFragment;
|
2020-03-16 20:28:03 +01:00
|
|
|
import org.mian.gitnex.fragments.BottomSheetSingleIssueFragment;
|
2022-03-28 19:57:47 +02:00
|
|
|
import org.mian.gitnex.fragments.IssuesFragment;
|
2022-08-26 19:00:08 +02:00
|
|
|
import org.mian.gitnex.helpers.AlertDialogs;
|
|
|
|
import org.mian.gitnex.helpers.AppUtil;
|
|
|
|
import org.mian.gitnex.helpers.ClickListener;
|
|
|
|
import org.mian.gitnex.helpers.ColorInverter;
|
|
|
|
import org.mian.gitnex.helpers.LabelWidthCalculator;
|
|
|
|
import org.mian.gitnex.helpers.Markdown;
|
|
|
|
import org.mian.gitnex.helpers.RoundedTransformation;
|
|
|
|
import org.mian.gitnex.helpers.TimeHelper;
|
|
|
|
import org.mian.gitnex.helpers.Toasty;
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
import org.mian.gitnex.helpers.contexts.IssueContext;
|
2021-12-15 20:20:49 +01:00
|
|
|
import org.mian.gitnex.structs.BottomSheetListener;
|
2019-06-03 23:25:05 +02:00
|
|
|
import org.mian.gitnex.viewmodels.IssueCommentsViewModel;
|
2020-11-08 19:58:47 +01:00
|
|
|
import org.mian.gitnex.views.ReactionList;
|
2020-04-30 12:42:22 +02:00
|
|
|
import retrofit2.Call;
|
|
|
|
import retrofit2.Callback;
|
|
|
|
import retrofit2.Response;
|
2019-06-03 23:25:05 +02:00
|
|
|
|
|
|
|
/**
|
2022-03-28 19:57:47 +02:00
|
|
|
* @author M M Arif
|
2019-06-03 23:25:05 +02:00
|
|
|
*/
|
2022-09-21 07:43:00 +02:00
|
|
|
public class IssueDetailActivity extends BaseActivity
|
|
|
|
implements LabelsListAdapter.LabelsListAdapterListener,
|
|
|
|
AssigneesListAdapter.AssigneesListAdapterListener,
|
|
|
|
BottomSheetListener {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2023-06-13 07:23:27 +02:00
|
|
|
private Typeface myTypeface;
|
2022-08-15 16:26:02 +02:00
|
|
|
public static boolean singleIssueUpdate = false;
|
|
|
|
public static boolean commentPosted = false;
|
|
|
|
private final List<Label> labelsList = new ArrayList<>();
|
|
|
|
private final List<User> assigneesList = new ArrayList<>();
|
|
|
|
public boolean commentEdited = false;
|
2020-04-30 12:42:22 +02:00
|
|
|
private IssueCommentsAdapter adapter;
|
2020-10-09 17:47:52 +02:00
|
|
|
private String repoOwner;
|
|
|
|
private String repoName;
|
|
|
|
private int issueIndex;
|
2022-02-11 15:27:31 +01:00
|
|
|
private String issueCreator;
|
2022-09-14 20:40:44 +02:00
|
|
|
public IssueContext issue;
|
2020-10-09 17:47:52 +02:00
|
|
|
private LabelsListAdapter labelsAdapter;
|
|
|
|
private AssigneesListAdapter assigneesAdapter;
|
|
|
|
private List<Integer> currentLabelsIds = new ArrayList<>();
|
|
|
|
private List<Integer> labelsIds = new ArrayList<>();
|
|
|
|
private List<String> assigneesListData = new ArrayList<>();
|
|
|
|
private List<String> currentAssignees = new ArrayList<>();
|
|
|
|
private ActivityIssueDetailBinding viewBinding;
|
2022-08-07 21:34:02 +02:00
|
|
|
private MaterialAlertDialogBuilder materialAlertDialogBuilder;
|
2022-04-18 09:10:54 +02:00
|
|
|
private IssueCommentsViewModel issueCommentsModel;
|
2022-09-21 07:43:00 +02:00
|
|
|
private Runnable showMenu = () -> {};
|
2022-08-15 16:26:02 +02:00
|
|
|
private boolean loadingFinishedIssue = false;
|
|
|
|
private boolean loadingFinishedPr = false;
|
|
|
|
private boolean loadingFinishedRepo = false;
|
2022-09-21 07:43:00 +02:00
|
|
|
public ActivityResultLauncher<Intent> editIssueLauncher =
|
|
|
|
registerForActivityResult(
|
|
|
|
new ActivityResultContracts.StartActivityForResult(),
|
|
|
|
result -> {
|
|
|
|
if (result.getResultCode() == 200) {
|
|
|
|
assert result.getData() != null;
|
|
|
|
if (result.getData().getBooleanExtra("issueEdited", false)) {
|
|
|
|
new Handler(Looper.getMainLooper())
|
|
|
|
.postDelayed(
|
|
|
|
() -> {
|
|
|
|
viewBinding.frameAssignees.removeAllViews();
|
|
|
|
viewBinding.frameLabels.removeAllViews();
|
|
|
|
issue.setIssue(null);
|
|
|
|
getSingleIssue(repoOwner, repoName, issueIndex);
|
|
|
|
},
|
|
|
|
500);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2022-09-14 20:40:44 +02:00
|
|
|
private int page = 1;
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
|
2020-04-30 12:42:22 +02:00
|
|
|
@Override
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
2020-10-09 17:47:52 +02:00
|
|
|
viewBinding = ActivityIssueDetailBinding.inflate(getLayoutInflater());
|
2021-01-26 18:43:25 +01:00
|
|
|
setContentView(viewBinding.getRoot());
|
2020-04-30 12:42:22 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
issue = IssueContext.fromIntent(getIntent());
|
|
|
|
repoOwner = issue.getRepository().getOwner();
|
|
|
|
repoName = issue.getRepository().getName();
|
|
|
|
issueIndex = issue.getIssueIndex();
|
2020-10-09 17:47:52 +02:00
|
|
|
|
|
|
|
setSupportActionBar(viewBinding.toolbar);
|
2020-04-30 12:42:22 +02:00
|
|
|
Objects.requireNonNull(getSupportActionBar()).setTitle(repoName);
|
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
materialAlertDialogBuilder =
|
|
|
|
new MaterialAlertDialogBuilder(ctx, R.style.ThemeOverlay_Material3_Dialog_Alert);
|
2022-08-07 21:34:02 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
issueCommentsModel = new ViewModelProvider(this).get(IssueCommentsViewModel.class);
|
|
|
|
|
2020-10-09 17:47:52 +02:00
|
|
|
viewBinding.recyclerView.setHasFixedSize(true);
|
|
|
|
viewBinding.recyclerView.setNestedScrollingEnabled(false);
|
|
|
|
viewBinding.recyclerView.setLayoutManager(new LinearLayoutManager(ctx));
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
viewBinding.addNewComment.setOnClickListener(
|
|
|
|
v -> {
|
|
|
|
BottomSheetReplyFragment bottomSheetReplyFragment =
|
|
|
|
BottomSheetReplyFragment.newInstance(new Bundle(), issue);
|
|
|
|
bottomSheetReplyFragment.setOnInteractedListener(this::onResume);
|
|
|
|
bottomSheetReplyFragment.show(getSupportFragmentManager(), "replyBottomSheet");
|
|
|
|
});
|
|
|
|
|
|
|
|
labelsAdapter =
|
|
|
|
new LabelsListAdapter(labelsList, IssueDetailActivity.this, currentLabelsIds);
|
|
|
|
assigneesAdapter =
|
|
|
|
new AssigneesListAdapter(
|
|
|
|
ctx, assigneesList, IssueDetailActivity.this, currentAssignees);
|
2020-11-02 16:17:00 +01:00
|
|
|
LabelsActions.getCurrentIssueLabels(ctx, repoOwner, repoName, issueIndex, currentLabelsIds);
|
2022-09-21 07:43:00 +02:00
|
|
|
AssigneesActions.getCurrentIssueAssignees(
|
|
|
|
ctx, repoOwner, repoName, issueIndex, currentAssignees);
|
|
|
|
|
|
|
|
viewBinding.pullToRefresh.setOnRefreshListener(
|
|
|
|
() ->
|
|
|
|
new Handler(Looper.getMainLooper())
|
|
|
|
.postDelayed(
|
|
|
|
() -> {
|
|
|
|
page = 1;
|
|
|
|
viewBinding.pullToRefresh.setRefreshing(false);
|
|
|
|
issueCommentsModel.loadIssueComments(
|
|
|
|
repoOwner, repoName, issueIndex, ctx, null);
|
|
|
|
},
|
|
|
|
50));
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2023-06-13 07:23:27 +02:00
|
|
|
myTypeface = AppUtil.getTypeface(this);
|
2020-10-09 17:47:52 +02:00
|
|
|
viewBinding.toolbarTitle.setTypeface(myTypeface);
|
|
|
|
viewBinding.toolbarTitle.setText(repoName);
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
getSingleIssue(repoOwner, repoName, issueIndex);
|
|
|
|
fetchDataAsync(repoOwner, repoName, issueIndex);
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (getIntent().getStringExtra("openPrDiff") != null
|
|
|
|
&& getIntent().getStringExtra("openPrDiff").equals("true")) {
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
startActivity(issue.getIntent(ctx, DiffActivity.class));
|
2021-07-23 17:41:19 +02:00
|
|
|
}
|
2020-04-30 12:42:22 +02:00
|
|
|
}
|
|
|
|
|
2020-10-09 17:47:52 +02:00
|
|
|
@Override
|
|
|
|
public void onButtonClicked(String text) {
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
switch (text) {
|
2020-11-08 19:58:47 +01:00
|
|
|
case "onResume":
|
|
|
|
onResume();
|
|
|
|
break;
|
|
|
|
|
2020-10-09 17:47:52 +02:00
|
|
|
case "showLabels":
|
|
|
|
showLabels();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case "showAssignees":
|
|
|
|
showAssignees();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2022-09-21 07:43:00 +02:00
|
|
|
public void labelsInterface(List<String> data) {}
|
2020-10-09 17:47:52 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void labelsIdsInterface(List<Integer> data) {
|
|
|
|
|
|
|
|
labelsIds = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void assigneesInterface(List<String> data) {
|
|
|
|
|
|
|
|
assigneesListData = data;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void showAssignees() {
|
|
|
|
|
|
|
|
assigneesAdapter.updateList(currentAssignees);
|
2022-08-07 21:34:02 +02:00
|
|
|
viewBinding.progressBar.setVisibility(View.VISIBLE);
|
2022-09-21 07:43:00 +02:00
|
|
|
CustomAssigneesSelectionDialogBinding assigneesBinding =
|
|
|
|
CustomAssigneesSelectionDialogBinding.inflate(LayoutInflater.from(ctx));
|
2020-10-09 17:47:52 +02:00
|
|
|
View view = assigneesBinding.getRoot();
|
2022-08-07 21:34:02 +02:00
|
|
|
materialAlertDialogBuilder.setView(view);
|
2020-10-09 17:47:52 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
materialAlertDialogBuilder.setPositiveButton(
|
|
|
|
R.string.saveButton,
|
|
|
|
(dialog, whichButton) -> {
|
|
|
|
currentAssignees = new ArrayList<>(new LinkedHashSet<>(currentAssignees));
|
|
|
|
assigneesListData = new ArrayList<>(new LinkedHashSet<>(assigneesListData));
|
|
|
|
Collections.sort(assigneesListData);
|
|
|
|
Collections.sort(currentAssignees);
|
2020-10-09 17:47:52 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!assigneesListData.equals(currentAssignees)) {
|
2020-10-09 17:47:52 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
updateIssueAssignees();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
AssigneesActions.getRepositoryAssignees(
|
|
|
|
ctx,
|
|
|
|
repoOwner,
|
|
|
|
repoName,
|
|
|
|
assigneesList,
|
|
|
|
materialAlertDialogBuilder,
|
|
|
|
assigneesAdapter,
|
|
|
|
assigneesBinding,
|
|
|
|
viewBinding.progressBar);
|
2020-10-09 17:47:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void showLabels() {
|
|
|
|
|
|
|
|
labelsAdapter.updateList(currentLabelsIds);
|
2022-08-07 21:34:02 +02:00
|
|
|
viewBinding.progressBar.setVisibility(View.VISIBLE);
|
2022-09-21 07:43:00 +02:00
|
|
|
CustomLabelsSelectionDialogBinding labelsBinding =
|
|
|
|
CustomLabelsSelectionDialogBinding.inflate(LayoutInflater.from(ctx));
|
2020-10-09 17:47:52 +02:00
|
|
|
View view = labelsBinding.getRoot();
|
2022-08-07 21:34:02 +02:00
|
|
|
materialAlertDialogBuilder.setView(view);
|
2020-10-09 17:47:52 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
materialAlertDialogBuilder.setPositiveButton(
|
|
|
|
R.string.saveButton,
|
|
|
|
(dialog, whichButton) -> {
|
|
|
|
currentLabelsIds = new ArrayList<>(new LinkedHashSet<>(currentLabelsIds));
|
|
|
|
labelsIds = new ArrayList<>(new LinkedHashSet<>(labelsIds));
|
|
|
|
Collections.sort(labelsIds);
|
|
|
|
Collections.sort(currentLabelsIds);
|
2020-10-09 17:47:52 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!labelsIds.equals(currentLabelsIds)) {
|
2020-10-09 17:47:52 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
updateIssueLabels();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
LabelsActions.getRepositoryLabels(
|
|
|
|
ctx,
|
|
|
|
repoOwner,
|
|
|
|
repoName,
|
|
|
|
labelsList,
|
|
|
|
materialAlertDialogBuilder,
|
|
|
|
labelsAdapter,
|
|
|
|
labelsBinding,
|
|
|
|
viewBinding.progressBar);
|
2020-10-09 17:47:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void updateIssueAssignees() {
|
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
EditIssueOption updateAssigneeJson = new EditIssueOption().assignees(assigneesListData);
|
2020-10-09 17:47:52 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
Call<Issue> call3 =
|
|
|
|
RetrofitClient.getApiInterface(ctx)
|
|
|
|
.issueEditIssue(repoOwner, repoName, (long) issueIndex, updateAssigneeJson);
|
|
|
|
|
|
|
|
call3.enqueue(
|
|
|
|
new Callback<>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResponse(
|
|
|
|
@NonNull Call<Issue> call,
|
|
|
|
@NonNull retrofit2.Response<Issue> response2) {
|
|
|
|
|
|
|
|
if (response2.code() == 201) {
|
|
|
|
|
|
|
|
Toasty.success(ctx, ctx.getString(R.string.assigneesUpdated));
|
|
|
|
|
|
|
|
viewBinding.frameAssignees.removeAllViews();
|
|
|
|
viewBinding.frameLabels.removeAllViews();
|
|
|
|
issue.setIssue(response2.body());
|
|
|
|
getSingleIssue(repoOwner, repoName, issueIndex);
|
|
|
|
currentAssignees.clear();
|
|
|
|
new Handler(Looper.getMainLooper())
|
|
|
|
.postDelayed(
|
|
|
|
() ->
|
|
|
|
AssigneesActions.getCurrentIssueAssignees(
|
|
|
|
ctx,
|
|
|
|
repoOwner,
|
|
|
|
repoName,
|
|
|
|
issueIndex,
|
|
|
|
currentAssignees),
|
|
|
|
1000);
|
|
|
|
} else if (response2.code() == 401) {
|
|
|
|
|
|
|
|
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
|
|
|
} else if (response2.code() == 403) {
|
|
|
|
|
|
|
|
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
|
|
|
} else if (response2.code() == 404) {
|
|
|
|
|
|
|
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Toasty.error(ctx, getString(R.string.genericError));
|
|
|
|
}
|
|
|
|
}
|
2020-10-09 17:47:52 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onFailure(@NonNull Call<Issue> call, @NonNull Throwable t) {
|
|
|
|
Log.e("onFailure", t.toString());
|
|
|
|
}
|
|
|
|
});
|
2020-10-09 17:47:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void updateIssueLabels() {
|
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
ArrayList<Long> labelIds = new ArrayList<>();
|
2022-09-21 07:43:00 +02:00
|
|
|
for (Integer i : labelsIds) {
|
2022-04-18 09:10:54 +02:00
|
|
|
labelIds.add((long) i);
|
|
|
|
}
|
|
|
|
|
|
|
|
IssueLabelsOption patchIssueLabels = new IssueLabelsOption();
|
|
|
|
patchIssueLabels.setLabels(labelIds);
|
2020-10-09 17:47:52 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
Call<List<Label>> call =
|
|
|
|
RetrofitClient.getApiInterface(ctx)
|
|
|
|
.issueReplaceLabels(
|
|
|
|
repoOwner, repoName, (long) issueIndex, patchIssueLabels);
|
|
|
|
|
|
|
|
call.enqueue(
|
|
|
|
new Callback<>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResponse(
|
|
|
|
@NonNull Call<List<Label>> call,
|
|
|
|
@NonNull retrofit2.Response<List<Label>> response) {
|
|
|
|
|
|
|
|
if (response.code() == 200) {
|
|
|
|
|
|
|
|
Toasty.success(ctx, ctx.getString(R.string.labelsUpdated));
|
|
|
|
|
|
|
|
viewBinding.frameAssignees.removeAllViews();
|
|
|
|
viewBinding.frameLabels.removeAllViews();
|
|
|
|
issue.setIssue(null);
|
|
|
|
getSingleIssue(repoOwner, repoName, issueIndex);
|
|
|
|
currentLabelsIds.clear();
|
|
|
|
new Handler(Looper.getMainLooper())
|
|
|
|
.postDelayed(
|
|
|
|
() ->
|
|
|
|
LabelsActions.getCurrentIssueLabels(
|
|
|
|
ctx,
|
|
|
|
repoOwner,
|
|
|
|
repoName,
|
|
|
|
issueIndex,
|
|
|
|
currentLabelsIds),
|
|
|
|
1000);
|
|
|
|
IssuesFragment.resumeIssues = true;
|
|
|
|
} else if (response.code() == 401) {
|
|
|
|
|
|
|
|
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
|
|
|
} else if (response.code() == 403) {
|
|
|
|
|
|
|
|
Toasty.error(ctx, ctx.getString(R.string.authorizeError));
|
|
|
|
} else if (response.code() == 404) {
|
|
|
|
|
|
|
|
Toasty.warning(ctx, ctx.getString(R.string.apiNotFound));
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Toasty.error(ctx, getString(R.string.genericError));
|
|
|
|
}
|
|
|
|
}
|
2020-10-09 17:47:52 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onFailure(@NonNull Call<List<Label>> call, @NonNull Throwable t) {
|
2022-04-18 09:10:54 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
Log.e("onFailure", t.toString());
|
|
|
|
}
|
|
|
|
});
|
2020-10-09 17:47:52 +02:00
|
|
|
}
|
|
|
|
|
2022-05-21 11:38:15 +02:00
|
|
|
private void updateMenuState() {
|
2022-09-21 07:43:00 +02:00
|
|
|
if (loadingFinishedIssue && loadingFinishedPr && loadingFinishedRepo) {
|
2022-08-15 16:26:02 +02:00
|
|
|
showMenu.run();
|
|
|
|
}
|
2022-05-21 11:38:15 +02:00
|
|
|
}
|
|
|
|
|
2020-04-30 12:42:22 +02:00
|
|
|
@Override
|
2022-08-26 19:00:08 +02:00
|
|
|
public boolean onCreateOptionsMenu(@NonNull Menu menu) {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
|
|
|
MenuInflater inflater = getMenuInflater();
|
2022-09-21 07:43:00 +02:00
|
|
|
showMenu =
|
|
|
|
() -> {
|
|
|
|
inflater.inflate(R.menu.generic_nav_dotted_menu, menu);
|
|
|
|
if (issue.getIssueType() != null) {
|
|
|
|
if (issue.getIssueType().equalsIgnoreCase("pull")) {
|
|
|
|
inflater.inflate(R.menu.pr_info_menu, menu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
showMenu = () -> {}; // reset Runnable
|
|
|
|
};
|
2022-05-21 11:38:15 +02:00
|
|
|
updateMenuState();
|
2020-04-30 12:42:22 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onOptionsItemSelected(MenuItem item) {
|
|
|
|
|
|
|
|
int id = item.getItemId();
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (id == android.R.id.home) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (issue.hasIssue()
|
|
|
|
&& getIntent().getStringExtra("openedFromLink") != null
|
|
|
|
&& getIntent().getStringExtra("openedFromLink").equals("true")) {
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
Intent intent = issue.getRepository().getIntent(ctx, RepoDetailActivity.class);
|
2021-07-09 17:36:59 +02:00
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
|
|
startActivity(intent);
|
|
|
|
}
|
2020-10-29 14:13:19 +01:00
|
|
|
finish();
|
|
|
|
return true;
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (id == R.id.genericMenu) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (issue.hasIssue()) {
|
|
|
|
BottomSheetSingleIssueFragment bottomSheet =
|
|
|
|
new BottomSheetSingleIssueFragment(issue, issueCreator);
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
bottomSheet.show(getSupportFragmentManager(), "singleIssueBottomSheet");
|
|
|
|
}
|
2020-10-29 14:13:19 +01:00
|
|
|
return true;
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (id == R.id.prInfo) {
|
2022-04-22 17:18:38 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (issue.getPullRequest() != null) {
|
2022-04-22 17:18:38 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
MaterialAlertDialogBuilder materialAlertDialogBuilderPrInfo =
|
|
|
|
new MaterialAlertDialogBuilder(ctx);
|
|
|
|
CustomPrInfoDialogBinding customPrInfoDialogBinding =
|
|
|
|
CustomPrInfoDialogBinding.inflate(LayoutInflater.from(ctx));
|
2022-08-07 21:34:02 +02:00
|
|
|
View view = customPrInfoDialogBinding.getRoot();
|
|
|
|
materialAlertDialogBuilderPrInfo.setView(view);
|
2022-04-22 17:18:38 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
customPrInfoDialogBinding.baseBranch.setText(
|
|
|
|
issue.getPullRequest().getBase().getRef());
|
|
|
|
customPrInfoDialogBinding.headBranch.setText(
|
|
|
|
issue.getPullRequest().getHead().getRef());
|
2022-04-22 17:18:38 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
materialAlertDialogBuilderPrInfo.setTitle(
|
|
|
|
getResources().getString(R.string.prMergeInfo));
|
2022-08-07 21:34:02 +02:00
|
|
|
materialAlertDialogBuilderPrInfo.setNeutralButton(getString(R.string.close), null);
|
|
|
|
materialAlertDialogBuilderPrInfo.create().show();
|
2022-05-21 11:38:15 +02:00
|
|
|
}
|
2022-04-22 17:18:38 +02:00
|
|
|
return true;
|
2022-09-21 07:43:00 +02:00
|
|
|
} else {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2020-10-29 14:13:19 +01:00
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
|
}
|
2020-04-30 12:42:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResume() {
|
|
|
|
|
|
|
|
super.onResume();
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
issue.getRepository().checkAccountSwitch(this);
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (commentPosted) {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
viewBinding.scrollViewComments.post(
|
|
|
|
() -> {
|
|
|
|
issueCommentsModel.loadIssueComments(
|
|
|
|
repoOwner,
|
|
|
|
repoName,
|
|
|
|
issueIndex,
|
|
|
|
ctx,
|
|
|
|
() ->
|
|
|
|
viewBinding.scrollViewComments.fullScroll(
|
|
|
|
ScrollView.FOCUS_DOWN));
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
commentPosted = false;
|
|
|
|
});
|
2020-04-30 12:42:22 +02:00
|
|
|
}
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (commentEdited) {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
viewBinding.scrollViewComments.post(
|
|
|
|
() -> {
|
|
|
|
issueCommentsModel.loadIssueComments(
|
|
|
|
repoOwner, repoName, issueIndex, ctx, null);
|
|
|
|
commentEdited = false;
|
|
|
|
});
|
2020-04-30 12:42:22 +02:00
|
|
|
}
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (singleIssueUpdate) {
|
|
|
|
|
|
|
|
new Handler(Looper.getMainLooper())
|
|
|
|
.postDelayed(
|
|
|
|
() -> {
|
|
|
|
viewBinding.frameAssignees.removeAllViews();
|
|
|
|
viewBinding.frameLabels.removeAllViews();
|
|
|
|
issue.setIssue(null);
|
|
|
|
getSingleIssue(repoOwner, repoName, issueIndex);
|
|
|
|
singleIssueUpdate = false;
|
|
|
|
},
|
|
|
|
500);
|
2020-04-30 12:42:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
private void fetchDataAsync(String owner, String repo, int index) {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
issueCommentsModel
|
|
|
|
.getIssueCommentList(owner, repo, index, ctx)
|
|
|
|
.observe(
|
|
|
|
this,
|
|
|
|
issueCommentsMain -> {
|
|
|
|
Bundle bundle = new Bundle();
|
|
|
|
bundle.putString("repoOwner", repoOwner);
|
|
|
|
bundle.putString("repoName", repoName);
|
|
|
|
bundle.putInt("issueNumber", issueIndex);
|
|
|
|
|
|
|
|
adapter =
|
|
|
|
new IssueCommentsAdapter(
|
|
|
|
ctx,
|
|
|
|
bundle,
|
|
|
|
issueCommentsMain,
|
|
|
|
getSupportFragmentManager(),
|
|
|
|
this::onResume,
|
|
|
|
issue);
|
|
|
|
adapter.setLoadMoreListener(
|
|
|
|
new IssueCommentsAdapter.OnLoadMoreListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onLoadMore() {
|
|
|
|
|
|
|
|
page += 1;
|
|
|
|
issueCommentsModel.loadMoreIssueComments(
|
|
|
|
owner, repo, index, ctx, page, adapter);
|
|
|
|
viewBinding.progressBar.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onLoadFinished() {
|
|
|
|
|
|
|
|
viewBinding.progressBar.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
adapter.notifyDataChanged();
|
|
|
|
viewBinding.recyclerView.setAdapter(adapter);
|
|
|
|
viewBinding.progressBar.setVisibility(View.GONE);
|
|
|
|
});
|
2020-04-30 12:42:22 +02:00
|
|
|
}
|
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
private void getSingleIssue(String repoOwner, String repoName, int issueIndex) {
|
2022-09-14 20:40:44 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (issue.hasIssue()) {
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.progressBar.setVisibility(View.GONE);
|
|
|
|
getSubscribed();
|
|
|
|
initWithIssue();
|
|
|
|
return;
|
|
|
|
}
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
Call<Issue> call =
|
|
|
|
RetrofitClient.getApiInterface(ctx)
|
|
|
|
.issueGetIssue(repoOwner, repoName, (long) issueIndex);
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
call.enqueue(
|
|
|
|
new Callback<>() {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onResponse(
|
|
|
|
@NonNull Call<Issue> call, @NonNull Response<Issue> response) {
|
2022-04-18 09:10:54 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
viewBinding.progressBar.setVisibility(View.GONE);
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (response.code() == 200) {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
Issue singleIssue = response.body();
|
|
|
|
assert singleIssue != null;
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
issue.setIssue(singleIssue);
|
|
|
|
initWithIssue();
|
|
|
|
} else if (response.code() == 401) {
|
2020-09-13 06:52:30 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
AlertDialogs.authorizationTokenRevokedDialog(ctx);
|
2020-09-13 06:52:30 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (response.code() == 404) {
|
2020-09-13 06:52:30 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
Toasty.warning(ctx, getResources().getString(R.string.noDataFound));
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
2022-04-18 09:10:54 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onFailure(@NonNull Call<Issue> call, @NonNull Throwable t) {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
viewBinding.progressBar.setVisibility(View.GONE);
|
|
|
|
Log.e("onFailure", t.toString());
|
|
|
|
}
|
|
|
|
});
|
2020-04-30 12:42:22 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
getSubscribed();
|
|
|
|
}
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
private void getSubscribed() {
|
2022-09-21 07:43:00 +02:00
|
|
|
RetrofitClient.getApiInterface(ctx)
|
|
|
|
.issueCheckSubscription(repoOwner, repoName, (long) issueIndex)
|
|
|
|
.enqueue(
|
|
|
|
new Callback<>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResponse(
|
|
|
|
@NonNull Call<WatchInfo> call,
|
|
|
|
@NonNull Response<WatchInfo> response) {
|
|
|
|
|
|
|
|
if (response.isSuccessful()) {
|
|
|
|
assert response.body() != null;
|
|
|
|
issue.setSubscribed(response.body().isSubscribed());
|
|
|
|
} else {
|
|
|
|
issue.setSubscribed(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(
|
|
|
|
@NonNull Call<WatchInfo> call, @NonNull Throwable t) {
|
|
|
|
|
|
|
|
issue.setSubscribed(false);
|
|
|
|
}
|
|
|
|
});
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
}
|
2020-04-30 12:42:22 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
private void initWithIssue() {
|
2022-09-14 20:40:44 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!issue.getRepository().hasRepository()) {
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
getRepoInfo();
|
2022-09-21 07:43:00 +02:00
|
|
|
} else {
|
2022-05-21 11:38:15 +02:00
|
|
|
loadingFinishedRepo = true;
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
}
|
2022-05-21 11:38:15 +02:00
|
|
|
loadingFinishedIssue = true;
|
|
|
|
updateMenuState();
|
2019-06-03 23:25:05 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.issuePrState.setVisibility(View.VISIBLE);
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (issue.getIssue().getPullRequest() != null) {
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
getPullRequest();
|
2022-09-21 07:43:00 +02:00
|
|
|
if (issue.getIssue().getPullRequest().isMerged()) { // merged
|
2021-08-02 20:04:33 +02:00
|
|
|
|
2022-03-18 09:56:49 +01:00
|
|
|
viewBinding.issuePrState.setImageResource(R.drawable.ic_pull_request);
|
2022-09-21 07:43:00 +02:00
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources().getColor(R.color.iconPrMergedColor, null)));
|
|
|
|
} else if (!issue.getIssue().getPullRequest().isMerged()
|
|
|
|
&& issue.getIssue().getState().equals("closed")) { // closed
|
2021-08-02 20:04:33 +02:00
|
|
|
|
2022-03-18 09:56:49 +01:00
|
|
|
viewBinding.issuePrState.setImageResource(R.drawable.ic_pull_request);
|
2022-09-21 07:43:00 +02:00
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources().getColor(R.color.iconIssuePrClosedColor, null)));
|
2023-09-19 07:23:43 +02:00
|
|
|
} else if (issue.getIssue().getTitle().contains("[WIP]")
|
|
|
|
|| issue.getIssue().getTitle().contains("[wip]")) { // draft
|
|
|
|
|
|
|
|
viewBinding.issuePrState.setImageResource(R.drawable.ic_draft);
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources().getColor(R.color.colorWhite, null)));
|
|
|
|
viewBinding.issuePrState.setBackgroundResource(R.drawable.shape_draft_release);
|
|
|
|
viewBinding.issuePrState.setPadding(
|
|
|
|
(int) ctx.getResources().getDimension(R.dimen.dimen4dp),
|
|
|
|
(int) ctx.getResources().getDimension(R.dimen.dimen2dp),
|
|
|
|
(int) ctx.getResources().getDimension(R.dimen.dimen4dp),
|
|
|
|
(int) ctx.getResources().getDimension(R.dimen.dimen2dp));
|
|
|
|
|
|
|
|
viewBinding.toolbarTitle.setPadding(
|
|
|
|
(int) ctx.getResources().getDimension(R.dimen.dimen12dp),
|
|
|
|
(int) ctx.getResources().getDimension(R.dimen.dimen0dp),
|
|
|
|
(int) ctx.getResources().getDimension(R.dimen.dimen0dp),
|
|
|
|
(int) ctx.getResources().getDimension(R.dimen.dimen0dp));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else { // open
|
2021-08-02 20:04:33 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.issuePrState.setImageResource(R.drawable.ic_pull_request);
|
2022-09-21 07:43:00 +02:00
|
|
|
if (tinyDB.getInt("themeId") == 3) {
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources()
|
|
|
|
.getColor(R.color.retroThemeColorPrimary, null)));
|
|
|
|
} else if (tinyDB.getInt("themeId") == 4) {
|
|
|
|
if (TimeHelper.timeBetweenHours(
|
|
|
|
tinyDB.getInt("darkThemeTimeHour", 18),
|
|
|
|
tinyDB.getInt("lightThemeTimeHour", 6),
|
|
|
|
tinyDB.getInt("darkThemeTimeMinute", 0),
|
|
|
|
tinyDB.getInt("lightThemeTimeMinute", 0))) {
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources().getColor(R.color.darkGreen, null)));
|
|
|
|
} else {
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources()
|
|
|
|
.getColor(R.color.retroThemeColorPrimary, null)));
|
2022-08-26 19:00:08 +02:00
|
|
|
}
|
2023-03-10 19:50:15 +01:00
|
|
|
} else if (tinyDB.getInt("themeId") == 8) {
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources()
|
|
|
|
.getColor(
|
|
|
|
android.R.color.system_accent1_300, null)));
|
|
|
|
}
|
2022-09-21 07:43:00 +02:00
|
|
|
} else {
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources().getColor(R.color.darkGreen, null)));
|
2022-08-26 19:00:08 +02:00
|
|
|
}
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
}
|
2022-09-21 07:43:00 +02:00
|
|
|
} else if (issue.getIssue().getState().equals("closed")) { // issue closed
|
2022-05-21 11:38:15 +02:00
|
|
|
loadingFinishedPr = true;
|
|
|
|
updateMenuState();
|
2022-03-18 09:56:49 +01:00
|
|
|
viewBinding.issuePrState.setImageResource(R.drawable.ic_issue);
|
2022-09-21 07:43:00 +02:00
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources().getColor(R.color.iconIssuePrClosedColor, null)));
|
|
|
|
} else {
|
2022-05-21 11:38:15 +02:00
|
|
|
loadingFinishedPr = true;
|
|
|
|
updateMenuState();
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.issuePrState.setImageResource(R.drawable.ic_issue);
|
2022-09-21 07:43:00 +02:00
|
|
|
if (tinyDB.getInt("themeId") == 3) {
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources().getColor(R.color.retroThemeColorPrimary, null)));
|
|
|
|
} else if (tinyDB.getInt("themeId") == 4) {
|
|
|
|
if (TimeHelper.timeBetweenHours(
|
|
|
|
tinyDB.getInt("darkThemeTimeHour", 18),
|
|
|
|
tinyDB.getInt("lightThemeTimeHour", 6),
|
|
|
|
tinyDB.getInt("darkThemeTimeMinute", 0),
|
|
|
|
tinyDB.getInt("lightThemeTimeMinute", 0))) {
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources().getColor(R.color.darkGreen, null)));
|
|
|
|
} else {
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources()
|
|
|
|
.getColor(R.color.retroThemeColorPrimary, null)));
|
2022-08-26 19:00:08 +02:00
|
|
|
}
|
2023-03-10 19:50:15 +01:00
|
|
|
} else if (tinyDB.getInt("themeId") == 8) {
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources()
|
|
|
|
.getColor(android.R.color.system_accent1_300, null)));
|
|
|
|
}
|
2022-09-21 07:43:00 +02:00
|
|
|
} else {
|
|
|
|
ImageViewCompat.setImageTintList(
|
|
|
|
viewBinding.issuePrState,
|
|
|
|
ColorStateList.valueOf(
|
|
|
|
ctx.getResources().getColor(R.color.darkGreen, null)));
|
2022-08-26 19:00:08 +02:00
|
|
|
}
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
}
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
final Locale locale = getResources().getConfiguration().locale;
|
|
|
|
issueCreator = issue.getIssue().getUser().getLogin();
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
PicassoService.getInstance(ctx)
|
|
|
|
.get()
|
|
|
|
.load(issue.getIssue().getUser().getAvatarUrl())
|
|
|
|
.placeholder(R.drawable.loader_animated)
|
|
|
|
.transform(new RoundedTransformation(8, 0))
|
|
|
|
.resize(120, 120)
|
|
|
|
.centerCrop()
|
|
|
|
.into(viewBinding.assigneeAvatar);
|
|
|
|
String issueNumber_ =
|
|
|
|
"<font color='"
|
|
|
|
+ ResourcesCompat.getColor(getResources(), R.color.lightGray, null)
|
|
|
|
+ "'>"
|
|
|
|
+ appCtx.getResources().getString(R.string.hash)
|
|
|
|
+ issue.getIssue().getNumber()
|
|
|
|
+ "</font>";
|
|
|
|
viewBinding.issueTitle.setText(
|
|
|
|
HtmlCompat.fromHtml(
|
|
|
|
issueNumber_
|
|
|
|
+ " "
|
|
|
|
+ EmojiParser.parseToUnicode(issue.getIssue().getTitle()),
|
|
|
|
HtmlCompat.FROM_HTML_MODE_LEGACY));
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
String cleanIssueDescription = issue.getIssue().getBody().trim();
|
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!AppUtil.checkGhostUsers(issue.getIssue().getUser().getLogin())) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
viewBinding.assigneeAvatar.setOnClickListener(
|
|
|
|
loginId -> {
|
|
|
|
Intent intent = new Intent(ctx, ProfileActivity.class);
|
|
|
|
intent.putExtra("username", issue.getIssue().getUser().getLogin());
|
|
|
|
ctx.startActivity(intent);
|
|
|
|
});
|
2022-08-01 09:24:23 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
viewBinding.assigneeAvatar.setOnLongClickListener(
|
|
|
|
loginId -> {
|
|
|
|
AppUtil.copyToClipboard(
|
|
|
|
ctx,
|
|
|
|
issue.getIssue().getUser().getLogin(),
|
|
|
|
ctx.getString(
|
|
|
|
R.string.copyLoginIdToClipBoard,
|
|
|
|
issue.getIssue().getUser().getLogin()));
|
|
|
|
return true;
|
|
|
|
});
|
2022-08-01 09:24:23 +02:00
|
|
|
}
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-14 20:40:44 +02:00
|
|
|
viewBinding.author.setText(issue.getIssue().getUser().getLogin());
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!cleanIssueDescription.equals("")) {
|
2022-09-14 20:40:44 +02:00
|
|
|
viewBinding.issueDescription.setVisibility(View.VISIBLE);
|
2022-09-21 07:43:00 +02:00
|
|
|
Markdown.render(
|
|
|
|
ctx,
|
|
|
|
EmojiParser.parseToUnicode(cleanIssueDescription),
|
|
|
|
viewBinding.issueDescription,
|
|
|
|
issue.getRepository());
|
|
|
|
} else {
|
2022-09-14 20:40:44 +02:00
|
|
|
viewBinding.issueDescription.setVisibility(View.GONE);
|
|
|
|
}
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-09-14 20:40:44 +02:00
|
|
|
LinearLayout.LayoutParams paramsAssignees = new LinearLayout.LayoutParams(64, 64);
|
|
|
|
paramsAssignees.setMargins(15, 0, 0, 0);
|
2020-07-22 21:32:42 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (issue.getIssue().getAssignees() != null) {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.assigneesScrollView.setVisibility(View.VISIBLE);
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
for (int i = 0; i < issue.getIssue().getAssignees().size(); i++) {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
ImageView assigneesView = new ImageView(ctx);
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
PicassoService.getInstance(ctx)
|
|
|
|
.get()
|
|
|
|
.load(issue.getIssue().getAssignees().get(i).getAvatarUrl())
|
|
|
|
.placeholder(R.drawable.loader_animated)
|
|
|
|
.transform(new RoundedTransformation(36, 0))
|
|
|
|
.resize(72, 72)
|
|
|
|
.centerCrop()
|
|
|
|
.into(assigneesView);
|
2020-07-22 21:32:42 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.frameAssignees.addView(assigneesView);
|
2022-09-14 20:40:44 +02:00
|
|
|
assigneesView.setLayoutParams(paramsAssignees);
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
int finalI = i;
|
2022-08-01 09:24:23 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!AppUtil.checkGhostUsers(
|
|
|
|
issue.getIssue().getAssignees().get(finalI).getLogin())) {
|
|
|
|
|
|
|
|
assigneesView.setOnClickListener(
|
|
|
|
loginId -> {
|
|
|
|
Intent intent = new Intent(ctx, ProfileActivity.class);
|
|
|
|
intent.putExtra(
|
|
|
|
"username",
|
|
|
|
issue.getIssue().getAssignees().get(finalI).getLogin());
|
|
|
|
ctx.startActivity(intent);
|
|
|
|
});
|
|
|
|
|
|
|
|
assigneesView.setOnLongClickListener(
|
|
|
|
loginId -> {
|
|
|
|
AppUtil.copyToClipboard(
|
|
|
|
ctx,
|
|
|
|
issue.getIssue().getAssignees().get(finalI).getLogin(),
|
|
|
|
ctx.getString(
|
|
|
|
R.string.copyLoginIdToClipBoard,
|
|
|
|
issue.getIssue()
|
|
|
|
.getAssignees()
|
|
|
|
.get(finalI)
|
|
|
|
.getLogin()));
|
|
|
|
return true;
|
|
|
|
});
|
2022-08-01 09:24:23 +02:00
|
|
|
}
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
}
|
2022-09-21 07:43:00 +02:00
|
|
|
} else {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.assigneesScrollView.setVisibility(View.GONE);
|
|
|
|
}
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
LinearLayout.LayoutParams paramsLabels =
|
|
|
|
new LinearLayout.LayoutParams(
|
|
|
|
LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
|
|
LinearLayout.LayoutParams.WRAP_CONTENT);
|
2022-09-14 20:40:44 +02:00
|
|
|
paramsLabels.setMargins(0, 0, 15, 0);
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (issue.getIssue().getLabels().size() > 0) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.labelsScrollView.setVisibility(View.VISIBLE);
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
for (int i = 0; i < issue.getIssue().getLabels().size(); i++) {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
String labelColor = issue.getIssue().getLabels().get(i).getColor();
|
|
|
|
String labelName = issue.getIssue().getLabels().get(i).getName();
|
|
|
|
int color = Color.parseColor("#" + labelColor);
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
ImageView labelsView = new ImageView(ctx);
|
|
|
|
viewBinding.frameLabels.setOrientation(LinearLayout.HORIZONTAL);
|
|
|
|
viewBinding.frameLabels.setGravity(Gravity.START | Gravity.TOP);
|
2022-09-14 20:40:44 +02:00
|
|
|
labelsView.setLayoutParams(paramsLabels);
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-03-28 19:57:47 +02:00
|
|
|
int height = AppUtil.getPixelsFromDensity(ctx, 20);
|
|
|
|
int textSize = AppUtil.getPixelsFromScaledDensity(ctx, 12);
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
TextDrawable drawable =
|
|
|
|
TextDrawable.builder()
|
|
|
|
.beginConfig()
|
2023-06-13 07:23:27 +02:00
|
|
|
.useFont(myTypeface)
|
2022-09-21 07:43:00 +02:00
|
|
|
.textColor(new ColorInverter().getContrastColor(color))
|
|
|
|
.fontSize(textSize)
|
|
|
|
.width(
|
|
|
|
LabelWidthCalculator.calculateLabelWidth(
|
|
|
|
labelName,
|
2023-06-13 07:23:27 +02:00
|
|
|
myTypeface,
|
2022-09-21 07:43:00 +02:00
|
|
|
textSize,
|
|
|
|
AppUtil.getPixelsFromDensity(ctx, 10)))
|
|
|
|
.height(height)
|
|
|
|
.endConfig()
|
|
|
|
.buildRoundRect(
|
|
|
|
labelName, color, AppUtil.getPixelsFromDensity(ctx, 18));
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
labelsView.setImageDrawable(drawable);
|
|
|
|
viewBinding.frameLabels.addView(labelsView);
|
|
|
|
}
|
2022-09-21 07:43:00 +02:00
|
|
|
} else {
|
2020-04-30 12:42:22 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.labelsScrollView.setVisibility(View.GONE);
|
|
|
|
}
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (issue.getIssue().getDueDate() != null) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-05-05 16:57:22 +02:00
|
|
|
viewBinding.dueDateFrame.setVisibility(View.VISIBLE);
|
2022-10-01 06:16:19 +02:00
|
|
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd", locale);
|
|
|
|
String dueDate = formatter.format(issue.getIssue().getDueDate());
|
|
|
|
viewBinding.issueDueDate.setText(dueDate);
|
|
|
|
viewBinding.issueDueDate.setOnClickListener(
|
|
|
|
new ClickListener(
|
|
|
|
TimeHelper.customDateFormatForToastDateFormat(
|
|
|
|
issue.getIssue().getDueDate()),
|
|
|
|
ctx));
|
2022-09-21 07:43:00 +02:00
|
|
|
} else {
|
2020-11-30 00:26:01 +01:00
|
|
|
|
2022-04-22 17:18:38 +02:00
|
|
|
viewBinding.dueDateFrame.setVisibility(View.GONE);
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
}
|
2020-11-08 19:58:47 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
String edited;
|
2020-11-30 00:26:01 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (!issue.getIssue().getUpdatedAt().equals(issue.getIssue().getUpdatedAt())) {
|
2020-11-30 00:26:01 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
edited = getString(R.string.colorfulBulletSpan) + getString(R.string.modifiedText);
|
|
|
|
viewBinding.issueModified.setVisibility(View.VISIBLE);
|
|
|
|
viewBinding.issueModified.setText(edited);
|
2022-09-21 07:43:00 +02:00
|
|
|
viewBinding.issueModified.setOnClickListener(
|
|
|
|
new ClickListener(
|
|
|
|
TimeHelper.customDateFormatForToastDateFormat(
|
|
|
|
issue.getIssue().getUpdatedAt()),
|
|
|
|
ctx));
|
|
|
|
} else {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.issueModified.setVisibility(View.INVISIBLE);
|
|
|
|
}
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.issueCreatedTime.setVisibility(View.VISIBLE);
|
2022-10-01 06:16:19 +02:00
|
|
|
viewBinding.issueCreatedTime.setText(
|
|
|
|
TimeHelper.formatTime(issue.getIssue().getCreatedAt(), locale));
|
|
|
|
viewBinding.issueCreatedTime.setOnClickListener(
|
|
|
|
new ClickListener(
|
|
|
|
TimeHelper.customDateFormatForToastDateFormat(
|
|
|
|
issue.getIssue().getCreatedAt()),
|
|
|
|
ctx));
|
2020-10-23 20:13:13 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
Bundle bundle = new Bundle();
|
|
|
|
bundle.putString("repoOwner", repoOwner);
|
|
|
|
bundle.putString("repoName", repoName);
|
2022-04-18 09:10:54 +02:00
|
|
|
bundle.putInt("issueId", Math.toIntExact(issue.getIssue().getNumber()));
|
2020-10-23 20:13:13 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
ReactionList reactionList = new ReactionList(ctx, bundle);
|
2020-10-23 20:13:13 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
viewBinding.commentReactionBadges.removeAllViews();
|
|
|
|
viewBinding.commentReactionBadges.addView(reactionList);
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
reactionList.setOnReactionAddedListener(
|
|
|
|
() -> {
|
|
|
|
if (viewBinding.commentReactionBadges.getVisibility() != View.VISIBLE) {
|
|
|
|
viewBinding.commentReactionBadges.post(
|
|
|
|
() ->
|
|
|
|
viewBinding.commentReactionBadges.setVisibility(
|
|
|
|
View.VISIBLE));
|
|
|
|
}
|
|
|
|
});
|
2020-04-30 12:42:22 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
if (issue.getIssue().getMilestone() != null) {
|
2020-05-21 20:58:00 +02:00
|
|
|
|
2022-04-22 17:18:38 +02:00
|
|
|
viewBinding.milestoneFrame.setVisibility(View.VISIBLE);
|
|
|
|
viewBinding.issueMilestone.setText(issue.getIssue().getMilestone().getTitle());
|
2022-09-21 07:43:00 +02:00
|
|
|
} else {
|
2020-05-21 20:58:00 +02:00
|
|
|
|
2022-04-22 17:18:38 +02:00
|
|
|
viewBinding.milestoneFrame.setVisibility(View.GONE);
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
}
|
|
|
|
}
|
2020-05-21 20:58:00 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
private void getPullRequest() {
|
2022-09-21 07:43:00 +02:00
|
|
|
RetrofitClient.getApiInterface(this)
|
|
|
|
.repoGetPullRequest(repoOwner, repoName, (long) issueIndex)
|
|
|
|
.enqueue(
|
2023-09-19 07:23:43 +02:00
|
|
|
new Callback<>() {
|
2022-09-21 07:43:00 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResponse(
|
|
|
|
@NonNull Call<PullRequest> call,
|
|
|
|
@NonNull Response<PullRequest> response) {
|
|
|
|
if (response.isSuccessful() && response.body() != null) {
|
|
|
|
issue.setPullRequest(response.body());
|
|
|
|
loadingFinishedPr = true;
|
|
|
|
updateMenuState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(
|
|
|
|
@NonNull Call<PullRequest> call, @NonNull Throwable t) {}
|
|
|
|
});
|
2020-04-30 12:42:22 +02:00
|
|
|
}
|
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
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/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
private void getRepoInfo() {
|
2022-09-21 07:43:00 +02:00
|
|
|
Call<Repository> call =
|
|
|
|
RetrofitClient.getApiInterface(ctx)
|
|
|
|
.repoGet(issue.getRepository().getOwner(), issue.getRepository().getName());
|
|
|
|
call.enqueue(
|
|
|
|
new Callback<>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResponse(
|
|
|
|
@NonNull Call<Repository> call,
|
|
|
|
@NonNull retrofit2.Response<Repository> response) {
|
|
|
|
|
|
|
|
Repository repoInfo = response.body();
|
|
|
|
|
|
|
|
if (response.code() == 200) {
|
|
|
|
assert repoInfo != null;
|
|
|
|
issue.getRepository().setRepository(repoInfo);
|
|
|
|
loadingFinishedRepo = true;
|
|
|
|
updateMenuState();
|
|
|
|
} else {
|
|
|
|
Toasty.error(ctx, getString(R.string.genericError));
|
|
|
|
}
|
|
|
|
}
|
2022-02-11 15:27:31 +01:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
@Override
|
|
|
|
public void onFailure(@NonNull Call<Repository> call, @NonNull Throwable t) {
|
2022-04-18 09:10:54 +02:00
|
|
|
|
2022-09-21 07:43:00 +02:00
|
|
|
Toasty.error(ctx, getString(R.string.genericError));
|
|
|
|
}
|
|
|
|
});
|
2022-02-11 15:27:31 +01:00
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
}
|