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..f01b36dd 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 copyIssueUrl = v.findViewById(R.id.copyIssueUrl); replyToIssue.setOnClickListener(new View.OnClickListener() { @Override @@ -78,6 +81,30 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment { } }); + copyIssueUrl.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 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("issueUrl", issueUrl); + clipboard.setPrimaryClip(clip); + + dismiss(); + + } + }); + if(tinyDB.getString("issueState").equals("open")) { // close issue reOpenIssue.setVisibility(View.GONE); 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 @@ + + + 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..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 @@ -79,4 +79,16 @@ android:textSize="16sp" android:padding="16dp" /> + + \ No newline at end of file diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index addf9fff..1ff88203 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 + Issue Url kopieren diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 1c445ceb..6bf7f7d1 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 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 06ba6e80..ea69029d 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 + 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 4e69e917..4a24ed37 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 Issue Url