Merge branch 'master' into light-theme
This commit is contained in:
@@ -18,7 +18,7 @@ import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.models.Collaborators;
|
||||
import org.mian.gitnex.models.Issues;
|
||||
import org.mian.gitnex.models.MultiSelectModel;
|
||||
import org.mian.gitnex.models.UpdateIssueAssignee;
|
||||
import org.mian.gitnex.models.UpdateIssueAssignees;
|
||||
import org.mian.gitnex.util.TinyDB;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -234,14 +234,14 @@ public class AddRemoveAssigneesActivity extends AppCompatActivity {
|
||||
|
||||
private void updateIssueAssignees(final String instanceUrl, final String instanceToken, String repoOwner, String repoName, String loginUid, int issueIndex, List<String> issueAssigneesList) {
|
||||
|
||||
UpdateIssueAssignee updateAssigneeJson = new UpdateIssueAssignee(issueAssigneesList);
|
||||
UpdateIssueAssignees updateAssigneeJson = new UpdateIssueAssignees(issueAssigneesList);
|
||||
|
||||
Call<JsonElement> call3;
|
||||
|
||||
call3 = RetrofitClient
|
||||
.getInstance(instanceUrl, getApplicationContext())
|
||||
.getApiInterface()
|
||||
.patchIssueAssignee(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, issueIndex, updateAssigneeJson);
|
||||
.patchIssueAssignees(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, issueIndex, updateAssigneeJson);
|
||||
|
||||
call3.enqueue(new Callback<JsonElement>() {
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ public class CreateIssueActivity extends AppCompatActivity implements View.OnCli
|
||||
TinyDB tinyDb = new TinyDB(getApplicationContext());
|
||||
final String instanceUrl = tinyDb.getString("instanceUrl");
|
||||
final String loginUid = tinyDb.getString("loginUid");
|
||||
final String loginFullName = tinyDb.getString("userFullname");
|
||||
String repoFullName = tinyDb.getString("repoFullName");
|
||||
String[] parts = repoFullName.split("/");
|
||||
final String repoOwner = parts[0];
|
||||
@@ -110,7 +111,7 @@ public class CreateIssueActivity extends AppCompatActivity implements View.OnCli
|
||||
getMilestones(instanceUrl, instanceToken, repoOwner, repoName, loginUid);
|
||||
|
||||
getLabels(instanceUrl, instanceToken, repoOwner, repoName, loginUid);
|
||||
getCollaborators(instanceUrl, instanceToken, repoOwner, repoName, loginUid);
|
||||
getCollaborators(instanceUrl, instanceToken, repoOwner, repoName, loginUid, loginFullName);
|
||||
|
||||
disableProcessButton();
|
||||
|
||||
@@ -377,13 +378,15 @@ public class CreateIssueActivity extends AppCompatActivity implements View.OnCli
|
||||
|
||||
}
|
||||
|
||||
private void getCollaborators(String instanceUrl, String instanceToken, String repoOwner, String repoName, String loginUid) {
|
||||
private void getCollaborators(String instanceUrl, String instanceToken, String repoOwner, String repoName, String loginUid, String loginFullName) {
|
||||
|
||||
Call<List<Collaborators>> call = RetrofitClient
|
||||
.getInstance(instanceUrl, getApplicationContext())
|
||||
.getApiInterface()
|
||||
.getCollaborators(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
|
||||
|
||||
listOfAssignees.add(new MultiSelectModel(-1, loginFullName));
|
||||
|
||||
call.enqueue(new Callback<List<Collaborators>>() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,8 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import com.github.barteksc.pdfviewer.PDFView;
|
||||
import com.github.barteksc.pdfviewer.util.FitPolicy;
|
||||
import com.github.chrisbanes.photoview.PhotoView;
|
||||
import com.pddstudio.highlightjs.HighlightJsView;
|
||||
import com.pddstudio.highlightjs.models.Theme;
|
||||
@@ -44,6 +46,8 @@ public class FileViewActivity extends AppCompatActivity {
|
||||
final Context ctx = this;
|
||||
private ProgressBar mProgressBar;
|
||||
private byte[] imageData;
|
||||
private PDFView pdfView;
|
||||
private byte[] decodedPdf;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -68,6 +72,7 @@ public class FileViewActivity extends AppCompatActivity {
|
||||
imageView = findViewById(R.id.imageView);
|
||||
singleFileContents.setVisibility(View.GONE);
|
||||
mProgressBar = findViewById(R.id.progress_bar);
|
||||
pdfView = findViewById(R.id.pdfView);
|
||||
|
||||
String singleFileName = getIntent().getStringExtra("singleFileName");
|
||||
|
||||
@@ -140,6 +145,33 @@ public class FileViewActivity extends AppCompatActivity {
|
||||
singleCodeContents.setShowLineNumbers(true);
|
||||
singleCodeContents.setSource(appUtil.decodeBase64(response.body().getContent()));
|
||||
|
||||
}
|
||||
else if (appUtil.pdfExtension(fileExtension)) { // file is pdf
|
||||
|
||||
imageView.setVisibility(View.GONE);
|
||||
singleFileContents.setVisibility(View.GONE);
|
||||
singleCodeContents.setVisibility(View.GONE);
|
||||
pdfView.setVisibility(View.VISIBLE);
|
||||
|
||||
decodedPdf = Base64.decode(response.body().getContent(), Base64.DEFAULT);
|
||||
pdfView.fromBytes(decodedPdf)
|
||||
.enableSwipe(true)
|
||||
.swipeHorizontal(false)
|
||||
.enableDoubletap(true)
|
||||
.defaultPage(0)
|
||||
.enableAnnotationRendering(false)
|
||||
.password(null)
|
||||
.scrollHandle(null)
|
||||
.enableAntialiasing(true)
|
||||
.spacing(0)
|
||||
.autoSpacing(true)
|
||||
.pageFitPolicy(FitPolicy.WIDTH)
|
||||
.fitEachPage(true)
|
||||
.pageSnap(false)
|
||||
.pageFling(true)
|
||||
.nightMode(true)
|
||||
.load();
|
||||
|
||||
}
|
||||
else { // file type not known - plain text view
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.mian.gitnex.R;
|
||||
import org.mian.gitnex.clients.RetrofitClient;
|
||||
import org.mian.gitnex.helpers.AlertDialogs;
|
||||
import org.mian.gitnex.helpers.Authorization;
|
||||
import org.mian.gitnex.helpers.VersionCheck;
|
||||
import org.mian.gitnex.helpers.Toasty;
|
||||
import org.mian.gitnex.models.Milestones;
|
||||
import org.mian.gitnex.util.AppUtil;
|
||||
@@ -117,15 +118,16 @@ public class NewMilestoneActivity extends AppCompatActivity implements View.OnCl
|
||||
}
|
||||
}
|
||||
|
||||
if(newMilestoneDueDate.equals("")) {
|
||||
|
||||
String finalMilestoneDueDate = null;
|
||||
if(!newMilestoneDueDate.isEmpty()) {
|
||||
finalMilestoneDueDate = (AppUtil.customDateCombine(AppUtil.customDateFormat(newMilestoneDueDate)));
|
||||
} else if (VersionCheck.compareVersion("1.10.0", tinyDb.getString("giteaVersion")) > 1) {
|
||||
// if Gitea version is less than 1.10.0 DueDate is required
|
||||
Toasty.info(getApplicationContext(), getString(R.string.milestoneDateEmpty));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
disableProcessButton();
|
||||
String finalMilestoneDueDate = (AppUtil.customDateCombine(AppUtil.customDateFormat(newMilestoneDueDate)));
|
||||
createNewMilestone(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, newMilestoneTitle, newMilestoneDescription, finalMilestoneDueDate);
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class SettingsFragment extends Fragment {
|
||||
|
||||
private Context ctx = null;
|
||||
|
||||
private static String[] langList = {"Arabic", "Chinese", "English", "Finnish", "French", "German", "Italian", "Persian", "Portuguese/Brazilian", "Russian", "Serbian", "Turkish", "Ukrainian"};
|
||||
private static String[] langList = {"Arabic", "Chinese", "English", "Finnish", "French", "German", "Italian", "Latvian", "Persian", "Portuguese/Brazilian", "Russian", "Serbian", "Turkish", "Ukrainian"};
|
||||
private static int langSelectedChoice = 0;
|
||||
|
||||
private static String[] timeList = {"Pretty", "Normal"};
|
||||
@@ -311,6 +311,9 @@ public class SettingsFragment extends Fragment {
|
||||
case "Italian":
|
||||
tinyDb.putString("locale", "it");
|
||||
break;
|
||||
case "Latvian":
|
||||
tinyDb.putString("locale", "lv");
|
||||
break;
|
||||
case "Persian":
|
||||
tinyDb.putString("locale", "fa");
|
||||
break;
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.mian.gitnex.models.Files;
|
||||
import org.mian.gitnex.models.MergePullRequest;
|
||||
import org.mian.gitnex.models.NewFile;
|
||||
import org.mian.gitnex.models.PullRequests;
|
||||
import org.mian.gitnex.models.UpdateIssueAssignee;
|
||||
import org.mian.gitnex.models.UpdateIssueAssignees;
|
||||
import org.mian.gitnex.models.UpdateIssueState;
|
||||
import org.mian.gitnex.models.Collaborators;
|
||||
import org.mian.gitnex.models.CreateIssue;
|
||||
@@ -207,7 +207,7 @@ public interface ApiInterface {
|
||||
Call<Releases> createNewRelease(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Body Releases jsonStr);
|
||||
|
||||
@PATCH("repos/{owner}/{repo}/issues/{issueIndex}") // patch issue assignees
|
||||
Call<JsonElement> patchIssueAssignee(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("issueIndex") int issueIndex, @Body UpdateIssueAssignee jsonStr);
|
||||
Call<JsonElement> patchIssueAssignees(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("issueIndex") int issueIndex, @Body UpdateIssueAssignees jsonStr);
|
||||
|
||||
@GET("admin/users") // get all users
|
||||
Call<List<UserInfo>> adminGetUsers(@Header("Authorization") String token);
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.List;
|
||||
|
||||
public class CreateIssue {
|
||||
|
||||
private String assignee;
|
||||
private String body;
|
||||
private boolean closed;
|
||||
private String due_date;
|
||||
@@ -19,7 +18,6 @@ public class CreateIssue {
|
||||
private int[] labels;
|
||||
|
||||
public CreateIssue(String assignee, String body, boolean closed, String due_date, int milestone, String title, List<String> assignees, int[] labels) {
|
||||
this.assignee = assignee;
|
||||
this.body = body;
|
||||
this.closed = closed;
|
||||
this.due_date = due_date;
|
||||
|
||||
@@ -25,7 +25,6 @@ public class Issues {
|
||||
private List<labelsObject> labels;
|
||||
private pullRequestObject pull_request;
|
||||
private milestoneObject milestone;
|
||||
private assigneeObject assignee;
|
||||
private List<assigneesObject> assignees;
|
||||
|
||||
public Issues(String body) {
|
||||
@@ -154,45 +153,6 @@ public class Issues {
|
||||
}
|
||||
}
|
||||
|
||||
public class assigneeObject {
|
||||
|
||||
private int id;
|
||||
private String login;
|
||||
private String full_name;
|
||||
private String email;
|
||||
private String avatar_url;
|
||||
private String language;
|
||||
private String username;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLogin() {
|
||||
return login;
|
||||
}
|
||||
|
||||
public String getFull_name() {
|
||||
return full_name;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getAvatar_url() {
|
||||
return avatar_url;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return language;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
}
|
||||
|
||||
public class assigneesObject {
|
||||
|
||||
private int id;
|
||||
@@ -292,10 +252,6 @@ public class Issues {
|
||||
return milestone;
|
||||
}
|
||||
|
||||
public assigneeObject getAssignee() {
|
||||
return assignee;
|
||||
}
|
||||
|
||||
public List<assigneesObject> getAssignees() {
|
||||
return assignees;
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import java.util.List;
|
||||
* Author M M Arif
|
||||
*/
|
||||
|
||||
public class UpdateIssueAssignee {
|
||||
public class UpdateIssueAssignees {
|
||||
|
||||
private List<String> assignees;
|
||||
|
||||
public UpdateIssueAssignee(List<String> assignees) {
|
||||
public UpdateIssueAssignees(List<String> assignees) {
|
||||
this.assignees = assignees;
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public class AppUtil {
|
||||
|
||||
public Boolean sourceCodeExtension(String ext) {
|
||||
|
||||
String[] extValues = new String[] {"md", "json", "java", "go", "php", "c", "cc", "cpp", "cxx", "cyc", "m",
|
||||
String[] extValues = new String[] {"md", "json", "java", "go", "php", "c", "cc", "cpp", "h", "cxx", "cyc", "m",
|
||||
"cs", "bash", "sh", "bsh", "cv", "python", "perl", "pm", "rb", "ruby", "javascript",
|
||||
"coffee", "rc", "rs", "rust", "basic", "clj", "css", "dart", "lisp", "erl", "hs", "lsp", "rkt",
|
||||
"ss", "llvm", "ll", "lua", "matlab", "pascal", "r", "scala", "sql", "latex", "tex", "vb", "vbs",
|
||||
@@ -224,6 +224,14 @@ public class AppUtil {
|
||||
|
||||
}
|
||||
|
||||
public Boolean pdfExtension(String ext) {
|
||||
|
||||
String[] extValues = new String[] {"pdf"};
|
||||
|
||||
return Arrays.asList(extValues).contains(ext);
|
||||
|
||||
}
|
||||
|
||||
public Boolean imageExtension(String ext) {
|
||||
|
||||
String[] extValues = new String[] {"jpg", "jpeg", "gif", "png", "ico"};
|
||||
|
||||
Reference in New Issue
Block a user