From c5bf617f6578503b6977060f356677b48ee444f6 Mon Sep 17 00:00:00 2001 From: gdlbo <41114720+gdlbo@users.noreply.github.com> Date: Wed, 8 Jun 2022 14:02:45 +0300 Subject: [PATCH] fixes + more translations --- .../java/ru/vtosters/lite/foaf/FoafBase.java | 3 +- .../java/ru/vtosters/lite/utils/About.java | 33 ++++++++++--------- .../lite/utils/DeletedMessagesHandler.java | 2 +- .../java/ru/vtosters/lite/utils/Globals.java | 11 +++++-- smali/res/values-ru/strings.xml | 5 ++- smali/res/values/strings.xml | 5 ++- smali/res/xml/preferences_activity.xml | 2 +- smali/res/xml/preferences_feed.xml | 4 +-- smali/res/xml/preferences_other.xml | 2 +- 9 files changed, 41 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/ru/vtosters/lite/foaf/FoafBase.java b/app/src/main/java/ru/vtosters/lite/foaf/FoafBase.java index b1aadf503..5aacfa104 100644 --- a/app/src/main/java/ru/vtosters/lite/foaf/FoafBase.java +++ b/app/src/main/java/ru/vtosters/lite/foaf/FoafBase.java @@ -2,6 +2,7 @@ package ru.vtosters.lite.foaf; import static android.widget.Toast.LENGTH_SHORT; import static android.widget.Toast.makeText; +import static ru.vtosters.lite.utils.Globals.getIdentifier; import static ru.vtosters.lite.utils.Globals.getString; import static ru.vtosters.lite.utils.Proxy.getApiCom; import static ru.vtosters.lite.utils.Proxy.proxy; @@ -79,7 +80,7 @@ public class FoafBase { matcher2.find(); String normalHumanDate = getNormalHumanDate(matcher.group(1)); getNormalHumanDate(matcher2.group(1)); - AlertDialog.a a2 = new VkAlertDialog.a(context).a(R.string.addinf); + AlertDialog.a a2 = new VkAlertDialog.a(context).a(getIdentifier("addinf", "string")); a2.b(getString("foafid") + " " + i + getString("foafregdate") + " " + normalHumanDate + getString("foafdate") + " " + daysPassedFromFoafDate(normalHumanDate)).b(17039370, null).b().show(); } catch (Exception e) { e.printStackTrace(); diff --git a/app/src/main/java/ru/vtosters/lite/utils/About.java b/app/src/main/java/ru/vtosters/lite/utils/About.java index f8e1d5f20..f2e71b8dc 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/About.java +++ b/app/src/main/java/ru/vtosters/lite/utils/About.java @@ -2,6 +2,7 @@ package ru.vtosters.lite.utils; import static ru.vtosters.lite.utils.Globals.getApplicationName; import static ru.vtosters.lite.utils.Globals.getContext; +import static ru.vtosters.lite.utils.Globals.getIdentifier; import static ru.vtosters.lite.utils.Preferences.VERSIONNAME; import static ru.vtosters.lite.utils.Preferences.oldabout; @@ -21,25 +22,25 @@ public class About { list.add(new Items1()); if (!oldabout()) { - list.add(new Items(21, com.vtosters.lite.R.string.opencommit)); - list.add(new Items(8, com.vtosters.lite.R.string.tgchannel)); - list.add(new Items(9, com.vtosters.lite.R.string.tgchat)); - list.add(new Items(16, com.vtosters.lite.R.string.vtfaq)); - list.add(new Items(19, com.vtosters.lite.R.string.vtsite)); - list.add(new Items(20, com.vtosters.lite.R.string.donate)); - list.add(new Items(17, com.vtosters.lite.R.string.vkgroup)); - list.add(new Items(18, com.vtosters.lite.R.string.sett_debug)); + list.add(new Items(21, getIdentifier("opencommit", "string"))); + list.add(new Items(8, getIdentifier("tgchannel", "string"))); + list.add(new Items(9, getIdentifier("tgchat", "string"))); + list.add(new Items(16, getIdentifier("vtfaq", "string"))); + list.add(new Items(19, getIdentifier("vtsite", "string"))); + list.add(new Items(20, getIdentifier("donate", "string"))); + list.add(new Items(17, getIdentifier("vkgroup", "string"))); + list.add(new Items(18, getIdentifier("sett_debug", "string"))); return; } - list.add(new Items(0, com.vtosters.lite.R.string.about_app_feedback)); - list.add(new Items(1, com.vtosters.lite.R.string.about_app_estimate)); - list.add(new Items(2, com.vtosters.lite.R.string.about_app_privacy)); - list.add(new Items(5, com.vtosters.lite.R.string.about_app_cookie)); - list.add(new Items(3, com.vtosters.lite.R.string.about_app_terms_to_use)); - list.add(new Items(4, com.vtosters.lite.R.string.about_app_license)); - list.add(new Items(6, com.vtosters.lite.R.string.about_app_data_protect)); - list.add(new Items(8, com.vtosters.lite.R.string.sett_debug)); + list.add(new Items(0, getIdentifier("about_app_feedback", "string"))); + list.add(new Items(1, getIdentifier("about_app_estimate", "string"))); + list.add(new Items(2, getIdentifier("about_app_privacy", "string"))); + list.add(new Items(5, getIdentifier("about_app_cookie", "string"))); + list.add(new Items(3, getIdentifier("about_app_terms_to_use", "string"))); + list.add(new Items(4, getIdentifier("about_app_license", "string"))); + list.add(new Items(6, getIdentifier("about_app_data_protect", "string"))); + list.add(new Items(8, getIdentifier("sett_debug", "string"))); } public static String getBuildNumber() { return getBuild(getContext(), "version.properties"); diff --git a/app/src/main/java/ru/vtosters/lite/utils/DeletedMessagesHandler.java b/app/src/main/java/ru/vtosters/lite/utils/DeletedMessagesHandler.java index 988cd6932..f5fd673e3 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/DeletedMessagesHandler.java +++ b/app/src/main/java/ru/vtosters/lite/utils/DeletedMessagesHandler.java @@ -75,7 +75,7 @@ public class DeletedMessagesHandler { } private static String getPreifxUndelete() { - return getPrefsValue("undeletemsg_prefix") + " "; + return getPrefsValue("undeletemsg_prefix_value") + " "; } public static void updateDialog(MsgDeleteLpTask msgDeleteLpTask) { diff --git a/app/src/main/java/ru/vtosters/lite/utils/Globals.java b/app/src/main/java/ru/vtosters/lite/utils/Globals.java index b4ff0ba25..faa9524a4 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/Globals.java +++ b/app/src/main/java/ru/vtosters/lite/utils/Globals.java @@ -18,6 +18,7 @@ import android.net.NetworkInfo; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; +import android.util.Log; import android.widget.Toast; import androidx.annotation.NonNull; @@ -129,7 +130,13 @@ public class Globals { } public static int getIdentifier(String name, String type) { - return getResources().getIdentifier(name, type, getContext().getPackageName()); + try { + return getResources().getIdentifier(name, type, getContext().getPackageName()); + } catch (Exception e) { + Log.d("VTLite", "Not found " + name + "as type " + type); + e.printStackTrace(); + } + return 0; } // Get res id public static String getString(String resourcename) { @@ -174,7 +181,7 @@ public class Globals { } } catch (Exception ignored) {} if (!hasMusicChannel) { - notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", getResources().getString(com.vtosters.lite.R.string.audio_message_play_error), NotificationManager.IMPORTANCE_LOW)); + notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", getResources().getString(getIdentifier("audio_message_play_error", "string")), NotificationManager.IMPORTANCE_LOW)); } } } catch (Exception ignored) {} diff --git a/smali/res/values-ru/strings.xml b/smali/res/values-ru/strings.xml index aaebf754a..bb45a6c38 100644 --- a/smali/res/values-ru/strings.xml +++ b/smali/res/values-ru/strings.xml @@ -4205,6 +4205,7 @@ Фильтр очистки постов с РФ и действиями связанными на Украине Показывать истории Блок истории в верхней части ленты + Отключить рекомендации о донате Показывать специальные верификации Показывать верификации Тип подключения @@ -4267,11 +4268,13 @@ Рекомендации постов популярных авторов контента Рекомендации лайкнутых постов ваших друзей - Обновление новостей + Автоматическое обновление новостей Выберите тип обновления Сортировка комментариев Сортировать комментарии по новизне Оставлять список загруженных постов в ленте + Встроенные настройки новостей + Официальные настройки новостей встроенные в клиент Полезная информация Для применений изменений тем необходимо переключить тему diff --git a/smali/res/values/strings.xml b/smali/res/values/strings.xml index 9188080cd..152a9c3c1 100644 --- a/smali/res/values/strings.xml +++ b/smali/res/values/strings.xml @@ -4330,6 +4330,7 @@ You need to restart the application to apply proxy settings" Filter for cleaning posts with the Russian Federation and actions related in Ukraine Show stories The story section at the top of the feed + Disable recommendations about donation Show special verifications Show verifications Connection type @@ -4391,11 +4392,13 @@ May look like a fake leaving the online" Recommend popular authors\' posts friends Recommend posts that your friends like - Update news + Audo update news Choose update type Sort comments Sort comments by newest Keep cached posts in feed + Built-in news settings + Official news settings built-in into the client Useful information To apply theme changes you should toggle the theme diff --git a/smali/res/xml/preferences_activity.xml b/smali/res/xml/preferences_activity.xml index 79cdaec8f..b37953caa 100644 --- a/smali/res/xml/preferences_activity.xml +++ b/smali/res/xml/preferences_activity.xml @@ -6,7 +6,7 @@ android:dialogTitle="@string/activity_undel_dial" android:entries="@array/undel_value" android:entryValues="@array/undel" - android:key="undeletemsg_prefix" + android:key="undeletemsg_prefix_value" android:title="@string/activity_undel_tag" /> + android:summary="@string/officialnewssett_summary" + android:title="@string/officialnewssett" /> + android:title="@string/donaterecomm" /> \ No newline at end of file