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