From b3e67113f5a8ab1e9a2be7accbb5aeb5afdb56e5 Mon Sep 17 00:00:00 2001 From: 6543 <6543@noreply.gitea.io> Date: Sun, 5 Jan 2020 12:07:29 +0000 Subject: [PATCH 1/6] Crowdin [2020-01-04] + add Latvian (#253) update Translators add Latvian update Crowdin Co-authored-by: 6543 <6543@obermui.de> --- CONTRIBUTORS.md | 1 + .../gitnex/fragments/SettingsFragment.java | 5 +- app/src/main/res/values-ar/strings.xml | 5 +- app/src/main/res/values-de/strings.xml | 5 +- app/src/main/res/values-fa/strings.xml | 5 +- app/src/main/res/values-fi/strings.xml | 5 +- app/src/main/res/values-fr/strings.xml | 7 +- app/src/main/res/values-it/strings.xml | 7 +- app/src/main/res/values-lv/strings.xml | 442 ++++++++++++++++++ app/src/main/res/values-pt/strings.xml | 5 +- app/src/main/res/values-ru/strings.xml | 5 +- app/src/main/res/values-sr/strings.xml | 3 + app/src/main/res/values-tr/strings.xml | 5 +- app/src/main/res/values-uk/strings.xml | 5 +- app/src/main/res/values-zh/strings.xml | 17 +- 15 files changed, 502 insertions(+), 20 deletions(-) create mode 100644 app/src/main/res/values-lv/strings.xml diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index c6047e77..821f3b75 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -18,6 +18,7 @@ This part lists all PUBLIC individuals having contributed content to the transla * erardiflorian * IndeedNotJames * jaqra + * Lafriks * ljoonal * Lunny Xiao (xiaolunwen) * lxs diff --git a/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java index 3ea7e686..50a2cc10 100644 --- a/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java +++ b/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java @@ -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; diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 47cc01b7..78ec2d1f 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -183,7 +183,7 @@ الترجمة التاريخ والوقت - تم حفظ الإعدادات. + تم حفظ الإعدادات اللغة العربية المظهر @@ -436,4 +436,7 @@ Merge comment Pull Request was merged successfully Pull Request is not available for merge + Font + Choose Font + Roboto diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index d6494228..c550440a 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -183,7 +183,7 @@ Sprachen Datum & Uhrzeit - Einstellungen wurden gespeichert! + Einstellungen gespeichert Sprache Englisch Aussehen @@ -436,4 +436,7 @@ Zusammenführ-Kommentar Dieser Pull-Request wurde erfolgreich zusammengeführt Pull-Request kann nicht zusammengeführt werden + Schriftart + Wähle eine Schriftart + Roboto diff --git a/app/src/main/res/values-fa/strings.xml b/app/src/main/res/values-fa/strings.xml index e9cd0781..7c24fc95 100644 --- a/app/src/main/res/values-fa/strings.xml +++ b/app/src/main/res/values-fa/strings.xml @@ -183,7 +183,7 @@ Translation Date & Time - Settings saved. + Settings saved Language English Appearance @@ -436,4 +436,7 @@ Merge comment Pull Request was merged successfully Pull Request is not available for merge + Font + Choose Font + Roboto diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index c2514f8d..6b399276 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -183,7 +183,7 @@ Translation Date & Time - Settings saved. + Settings saved Language English Appearance @@ -436,4 +436,7 @@ Merge comment Pull Request was merged successfully Pull Request is not available for merge + Font + Choose Font + Roboto diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 17b21811..1b7c0195 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -177,13 +177,13 @@ Description du ticket requise Nouveau ticket créé Une erreur s’est produite, veuillez réessayer - No milestone + Aucun jalon Aucun collaborateur Aucune étiquette Traduction Date et heure - Configuration enregistrée + Réglages enregistrés Langue Français Apparence @@ -436,4 +436,7 @@ Commentaire de la fusion La demande de tirage a été fusionnée La demande de tirage ne peut pas être fusionnée + Police + Choisir la police + Roboto diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index ed9dc616..938daf7e 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -184,7 +184,7 @@ URL è richiesto Traduzione Data & Ora - Impostazioni salvate. + Impostazioni salvate Lingua Inglese Aspetto @@ -203,7 +203,7 @@ URL è richiesto Nuovo label Menu Repo Nome label - Colorore label + Colore dell\'etichetta Nome label è vuoto Nome label non valido Label creato. @@ -438,4 +438,7 @@ autorizzazione Merge comment Pull Request was merged successfully Pull Request is not available for merge + Font + Choose Font + Roboto diff --git a/app/src/main/res/values-lv/strings.xml b/app/src/main/res/values-lv/strings.xml new file mode 100644 index 00000000..a93f7647 --- /dev/null +++ b/app/src/main/res/values-lv/strings.xml @@ -0,0 +1,442 @@ + + + + + Mani repozitoriji + Starred Repositories + Repozitoriji + Profils + Iestatījumi + Organizācijas + Par + Rate GitNex + Logout + Izpētīt + + + Par + Sākums + Mani repozitoriji + Repozitoriji + Profils + Jauns repozitorijs + Organizācijas + Problēmas + Iestatījumi + Jauna organizācija + Jauns atskaites punkts + Jauna problēma + Jauna etiķete + Credits + Update Label + Donators + Starred Repositories + New Team + Add Email Address + New File + Izpētīt + + Version\u0020:\u0020 + Build No.\u0020:\u0020 + Demo repo + Repo with ORG + Demo description + No repositories found + Demo organization + Demo description + No organizations found + Izveidot + Atjaunot + Repozitorija nosaukums + Repository Description + Privāts + Max 255 characters + Īpašnieks + Organizācijas nosaukums + Organization Description + Max 255 characters + Username + Password + LOGIN + Instance URL + Open Navigation Drawer + Close Navigation Drawer + Login to Gitea + 1- Choose the correct protocol(https or http). \n2- Enter Gitea url e.g: try.gitea.io. \n3- If you have enabled 2FA for your account, enter the code in the OTP Code field. \n4- For HTTP basic auth use USERNAME@DOMAIN.COM in the URL field. + Wrong username/password + It is not recommended to use HTTP protocol unless you are testing on local network. + Malformed JSON was received. Server response was not successful. + Instance URL is required + Username is required + Password is required + Cannot access network, please check your Internet connection + Repository name is empty + Repository name is not valid. [a–z A–Z 0–9 – _] + Repository description exceeds the max 255 characters limit + Repository created successfully + Something went wrong, please try again + Repository of this name already exists under selected Owner + Organization name is empty + Organization name is not valid, [a–z A–Z 0–9 – _] + Organization description exceeds the max 255 characters limit + Organization created successfully + Something went wrong, please try again + Organization already exists + Processing + Search + Work in progress + Close + Add + Org + Repo + Pri + Remove + Instance has returned an error. Code\u0020 + RepoDetailActivity + Details + Files + Open Issues + Closed Issues + Milestones + Releases + Branches + Labels + Settings + Collaborators + Pull Requests + No issues found + Repository + Owner + Description + Website + Size + Default Branch + SSH URL + Clone URL + Repo URL + Forks + Created + Last Updated + at + Opened\u0020 + Due Date + Status: open + open + Status: closed + closed + Creator :\u0020 + Assignees + Type: Issue + Type: Pull Request + Commenter:\u0020 + Milestone %1$s + Due %1$s + Opened %1$s + Assigned to: %1$s + Comment + Please write your comment + Comment posted + Something went wrong, please try again + Avatar + No milestones found + Commit author: %1$s + Commit hash \n%1$s%2$s + Release Title + Release Description + Downloads + Release Type + Release Zip + Release Tar + No releases found + Tag: %1$s + Collaborator : %1$s + No collaborators found + Edit + Title + Description + Due Date + Milestone title is empty + Milestone title is not valid. [a–z A–Z 0–9 – _] + Milestone description exceeds the max 255 characters limit + Milestone created successfully + Something went wrong, please try again + Please choose due date + Open issues : %1$d + Closed issues : %1$d + Select Assignees + Select Labels + Done + Cancel + Title + Assignees + Description + Due Date + Milestone + Labels + Issue title is empty + Issue description is empty + New issue created successfully + Something went wrong, please try again + No milestone + No collaborators found + No labels found + + Translation + Date & Time + Settings saved + Language + English + Appearance + Pretty + Choose Language + Choose Time Format + Issues Badge + Help us translate GitNex to your language + Code Block Color + Code Block Color Selector + Home Screen + My Repositories + Select Home Screen + + No more data available + New Label + Repo Menu + Label Name + Label Color + Label name is empty + Label name is not valid + Label created. + Something went wrong, please try again + Label updated. + No labels found + Desc + Edit + Delete + Label deleted + Something went wrong, please try again + No branches found + Design + Authorization Error + It seems that the Access Token is revoked OR your are not allowed to see these contents. In case of revoked Token, please logout and login again + Cancel + Logout + Delete\u0020 + Do you really want to delete this label? + OK + Cancel + + OrgDetailActivity + Repositories + Teams + Members + New Team + No teams found + Team name + Team desc + Permission : %1$s + No members found + Org members + Organization team members + + + Team Name + Description + Permission + Access Controls + Members can view and clone team repositories + Members can read and push to team repositories + Members can pull and push to team repositories and add collaborators to them + Please enter team name + Team name should contain only alphanumeric, dash (-), underscore (_) and dot (.) characters + Please select permission + Team description have illegal characters + Team description have more than 100 characters + Team created successfully + Something went wrong, please try again + + + Edit Comment + Edit + Comment updated + + + Add / Remove Collaborator + Search users + Username + Remove\u0020 + Do you want to remove this user from the repository? + User removed from the repository. + User added to the repository. + + + Followers + Following + Add Email Address + Save + Email Address + New email added successfully. + Email address is empty. + Email address is not valid + Email address is already in use + Primary + Emails + + + Add / Remove Labels + Labels updated + Close Issue + Add Comment + Edit Issue + Reopen Issue + Issue closed + Issue reopened + Add Assignees + Add / Remove Assignees + Assignees updated + + + Select Entries + Please select at least one option + Please select at least + You can only select up to + option + options + Select all + Deselect all + + Repository Meta + + Add New User + Users + Admin + + + Full Name + Email + Username + Password + Invalid Full Name + Invalid Username + Invalid Email + New user added successfully + User already exists + + + Edit Issue #%1$s + Issue updated + + + New Release + Tag Name + Title + Content + Mark as Pre-Release + Select Branch + Draft + Tag name is empty + Title is empty + New release created + + Enter OTP code + OTP code should be numbers. + OTP Code (Optional) + Enter the otp code if 2FA is enabled + Open in Browser + Stargazers + Watchers + No stars found + No watchers found + Star + Watcher + Commit + Zip Archive + Tar Archive + + File Name + New Branch Name + File Content + Create New File + with folder: app/test.md + Commit Message + Invalid branch name, may only contain –, a–z, 0–9 + Commit message is too long + New file created + Current Branches + Fields like filename, content and commit message are required + Selecting current branch will disable new branch + e.g: new-branch + New branch name cannot be empty if current branch is not selected + Filter + Copy Issue URL + URL copied to clipboard + %1$d\uFF05 completed + + No files found + Directory browsing is not supported yet + Sorry this file cannot be viewed as API returned an error + Root + + OK + Done + Cancel + Something went wrong, please try again + This request needs higher Gitea version than the one installed. Please upgrade your instance to the latest version of Gitea. + No data found + Add + Remove + You are not authorized to perform this action. + Menu + Edit + Delete + edited + Save + Name + Description + Website + Location + Max 255 characters + All fields are required + Continue + Token + + Translate GitNex with Crowdin + Explore repositories + Star Repository + Unstar Repository + Repository added to starred list + Repository removed from starred list + Watch Repository + Unwatch Repository + Repository added to watch list + Repository removed from watch list + Unsupported old version(%1$s) of Gitea detected. Please update to latest stable version. If you continue, the app may not function properly. + Old Gitea version detected, please update to latest stable version + New Gitea version detected! Please UPDATE GitNex! + Gitea version is up to date + Gitea development version + No Gitea detected! + Version Alert + Unsupported Version of Gitea + Username / Password + Choose your preferred login method to access your account. Token is more secure! + Instance has returned an error - Unauthorized. Check your credentials and try again + Please enter the correct token + No pull requests found + Creator :\u0020 + Edit Pull Request + Copy Pull Request URL + Edit Pull Request #%1$s + Pull Request updated + %1$s Files Changed + %1$s File Changed + Files Changed + Merge Pull Request + Merge + Merge may fail if you are not authorized to merge this Pull Request. + Merge comment + Pull Request was merged successfully + Pull Request is not available for merge + Font + Choose Font + Roboto + diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 15b96a5c..44960c36 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -183,7 +183,7 @@ Tradução Data & Hora - Configurações salvas. + Configurações salvas Idioma Português (Brasil) Aparência @@ -436,4 +436,7 @@ Comentário do merge O merge da Pull Request foi aplicado com sucesso Pull Request não está disponível para aplicação do merge + Font + Choose Font + Roboto diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 48e6b923..6ce29ec7 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -183,7 +183,7 @@ Перевод Дата и время - Сохранено. + Сохранено Язык Английский Интерфейс @@ -436,4 +436,7 @@ Комментарий для слияния Запрос на слияние был успешно выполнен Запрос на слияние не доступен для слияния + Font + Choose Font + Roboto diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index 08804e5b..55c27d7c 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -436,4 +436,7 @@ Merge comment Pull Request was merged successfully Pull Request is not available for merge + Font + Choose Font + Roboto diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 8881a55e..1eaa81e2 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -183,7 +183,7 @@ Çeviri Tarih ve Saat - Ayarlar kaydedildi. + Ayarlar kaydedildi Dil İngilizce Görünüm @@ -436,4 +436,7 @@ Yorumu birleştir Çekme İsteği başarıyla birleştirildi Çekme İsteği birleştirme için uygun değil + Font + Choose Font + Roboto diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 44c8259f..ffcf4a2f 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -183,7 +183,7 @@ Переклад Дата і час - Налаштування збережено. + Налаштування збережено Мова Англійська Зовнішній вигляд @@ -436,4 +436,7 @@ Коментар до об\'єднання Запит на злиття було успішно об\'єднано Запит на злиття недоступний для об\'єднання + Font + Choose Font + Roboto diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index ef45d3c0..434e02f7 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -90,11 +90,11 @@ 组织 仓库 Pri - Remove + 移除 Instance has returned an error. Code\u0020 RepoDetailActivity 详情 - Files + 文件 Open Issues Closed Issues 里程碑 @@ -107,15 +107,15 @@ 没有工单 仓库 所有者 - Description - Website - Size + 说明 + 网站 + 尺寸 默认分支 SSH URL Clone URL Repo URL 派生仓库 - Created + 已创建 Last Updated at Opened\u0020 @@ -183,7 +183,7 @@ 翻译 Date & Time - 设置已保存。 + 设置已保存 语言 英语 外观 @@ -436,4 +436,7 @@ Merge comment Pull Request was merged successfully Pull Request is not available for merge + Font + Choose Font + Roboto From ec62e3cebfc690f7435fb76e73dcf843c304c0f9 Mon Sep 17 00:00:00 2001 From: 6543 <6543@noreply.gitea.io> Date: Tue, 14 Jan 2020 12:52:34 +0000 Subject: [PATCH 2/6] Make DueDate optional on MilestoneCreaton (#252) Merge branch 'master' into milestone-DueDate-optional_240 add check again if gitea is older than 1.10.0 ... Crowdin [2020-01-04] + add Latvian (#253) update Translators add Latvian update Crowdin Co-authored-by: 6543 <6543@obermui.de> make DueDate optional on MilestoneCreaton Co-authored-by: 6543 <6543@obermui.de> --- .../mian/gitnex/activities/NewMilestoneActivity.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java b/app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java index c2293adb..61d68c58 100644 --- a/app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java @@ -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); } From 1293e8be27f3057ce0d695b42991a858d6925b70 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Thu, 30 Jan 2020 18:00:31 +0000 Subject: [PATCH 3/6] Support pdf files in file viewer (#259) auto convert EOL this fix it for me fix layout implement support for pdf files in file viewer Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/259 Reviewed-by: 6543 <6543@noreply.gitea.io> --- .gitattributes | 1 + README.md | 1 + app/build.gradle | 5 +-- .../gitnex/activities/FileViewActivity.java | 32 +++++++++++++++++++ .../java/org/mian/gitnex/util/AppUtil.java | 8 +++++ .../main/res/layout/activity_file_view.xml | 18 ++++++++++- 6 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..6313b56c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/README.md b/README.md index bbdbc7f1..ff0b46b0 100644 --- a/README.md +++ b/README.md @@ -89,5 +89,6 @@ Open source libraries - Apache/commons-io - Caverock/androidsvg - Droidsonroids.gif/android-gif-drawable +- Barteksc/AndroidPdfViewer [Follow me on Fediverse - mastodon.social/@mmarif](https://mastodon.social/@mmarif) diff --git a/app/build.gradle b/app/build.gradle index 122d0361..01b7034f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,12 +23,12 @@ android { } dependencies { - def lifecycle_version = "2.2.0-rc03" + def lifecycle_version = "2.2.0" final def markwon_version = "4.1.1" implementation fileTree(include: ['*.jar'], dir: 'libs') implementation "androidx.appcompat:appcompat:1.1.0" - implementation "com.google.android.material:material:1.2.0-alpha03" + implementation "com.google.android.material:material:1.2.0-alpha04" implementation "androidx.constraintlayout:constraintlayout:1.1.3" implementation "androidx.legacy:legacy-support-v4:1.0.0" testImplementation "junit:junit:4.12" @@ -69,4 +69,5 @@ dependencies { implementation "commons-io:commons-io:2.6" implementation "com.github.chrisbanes:PhotoView:2.3.0" implementation "com.pddstudio:highlightjs-android:1.5.0" + implementation "com.github.barteksc:android-pdf-viewer:3.2.0-beta.1" } diff --git a/app/src/main/java/org/mian/gitnex/activities/FileViewActivity.java b/app/src/main/java/org/mian/gitnex/activities/FileViewActivity.java index 760fe6c6..77ee3ce3 100644 --- a/app/src/main/java/org/mian/gitnex/activities/FileViewActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/FileViewActivity.java @@ -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 diff --git a/app/src/main/java/org/mian/gitnex/util/AppUtil.java b/app/src/main/java/org/mian/gitnex/util/AppUtil.java index c544924e..cc263395 100644 --- a/app/src/main/java/org/mian/gitnex/util/AppUtil.java +++ b/app/src/main/java/org/mian/gitnex/util/AppUtil.java @@ -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"}; diff --git a/app/src/main/res/layout/activity_file_view.xml b/app/src/main/res/layout/activity_file_view.xml index 05f0e695..0059e546 100644 --- a/app/src/main/res/layout/activity_file_view.xml +++ b/app/src/main/res/layout/activity_file_view.xml @@ -71,6 +71,22 @@ + + + + + + - \ No newline at end of file + From 2c163fdc9c41cc533fb252f9bd75499c0f360249 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Thu, 20 Feb 2020 10:24:14 +0500 Subject: [PATCH 4/6] support for c header files --- app/src/main/java/org/mian/gitnex/util/AppUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/org/mian/gitnex/util/AppUtil.java b/app/src/main/java/org/mian/gitnex/util/AppUtil.java index cc263395..647e27c5 100644 --- a/app/src/main/java/org/mian/gitnex/util/AppUtil.java +++ b/app/src/main/java/org/mian/gitnex/util/AppUtil.java @@ -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", From 5720c5f61384b22924ef33facbe36a490290205a Mon Sep 17 00:00:00 2001 From: M M Arif Date: Fri, 21 Feb 2020 05:58:36 +0000 Subject: [PATCH 5/6] Remove credits, add donators (#268) Merge branch 'master' into 264-remove-credits Merge pull request 'Support for c header files' (#266) from 265-files-support-in-file-viewer into master Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/266 Remove credits, add donators support for c header files Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/268 --- app/src/main/res/layout/fragment_about.xml | 2 +- app/src/main/res/values/credits.xml | 2 +- app/src/main/res/values/sponsors.xml | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml index 75ae97e0..cfa777fc 100644 --- a/app/src/main/res/layout/fragment_about.xml +++ b/app/src/main/res/layout/fragment_about.xml @@ -152,7 +152,7 @@ android:textSize="16sp" android:gravity="start" android:autoLink="web" - android:visibility="visible" + android:visibility="gone" android:layout_marginBottom="10dp" android:textColorLink="@color/lightBlue" /> diff --git a/app/src/main/res/values/credits.xml b/app/src/main/res/values/credits.xml index 91bb10a8..5f1fbbe2 100644 --- a/app/src/main/res/values/credits.xml +++ b/app/src/main/res/values/credits.xml @@ -2,7 +2,7 @@ - Logo by Kasun @kasun + Removed \ No newline at end of file diff --git a/app/src/main/res/values/sponsors.xml b/app/src/main/res/values/sponsors.xml index d55230a0..543dde68 100644 --- a/app/src/main/res/values/sponsors.xml +++ b/app/src/main/res/values/sponsors.xml @@ -7,6 +7,8 @@ Ljoonal @ljoonal Tobias @Tobias Sameer Gupta + Yin Yihang + Svierne \ No newline at end of file From 3f4db112b19b7335d38f147a4d806df07b0bd1f7 Mon Sep 17 00:00:00 2001 From: 6543 <6543@noreply.gitea.io> Date: Mon, 24 Feb 2020 18:50:51 +0000 Subject: [PATCH 6/6] Refactor assignee(s) API calls (#199) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge branch 'master' into refactor_issues_call Remove credits, add donators (#268) Merge branch 'master' into 264-remove-credits Merge pull request 'Support for c header files' (#266) from 265-files-support-in-file-viewer into master Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/266 Remove credits, add donators support for c header files Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/268 Merge pull request 'Support for c header files' (#266) from 265-files-support-in-file-viewer into master Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/266 support for c header files fix Merge branch 'master' into refactor_issues_call Support pdf files in file viewer (#259) auto convert EOL this fix it for me fix layout implement support for pdf files in file viewer Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/259 Reviewed-by: 6543 <6543@noreply.gitea.io> Make DueDate optional on MilestoneCreaton (#252) Merge branch 'master' into milestone-DueDate-optional_240 add check again if gitea is older than 1.10.0 ... Crowdin [2020-01-04] + add Latvian (#253) update Translators add Latvian update Crowdin Co-authored-by: 6543 <6543@obermui.de> make DueDate optional on MilestoneCreaton Co-authored-by: 6543 <6543@obermui.de> Crowdin [2020-01-04] + add Latvian (#253) update Translators add Latvian update Crowdin Co-authored-by: 6543 <6543@obermui.de> Merge branch '51-custom-fonts' of gitnex/GitNex into master Reviewed-by: 6543 <6543@noreply.gitea.io> Implement across the whole app Implementation of custom fonts app wide Merge branch 'crowdin_2019-12-25' of gitnex/GitNex into master add user to the “new issue” assignees dialog refactor.start() update from crowdin Merge branch 'backport-243' of gitnex/GitNex into master backport url slashes fix Merge branch 'fix-238' of gitnex/GitNex into master fix Merge branch 'backport-235' of gitnex/GitNex into master backport fix #235 Merge branch 'backport-232' of gitnex/GitNex into master show all issues and prs Merge branch '206-repos-in-explore-screen' of gitnex/GitNex into master Load default list of explore repositories Merge branch '225-backport' of gitnex/GitNex into master copy and support files backport - #225 Merge branch '226-backport' of gitnex/GitNex into master fix alignments backport Co-authored-by: M M Arif Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/199 --- .../AddRemoveAssigneesActivity.java | 6 +-- .../activities/CreateIssueActivity.java | 7 ++- .../mian/gitnex/interfaces/ApiInterface.java | 4 +- .../org/mian/gitnex/models/CreateIssue.java | 2 - .../java/org/mian/gitnex/models/Issues.java | 44 ------------------- ...ssignee.java => UpdateIssueAssignees.java} | 4 +- 6 files changed, 12 insertions(+), 55 deletions(-) rename app/src/main/java/org/mian/gitnex/models/{UpdateIssueAssignee.java => UpdateIssueAssignees.java} (64%) diff --git a/app/src/main/java/org/mian/gitnex/activities/AddRemoveAssigneesActivity.java b/app/src/main/java/org/mian/gitnex/activities/AddRemoveAssigneesActivity.java index 5c29c0aa..83774b0d 100644 --- a/app/src/main/java/org/mian/gitnex/activities/AddRemoveAssigneesActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/AddRemoveAssigneesActivity.java @@ -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 issueAssigneesList) { - UpdateIssueAssignee updateAssigneeJson = new UpdateIssueAssignee(issueAssigneesList); + UpdateIssueAssignees updateAssigneeJson = new UpdateIssueAssignees(issueAssigneesList); Call 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() { diff --git a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java index b04f5014..16448ae3 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreateIssueActivity.java @@ -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> call = RetrofitClient .getInstance(instanceUrl, getApplicationContext()) .getApiInterface() .getCollaborators(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName); + listOfAssignees.add(new MultiSelectModel(-1, loginFullName)); + call.enqueue(new Callback>() { @Override diff --git a/app/src/main/java/org/mian/gitnex/interfaces/ApiInterface.java b/app/src/main/java/org/mian/gitnex/interfaces/ApiInterface.java index deb2b053..54f0bd9d 100644 --- a/app/src/main/java/org/mian/gitnex/interfaces/ApiInterface.java +++ b/app/src/main/java/org/mian/gitnex/interfaces/ApiInterface.java @@ -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 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 patchIssueAssignee(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("issueIndex") int issueIndex, @Body UpdateIssueAssignee jsonStr); + Call 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> adminGetUsers(@Header("Authorization") String token); diff --git a/app/src/main/java/org/mian/gitnex/models/CreateIssue.java b/app/src/main/java/org/mian/gitnex/models/CreateIssue.java index 3d81d7f3..e15252b9 100644 --- a/app/src/main/java/org/mian/gitnex/models/CreateIssue.java +++ b/app/src/main/java/org/mian/gitnex/models/CreateIssue.java @@ -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 assignees, int[] labels) { - this.assignee = assignee; this.body = body; this.closed = closed; this.due_date = due_date; diff --git a/app/src/main/java/org/mian/gitnex/models/Issues.java b/app/src/main/java/org/mian/gitnex/models/Issues.java index 234242b7..d6fa0d4b 100644 --- a/app/src/main/java/org/mian/gitnex/models/Issues.java +++ b/app/src/main/java/org/mian/gitnex/models/Issues.java @@ -25,7 +25,6 @@ public class Issues { private List labels; private pullRequestObject pull_request; private milestoneObject milestone; - private assigneeObject assignee; private List 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 getAssignees() { return assignees; } diff --git a/app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignee.java b/app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignees.java similarity index 64% rename from app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignee.java rename to app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignees.java index f3f6ed4a..190895f0 100644 --- a/app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignee.java +++ b/app/src/main/java/org/mian/gitnex/models/UpdateIssueAssignees.java @@ -6,11 +6,11 @@ import java.util.List; * Author M M Arif */ -public class UpdateIssueAssignee { +public class UpdateIssueAssignees { private List assignees; - public UpdateIssueAssignee(List assignees) { + public UpdateIssueAssignees(List assignees) { this.assignees = assignees; }