From b3e88b0a9dd0af2b511e182090f152f38798d11d Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 27 Sep 2019 18:50:05 +0200 Subject: [PATCH 1/5] add content copy icon --- app/src/main/res/drawable/ic_content_copy.xml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 app/src/main/res/drawable/ic_content_copy.xml diff --git a/app/src/main/res/drawable/ic_content_copy.xml b/app/src/main/res/drawable/ic_content_copy.xml new file mode 100644 index 00000000..62ad9539 --- /dev/null +++ b/app/src/main/res/drawable/ic_content_copy.xml @@ -0,0 +1,5 @@ + + + From dcd28e845a6209f8c00d1cf5b20b3d95c7d1f3a9 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 27 Sep 2019 19:12:19 +0200 Subject: [PATCH 2/5] add Copy to Clipboard String --- app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 4 files changed, 4 insertions(+) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index addf9fff..1b471690 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -446,6 +446,7 @@ Website Standort maximal 255 Zeichen + Kopiere in Zwischenablage diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 1c445ceb..7f65bea3 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -447,6 +447,7 @@ Location Ouvrir avec le Browser Max 255 characters + Copier dans le Presse-papiers \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 06ba6e80..e3013599 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -447,6 +447,7 @@ Место расположения Открыть с помощью браузера Max 255 characters + Копировать в буфер обмена \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4e69e917..ef0287d7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -488,6 +488,7 @@ Location Max 255 characters All fields are required + Copy to Clipboard From 71bb8cc75da64033a4752353a7c2b5d1bcc8b7f5 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 27 Sep 2019 21:17:28 +0200 Subject: [PATCH 3/5] add copy function --- .../SingleIssueBottomSheetFragment.java | 30 +++++++++++++++++++ .../single_issue_bottom_sheet_layout.xml | 12 ++++++++ 2 files changed, 42 insertions(+) diff --git a/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java b/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java index c0e54d0e..fd41d6f6 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java @@ -16,6 +16,8 @@ import org.mian.gitnex.activities.ReplyToIssueActivity; import org.mian.gitnex.util.TinyDB; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import android.content.ClipboardManager; +import android.content.ClipData; /** * Author M M Arif @@ -37,6 +39,7 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment { TextView closeIssue = v.findViewById(R.id.closeIssue); TextView reOpenIssue = v.findViewById(R.id.reOpenIssue); TextView addRemoveAssignees = v.findViewById(R.id.addRemoveAssignees); + TextView copyIssue = v.findViewById(R.id.copyIssue); replyToIssue.setOnClickListener(new View.OnClickListener() { @Override @@ -78,6 +81,33 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment { } }); + copyIssue.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + //get url of repo + String repoFullName = tinyDB.getString("repoFullName"); + String instanceUrlWithProtocol = "https://" + tinyDB.getString("instanceUrlRaw"); + if(!tinyDB.getString("instanceUrlWithProtocol").isEmpty()) { + instanceUrlWithProtocol = tinyDB.getString("instanceUrlWithProtocol"); + } + + //get issue number + String issue = tinyDB.getString("issueNumber"); + + //combine + issue = instanceUrlWithProtocol + "/" + repoFullName + "/issues/" + issue; + + // copy to clipboard + ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(android.content.Context.CLIPBOARD_SERVICE); + ClipData clip = ClipData.newPlainText("issue", issue); + clipboard.setPrimaryClip(clip); + + dismiss(); + + } + }); + if(tinyDB.getString("issueState").equals("open")) { // close issue reOpenIssue.setVisibility(View.GONE); diff --git a/app/src/main/res/layout/single_issue_bottom_sheet_layout.xml b/app/src/main/res/layout/single_issue_bottom_sheet_layout.xml index 2545fb10..275d1d9c 100644 --- a/app/src/main/res/layout/single_issue_bottom_sheet_layout.xml +++ b/app/src/main/res/layout/single_issue_bottom_sheet_layout.xml @@ -79,4 +79,16 @@ android:textSize="16sp" android:padding="16dp" /> + + \ No newline at end of file From bf5527a82d4ed17cc4a560cfe0d683beb0c85569 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 29 Sep 2019 00:10:28 +0200 Subject: [PATCH 4/5] issue -> issueUrl --- .../gitnex/fragments/SingleIssueBottomSheetFragment.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java b/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java index fd41d6f6..363c1d1b 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java @@ -92,15 +92,12 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment { instanceUrlWithProtocol = tinyDB.getString("instanceUrlWithProtocol"); } - //get issue number - String issue = tinyDB.getString("issueNumber"); - - //combine - issue = instanceUrlWithProtocol + "/" + repoFullName + "/issues/" + issue; + //get issue Url + String issueUrl = instanceUrlWithProtocol + "/" + repoFullName + "/issues/" + tinyDB.getString("issueNumber"); // copy to clipboard ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(android.content.Context.CLIPBOARD_SERVICE); - ClipData clip = ClipData.newPlainText("issue", issue); + ClipData clip = ClipData.newPlainText("issueUrl", issueUrl); clipboard.setPrimaryClip(clip); dismiss(); From 4e8a961643e043e0952dfc4bb90e17e076d98fea Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 29 Sep 2019 00:56:48 +0200 Subject: [PATCH 5/5] copyIssue -> copyIssueUrl --- .../mian/gitnex/fragments/SingleIssueBottomSheetFragment.java | 4 ++-- app/src/main/res/layout/single_issue_bottom_sheet_layout.xml | 4 ++-- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-fr/strings.xml | 2 +- app/src/main/res/values-ru/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java b/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java index 363c1d1b..f01b36dd 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/SingleIssueBottomSheetFragment.java @@ -39,7 +39,7 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment { TextView closeIssue = v.findViewById(R.id.closeIssue); TextView reOpenIssue = v.findViewById(R.id.reOpenIssue); TextView addRemoveAssignees = v.findViewById(R.id.addRemoveAssignees); - TextView copyIssue = v.findViewById(R.id.copyIssue); + TextView copyIssueUrl = v.findViewById(R.id.copyIssueUrl); replyToIssue.setOnClickListener(new View.OnClickListener() { @Override @@ -81,7 +81,7 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment { } }); - copyIssue.setOnClickListener(new View.OnClickListener() { + copyIssueUrl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/app/src/main/res/layout/single_issue_bottom_sheet_layout.xml b/app/src/main/res/layout/single_issue_bottom_sheet_layout.xml index 275d1d9c..6f342b04 100644 --- a/app/src/main/res/layout/single_issue_bottom_sheet_layout.xml +++ b/app/src/main/res/layout/single_issue_bottom_sheet_layout.xml @@ -80,14 +80,14 @@ android:padding="16dp" /> diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 1b471690..1ff88203 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -446,7 +446,7 @@ Website Standort maximal 255 Zeichen - Kopiere in Zwischenablage + Issue Url kopieren diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 7f65bea3..6bf7f7d1 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -447,7 +447,7 @@ Location Ouvrir avec le Browser Max 255 characters - Copier dans le Presse-papiers + Copier l Issue Url \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index e3013599..ea69029d 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -447,7 +447,7 @@ Место расположения Открыть с помощью браузера Max 255 characters - Копировать в буфер обмена + Copy Issue Url \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ef0287d7..4a24ed37 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -488,7 +488,7 @@ Location Max 255 characters All fields are required - Copy to Clipboard + Copy Issue Url