translate all strings to RU/EN

This commit is contained in:
Erik Kiznov
2022-08-13 20:46:17 +03:00
committed by gdlbo
parent d2e9968829
commit 8925e85bb4
48 changed files with 1136 additions and 410 deletions
@@ -16,6 +16,7 @@ import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicLong;
import ru.vtosters.lite.utils.AndroidUtils;
/**
* Created by Aefyr on 20.05.2018.
@@ -39,7 +40,7 @@ public class NotificationsHelper {
downloadingPacksNotificationsIds = new HashMap<>();
if (oreo()) {
NotificationChannel notificationChan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "Сервис стикеров Telegram в VTLite", NotificationManager.IMPORTANCE_HIGH);
NotificationChannel notificationChan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, AndroidUtils.getString("telegram_stickers_service"), NotificationManager.IMPORTANCE_HIGH);
((NotificationManager) c.getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(notificationChan);
}
}
@@ -49,8 +50,8 @@ public class NotificationsHelper {
downloadingPacksNotificationsIds.put(pack, notificationId);
Notification.Builder builder = commonBuilder();
builder.setContentTitle(pack.state == TelegramStickersPack.DOWNLOADING ? pack.title + ": загрузка" : pack.title + ": обновление");
builder.setContentText("Получение информации");
builder.setContentTitle(pack.state == TelegramStickersPack.DOWNLOADING ? pack.title + AndroidUtils.getString("telegram_stickers_downloading") : pack.title + AndroidUtils.getString("telegram_stickers_updating"));
builder.setContentText(AndroidUtils.getString("telegram_stickers_gettinginfo"));
builder.setOngoing(true);
manager.notify(notificationId, builder.build());
@@ -63,7 +64,7 @@ public class NotificationsHelper {
lastNotificationTime.set(System.currentTimeMillis());
Notification.Builder builder = commonBuilder();
builder.setContentTitle(pack.state == TelegramStickersPack.DOWNLOADING ? pack.title + ": загрузка" : pack.title + ": обновление");
builder.setContentTitle(pack.state == TelegramStickersPack.DOWNLOADING ? pack.title + AndroidUtils.getString("telegram_stickers_downloading") : pack.title + AndroidUtils.getString("telegram_stickers_updating"));
builder.setContentText(downloadProgress + "/" + pack.stickersCount);
builder.setProgress(pack.stickersCount, downloadProgress, false);
builder.setOngoing(true);
@@ -77,13 +78,13 @@ public class NotificationsHelper {
Notification.Builder builder = commonBuilder();
builder.setProgress(0, 0, false);
builder.setOngoing(false);
builder.setContentTitle("Сервис стикеров Telegram в VTLite");
builder.setContentTitle(AndroidUtils.getString("telegram_stickers_service"));
String text;
if (success)
text = wasUpdate ? pack.title + " успешно обновлен" : pack.title + " успешно загружен";
text = wasUpdate ? pack.title + AndroidUtils.getString("telegram_stickers_updated") : pack.title + AndroidUtils.getString("telegram_stickers_downloaded");
else
text = wasUpdate ? pack.title + ": ошибка при обновлении" : pack.title + ": ошибка при загрузке";
text = wasUpdate ? pack.title + AndroidUtils.getString("telegram_stickers_error_update") : pack.title + AndroidUtils.getString("telegram_stickers_error_download");
if (e instanceof TelegramStickersGrabber.TSGException) {
text = pack.title + ": " + e.getMessage();
@@ -38,6 +38,7 @@ import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import ru.vtosters.lite.ui.dialogs.Translate;
import ru.vtosters.lite.utils.AndroidUtils;
public class DNRInjector {
public static void inject(Dialog dialog, List<DialogAction> list) {
@@ -196,13 +197,13 @@ public class DNRInjector {
if (action == MsgAction.valueOf("TRANSLATE")) {
if (isTextExist && isReplyExist) {
Translate.showTranslatedText(context, text + "\n\nРеплай:\n" + reply);
Translate.showTranslatedText(context, text + "\n\n" + AndroidUtils.getString("translator_reply") + "\n" + reply);
} else if (isReplyExist) {
Translate.showTranslatedText(context, "Реплай:\n" + reply);
Translate.showTranslatedText(context, AndroidUtils.getString("translator_reply") + "\n" + reply);
} else if (isTextExist) {
Translate.showTranslatedText(context, text);
} else {
sendToast("Нет текста для перевода");
sendToast(AndroidUtils.getString("translator_no_text"));
}
}
@@ -230,7 +231,7 @@ public class DNRInjector {
thread.start();
sendToast("Диалог успешно " + (needToBePinned ? "закреплен" : "откреплен"));
sendToast(AndroidUtils.getString("pin_dialog") + (needToBePinned ? AndroidUtils.getString("dialog_pinned") : AndroidUtils.getString("dialog_unpinned")));
}
public static void setDnr(Dialog dialog, boolean value) {
@@ -31,7 +31,7 @@ public class AudioDownloader {
public static void downloadM3U8(MusicTrack track) {
if (track.D == null) {
ToastUtils.a("Не удалось найти ссылку на аудиозапись");
ToastUtils.a(AndroidUtils.getString("link_audio_error"));
return;
}
@@ -64,7 +64,7 @@ public class AudioDownloader {
var success = FFMpeg.convert(downloadPath, musicPath + File.separator + fileName + ".mp3");
if (success) {
notification
.setContentText("Загрузка завершена")
.setContentText(AndroidUtils.getString("player_download_finished"))
.setProgress(0, 0, false)
.setSmallIcon(android.R.drawable.stat_sys_download_done);
notificationManager.notify(tempId, notification.build());
@@ -72,7 +72,7 @@ public class AudioDownloader {
onFailure();
}
} catch (UnsatisfiedLinkError e) {
Log.e("AudioDownloader", "Опять эти нативные либы");
Log.e("AudioDownloader", "native libs");
Log.e("AudioDownloader", e.getMessage());
onFailure();
}
@@ -80,7 +80,7 @@ public class AudioDownloader {
@Override
public void onFailure() {
notification.setContentText("Не удалось загрузить аудиозапись").setProgress(0, 0, false);
notification.setContentText(AndroidUtils.getString("load_audio_error")).setProgress(0, 0, false);
notificationManager.notify(tempId, notification.build());
}
@@ -109,7 +109,7 @@ public class AudioDownloader {
private static NotificationCompat.Builder buildDownloadNotification(MusicTrack track, int id) {
var notificationBuilder = new NotificationCompat.Builder(AndroidUtils.getGlobalContext(), NotificationChannels.MUSIC_DOWNLOAD_CHANNEL_ID)
.setSmallIcon(android.R.drawable.stat_sys_download)
.setContentTitle("Загрузка аудиозаписи")
.setContentTitle(AndroidUtils.getString("audio_downloading"))
.setContentText(track.toString())
.setPriority(NotificationCompat.PRIORITY_LOW)
.setCategory(NotificationCompat.CATEGORY_PROGRESS)
@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.ExternalLinkParser;
public class VideoDownloader {
@@ -123,13 +124,13 @@ public class VideoDownloader {
}
public static void parseVideoLink(String url, Context ctx) {
if (url.contains("vk.com/story")) {
ToastUtils.a("Не поддерживается загрузка историй");
if (url.startsWith("vk.com/story") || url.startsWith("http://vk.com/story") || url.startsWith("https://vk.com/story")) {
ToastUtils.a(AndroidUtils.getString("video_dl_stories_not_supported"));
return;
}
if (!url.contains("vk.com/video")) {
ToastUtils.a("Неверная ссылка");
if (!url.startsWith("http://vk.com/video") || !url.startsWith("https://vk.com/video") || !url.startsWith("vk.com/video")) {
ToastUtils.a(AndroidUtils.getString("video_dl_wrong_link"));
return;
}
@@ -137,7 +138,7 @@ public class VideoDownloader {
String ownerId = videoId.split("_")[0];
final ProgressDialog progressDialog = new ProgressDialog(ctx);
progressDialog.setMessage("Обработка видео");
progressDialog.setMessage(AndroidUtils.getString("video_dl_progress"));
progressDialog.show();
makeRequest("https://" + "api.vk.com" + "/method/video.get?owner_id=" + ownerId + "&videos=" + videoId + "&v=5.99&access_token=" + getUserToken(),
@@ -153,7 +154,7 @@ public class VideoDownloader {
downloadVideo(videoFile, ctx);
} catch (JSONException e) {
e.printStackTrace();
Toast.makeText(ctx, "Видео нельзя скачать", Toast.LENGTH_SHORT).show();
Toast.makeText(ctx, AndroidUtils.getString("video_dl_error"), Toast.LENGTH_SHORT).show();
}
});
}
@@ -12,8 +12,8 @@ import ru.vtosters.lite.utils.AndroidUtils;
public class NotificationChannels {
public static final String MUSIC_DOWNLOAD_CHANNEL_ID = "music_download_channel";
public static final String MUSIC_DOWNLOAD_CHANNEL_NAME = "Загрузка музыки";
public static final String MUSIC_DOWNLOAD_CHANNEL_DESCRIPTION = "Прогресс загрузки музыки";
public static final String MUSIC_DOWNLOAD_CHANNEL_NAME = AndroidUtils.getString("music_dl_title");
public static final String MUSIC_DOWNLOAD_CHANNEL_DESCRIPTION = AndroidUtils.getString("music_dl_progress");
@RequiresApi(api = Build.VERSION_CODES.O)
public static void createChannels() {
@@ -73,7 +73,7 @@ public class JsonInjectors {
}
public static JSONObject donateRecomm() throws JSONException {
var title = "Помоги проекту донатом и получи бонус!";
var title = AndroidUtils.getString("donate_to_vtl");
var link = "https://vk.com/vtosters_official";
var text_color = "2D81E0";
@@ -114,7 +114,7 @@ public class JsonInjectors {
}
public static JSONObject vktesters(int id) throws JSONException {
var title = "Карточка Тестера";
var title = AndroidUtils.getString("tester_profile");
var text_color = "2D81E0";
var link = "https://static.vk.com/bugs?lang=" + LangUtils.a() + "#/reporter" + id;
@@ -158,7 +158,7 @@ public class JsonInjectors {
var peerid = Objects.requireNonNull(orig.optJSONObject("peer")).optInt("id");
var pic = "https://image.pngaaa.com/641/326641-middle.png"; // can be null
var text = "Я не загрузил данные (9(9((";
var text = AndroidUtils.getString("no_data_error");
var link = "https://vtosters.app"; // can be null
var linktitle = "Test button"; // can be null
@@ -175,9 +175,9 @@ public class JsonInjectors {
if (!hasIcon) icon = "";
if (!hasButton) buttons = "";
if (isVerified(peerid)) text = "Я купил VTosters Premium";
if (isPrometheus(peerid)) text = "Я купил VTosters Premium Gold Prime Pro Plus";
if (isDeveloper(peerid)) text = "Я создал говно";
if (isVerified(peerid)) text = AndroidUtils.getString("i_bought") + " VTosters Premium";
if (isPrometheus(peerid)) text = AndroidUtils.getString("i_bought") + " VTosters Premium Gold Prime Pro Plus";
if (isDeveloper(peerid)) text = AndroidUtils.getString("i_created_poop");
if (!isVerified(peerid) || text.equals("")) {
if (getBoolValue("convBarRecomm", false)) {
return null;
@@ -17,6 +17,8 @@ import org.json.JSONObject;
import java.io.IOException;
import java.text.ParseException;
import ru.vtosters.lite.utils.AndroidUtils;
public class OnlineFormatterHook {
private static String AppName;
@@ -59,37 +61,37 @@ public class OnlineFormatterHook {
case 5027722:
return "VK Messenger (Desktop)";
case 6146827:
return "VK Мессенджер (Android)";
return AndroidUtils.getString("vk_messenger") + " (Android)"; // VK Мессенджер (Android)
case 6482950:
return "VK Мессенджер (iPhone)";
return AndroidUtils.getString("vk_messenger") + " (iPhone)"; // VK Мессенджер (iPhone)
case 6481715:
return "VK Мессенджер Dev (iPhone)";
return AndroidUtils.getString("vk_messenger") + " Dev (iPhone)"; // VK Мессенджер Dev (iPhone)
case 7799655:
return "VK Почта";
return AndroidUtils.getString("vk_mail_online"); // VK Почта
case 7598572:
return "Сферум (Android)";
return AndroidUtils.getString("sferum_online") + " (Android)"; // Сферум (Android)
case 7571751:
return "Сферум (iPhone)";
return AndroidUtils.getString("sferum_online") + " (iPhone)"; // Сферум (iPhone)
case 7556576:
return "Сферум";
return AndroidUtils.getString("sferum_online"); // Сферум
case 7497650:
return "VK ID";
case 8094476:
return "VK Звонки (Android)";
return AndroidUtils.getString("vk_calls_online") + " (Android)"; // VK Звонки (Android)
case 8093730:
return "VK Звонки (iPhone)";
return AndroidUtils.getString("vk_calls_online") + " (iPhone)"; // VK Звонки (iPhone)
case 7793118:
return "VK Звонки (Desktop)";
return AndroidUtils.getString("vk_calls_online") + " (Desktop)"; // VK Звонки (Desktop)
case 6767438:
return "VK Музыка (Android)";
return AndroidUtils.getString("vk_music_online") + " (Android)"; // VK Музыка (Android)
case 8113297:
return "VK Клипы (Android)";
return AndroidUtils.getString("vk_clips_online") + " (Android)"; // VK Клипы (Android)
case 8106428:
return "VK Клипы (iPhone)";
return AndroidUtils.getString("vk_clips_online") + " (iPhone)"; // VK Клипы (iPhone)
case 5044491:
return "Candy";
case 8114066:
return "VK Видео";
return AndroidUtils.getString("vk_video_online"); // VK Видео
case 4894723:
return "Phoenix Lite";
case 4994316:
@@ -27,11 +27,12 @@ import com.vk.auth.ui.VkAuthTextView;
import com.vk.navigation.Navigator;
import ru.vtosters.lite.ui.fragments.ProxySettingsFragment;
import ru.vtosters.lite.utils.AndroidUtils;
public class ProxyHook {
public static void hookAuth(View v) {
VkAuthTextView button = (VkAuthTextView) v;
button.setText("Настроить прокси");
button.setText(AndroidUtils.getString("proxy_setup"));
button.setOnClickListener(v1 -> callProxyDialog(v1.getContext()));
}
@@ -50,20 +51,20 @@ public class ProxyHook {
rg.setPadding(dp2px(18f), dp2px(12f), dp2px(18f), 0);
rgDefault.setText("Отключить");
rgDefault.setText(AndroidUtils.getString("proxy_disable"));
rgDefault.setTextColor(getTextAttr());
rgProxy.setText("Включить (Zaborona)");
rgProxy.setText(AndroidUtils.getString("proxy_enable") + " (Zaborona)");
rgProxy.setTextColor(getTextAttr());
rgProxy.setChecked(isZaboronaEnabled());
rgDefault.setChecked(!isZaboronaEnabled());
AlertDialog.Builder builder = new AlertDialog.Builder(ctx, getAlertStyle());
builder.setTitle("Прокси");
builder.setMessage("Zaborona никак не связана с ВТостерс и мы не можем гарантировать её работу и безопасность");
builder.setTitle(AndroidUtils.getString("vtlproxy"));
builder.setMessage(AndroidUtils.getString("proxy_warning"));
builder.setView(rg);
builder.setPositiveButton("Применить", ((dialog, which) -> {
builder.setPositiveButton(AndroidUtils.getString("vtl_confirm"), ((dialog, which) -> { // Применить
if (rgProxy.isChecked()) {
edit().putString("proxy", "zaborona").commit();
restartApplication();
@@ -77,7 +78,7 @@ public class ProxyHook {
}
}));
builder.setNeutralButton("Настройки прокси", ((dialog, which) -> {
builder.setNeutralButton(AndroidUtils.getString("proxy_settings"), ((dialog, which) -> {
Intent a2 = new Navigator(ProxySettingsFragment.class).b(ctx);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(a2);
@@ -41,7 +41,7 @@ public class FFMpeg {
private static void checkFFMpegLibs() {
var lib = new File(AndroidUtils.getGlobalContext().getFilesDir(), "libffmpegkit_abidetect.so");
if (!lib.exists()) {
ToastUtils.a("Копирование библиотеки ffmpegkit");
ToastUtils.a(AndroidUtils.getString("ffmpegkit_copy"));
copyAssets();
}
}
@@ -34,7 +34,7 @@ public class MP3Downloader {
public static void execute(MusicTrack track) {
var token = AndroidUtils.getPreferences().getString("vk_admin_token", "");
if (token.isEmpty()) {
Toast.makeText(AndroidUtils.getGlobalContext(), "Обновите токен VK Admin в настройках", Toast.LENGTH_SHORT).show();
Toast.makeText(AndroidUtils.getGlobalContext(), AndroidUtils.getString("update_vk_admin_token"), Toast.LENGTH_SHORT).show();
return;
}
var request = new Request.a()
@@ -24,6 +24,7 @@ import ru.vtosters.lite.net.NetCallback;
import ru.vtosters.lite.net.NetClient;
import ru.vtosters.lite.net.NetRequest;
import ru.vtosters.lite.net.NetResponse;
import ru.vtosters.lite.utils.AndroidUtils;
public class Scrobbler {
private static final String key = "5965d63402414776c54c266db0211746";
@@ -103,7 +104,7 @@ public class Scrobbler {
public static void auth(String login, String pass) {
if (login == null || pass == null) {
sendToast("Логин или пароль не заданы");
sendToast(AndroidUtils.getString("lastfm_credentials_empty"));
return;
}
@@ -119,7 +120,7 @@ public class Scrobbler {
@Override
public void onFailure(NetCall call, IOException e) {
Log.d("Scrobbler", "Auth failed", e);
sendToast("Ошибка входа");
sendToast(AndroidUtils.getString("lastfm_auth_error"));
}
@Override
@@ -155,7 +156,7 @@ public class Scrobbler {
edit().remove("username").apply();
edit().remove("sessionKey").apply();
scrobbled.clear();
sendToast("Вы успешно вышли из учетной записи");
sendToast(AndroidUtils.getString("lastfm_logout_success"));
}
public static boolean needToBeScrobble(String uid) {
@@ -22,6 +22,8 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import ru.vtosters.lite.utils.AndroidUtils;
public class LogWriterService extends Service {
public LogWriterService() {
}
@@ -44,12 +46,12 @@ public class LogWriterService extends Service {
writeLog(intent, file);
} catch (Exception e) {
e.printStackTrace();
makeText(getGlobalContext(), "Не удалось сохранить лог-файл", LENGTH_SHORT).show();
makeText(getGlobalContext(), AndroidUtils.getString("logfile_error"), LENGTH_SHORT).show();
}
var notificationId = intent.getIntExtra("notificationId", 1);
var manager = (NotificationManager) getGlobalContext().getSystemService(Context.NOTIFICATION_SERVICE);
manager.cancel(notificationId);
makeText(getGlobalContext(), "Лог-файл был сохранен", LENGTH_SHORT).show();
makeText(getGlobalContext(), AndroidUtils.getString("logfile_saved"), LENGTH_SHORT).show();
stopSelf();
return START_NOT_STICKY;
@@ -11,6 +11,8 @@ import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import ru.vtosters.lite.utils.AndroidUtils;
public class APKInstallActivity extends AppCompatActivity {
public static final int REQUEST_INSTALL_PERMISSION = 1;
@@ -65,7 +67,7 @@ public class APKInstallActivity extends AppCompatActivity {
startActivity(intent);
} catch (Exception e) {
Toast.makeText(this, "Ошибка установки обновления " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
Toast.makeText(this, AndroidUtils.getString("apk_install_error") + e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
}
finish();
@@ -23,9 +23,7 @@ public class MessagesPreviewAdapter extends RecyclerView.Adapter<MessagesPreview
private static final int ME = 0x0;
private static final int ANONYMOUS = -0x1;
private final String[] mMessages = {
"Доброе время", "Доброе утро, день, вечер. ночь", "Как живёшь?", "Не мёртвый, и то хорошо"
};
private final String[] mMessages = AndroidUtils.getArray("wallpaper_change_dialog");
@Override
public int getItemViewType(int i) {
@@ -23,6 +23,7 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.IOUtils;
import ru.vtosters.lite.utils.Preferences;
@@ -42,7 +43,7 @@ public class BackupManager {
public static void backupOnlines() throws IOException {
if (getPrefContent("onlines.xml") == null) {
Toast.makeText(getGlobalContext(), "Нет данных для резервного копирования", LENGTH_SHORT).show();
Toast.makeText(getGlobalContext(), AndroidUtils.getString("no_data_to_backup"), LENGTH_SHORT).show();
return;
}
@@ -54,10 +55,10 @@ public class BackupManager {
FileWriter out = new FileWriter(file);
out.write(getPrefContent("onlines.xml"));
out.close();
Toast.makeText(getGlobalContext(), "Сохранено в файл " + file.getAbsolutePath(), LENGTH_LONG).show();
Toast.makeText(getGlobalContext(), AndroidUtils.getString("backup_saved_in") + file.getAbsolutePath(), LENGTH_LONG).show();
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(getGlobalContext(), "Не удалось сохранить файл", LENGTH_SHORT).show();
Toast.makeText(getGlobalContext(), AndroidUtils.getString("backup_save_error"), LENGTH_SHORT).show();
}
}
@@ -70,10 +71,10 @@ public class BackupManager {
FileWriter out = new FileWriter(file);
out.write(getPrefContent("com.vtosters.lite_preferences.xml"));
out.close();
Toast.makeText(getGlobalContext(), "Сохранено в файл " + file.getAbsolutePath(), LENGTH_LONG).show();
Toast.makeText(getGlobalContext(), AndroidUtils.getString("backup_saved_in") + file.getAbsolutePath(), LENGTH_LONG).show();
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(getGlobalContext(), "Не удалось сохранить файл", LENGTH_SHORT).show();
Toast.makeText(getGlobalContext(), AndroidUtils.getString("backup_save_error"), LENGTH_SHORT).show();
}
}
@@ -12,6 +12,7 @@ import java.util.Collections;
import java.util.LinkedHashSet;
import ru.vtosters.lite.ui.vkui.VBottomSheetBuilder;
import ru.vtosters.lite.utils.AndroidUtils;
public class NewsfeedListManager {
@@ -21,7 +22,7 @@ public class NewsfeedListManager {
var list = new ArrayList<VBListItem>();
if (filtersSet.size() == 0) {
sendToast("Обновите ленту для получения списка доступных пунктов");
sendToast(AndroidUtils.getString("newsfeed_update_feed"));
return;
}
@@ -35,10 +36,10 @@ public class NewsfeedListManager {
}
VBottomSheetBuilder.show(activity, new VBottomSheetBuilder.VBSContent(
"Выберите пункты для скрытия",
AndroidUtils.getString("newsfeed_list_choose_to_hide"),
buildListOf(activity, list),
new VBottomSheetBuilder.VBSContent.VBSButton(
"Сохранить",
AndroidUtils.getString("save"),
() -> {
var newSelectedItems = "";
for (VBListItem item : list)
@@ -47,7 +48,7 @@ public class NewsfeedListManager {
getDefaultPrefs().edit()
.putString("news_feed_selected_items", newSelectedItems)
.apply();
sendToast("Для применения изменений обновите ленту");
sendToast(AndroidUtils.getString("newsfeed_list_update_feed_to_work"));
}
)
));
@@ -57,6 +58,6 @@ public class NewsfeedListManager {
getDefaultPrefs().edit()
.putString("news_feed_selected_items", "")
.apply();
sendToast("Сброшены пункты для скрытия");
sendToast(AndroidUtils.getString("newsfeed_list_hidden_reseted"));
}
}
@@ -89,33 +89,33 @@ public class SuperAppEditorManager {
private SuperAppItem getItemByTag(String tag) {
switch (tag) {
case "menu":
return SuperAppItem.valuesOf("menu", "Меню приложения");
return SuperAppItem.valuesOf("menu", AndroidUtils.getString("superapp_menu"));
case "miniapps":
return SuperAppItem.valuesOf("miniapps", "Mini Apps: виджет");
return SuperAppItem.valuesOf("miniapps", AndroidUtils.getString("superapp_miniapps"));
case "vkpay_slim":
return SuperAppItem.valuesOf("vkpay_slim", "VK Pay");
return SuperAppItem.valuesOf("vkpay_slim", AndroidUtils.getString("superapp_vkpay"));
case "greeting":
return SuperAppItem.valuesOf("greeting", "Приветствие");
return SuperAppItem.valuesOf("greeting", AndroidUtils.getString("superapp_greeting"));
case "promo":
return SuperAppItem.valuesOf("promo", "Mini Apps: промо");
return SuperAppItem.valuesOf("promo", AndroidUtils.getString("superapp_miniapps_promo"));
case "holiday":
return SuperAppItem.valuesOf("holiday", "Дни рождения у друзей");
return SuperAppItem.valuesOf("holiday", AndroidUtils.getString("superapp_holiday"));
case "weather":
return SuperAppItem.valuesOf("weather", "Погода");
return SuperAppItem.valuesOf("weather", AndroidUtils.getString("superapp_weather"));
case "sport":
return SuperAppItem.valuesOf("sport", "Спортивные события");
return SuperAppItem.valuesOf("sport", AndroidUtils.getString("superapp_sport"));
case "games":
return SuperAppItem.valuesOf("games", "Игры");
return SuperAppItem.valuesOf("games", AndroidUtils.getString("superapp_games"));
case "informer":
return SuperAppItem.valuesOf("informer", "Информер");
return SuperAppItem.valuesOf("informer", AndroidUtils.getString("superapp_informer"));
case "food":
return SuperAppItem.valuesOf("food", "Еда");
return SuperAppItem.valuesOf("food", AndroidUtils.getString("superapp_food"));
case "event":
return SuperAppItem.valuesOf("event", "Мероприятия");
return SuperAppItem.valuesOf("event", AndroidUtils.getString("superapp_event"));
case "music":
return SuperAppItem.valuesOf("music", "Музыка");
return SuperAppItem.valuesOf("music", AndroidUtils.getString("superapp_music"));
case "vk_run":
return SuperAppItem.valuesOf("vk_run", "VK Run");
return SuperAppItem.valuesOf("vk_run", AndroidUtils.getString("superapp_vk_run"));
default:
return null;
}
@@ -15,6 +15,7 @@ import androidx.appcompat.widget.SwitchCompat;
import com.vk.core.dialogs.alert.VkAlertDialog;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.LayoutUtils;
public class MessageSettings {
@@ -50,12 +51,12 @@ public class MessageSettings {
four.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
five.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
zero.setText("Отключить");
one.setText("15 секунд");
two.setText("1 минута");
three.setText("5 минут");
four.setText("1 час");
five.setText("24 часа");
zero.setText(AndroidUtils.getString("proxy_disable")); // Отключить
one.setText(AndroidUtils.getString("message_self_destruct_15sec"));
two.setText(AndroidUtils.getString("message_self_destruct_1min"));
three.setText(AndroidUtils.getString("message_self_destruct_5min"));
four.setText(AndroidUtils.getString("message_self_destruct_1hour"));
five.setText(AndroidUtils.getString("message_self_destruct_24hours"));
zero.setTextColor(getTextAttr());
one.setTextColor(getTextAttr());
@@ -87,7 +88,7 @@ public class MessageSettings {
@SuppressLint("UseSwitchCompatOrMaterialCode")
var silentSwitch = new SwitchCompat(new ContextThemeWrapper(context, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_Switch));
silentSwitch.setText("Бесшумные сообщения");
silentSwitch.setText(AndroidUtils.getString("silent_messages"));
silentSwitch.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
silentSwitch.setTextColor(getTextAttr());
silentSwitch.setChecked(isSilentEnabled);
@@ -104,12 +105,12 @@ public class MessageSettings {
mContainer.addView(silentSwitch, LayoutUtils.createLinear(-1, -2));
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context);
builder.setTitle("Настройки отправки");
builder.setMessage("Выберите время исчезновения сообщения");
builder.setTitle(AndroidUtils.getString("message_send_settings_title"));
builder.setMessage(AndroidUtils.getString("silent_messages_time_select"));
builder.setCancelable(true);
builder.setNegativeButton("Отмена", null);
builder.setNegativeButton(AndroidUtils.getString("cancel"), null);
builder.setView(mContainer);
builder.setPositiveButton("Применить", (dialog, which) -> {
builder.setPositiveButton(AndroidUtils.getString("vtl_confirm"), (dialog, which) -> { // Применить
var checked = rg.getCheckedRadioButtonId();
if (checked == zero.getId()) {
@@ -11,6 +11,7 @@ import android.widget.SeekBar;
import com.vk.core.dialogs.alert.VkAlertDialog;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.LayoutUtils;
public class RoundingSeekbarDialog{
@@ -25,12 +26,12 @@ public class RoundingSeekbarDialog{
mContainer.addView(seek, LayoutUtils.createLinear(-1, -2));
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context);
builder.setTitle("Выберите размер закругления углов");
builder.setMessage("Для отключения функции закругления углов введите 0");
builder.setTitle(AndroidUtils.getString("pic_rounding_title"));
builder.setMessage(AndroidUtils.getString("pic_rounding_info"));
builder.setCancelable(true);
builder.setNegativeButton("Отмена", null);
builder.setNegativeButton(AndroidUtils.getString("cancel"), null);
builder.setView(mContainer);
builder.setPositiveButton("Применить", (dialog, which) -> {
builder.setPositiveButton(AndroidUtils.getString("vtl_confirm"), (dialog, which) -> {
edit().putInt("pic_rounding", seek.getProgress()).commit();
restartApplicationWithTimer();
});
@@ -10,6 +10,7 @@ import android.util.Log;
import com.vk.core.dialogs.alert.VkAlertDialog;
import ru.vtosters.lite.translators.BaseTranslator;
import ru.vtosters.lite.utils.AndroidUtils;
public class Translate {
public static void showTranslatedText(Context context, String text) {
@@ -27,16 +28,16 @@ public class Translate {
private static void showDialog(Context context, String text) {
VkAlertDialog.Builder alertDialog = new VkAlertDialog.Builder(context);
alertDialog.setTitle("Переводчик");
alertDialog.setTitle(AndroidUtils.getString("translator_title"));
alertDialog.setMessage(text);
alertDialog.setPositiveButton("Закрыть", (dialog, which) -> {
alertDialog.setPositiveButton(AndroidUtils.getString("close"), (dialog, which) -> {
dialog.cancel();
});
alertDialog.setNeutralButton("Скопировать", (dialog, which) -> {
alertDialog.setNeutralButton(AndroidUtils.getString("copy"), (dialog, which) -> {
android.content.ClipboardManager clipboard = (android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
android.content.ClipData clip = android.content.ClipData.newPlainText("Copied Text", text);
clipboard.setPrimaryClip(clip);
sendToast("Скопировано в буфер обмена");
sendToast(AndroidUtils.getString("copied_to_clipboard"));
});
var alert = alertDialog.create();
alert.show();
@@ -17,6 +17,7 @@ import com.vk.newsfeed.NewsfeedSettingsFragment;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.ui.components.NewsfeedListManager;
import ru.vtosters.lite.utils.AndroidUtils;
public class FeedFragment extends MaterialPreferenceToolbarFragment {
@Override
@@ -39,9 +40,8 @@ public class FeedFragment extends MaterialPreferenceToolbarFragment {
});
var str = getDefaultPrefs().getString("news_feed_selected_items", "");
findPreference("newsfeedlistmanager").setSummary(
"Скрыто "
+ (!TextUtils.isEmpty(str) ? str.split(",").length : 0)
+ " лент новостей");
String.format(AndroidUtils.getString("feed_hidden"), (!TextUtils.isEmpty(str) ? str.split(",").length : 0))
);
findPreference("newsfeedlistmanager_reset").setOnPreferenceClickListener(preference -> {
NewsfeedListManager.resetHideItems();
return true;
@@ -53,9 +53,9 @@ public class FeedFragment extends MaterialPreferenceToolbarFragment {
var count = text.split(", ").length;
if (count < 1 || text.isEmpty()) {
return "Нет добавленных элементов";
return AndroidUtils.getString("feed_no_elements");
} else {
return "Добавлено " + count + " элементов";
return String.format(AndroidUtils.getString("feed_elements_count"), count);
}
}
@@ -37,6 +37,8 @@ import androidx.core.content.res.ResourcesCompat;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.utils.AndroidUtils;
public class IconsFragment extends MaterialPreferenceToolbarFragment {
@SuppressLint("SetTextI18n")
public static void callSelectDialog(Context ctx, String appicon) {
@@ -70,9 +72,9 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
rgDefault.setChecked(!isZaboronaEnabled());
AlertDialog.Builder builder = new AlertDialog.Builder(ctx, getAlertStyle());
builder.setTitle("Выберите название приложения");
builder.setTitle(AndroidUtils.getString("app_name_select_title"));
builder.setView(rg);
builder.setPositiveButton("Применить", ((dialog, which) -> {
builder.setPositiveButton(AndroidUtils.getString("vtl_confirm"), ((dialog, which) -> {
var defname = preferences.getString("appname", "vt");
var deficon = preferences.getString("selectedicon", "vt");
@@ -93,7 +95,7 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
switchComponent(appicon, "vkontakte", deficon, defname);
}
}));
builder.setNegativeButton("Отмена", ((dialog, which) -> {
builder.setNegativeButton(AndroidUtils.getString("cancel"), ((dialog, which) -> {
dialog.dismiss();
}));
@@ -114,13 +116,13 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
this.addPreferencesFromResource(vtosterXml);
if (!hasVerification() && !getBoolValue("dialogrecomm", false)) {
addPreference(this, "", "Доступны не все функции!", "Для разблокировки необходимо сделать пожертование от 99р", "ic_about_outline_28", preference -> {
addPreference(this, "", AndroidUtils.getString("icons_warning"), AndroidUtils.getString("icons_warning_info"), "ic_about_outline_28", preference -> {
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://vtosters.app")));
return false;
});
}
addPreferenceCategory(this, "Иконки");
addPreferenceCategory(this, AndroidUtils.getString("icons_title"));
for (var i = 0; i < icons().size(); i++) {
if (icons().get(i) == null || iconsValues().get(i) == null) return;
@@ -151,7 +153,7 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
}
if (!hasVerification() && !getBoolValue("dialogrecomm", false)) {
addPreferenceCategory(this, "Недоступные иконки");
addPreferenceCategory(this, AndroidUtils.getString("unavailable_icons"));
for (var i = 2; i < sIconsPlusNames.size(); i++) {
if (sIconsPlusNames.get(i) == null || sIconsPlus.get(i) == null) return;
@@ -176,7 +178,7 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
}
addPreferenceDrawable(this, icon, iconname, "", drawable, preference -> {
sendToast("Иконка доступна только обладателям верификации");
sendToast(AndroidUtils.getString("unavailable_icon_warning"));
return false;
});
}
@@ -11,6 +11,7 @@ import androidx.preference.Preference;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.ui.dialogs.RoundingSeekbarDialog;
import ru.vtosters.lite.utils.AndroidUtils;
public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
@Override
@@ -31,9 +32,9 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
});
if (getPreferences().getInt("pic_rounding", 0) == 0) {
findPreference("customrounding").setSummary("Отключено");
findPreference("customrounding").setSummary(AndroidUtils.getString("disabled"));
} else {
findPreference("customrounding").setSummary("Размер закругления: " + getPreferences().getInt("pic_rounding", 0) + "dp");
findPreference("customrounding").setSummary(String.format(AndroidUtils.getString("rounding_size"), getPreferences().getInt("pic_rounding", 0)));
}
}
@@ -42,6 +42,7 @@ import okhttp3.Request;
import ru.vtosters.lite.downloaders.VideoDownloader;
import ru.vtosters.lite.music.Scrobbler;
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.FileUriUtils;
import ru.vtosters.lite.utils.Preferences;
@@ -113,19 +114,19 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
});
findPreference("downloads_directory").setSummary(
"Текущая папка: " + Preferences.getDownloadsDir()
AndroidUtils.getString("current_download_folder") + " " + Preferences.getDownloadsDir()
);
findPreference("photos_directory").setSummary(
"Текущая папка: " + Preferences.getPhotosDir()
AndroidUtils.getString("current_download_folder") + " " + Preferences.getPhotosDir()
);
findPreference("videos_directory").setSummary(
"Текущая папка: " + Preferences.getVideosDir()
AndroidUtils.getString("current_download_folder") + " " + Preferences.getVideosDir()
);
findPreference("music_directory").setSummary(
"Текущая папка: " + Preferences.getMusicDir()
AndroidUtils.getString("current_download_folder") + " " + Preferences.getMusicDir()
);
findPreference("downloads_directory").setOnPreferenceClickListener(preference -> {
@@ -157,7 +158,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
});
if (isLoggedIn()) {
findPreference("lastfm_auth").setSummary("Вы авторизованы как " + Scrobbler.getUserName());
findPreference("lastfm_auth").setSummary(AndroidUtils.getString("lastfm_authorized_as") + Scrobbler.getUserName());
} else {
findPreference("lastfm_enabled").setEnabled(false);
}
@@ -191,7 +192,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
linearLayout.setOrientation(LinearLayout.VERTICAL);
final EditText fn = new EditText(ctx);
fn.setHint("Логин");
fn.setHint(AndroidUtils.getString("lastfm_login"));
fn.setTextColor(getTextAttr());
fn.setHintTextColor(getSTextAttr());
fn.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
@@ -202,7 +203,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
fn.setLayoutParams(margin);
final EditText ln = new EditText(ctx);
ln.setHint("Пароль");
ln.setHint(AndroidUtils.getString("lastfm_password"));
ln.setTextColor(getTextAttr());
ln.setHintTextColor(getSTextAttr());
ln.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
@@ -211,10 +212,10 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
ln.setLayoutParams(margin);
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ctx, getAlertStyle());
alertDialog.setTitle("Введите логин и пароль");
alertDialog.setTitle(AndroidUtils.getString("lastfm_enter_credentials"));
alertDialog.setView(linearLayout);
alertDialog.setPositiveButton("Войти", (dialog, which) -> {
alertDialog.setPositiveButton(AndroidUtils.getString("lastfm_enter"), (dialog, which) -> {
String login = fn.getText().toString();
String pass = ln.getText().toString();
@@ -227,12 +228,12 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
private void logout(Context ctx) {
VkAlertDialog.Builder alertDialog = new VkAlertDialog.Builder(ctx);
alertDialog.setTitle("Вы уверены?");
alertDialog.setMessage("Вы действительно хотите выйти из аккаунта?");
alertDialog.setPositiveButton("Да", (dialog, which) -> {
alertDialog.setTitle(AndroidUtils.getString("lastfm_logout_title"));
alertDialog.setMessage(AndroidUtils.getString("lastfm_logout_confirm"));
alertDialog.setPositiveButton(AndroidUtils.getString("vkim_yes"), (dialog, which) -> {
Scrobbler.logout();
});
alertDialog.setNeutralButton("Нет", (dialog, which) -> {
alertDialog.setNeutralButton(AndroidUtils.getString("vkim_no"), (dialog, which) -> {
dialog.cancel();
});
var alert = alertDialog.create();
@@ -262,12 +263,12 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
thread.start();
sendToast("История просмотра видео очищена");
sendToast(AndroidUtils.getString("video_history_cleaned"));
}
public static void download(Context ctx) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(ctx, getAlertStyle());
alertDialog.setTitle("Введите ссылку на видео");
alertDialog.setTitle(AndroidUtils.getString("video_dl_enter_link"));
final EditText input = new EditText(ctx);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
@@ -277,7 +278,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
input.setTextColor(getTextAttr());
input.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
alertDialog.setView(input);
alertDialog.setPositiveButton("Скачать", (dialog, which) -> VideoDownloader.parseVideoLink(input.getText().toString(), ctx));
alertDialog.setPositiveButton(AndroidUtils.getString("download"), (dialog, which) -> VideoDownloader.parseVideoLink(input.getText().toString(), ctx));
var alert = alertDialog.create();
alert.show();
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
@@ -77,7 +77,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
String token = data.getStringExtra("token");
AndroidUtils.getPreferences().edit().putString("vk_admin_token", token).apply();
Log.d("VkAdminToken", token);
Toast.makeText(getContext(), "Токен успешно сохранён", LENGTH_SHORT).show();
Toast.makeText(getContext(), AndroidUtils.getString("token_saved"), LENGTH_SHORT).show();
}
}
}
@@ -98,29 +98,29 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
findPreference("resetfolders").setOnPreferenceClickListener(preference -> {
edit().remove("photos_directory").remove("videos_directory").remove("audios_directory").remove("downloads_directory").apply();
Toast.makeText(getContext(), "Папки успешно сброшены", LENGTH_SHORT).show();
Toast.makeText(getContext(), AndroidUtils.getString("download_folders_reseted"), LENGTH_SHORT).show();
return true;
});
var pref = getDefaultPrefs().getString("autoclearcache", "Default");
switch (pref) {
case "Default":
findPreference("autoclearcache").setSummary("Не включено");
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_disabled"));
break;
case "100mb":
findPreference("autoclearcache").setSummary("Очищать кеш при не менее 100 Мб");
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_100mb"));
break;
case "500mb":
findPreference("autoclearcache").setSummary("Очищать кеш при не менее 500 Мб");
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_500mb"));
break;
case "1gb":
findPreference("autoclearcache").setSummary("Очищать кеш при не менее 1 Гб");
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_1gb"));
break;
case "2gb":
findPreference("autoclearcache").setSummary("Очищать кеш при не менее 2 Гб");
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_2gb"));
break;
case "5gb":
findPreference("autoclearcache").setSummary("Очищать кеш при не менее 5 Гб");
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_5gb"));
break;
}
@@ -192,12 +192,12 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
five.setChecked(val == 5);
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(getContext());
builder.setTitle("Очистка кеша");
builder.setMessage("Выберите объём кеша для очистки");
builder.setTitle(AndroidUtils.getString("cache_clean_title"));
builder.setMessage(AndroidUtils.getString("cache_select_size"));
builder.setCancelable(true);
builder.setNegativeButton("Отмена", null);
builder.setNegativeButton(AndroidUtils.getString("cancel"), null);
builder.setView(rg);
builder.setPositiveButton("Сохранить", (dialog, which) -> {
builder.setPositiveButton(AndroidUtils.getString("save"), (dialog, which) -> {
var pref = getDefaultPrefs().edit();
var checked = rg.getCheckedRadioButtonId();
@@ -228,8 +228,8 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
private void cacheCleanDialog() {
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(getContext());
builder.setTitle("Выберите что вы хотите очистить");
builder.setItems(new String[]{"Очистить весь кеш", "Очистить кеш стикеров", "Очистить кеш изображений", "Очистить кеш видео", "Очистить кеш сообщений", "Очистить кеш WebView"}, (dialog, which) -> {
builder.setTitle(AndroidUtils.getString("select_which_clean"));
builder.setItems(AndroidUtils.getArray("cache_cleaner"), (dialog, which) -> {
switch (which) {
case 0: {
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
@@ -270,7 +270,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
break;
}
Toast.makeText(getContext(), "Кеш очищен", LENGTH_SHORT).show();
Toast.makeText(getContext(), AndroidUtils.getString("cache_cleaned"), LENGTH_SHORT).show();
});
builder.create().show();
}
@@ -289,7 +289,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
try {
backupOnlines();
} catch (IOException e) {
Toast.makeText(getContext(), "Нет данных для резервного копирования", LENGTH_SHORT).show();
Toast.makeText(getContext(), AndroidUtils.getString("no_data_to_backup"), LENGTH_SHORT).show();
}
return true;
}
@@ -359,14 +359,14 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
var arr = BackupManager.getBackupsNames();
var adapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, arr);
new VkAlertDialog.Builder(getContext())
.setTitle("Выберите бэкап")
.setTitle(AndroidUtils.getString("select_backup"))
.setAdapter(adapter, (dialog, which) -> {
try {
restoreBackup(arr[which]);
Toast.makeText(getContext(), "Настройки восстановлены", LENGTH_LONG).show();
Toast.makeText(getContext(), AndroidUtils.getString("backup_success"), LENGTH_LONG).show();
} catch (IOException e) {
e.printStackTrace();
Toast.makeText(getContext(), "Ошибка, Настройки не восстановлены", LENGTH_LONG).show();
Toast.makeText(getContext(), AndroidUtils.getString("backup_error"), LENGTH_LONG).show();
}
}).create().show();
return true;
@@ -114,7 +114,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
public static String getSuperappsumm() {
if (disableSettingsSumms()) return null;
return "Скрыто элементов" + ": " + SuperAppEditorManager.getInstance().getDisabledTabs().size();
return AndroidUtils.getString("elements_hidden_count") + ": " + SuperAppEditorManager.getInstance().getDisabledTabs().size();
}
public static String getCachesumm() {
@@ -330,7 +330,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
});
}
} else {
addPreference(this, "", "Внимание!", "Некоторые пункты настроек были скрыты из-за режима VK Мессенджер \n\nДля отключения режима перейдите в настройки Сообщений", "ic_about_outline_28", preference -> false);
addPreference(this, "", AndroidUtils.getString("debug_warning"), AndroidUtils.getString("vkme_mode_info"), "ic_about_outline_28", preference -> false);
}
addPreference(this, "", AndroidUtils.getString("vtlmedia"), mediasumm, "ic_media_outline_28", preference -> {
@@ -24,6 +24,7 @@ import java.util.Objects;
import kotlin.Unit;
import kotlin.jvm.b.Functions;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.RenameTool;
public class MenuBuilder {
@@ -55,17 +56,17 @@ public class MenuBuilder {
final ExtendedUserProfile eup = (ExtendedUserProfile) pfambObject.get(mb);
final Context ctx = ((View) Objects.requireNonNull(apView.get(builder))).getContext();
addItem(builder, "Скопировать ID", () -> {
addItem(builder, AndroidUtils.getString("menu_copy_id"), () -> {
copy(ctx, String.valueOf(getUserID(eup)));
return Unit.a;
});
addItem(builder, "Дополнительная информация", () -> {
addItem(builder, AndroidUtils.getString("menu_addon_info"), () -> {
loadAndShow(ctx, getUserID(eup));
return Unit.a;
});
addItem(builder, "Изменить имя", () -> {
addItem(builder, AndroidUtils.getString("menu_change_name"), () -> {
RenameTool.createDialog(eup, ctx);
return Unit.a;
});
@@ -80,12 +81,12 @@ public class MenuBuilder {
final ExtendedCommunityProfile ecp = (ExtendedCommunityProfile) cfambObject.get(mb);
final Context ctx = ((View) apView.get(builder)).getContext();
addItem(builder, "Скопировать ID", () -> {
addItem(builder, AndroidUtils.getString("menu_copy_id"), () -> {
copy(ctx, String.valueOf(getUserID(ecp)));
return Unit.a;
});
addItem(builder, "Изменить имя", () -> {
addItem(builder, AndroidUtils.getString("menu_addon_info"), () -> {
RenameTool.createDialogGroup(ecp, ctx);
return Unit.a;
});
@@ -100,7 +101,7 @@ public class MenuBuilder {
ClipData clip = ClipData.newPlainText("MBH-ST", txt);
clipboard.setPrimaryClip(clip);
sendToast("Скопировано!");
sendToast(AndroidUtils.getString("menu_copied"));
}
public static void addItem(final ActionsPopup.b builder, final String title, final Functions onClick) throws InvocationTargetException, IllegalAccessException {
@@ -31,6 +31,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import ru.vtosters.lite.ui.PreferencesUtil;
import ru.vtosters.lite.utils.AndroidUtils;
public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
@@ -56,20 +57,20 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
int vtosterXml = getIdentifier("empty", "xml");
addPreferencesFromResource(vtosterXml);
PreferencesUtil.addPreferenceCategory(this, "Предпросмотр");
PreferencesUtil.addPreferenceCategory(this, AndroidUtils.getString("vkim_settings_appearance_chat_preview_title"));
mWPPreviewPref = new WallpaperPreferences(getContext());
mWPPreviewPref.setIcon(null);
mWPPreviewPref.setIconSpaceReserved(false);
getPreferenceScreen().addPreference(mWPPreviewPref);
PreferencesUtil.addPreference(this, "wp_set", "Выбрать обои", "из галереи", "ic_picture_outline_28", preference -> {
PreferencesUtil.addPreference(this, "wp_set", AndroidUtils.getString("wallpaper_select"), AndroidUtils.getString("wallpaper_from_gallery"), "ic_picture_outline_28", preference -> {
startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI), 1488);
removeStickCache();
return true;
});
PreferencesUtil.addPreference(this, "wp_clear", "Удалить обои", "", "ic_delete_outline_28", preference -> {
PreferencesUtil.addPreference(this, "wp_clear", AndroidUtils.getString("wallpaper_remove"), "", "ic_delete_outline_28", preference -> {
removeWallpaper();
requestUpdateWallpaper();
mWPPreviewPref.redraw();
@@ -77,36 +78,30 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
return true;
});
PreferencesUtil.addPreferenceCategory(this, "Фильтры");
PreferencesUtil.addPreferenceCategory(this, AndroidUtils.getString("vtlfilters"));
if (!hasVerification() && !getBoolValue("dialogrecomm", false)) {
PreferencesUtil.addPreference(this, "", "Доступны не все фильтры!", "Для разблокировки необходимо сделать пожертование от 99р", null, preference -> {
PreferencesUtil.addPreference(this, "", AndroidUtils.getString("filters_warning"), AndroidUtils.getString("icons_warning_info"), null, preference -> {
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://vtosters.app")));
return false;
});
}
PreferencesUtil.addListPreference(this, "msg_blur_radius", "disabled", "Размытие фона сообщений", new CharSequence[]{
"Отключено", "Низкое (15px)", "Среднее (25px)", "Высокое (50px)"
}, new String[]{
PreferencesUtil.addListPreference(this, "msg_blur_radius", "disabled", AndroidUtils.getString("filter_blur"), AndroidUtils.getArray("filter_types"), new String[]{
"disabled", "low", "med", "high"
});
PreferencesUtil.addListPreference(this, "msg_dim", "off", "Затемнение изображения", new CharSequence[]{
"Отключено", "Затемнить", "Осветлить"
}, new String[]{
PreferencesUtil.addListPreference(this, "msg_dim", "off", AndroidUtils.getString("filter_dim"), AndroidUtils.getArray("filter_dim_types"), new String[]{
"off", "dim_black", "dim_white"
});
PreferencesUtil.addListPreference(this, "msg_mosaic", "disabled", "Мозаика", new CharSequence[]{
"Отключено", "Низкое", "Среднее", "Высокое"
}, new String[]{
PreferencesUtil.addListPreference(this, "msg_mosaic", "disabled", AndroidUtils.getString("filter_mosaic"), AndroidUtils.getArray("filter_types"), new String[]{
"disabled", "low", "med", "high"
});
if (hasVerification()) {
PreferencesUtil.addMaterialSwitchPreference(this, "msg_monochrome", "Черно-белый фон", "", null, false, (preference, o) -> {
PreferencesUtil.addMaterialSwitchPreference(this, "msg_monochrome", AndroidUtils.getString("filter_monochrome"), "", null, false, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("msg_monochrome", value).commit();
requestUpdateWallpaper();
@@ -114,7 +109,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
return true;
});
PreferencesUtil.addMaterialSwitchPreference(this, "msg_invert", "Инвертировать цвета", "", null, false, (preference, o) -> {
PreferencesUtil.addMaterialSwitchPreference(this, "msg_invert", AndroidUtils.getString("filter_invert_colors"), "", null, false, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("msg_invert", value).commit();
requestUpdateWallpaper();
@@ -122,7 +117,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
return true;
});
PreferencesUtil.addMaterialSwitchPreference(this, "msg_sepia", "Эффект сепии", "", null, false, (preference, o) -> {
PreferencesUtil.addMaterialSwitchPreference(this, "msg_sepia", AndroidUtils.getString("filter_sepia"), "", null, false, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("msg_sepia", value).commit();
requestUpdateWallpaper();
@@ -130,7 +125,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
return true;
});
PreferencesUtil.addMaterialSwitchPreference(this, "msg_emboss", "Emboss фильтр", "Возможна нагрузка на устройство", null, false, (preference, o) -> {
PreferencesUtil.addMaterialSwitchPreference(this, "msg_emboss", AndroidUtils.getString("filter_emboss"), AndroidUtils.getString("filter_maybe_lag"), null, false, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("msg_emboss", value).commit();
requestUpdateWallpaper();
@@ -138,7 +133,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
return true;
});
PreferencesUtil.addMaterialSwitchPreference(this, "msg_engrave", "Engrave фильтр", "Возможна нагрузка на устройство", null, false, (preference, o) -> {
PreferencesUtil.addMaterialSwitchPreference(this, "msg_engrave", AndroidUtils.getString("filter_engrave"), AndroidUtils.getString("filter_maybe_lag"), null, false, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("msg_engrave", value).commit();
requestUpdateWallpaper();
@@ -146,7 +141,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
return true;
});
PreferencesUtil.addMaterialSwitchPreference(this, "msg_flea", "Flea фильтр", "", null, false, (preference, o) -> {
PreferencesUtil.addMaterialSwitchPreference(this, "msg_flea", AndroidUtils.getString("filter_flea"), "", null, false, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("msg_flea", value).commit();
requestUpdateWallpaper();
@@ -154,7 +149,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
return true;
});
PreferencesUtil.addMaterialSwitchPreference(this, "msg_snow", "Эффект снега", "", null, false, (preference, o) -> {
PreferencesUtil.addMaterialSwitchPreference(this, "msg_snow", AndroidUtils.getString("filter_flea"), "", null, false, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("msg_snow", value).commit();
requestUpdateWallpaper();
@@ -16,6 +16,8 @@ import android.widget.ImageView;
import java.io.File;
import ru.vtosters.lite.utils.AndroidUtils;
public class WallpapersHooks {
private static File mWallpaperFile;
@@ -91,13 +93,13 @@ public class WallpapersHooks {
String radius = getPreferences().getString("msg_blur_radius", "disabled");
switch (radius) {
case "low":
return "Низкое";
return AndroidUtils.getString("wallpapers_low");
case "med":
return "Среднее";
return AndroidUtils.getString("wallpapers_med");
case "high":
return "Высокое";
return AndroidUtils.getString("wallpapers_high");
default:
return "Отключено";
return AndroidUtils.getString("wallpapers_disabled");
}
}
@@ -105,11 +107,11 @@ public class WallpapersHooks {
String radius = getPreferences().getString("msg_dim", "disabled");
switch (radius) {
case "dim_black":
return "Затемнить";
return AndroidUtils.getString("wallpapers_dim_black");
case "dim_white":
return "Осветлить";
return AndroidUtils.getString("wallpapers_dim_white");
default:
return "Отключено";
return AndroidUtils.getString("wallpapers_disabled");
}
}
@@ -117,13 +119,13 @@ public class WallpapersHooks {
String radius = getPreferences().getString("msg_mosaic", "disabled");
switch (radius) {
case "low":
return "Низкое";
return AndroidUtils.getString("wallpapers_low");
case "med":
return "Среднее";
return AndroidUtils.getString("wallpapers_med");
case "high":
return "Высокое";
return AndroidUtils.getString("wallpapers_high");
default:
return "Отключено";
return AndroidUtils.getString("wallpapers_disabled");
}
}
@@ -22,10 +22,10 @@ public class About {
public static void injectToToolBar(View view) {
view.setOnLongClickListener(v -> {
if (devmenu()) {
sendToast("Меню для разработчиков уже активировано");
sendToast(AndroidUtils.getString("debug_menu_already_activated"));
} else {
edit().putBoolean("devmenu", true).apply();
sendToast("Меню для разработчиков активировано");
sendToast(AndroidUtils.getString("debug_menu_activated"));
}
return true;
});
@@ -63,6 +63,10 @@ public class AndroidUtils {
return 0;
} // Get res id
public static String[] getArray(String resourcename) {
return getResources().getStringArray(getIdentifier(resourcename, "array"));
} // Get array from arrays.xml
public static String getString(String resourcename) {
return getGlobalContext().getString(getIdentifier(resourcename, "string"));
} // Get string via getIdentifier
@@ -56,7 +56,7 @@ public class CacheUtils {
size = IOUtils.getDirSize(getGlobalContext().getCacheDir());
if (size >= getSizeForDelete()) {
if (dev()) sendToast("Кеш очищен");
if (dev()) sendToast(AndroidUtils.getString("cache_cleaned"));
VKImageLoader.e();
ImAudioMsgPlayerProvider.b().e(PlayerActionSources.a);
ImAudioMsgPlayerProvider.b().d(PlayerActionSources.a);
@@ -152,7 +152,7 @@ public class RenameTool {
linearLayout.setOrientation(LinearLayout.VERTICAL);
final EditText fn = new EditText(ctx);
fn.setHint("Имя");
fn.setHint(AndroidUtils.getString("vk_auth_sign_up_first_name"));
fn.setTextColor(getTextAttr());
fn.setHintTextColor(getSTextAttr());
fn.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
@@ -163,7 +163,7 @@ public class RenameTool {
fn.setLayoutParams(margin);
final EditText ln = new EditText(ctx);
ln.setHint("Фамилия");
ln.setHint(AndroidUtils.getString("vk_auth_sign_up_last_name"));
ln.setTextColor(getTextAttr());
ln.setHintTextColor(getSTextAttr());
ln.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
@@ -178,8 +178,8 @@ public class RenameTool {
int id = AccountManagerUtils.getUserID(profile);
AlertDialog.Builder builder = new AlertDialog.Builder(ctx, getAlertStyle());
builder.setTitle("Смена имени");
builder.setMessage("Это локальное изменение, которое будет отображатся только в данном клиенте.");
builder.setTitle(AndroidUtils.getString("rename_title"));
builder.setMessage(AndroidUtils.getString("rename_message"));
builder.setView(linearLayout);
builder.setPositiveButton("OK", (dialog, which) -> {
String firstName = fn.getText().toString();
@@ -197,19 +197,20 @@ public class RenameTool {
}
ctx.sendBroadcast(new Intent("com.vkontakte.android.ACTION_PROFILE_UPDATED").putExtra("uid", id));
sendToast("Пользователь успешно переименован!");
sendToast(AndroidUtils.getString("rename_success"));
} catch (Exception e) {
e.printStackTrace();
sendToast(AndroidUtils.getString("rename_error"));
}
});
if (isChangedName(id)) builder.setNeutralButton("Сбросить", (dialog, which) -> {
if (isChangedName(id)) builder.setNeutralButton(AndroidUtils.getString("rename_reset"), (dialog, which) -> {
getHelper().getWritableDatabase().execSQL(String.format("DELETE FROM %s WHERE %s='%s'", TABLE_NAME, COLUMN_VKID, id));
if (id == AccountManagerUtils.getUserId()) {
ctx.sendBroadcast(new Intent("com.vkontakte.android.USER_NAME_CHANGED"));
}
updateRequested = true;
ctx.sendBroadcast(new Intent("com.vkontakte.android.ACTION_PROFILE_UPDATED").putExtra("uid", id));
sendToast("Пользователь успешно удален из базы данных!");
sendToast(AndroidUtils.getString("rename_remove_from_bd_success"));
});
var alert = builder.create();
@@ -225,7 +226,7 @@ public class RenameTool {
linearLayout.setOrientation(LinearLayout.VERTICAL);
final EditText fn = new EditText(ctx);
fn.setHint("Имя");
fn.setHint(AndroidUtils.getString("vk_auth_sign_up_first_name"));
fn.setHintTextColor(getSTextAttr());
fn.setTextColor(getTextAttr());
fn.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
@@ -244,8 +245,8 @@ public class RenameTool {
final int id = fid;
AlertDialog.Builder builder = new AlertDialog.Builder(ctx, getAlertStyle());
builder.setTitle("Смена имени");
builder.setMessage("Это локальное изменение, которое будет отображатся только в данном клиенте");
builder.setTitle(AndroidUtils.getString("rename_title"));
builder.setMessage(AndroidUtils.getString("rename_message"));
builder.setView(linearLayout);
builder.setPositiveButton("OK", (dialog, which) -> {
String firstName = fn.getText().toString();
@@ -257,15 +258,15 @@ public class RenameTool {
writableDatabase.execSQL(String.format("INSERT INTO %s (%s, %s) VALUES (%s, '%s')", TABLE_NAME_GROUP, COLUMN_VKID, COLUMN_NAME, id, URLEncoder.encode(firstName, "UTF-8")));
}
updateRequested = true;
sendToast("Сообщество успешно переименовано!");
sendToast(AndroidUtils.getString("rename_group_success"));
} catch (Exception e) {
e.printStackTrace();
}
});
if (isChangedNameGroup(id)) builder.setNeutralButton("Сбросить", (dialog, which) -> {
if (isChangedNameGroup(id)) builder.setNeutralButton(AndroidUtils.getString("rename_reset"), (dialog, which) -> {
getHelper().getWritableDatabase().execSQL(String.format("DELETE FROM %s WHERE %s='%s'", TABLE_NAME_GROUP, COLUMN_VKID, id));
updateRequested = true;
sendToast("Сообщество успешно удалено из базы данных!");
sendToast(AndroidUtils.getString("rename_remove_group_from_bd_success"));
});
var alert = builder.create();