mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
Copy comment url to clipboard (#655)
Copy comment url to clipboard Co-authored-by: M M Arif <mmarif@swatian.com> Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/655
This commit is contained in:
parent
5fc6cdde63
commit
6d8a87358d
@ -109,6 +109,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
|
||||
TextView commentMenuQuote = view.findViewById(R.id.commentMenuQuote);
|
||||
TextView commentMenuCopy = view.findViewById(R.id.commentMenuCopy);
|
||||
TextView commentMenuDelete = view.findViewById(R.id.commentMenuDelete);
|
||||
TextView issueCommentCopyUrl = view.findViewById(R.id.issueCommentCopyUrl);
|
||||
|
||||
if(!loginUid.contentEquals(commenterUsername.getText())) {
|
||||
commentMenuEdit.setVisibility(View.GONE);
|
||||
@ -151,6 +152,22 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
|
||||
|
||||
});
|
||||
|
||||
issueCommentCopyUrl.setOnClickListener(ediComment -> {
|
||||
|
||||
// comment Url
|
||||
CharSequence commentUrl = htmlUrl.getText();
|
||||
|
||||
ClipboardManager clipboard = (ClipboardManager) Objects.requireNonNull(ctx).getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
assert clipboard != null;
|
||||
|
||||
ClipData clip = ClipData.newPlainText(commentUrl, commentUrl);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
|
||||
dialog.dismiss();
|
||||
Toasty.success(ctx, ctx.getString(R.string.copyIssueUrlToastMsg));
|
||||
|
||||
});
|
||||
|
||||
commentMenuQuote.setOnClickListener(v1 -> {
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
@ -189,7 +206,7 @@ public class IssueCommentsAdapter extends RecyclerView.Adapter<IssueCommentsAdap
|
||||
clipboard.setPrimaryClip(clip);
|
||||
|
||||
dialog.dismiss();
|
||||
Toasty.info(ctx, ctx.getString(R.string.copyIssueCommentToastMsg));
|
||||
Toasty.success(ctx, ctx.getString(R.string.copyIssueCommentToastMsg));
|
||||
|
||||
});
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/menuCopyText"
|
||||
android:text="@string/copyCommentText"
|
||||
android:drawableStart="@drawable/ic_copy"
|
||||
android:drawablePadding="24dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
@ -77,6 +77,18 @@
|
||||
android:textSize="16sp"
|
||||
android:padding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/issueCommentCopyUrl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/genericCopyUrl"
|
||||
android:drawableStart="@drawable/ic_link"
|
||||
android:drawablePadding="24dp"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="16sp"
|
||||
android:padding="12dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
@ -342,6 +342,7 @@
|
||||
<string name="editCommentUpdatedText">Comment updated</string>
|
||||
<string name="issueCommentShare">Share Comment</string>
|
||||
<string name="deleteCommentSuccess">Comment deleted successfully</string>
|
||||
<string name="copyCommentText">Copy Comment</string>
|
||||
<!-- issue comments -->
|
||||
|
||||
<!-- add collaborator -->
|
||||
|
Loading…
Reference in New Issue
Block a user