mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2025-01-05 16:12:25 +08:00
Merge branch 'issue-copy-nr' of 6543/GitNex into master
This commit is contained in:
commit
c1e27c9776
@ -16,6 +16,8 @@ import org.mian.gitnex.activities.ReplyToIssueActivity;
|
|||||||
import org.mian.gitnex.util.TinyDB;
|
import org.mian.gitnex.util.TinyDB;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import android.content.ClipboardManager;
|
||||||
|
import android.content.ClipData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author M M Arif
|
* Author M M Arif
|
||||||
@ -37,6 +39,7 @@ public class SingleIssueBottomSheetFragment extends BottomSheetDialogFragment {
|
|||||||
TextView closeIssue = v.findViewById(R.id.closeIssue);
|
TextView closeIssue = v.findViewById(R.id.closeIssue);
|
||||||
TextView reOpenIssue = v.findViewById(R.id.reOpenIssue);
|
TextView reOpenIssue = v.findViewById(R.id.reOpenIssue);
|
||||||
TextView addRemoveAssignees = v.findViewById(R.id.addRemoveAssignees);
|
TextView addRemoveAssignees = v.findViewById(R.id.addRemoveAssignees);
|
||||||
|
TextView copyIssueUrl = v.findViewById(R.id.copyIssueUrl);
|
||||||
|
|
||||||
replyToIssue.setOnClickListener(new View.OnClickListener() {
|
replyToIssue.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@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
|
if(tinyDB.getString("issueState").equals("open")) { // close issue
|
||||||
|
|
||||||
reOpenIssue.setVisibility(View.GONE);
|
reOpenIssue.setVisibility(View.GONE);
|
||||||
|
5
app/src/main/res/drawable/ic_content_copy.xml
Normal file
5
app/src/main/res/drawable/ic_content_copy.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||||
|
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||||
|
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FF000000" android:pathData="M16,1L4,1c-1.1,0 -2,0.9 -2,2v14h2L4,3h12L16,1zM19,5L8,5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h11c1.1,0 2,-0.9 2,-2L21,7c0,-1.1 -0.9,-2 -2,-2zM19,21L8,21L8,7h11v14z"/>
|
||||||
|
</vector>
|
@ -79,4 +79,16 @@
|
|||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:padding="16dp" />
|
android:padding="16dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/copyIssueUrl"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:drawableStart="@drawable/ic_content_copy"
|
||||||
|
android:drawablePadding="24dp"
|
||||||
|
android:padding="16dp"
|
||||||
|
android:text="@string/copyIssueUrl"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -446,6 +446,7 @@
|
|||||||
<string name="websiteText">Website</string>
|
<string name="websiteText">Website</string>
|
||||||
<string name="locationText">Standort</string>
|
<string name="locationText">Standort</string>
|
||||||
<string name="characters255Limit">maximal 255 Zeichen</string>
|
<string name="characters255Limit">maximal 255 Zeichen</string>
|
||||||
|
<string name="copyIssueUrl">Issue Url kopieren</string>
|
||||||
<!-- generic copy -->
|
<!-- generic copy -->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -447,6 +447,7 @@
|
|||||||
<string name="locationText">Location</string>
|
<string name="locationText">Location</string>
|
||||||
<string name="openWebRepo">Ouvrir avec le Browser</string>
|
<string name="openWebRepo">Ouvrir avec le Browser</string>
|
||||||
<string name="characters255Limit">Max 255 characters</string>
|
<string name="characters255Limit">Max 255 characters</string>
|
||||||
|
<string name="copyIssueUrl">Copier l Issue Url</string>
|
||||||
<!-- generic copy -->
|
<!-- generic copy -->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -447,6 +447,7 @@
|
|||||||
<string name="locationText">Место расположения</string>
|
<string name="locationText">Место расположения</string>
|
||||||
<string name="openWebRepo">Открыть с помощью браузера</string>
|
<string name="openWebRepo">Открыть с помощью браузера</string>
|
||||||
<string name="characters255Limit">Max 255 characters</string>
|
<string name="characters255Limit">Max 255 characters</string>
|
||||||
|
<string name="copyIssueUrl">Copy Issue Url</string>
|
||||||
<!-- generic copy -->
|
<!-- generic copy -->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -488,6 +488,7 @@
|
|||||||
<string name="locationText">Location</string>
|
<string name="locationText">Location</string>
|
||||||
<string name="characters255Limit">Max 255 characters</string>
|
<string name="characters255Limit">Max 255 characters</string>
|
||||||
<string name="emptyFields">All fields are required</string>
|
<string name="emptyFields">All fields are required</string>
|
||||||
|
<string name="copyIssueUrl">Copy Issue Url</string>
|
||||||
<!-- generic copy -->
|
<!-- generic copy -->
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user