From 0e696eb46f8bf59649f82f2387c3c581c37e9e29 Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Fri, 9 Jul 2021 17:36:59 +0200 Subject: [PATCH] Allow navigating from issue to repo (#937) Allow navigating from issue opend by link to go back to repo Closes #747 Co-authored-by: qwerty287 Co-authored-by: M M Arif Co-authored-by: M M Arif Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/937 Reviewed-by: M M Arif Reviewed-by: 6543 <6543@noreply.codeberg.org> Co-authored-by: qwerty287 Co-committed-by: qwerty287 --- .../java/org/mian/gitnex/activities/DeepLinksActivity.java | 2 ++ .../java/org/mian/gitnex/activities/IssueDetailActivity.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java b/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java index 8e0a85bd..c8409cf7 100644 --- a/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/DeepLinksActivity.java @@ -100,6 +100,7 @@ public class DeepLinksActivity extends BaseActivity { if(!Objects.requireNonNull(data.getLastPathSegment()).contains("issues") & StringUtils.isNumeric(data.getLastPathSegment())) { issueIntent.putExtra("issueNumber", data.getLastPathSegment()); + issueIntent.putExtra("openedFromLink", "true"); tinyDB.putString("issueNumber", data.getLastPathSegment()); tinyDB.putString("issueType", "Issue"); @@ -316,6 +317,7 @@ public class DeepLinksActivity extends BaseActivity { issueIntent.putExtra("issueNumber", index); issueIntent.putExtra("prMergeable", prInfo.isMergeable()); + issueIntent.putExtra("openedFromLink", "true"); if(prInfo.getHead() != null) { diff --git a/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java b/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java index afa16ada..d4b5aa38 100644 --- a/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/IssueDetailActivity.java @@ -434,6 +434,11 @@ public class IssueDetailActivity extends BaseActivity implements LabelsListAdapt if(id == android.R.id.home) { + if(getIntent().getStringExtra("openedFromLink") != null && getIntent().getStringExtra("openedFromLink").equals("true")) { + Intent intent = new Intent(ctx, RepoDetailActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivity(intent); + } finish(); return true; }