From 4be595ea54425ebf08ca6538827e08cf4cdc6b58 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 27 Dec 2022 16:50:08 +0100 Subject: [PATCH 1/7] Add deepl support --- .../android/activities/MediaActivity.java | 94 ++++--------------- .../app/fedilab/android/helper/Helper.java | 6 +- .../android/helper/TranslateHelper.java | 91 ++++++++++++++++++ .../android/ui/drawer/ReleaseNoteAdapter.java | 46 ++------- .../android/ui/drawer/StatusAdapter.java | 45 ++------- .../settings/FragmentTimelinesSettings.java | 27 +++++- app/src/main/res/values/strings.xml | 31 ++++++ app/src/main/res/xml/pref_timelines.xml | 26 +++++ .../stom79/mytransl/translate/Helper.java | 10 +- .../stom79/mytransl/translate/Params.java | 10 ++ .../metadata/android/en/changelogs/455.txt | 7 ++ 11 files changed, 237 insertions(+), 156 deletions(-) create mode 100644 app/src/main/java/app/fedilab/android/helper/TranslateHelper.java create mode 100644 src/fdroid/fastlane/metadata/android/en/changelogs/455.txt diff --git a/app/src/main/java/app/fedilab/android/activities/MediaActivity.java b/app/src/main/java/app/fedilab/android/activities/MediaActivity.java index 608f6f35..a93697f6 100644 --- a/app/src/main/java/app/fedilab/android/activities/MediaActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/MediaActivity.java @@ -21,14 +21,12 @@ import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.graphics.Point; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Handler; -import android.text.Html; import android.view.Display; import android.view.Menu; import android.view.MenuItem; @@ -44,15 +42,8 @@ import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentStatePagerAdapter; -import androidx.preference.PreferenceManager; import androidx.viewpager.widget.ViewPager; -import com.github.stom79.mytransl.MyTransL; -import com.github.stom79.mytransl.client.HttpsConnectionException; -import com.github.stom79.mytransl.client.Results; -import com.github.stom79.mytransl.translate.Params; -import com.github.stom79.mytransl.translate.Translate; - import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -63,6 +54,7 @@ import app.fedilab.android.client.entities.api.Status; import app.fedilab.android.databinding.ActivityMediaPagerBinding; import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.MediaHelper; +import app.fedilab.android.helper.TranslateHelper; import app.fedilab.android.interfaces.OnDownloadInterface; import app.fedilab.android.ui.fragment.media.FragmentMedia; import es.dmoral.toasty.Toasty; @@ -157,40 +149,14 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload binding.mediaDescription.setText(description); binding.translate.setOnClickListener(v -> { String descriptionToTranslate = attachments.get(mediaPosition - 1).description; - MyTransL.translatorEngine et = MyTransL.translatorEngine.LIBRETRANSLATE; - final MyTransL myTransL = MyTransL.getInstance(et); - myTransL.setObfuscation(true); - Params params = new Params(); - params.setSplit_sentences(false); - params.setFormat(Params.fType.TEXT); - params.setSource_lang("auto"); - myTransL.setLibretranslateDomain("translate.fedilab.app"); - String statusToTranslate; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) - statusToTranslate = Html.fromHtml(descriptionToTranslate, Html.FROM_HTML_MODE_LEGACY).toString(); - else - statusToTranslate = Html.fromHtml(descriptionToTranslate).toString(); - SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(MediaActivity.this); - String translate = sharedpreferences.getString(getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale()); - if (translate != null && translate.equalsIgnoreCase("default")) { - translate = MyTransL.getLocale(); - } - myTransL.translate(statusToTranslate, translate, params, new Results() { - @Override - public void onSuccess(Translate translate) { - if (translate.getTranslatedContent() != null) { - attachments.get(mediaPosition - 1).translation = translate.getTranslatedContent(); - binding.mediaDescriptionTranslated.setText(translate.getTranslatedContent()); - binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); - binding.mediaDescription.setVisibility(View.GONE); - } else { - Toasty.error(MediaActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); - } - } - - @Override - public void onFail(HttpsConnectionException httpsConnectionException) { - + TranslateHelper.translate(MediaActivity.this, descriptionToTranslate, translated -> { + if (translated != null) { + attachments.get(mediaPosition - 1).translation = translated; + binding.mediaDescriptionTranslated.setText(translated); + binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); + binding.mediaDescription.setVisibility(View.GONE); + } else { + Toasty.error(MediaActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); } }); }); @@ -222,40 +188,14 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload } binding.translate.setOnClickListener(v -> { String descriptionToTranslate = attachments.get(position).description; - MyTransL.translatorEngine et = MyTransL.translatorEngine.LIBRETRANSLATE; - final MyTransL myTransL = MyTransL.getInstance(et); - myTransL.setObfuscation(true); - Params params = new Params(); - params.setSplit_sentences(false); - params.setFormat(Params.fType.TEXT); - params.setSource_lang("auto"); - myTransL.setLibretranslateDomain("translate.fedilab.app"); - String statusToTranslate; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) - statusToTranslate = Html.fromHtml(descriptionToTranslate, Html.FROM_HTML_MODE_LEGACY).toString(); - else - statusToTranslate = Html.fromHtml(descriptionToTranslate).toString(); - SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(MediaActivity.this); - String translate = sharedpreferences.getString(getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale()); - if (translate != null && translate.equalsIgnoreCase("default")) { - translate = MyTransL.getLocale(); - } - myTransL.translate(statusToTranslate, translate, params, new Results() { - @Override - public void onSuccess(Translate translate) { - if (translate.getTranslatedContent() != null) { - attachments.get(position).translation = translate.getTranslatedContent(); - binding.mediaDescriptionTranslated.setText(translate.getTranslatedContent()); - binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); - binding.mediaDescription.setVisibility(View.GONE); - } else { - Toasty.error(MediaActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); - } - } - - @Override - public void onFail(HttpsConnectionException httpsConnectionException) { - + TranslateHelper.translate(MediaActivity.this, descriptionToTranslate, translated -> { + if (translated != null) { + attachments.get(position).translation = translated; + binding.mediaDescriptionTranslated.setText(translated); + binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); + binding.mediaDescription.setVisibility(View.GONE); + } else { + Toasty.error(MediaActivity.this, getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); } }); }); diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java index 75ea7626..dc415779 100644 --- a/app/src/main/java/app/fedilab/android/helper/Helper.java +++ b/app/src/main/java/app/fedilab/android/helper/Helper.java @@ -124,14 +124,17 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Date; +import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Random; +import java.util.Set; import java.util.TimeZone; import java.util.UUID; import java.util.regex.Matcher; @@ -1236,7 +1239,8 @@ public class Helper { counter++; Date now = new Date(); attachment.filename = formatter.format(now) + "." + extension; - if (attachment.mimeType.startsWith("image")) { + Set imageType = new HashSet<>(Arrays.asList("image/png", "image/jpeg", "image/jpg")); + if (imageType.contains(attachment.mimeType)) { final File certCacheDir = new File(context.getCacheDir(), TEMP_MEDIA_DIRECTORY); boolean isCertCacheDirExists = certCacheDir.exists(); if (!isCertCacheDirExists) { diff --git a/app/src/main/java/app/fedilab/android/helper/TranslateHelper.java b/app/src/main/java/app/fedilab/android/helper/TranslateHelper.java new file mode 100644 index 00000000..2edbb8ac --- /dev/null +++ b/app/src/main/java/app/fedilab/android/helper/TranslateHelper.java @@ -0,0 +1,91 @@ +package app.fedilab.android.helper; +/* Copyright 2022 Thomas Schneider + * + * This file is a part of Fedilab + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation; either version 3 of the + * License, or (at your option) any later version. + * + * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Fedilab; if not, + * see . */ + +import android.content.Context; +import android.content.SharedPreferences; +import android.os.Build; +import android.text.Html; +import android.widget.Toast; + +import androidx.preference.PreferenceManager; + +import com.github.stom79.mytransl.MyTransL; +import com.github.stom79.mytransl.client.HttpsConnectionException; +import com.github.stom79.mytransl.client.Results; +import com.github.stom79.mytransl.translate.Params; + +import app.fedilab.android.R; +import es.dmoral.toasty.Toasty; + +public class TranslateHelper { + + public static void translate(Context context, String toTranslate, Translate callback) { + String statusToTranslate; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) + statusToTranslate = Html.fromHtml(toTranslate, Html.FROM_HTML_MODE_LEGACY).toString(); + else + statusToTranslate = Html.fromHtml(toTranslate).toString(); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); + String translator = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR), "FEDILAB"); + MyTransL.translatorEngine et; + if (translator.compareToIgnoreCase("FEDILAB") == 0) { + et = MyTransL.translatorEngine.LIBRETRANSLATE; + } else { + et = MyTransL.translatorEngine.DEEPL; + } + final MyTransL myTransL = MyTransL.getInstance(et); + myTransL.setObfuscation(true); + Params params = new Params(); + params.setSplit_sentences(false); + params.setFormat(Params.fType.TEXT); + params.setSource_lang("auto"); + if (translator.compareToIgnoreCase("FEDILAB") == 0) { + myTransL.setLibretranslateDomain("translate.fedilab.app"); + } else { + String translatorVersion = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR_VERSION), "PRO"); + params.setPro(translatorVersion.equals("PRO")); + String apikey = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR_API_KEY), null); + myTransL.setDeeplAPIKey(apikey.trim()); + } + + String translate = sharedpreferences.getString(context.getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale()); + if (translate.equalsIgnoreCase("default")) { + translate = MyTransL.getLocale(); + } + + myTransL.translate(statusToTranslate, translate, params, new Results() { + @Override + public void onSuccess(com.github.stom79.mytransl.translate.Translate translate) { + if (translate.getTranslatedContent() != null) { + callback.onTranslate(translate.getTranslatedContent()); + } else { + callback.onTranslate(""); + Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); + } + } + + @Override + public void onFail(HttpsConnectionException httpsConnectionException) { + callback.onTranslate(""); + Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); + } + }); + } + + public interface Translate { + void onTranslate(String translated); + } +} diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/ReleaseNoteAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/ReleaseNoteAdapter.java index 6e4309ca..65353d33 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/ReleaseNoteAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/ReleaseNoteAdapter.java @@ -16,28 +16,21 @@ package app.fedilab.android.ui.drawer; import android.content.Context; -import android.content.SharedPreferences; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import androidx.annotation.NonNull; -import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.RecyclerView; -import com.github.stom79.mytransl.MyTransL; -import com.github.stom79.mytransl.client.HttpsConnectionException; -import com.github.stom79.mytransl.client.Results; -import com.github.stom79.mytransl.translate.Params; -import com.github.stom79.mytransl.translate.Translate; - import java.util.List; import java.util.Locale; import app.fedilab.android.R; import app.fedilab.android.client.entities.app.ReleaseNote; import app.fedilab.android.databinding.DrawerReleaseNoteBinding; +import app.fedilab.android.helper.TranslateHelper; import es.dmoral.toasty.Toasty; @@ -81,37 +74,14 @@ public class ReleaseNoteAdapter extends RecyclerView.Adapter { - MyTransL.translatorEngine et = MyTransL.translatorEngine.LIBRETRANSLATE; - final MyTransL myTransL = MyTransL.getInstance(et); - myTransL.setObfuscation(true); - Params params = new Params(); - params.setSplit_sentences(false); - params.setFormat(Params.fType.TEXT); - params.setSource_lang("auto"); - myTransL.setLibretranslateDomain("translate.fedilab.app"); - SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); - String translate = sharedpreferences.getString(context.getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale()); - if (translate != null && translate.equalsIgnoreCase("default")) { - translate = MyTransL.getLocale(); + holder.binding.translate.setOnClickListener(v -> TranslateHelper.translate(context, note.note, translated -> { + if (translated != null) { + note.noteTranslated = translated; + notifyItemChanged(holder.getBindingAdapterPosition()); + } else { + Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); } - myTransL.translate(note.note, translate, params, new Results() { - @Override - public void onSuccess(Translate translate) { - if (translate.getTranslatedContent() != null) { - note.noteTranslated = translate.getTranslatedContent(); - notifyItemChanged(holder.getBindingAdapterPosition()); - } else { - Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); - } - } - - @Override - public void onFail(HttpsConnectionException httpsConnectionException) { - Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); - } - }); - }); + })); } diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java index a2f6013f..f0be81cc 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java @@ -87,10 +87,6 @@ import com.bumptech.glide.RequestBuilder; import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.request.RequestOptions; import com.github.stom79.mytransl.MyTransL; -import com.github.stom79.mytransl.client.HttpsConnectionException; -import com.github.stom79.mytransl.client.Results; -import com.github.stom79.mytransl.translate.Params; -import com.github.stom79.mytransl.translate.Translate; import com.vanniktech.emoji.EmojiManager; import com.vanniktech.emoji.EmojiPopup; import com.vanniktech.emoji.one.EmojiOneProvider; @@ -145,6 +141,7 @@ import app.fedilab.android.helper.MediaHelper; import app.fedilab.android.helper.SpannableHelper; import app.fedilab.android.helper.ThemeHelper; import app.fedilab.android.helper.TimelineHelper; +import app.fedilab.android.helper.TranslateHelper; import app.fedilab.android.ui.fragment.timeline.FragmentMastodonContext; import app.fedilab.android.viewmodel.mastodon.AccountsVM; import app.fedilab.android.viewmodel.mastodon.SearchVM; @@ -1982,6 +1979,7 @@ public class StatusAdapter extends RecyclerView.Adapter } + private static void translate(Context context, Status statusToDeal, StatusViewHolder holder, RecyclerView.Adapter adapter) { @@ -1990,40 +1988,15 @@ public class StatusAdapter extends RecyclerView.Adapter statusToTranslate = Html.fromHtml(statusToDeal.content, Html.FROM_HTML_MODE_LEGACY).toString(); else statusToTranslate = Html.fromHtml(statusToDeal.content).toString(); - int countMorseChar = ComposeAdapter.countMorseChar(statusToTranslate); if (countMorseChar < 4) { - MyTransL.translatorEngine et = MyTransL.translatorEngine.LIBRETRANSLATE; - final MyTransL myTransL = MyTransL.getInstance(et); - myTransL.setObfuscation(true); - Params params = new Params(); - params.setSplit_sentences(false); - params.setFormat(Params.fType.TEXT); - params.setSource_lang("auto"); - myTransL.setLibretranslateDomain("translate.fedilab.app"); - - SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); - String translate = sharedpreferences.getString(context.getString(R.string.SET_LIVE_TRANSLATE), MyTransL.getLocale()); - if (translate != null && translate.equalsIgnoreCase("default")) { - translate = MyTransL.getLocale(); - } - - - myTransL.translate(statusToTranslate, translate, params, new Results() { - @Override - public void onSuccess(Translate translate) { - if (translate.getTranslatedContent() != null) { - statusToDeal.translationShown = true; - statusToDeal.translationContent = translate.getTranslatedContent(); - adapter.notifyItemChanged(holder.getBindingAdapterPosition()); - } else { - Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); - } - } - - @Override - public void onFail(HttpsConnectionException httpsConnectionException) { - + TranslateHelper.translate(context, statusToDeal.content, translated -> { + if (translated != null) { + statusToDeal.translationShown = true; + statusToDeal.translationContent = translated; + adapter.notifyItemChanged(holder.getBindingAdapterPosition()); + } else { + Toasty.error(context, context.getString(R.string.toast_error_translate), Toast.LENGTH_LONG).show(); } }); } else { diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentTimelinesSettings.java b/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentTimelinesSettings.java index a8f2a5ee..04fd9e9f 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentTimelinesSettings.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentTimelinesSettings.java @@ -17,9 +17,11 @@ package app.fedilab.android.ui.fragment.settings; import android.content.SharedPreferences; import android.os.Bundle; +import androidx.preference.EditTextPreference; import androidx.preference.ListPreference; import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceManager; +import androidx.preference.PreferenceScreen; import app.fedilab.android.R; import app.fedilab.android.helper.Helper; @@ -33,10 +35,31 @@ public class FragmentTimelinesSettings extends PreferenceFragmentCompat implemen } private void createPref() { + + getPreferenceScreen().removeAll(); + addPreferencesFromResource(R.xml.pref_timelines); + PreferenceScreen preferenceScreen = getPreferenceScreen(); ListPreference SET_LOAD_MEDIA_TYPE = findPreference(getString(R.string.SET_LOAD_MEDIA_TYPE)); if (SET_LOAD_MEDIA_TYPE != null) { SET_LOAD_MEDIA_TYPE.getContext().setTheme(Helper.dialogStyle()); } + ListPreference SET_TRANSLATOR = findPreference(getString(R.string.SET_TRANSLATOR)); + if (SET_TRANSLATOR != null) { + SET_TRANSLATOR.getContext().setTheme(Helper.dialogStyle()); + } + ListPreference SET_TRANSLATOR_VERSION = findPreference(getString(R.string.SET_TRANSLATOR_VERSION)); + if (SET_TRANSLATOR_VERSION != null) { + SET_TRANSLATOR_VERSION.getContext().setTheme(Helper.dialogStyle()); + } + EditTextPreference SET_TRANSLATOR_API_KEY = findPreference(getString(R.string.SET_TRANSLATOR_API_KEY)); + if (SET_TRANSLATOR != null && SET_TRANSLATOR.getValue().equals("FEDILAB")) { + if (SET_TRANSLATOR_API_KEY != null) { + preferenceScreen.removePreferenceRecursively("SET_TRANSLATOR_API_KEY"); + } + if (SET_TRANSLATOR_VERSION != null) { + preferenceScreen.removePreferenceRecursively("SET_TRANSLATOR_VERSION"); + } + } } @Override @@ -44,8 +67,10 @@ public class FragmentTimelinesSettings extends PreferenceFragmentCompat implemen if (getActivity() != null) { SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.apply(); + if (key.compareToIgnoreCase(getString(R.string.SET_TRANSLATOR)) == 0) { + createPref(); + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8644912b..b04300af 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -766,6 +766,26 @@ Wifi only Ask + + + Fedilab + DeepL + + + Free + Pro + + + + FEDILAB + DEEPL + + + + FREE + PRO + + 15 minutes 30 minutes @@ -1400,6 +1420,12 @@ SET_NOTIF_VALIDATION SET_DISPLAY_BOOKMARK SET_DISPLAY_TRANSLATE + SET_TRANSLATOR + SET_TRANSLATOR_VERSION + + SET_TRANSLATOR_API_KEY + + SET_NOTIF_VALIDATION_FAV SET_DISPLAY_COUNTER_FAV_BOOST SET_REMOVE_LEFT_MARGIN @@ -2116,4 +2142,9 @@ Manage accounts Remove left margin Remove the left margin in timelines to make messages more compact + Translator + Translator + Translator API key + Version + Translator version \ No newline at end of file diff --git a/app/src/main/res/xml/pref_timelines.xml b/app/src/main/res/xml/pref_timelines.xml index 4ba37efa..34ea407f 100644 --- a/app/src/main/res/xml/pref_timelines.xml +++ b/app/src/main/res/xml/pref_timelines.xml @@ -54,6 +54,32 @@ app:singleLineTitle="false" app:title="@string/set_display_translate_indication" /> + + + + + Date: Tue, 27 Dec 2022 16:58:38 +0100 Subject: [PATCH 2/7] Fix issue #691 - Suggested accounts cannot be followed --- .../java/app/fedilab/android/ui/drawer/SuggestionAdapter.java | 1 - app/src/main/res/layout/drawer_suggestion.xml | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/SuggestionAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/SuggestionAdapter.java index 1637004c..58eb1712 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/SuggestionAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/SuggestionAdapter.java @@ -109,7 +109,6 @@ public class SuggestionAdapter extends RecyclerView.Adapter(holder.binding.bio)), TextView.BufferType.SPANNABLE); - holder.binding.followAction.setEnabled(false); holder.binding.followAction.setOnClickListener(v -> { suggestionList.remove(position); notifyItemRemoved(position); diff --git a/app/src/main/res/layout/drawer_suggestion.xml b/app/src/main/res/layout/drawer_suggestion.xml index a8eba685..de4ccbad 100644 --- a/app/src/main/res/layout/drawer_suggestion.xml +++ b/app/src/main/res/layout/drawer_suggestion.xml @@ -106,7 +106,9 @@ android:layout_marginTop="6dp" android:insetTop="0dp" android:insetBottom="0dp" - android:padding="6dp" + android:padding="0dp" + app:iconGravity="textStart" + app:iconPadding="0dp" app:icon="@drawable/ic_baseline_person_add_24" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toBottomOf="@id/bio" /> From 608843b20a3a0c98137eceefebb664637025a84d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Jel=C3=ADnek?= Date: Tue, 27 Dec 2022 16:50:38 +0100 Subject: [PATCH 3/7] Translated using Weblate (Czech) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 99.5% (994 of 998 strings) Co-authored-by: Lukáš Jelínek Translate-URL: https://hosted.weblate.org/projects/fedilab/strings/cs/ Translation: Fedilab/Strings --- app/src/main/res/values-cs/strings.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index f15e3f93..6929f0af 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -942,4 +942,8 @@ Přidat všechny uživatele pro ztlumený domov Zobrazit Seskupovat reblogy v domovské časové ose + Spravovat účty + Vyberte vše, co vyhovuje + Odstranit levý okraj + Odstranit v časových osách levý okraj, aby se zprávy zobrazovaly kompaktněji \ No newline at end of file From 4d91c400ab63ff44bca8081cfdbbb2ad8443a385 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?jos=C3=A9=20m?= Date: Tue, 27 Dec 2022 16:50:39 +0100 Subject: [PATCH 4/7] Translated using Weblate (Galician) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 100.0% (998 of 998 strings) Co-authored-by: josé m Translate-URL: https://hosted.weblate.org/projects/fedilab/strings/gl/ Translation: Fedilab/Strings --- app/src/main/res/values-gl/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 9d8a9181..1cc6350d 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -931,4 +931,6 @@ Usuarias acalas en Inicio Comparticións para o grupo no Inicio Xestionar contas + Eliminar marxe esquerda + Eliminar a marxe esquerda nas cronoloxías para compactar máis as mensaxes \ No newline at end of file From 01e5893c95117415cc7841221702992c0d1e8377 Mon Sep 17 00:00:00 2001 From: RintanBroadleaf Date: Tue, 27 Dec 2022 16:50:39 +0100 Subject: [PATCH 5/7] Translated using Weblate (Japanese) Currently translated at 99.8% (997 of 998 strings) Co-authored-by: RintanBroadleaf Translate-URL: https://hosted.weblate.org/projects/fedilab/strings/ja/ Translation: Fedilab/Strings --- app/src/main/res/values-ja/strings.xml | 70 ++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 77b64af8..c67ed5d5 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -859,4 +859,74 @@ タイムラインの削除 レポートを送信しました 登録しました + データをインポート + 通報を却下 + 新着情報の通知 + 新しい通報(モデレーター) + 新着情報 + 新規登録 + 新しい通報 + あなたが共有した投稿が編集されました + ユーザーが登録しました + ユーザーが通報しました + 新規登録 + タグ %1$s をブロックしますか? + メディアファイルを拒否 + このドメインからの通報を全て無視します。サスペンドとは無関係です + テーマのモードを選択 + ダーク - カスタムカラー + ライト - カスタムカラー + タグのミュートを解除 + タグをミュート + リモートの会話を表示 + タグのピン留め + タグのピン留めを解除 + ホームでのミュートを解除 + 重大性 + サイレンスするとそのアカウントの投稿がフォローしていないユーザーから見えなくなります。サスペンドはそのアカウントのコンテンツやメディア、プロフィール情報などが全て削除されます。メディアファイルを拒否したいだけの場合は「なし」を使用してください。 + デフォルトのダークテーマ + デフォルトのライトテーマ + ホームのミュートしたユーザー + 通知を消去しない + ダイナミックカラー + 個人設定の壁紙の配色に合わせます。 + 翻訳ボタンを常に表示します + 通報を却下 + ドメイン名の難読化 + 公開コメント + 変更が保存されました! + ドメインブロックを追加 + 色のカスタマイズ + テーマのカスタムカラーを設定することができます。 + 高さのあるカード + ライトテーマのカスタマイズ + ダークテーマのカスタマイズ + カスタムカラーの設定 + 時間をおいて再試行してください。 + ホームでのミュート + タイムライン上の左のマージンを削除し、投稿をよりコンパクトにします + 通報しました + ドメイン + 新規登録(モデレーター) + リストの並び替え + ドメインブロックはデータベースへのアカウントエントリーの作成を妨げませんが、それらのアカウントに指定されたモデレーション方法を遡及的かつ自動的に適用します。 + 他のアカウントで開く + メディアを拒否 + 有効にすると、タイムライン上のアイテムが影と高さを持ちます。 + ライトテーマでの投稿の一部の要素をカスタマイズできます。 + ダークテーマでの投稿の一部の要素をカスタマイズできます。 + 会話があなたのサーバーで開始されました! + リモートの投稿が見つかりませんでした。 + タグのフォローを解除 + 全てのアカウントがホームタイムライン上でミュートされます。 + 全てのユーザーをホームでのミュート対象として追加 + 選択をミュート + ホームタイムラインでブーストをグループ化 + アカウントの管理 + 左のマージンを削除 + このドメインからの通報を全て無視します。サスペンドとは無関係です + ドメイン制限リストの公開が有効なとき、リスト内のドメイン名を一部難読化します + 内部コメント + このドメイン制限に関するコメントで、モデレーターによって内部で使用されます。 + このドメイン制限に関するコメントで、ドメイン制限リストの公開が有効な場合に一般外部向けに使用されます。 \ No newline at end of file From 5ca727705bc05e19fb4d921c757027bdbc12dfb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20Ersen?= Date: Tue, 27 Dec 2022 16:50:39 +0100 Subject: [PATCH 6/7] Translated using Weblate (Turkish) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 100.0% (998 of 998 strings) Co-authored-by: Oğuz Ersen Translate-URL: https://hosted.weblate.org/projects/fedilab/strings/tr/ Translation: Fedilab/Strings --- app/src/main/res/values-tr/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index c3caf14e..ca7a283c 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -935,4 +935,6 @@ Verileri içe aktar Ana sayfa zaman çizelgesinde yeniden blogları gruplandır Hesapları yönet + Sol kenar boşluğunu kaldır + Mesajları daha sıkı hale getirmek için zaman çizelgelerindeki sol kenar boşluğunu kaldır \ No newline at end of file From d70231cd7813195cfd154feccbd9fb429d0191d3 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 27 Dec 2022 17:39:29 +0100 Subject: [PATCH 7/7] Release 3.13.1 --- app/build.gradle | 4 ++-- app/src/main/assets/release_notes/notes.json | 5 +++++ .../java/app/fedilab/android/ui/drawer/ComposeAdapter.java | 7 +++++++ src/fdroid/fastlane/metadata/android/en/changelogs/455.txt | 4 +++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ccc80bdb..566df8e7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,8 +13,8 @@ android { defaultConfig { minSdk 21 targetSdk 33 - versionCode 454 - versionName "3.13.0" + versionCode 455 + versionName "3.13.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } flavorDimensions "default" diff --git a/app/src/main/assets/release_notes/notes.json b/app/src/main/assets/release_notes/notes.json index c44d304a..2d2d1bba 100644 --- a/app/src/main/assets/release_notes/notes.json +++ b/app/src/main/assets/release_notes/notes.json @@ -1,4 +1,9 @@ [ + { + "version": "3.13.1", + "code": "455", + "note": "Added:\n- DeepL translation support free/pro keys\n\nChanged:\n- Hide buttons for media when editing\n\nFixed:\n- GIF loaded as static images\n- Suggested accounts cannot be followed" + }, { "version": "3.13.0", "code": "454", diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java index ea5311c4..75f794be 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java @@ -1021,6 +1021,13 @@ public class ComposeAdapter extends RecyclerView.Adapter