Merge branch 'master' into 77-ui-changes

This commit is contained in:
M M Arif 2019-09-30 23:14:04 +05:00
commit d350fe96d9
7 changed files with 48 additions and 0 deletions

View File

@ -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);

View 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>

View File

@ -79,4 +79,16 @@
android:textSize="16sp"
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>

View File

@ -447,6 +447,7 @@
<string name="websiteText">Website</string>
<string name="locationText">Standort</string>
<string name="characters255Limit">maximal 255 Zeichen</string>
<string name="copyIssueUrl">Issue Url kopieren</string>
<!-- generic copy -->
</resources>

View File

@ -448,6 +448,7 @@
<string name="locationText">Location</string>
<string name="openWebRepo">Ouvrir avec le Browser</string>
<string name="characters255Limit">Max 255 characters</string>
<string name="copyIssueUrl">Copier l Issue Url</string>
<!-- generic copy -->
</resources>

View File

@ -448,6 +448,7 @@
<string name="locationText">Место расположения</string>
<string name="openWebRepo">Открыть с помощью браузера</string>
<string name="characters255Limit">Max 255 characters</string>
<string name="copyIssueUrl">Copy Issue Url</string>
<!-- generic copy -->
</resources>

View File

@ -488,6 +488,7 @@
<string name="locationText">Location</string>
<string name="characters255Limit">Max 255 characters</string>
<string name="emptyFields">All fields are required</string>
<string name="copyIssueUrl">Copy Issue Url</string>
<!-- generic copy -->
</resources>