fixes + more translations

This commit is contained in:
gdlbo
2022-06-08 15:14:34 +03:00
parent a5a2179399
commit 155fa80c95
12 changed files with 86 additions and 38 deletions
@@ -1,5 +1,7 @@
package ru.vtosters.lite.downloaders;
import static ru.vtosters.lite.utils.Globals.getString;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.content.Context;
@@ -48,7 +50,7 @@ public class VideoDownloader {
}
if (list.isEmpty()) {
ToastUtils.a("Данное видео невозможно скачать");
ToastUtils.a(getString("videodownloaderr"));
return;
}
@@ -2,6 +2,7 @@ package ru.vtosters.lite.f0x1d;
import static ru.vtosters.lite.utils.About.getBuildNumber;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getString;
import android.app.Activity;
import android.app.Notification;
@@ -60,13 +61,13 @@ public class Crashreporter {
var builder = new Notification.Builder(getContext());
builder.setSmallIcon(R.drawable.ic_bug_24);
builder.setContentTitle("Произошла ошибка в работе VTLite!");
builder.setContentTitle(getString("vtl_crashed"));
builder.setContentText(logString);
builder.setStyle(new Notification.BigTextStyle().bigText(logString));
builder.setAutoCancel(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
builder.addAction(new Notification.Action(0, "Загрузить логи", PendingIntent.getActivity(getContext(), (int) (Math.random() * 100.0d), foxbinIntent, PendingIntent.FLAG_CANCEL_CURRENT)));
builder.addAction(new Notification.Action(0, "Сохранить в файл", psaveLogIntent));
builder.addAction(new Notification.Action(0, getString("vtl_crash_upload"), PendingIntent.getActivity(getContext(), (int) (Math.random() * 100.0d), foxbinIntent, PendingIntent.FLAG_CANCEL_CURRENT)));
builder.addAction(new Notification.Action(0, getString("vtl_crash_save"), psaveLogIntent));
} else {
builder.setContentIntent(PendingIntent.getActivity(activity, 0, foxbinIntent, PendingIntent.FLAG_ONE_SHOT));
}
@@ -63,7 +63,7 @@ public class FoafBase {
public static void loadAndShow(Context context, int i) {
ProgressDialog progressDialog = new ProgressDialog(context);
progressDialog.setMessage("Загрузка...");
progressDialog.setMessage(getString("com_facebook_loading"));
progressDialog.setCancelable(false);
progressDialog.show();
@@ -2,6 +2,7 @@ package ru.vtosters.lite.ui.dialogs;
import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getString;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import android.app.Activity;
@@ -21,10 +22,10 @@ public class DisableBattery {
final Context context = getContext();
if (!((PowerManager) context.getSystemService(Context.POWER_SERVICE)).isIgnoringBatteryOptimizations(context.getPackageName())) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("Выключите оптимизацию батареи!");
builder.setMessage("Из-за того, что Вы используете оболочку из списка ниже - уведомления могут приходить с задержкой или не приходить вовсе. \n Для того, чтобы это исправить - нажмите на кнопку \"Отключить оптимизацию\". \n\nПрошивки на которых наблюдаются проблемы с пушами:\nFlyme, EMUI, MIUI, ColorOS, Samsung Experience или TouchWiz, Magic UI, ZenUI, Funtouch OS");
builder.setTitle(getString("batteryissuetitle"));
builder.setMessage(getString("batteryissuesumm"));
builder.setCancelable(false);
builder.setPositiveButton("Отключить оптимизацию", new DialogInterface.OnClickListener() {
builder.setPositiveButton(getString("batteryissuebtn1"), new DialogInterface.OnClickListener() {
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent("android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS");
@@ -35,7 +36,7 @@ public class DisableBattery {
context.startActivity(intent);
}
});
builder.setNeutralButton("Игнорировать", new DialogInterface.OnClickListener() {
builder.setNeutralButton(getString("batteryissuebtn2"), new DialogInterface.OnClickListener() {
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
edit().putBoolean("showDoze", false).apply();
@@ -2,6 +2,7 @@ package ru.vtosters.lite.ui.dialogs;
import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getString;
import static ru.vtosters.lite.utils.Globals.isGmsInstalled;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
@@ -19,17 +20,17 @@ public class InstallGMS {
public static void alert(final Activity activity) {
if (!isGmsInstalled()) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("Внимание!");
builder.setMessage(Text());
builder.setTitle(getString("debug_warning"));
builder.setMessage(getString("gmsissuesumm"));
builder.setCancelable(false);
builder.setPositiveButton("Продолжить без GMS", new DialogInterface.OnClickListener() {
builder.setPositiveButton(getString("gmsissuebtn1"), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
edit().putBoolean("showAlertGms", false).apply();
}
});
builder.setNeutralButton("Установить GMS", new DialogInterface.OnClickListener() {
builder.setNeutralButton(getString("gmsissuebtn2"), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
@@ -44,8 +45,4 @@ public class InstallGMS {
}
}
}
private static String Text() {
return "На вашем устройстве отсутствует компонент Google Play Services (GMS), который необходим для корректной работы VTosters Lite";
}
}
@@ -1,6 +1,7 @@
package ru.vtosters.lite.ui.dialogs;
import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getString;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import android.app.Activity;
@@ -18,17 +19,17 @@ public class Start {
activity.requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 228);
}
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("Внимание!");
builder.setTitle(getString("debug_warning"));
builder.setMessage(getWelcome());
builder.setCancelable(false);
builder.setPositiveButton("Продолжить", new DialogInterface.OnClickListener() {
builder.setPositiveButton(getString("startbtn2"), new DialogInterface.OnClickListener() {
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
edit().putBoolean("showAlert", false).apply();
}
});
builder.setNeutralButton("Новости", new DialogInterface.OnClickListener() {
builder.setNeutralButton(getString("startbtn1"), new DialogInterface.OnClickListener() {
@Override // android.content.DialogInterface.OnClickListener
public void onClick(DialogInterface dialogInterface, int i) {
@@ -42,9 +43,12 @@ public class Start {
}
private static String getWelcome() {
if (!OEMDetector.isOEM()) {
return "Модификация VTosters Lite не имеет никакого отношения к VK Group!\nРаспространяется полностью бесплатно!";
String Default = getString("startsumm1");
if (OEMDetector.isOEM()){
return Default + getString("startsumm2");
}
return "Модификация VTosters Lite не имеет никакого отношения к VK Group!\nРаспространяется полностью бесплатно!\n\nПриложение может некорректно работать в связи с тем, что вы, скорее всего, используете оболочку из списка ниже. Все проблемы с отображением и работой приложения связаны только с вашей прошивкой и только с ней. Все багрепорты, присланные из-за проблем на этой прошивке, не рассматриваются разработчиками и не будут исправлены.\n\nНажимая на кнопку \"Продолжить\", вы соглашаетесь с тем, что возможные баги приложения могут произойти из-за специфики вашей прошивки. Рекомендуем использовать прошивки на базе AOSP для получения максимальной стабильности.\n\nПрошивки на которых наблюдаются проблемы с приложениями:\nFlyme, EMUI, MIUI, ColorOS, Samsung Experience или TouchWiz, Magic UI, ZenUI, Funtouch OS";
return Default;
}
}
@@ -1,6 +1,6 @@
package ru.vtosters.lite.ui.fragments.dockbar;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getResources;
import static ru.vtosters.lite.utils.Themes.getAccentColor;
import android.content.res.ColorStateList;
@@ -63,7 +63,7 @@ public class DockBarInjector {
for (DockBarTab tab : sManager.getSelectedTabs()) {
MenuItem add = menu.add(0, tab.id, 0, tab.titleID);
Drawable drawable = getContext().getResources().getDrawable(tab.iconID);
Drawable drawable = getResources().getDrawable(tab.iconID);
ColorStateList dockcolors = new ColorStateList(
new int[][]{
new int[]{android.R.attr.state_checked},
@@ -1,6 +1,6 @@
package ru.vtosters.lite.ui.fragments.tgstickers;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getString;
import android.os.Bundle;
@@ -19,7 +19,7 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
public void b(Bundle bundle) {
super.b(bundle);
int vtosterXml = getContext().getResources().getIdentifier("empty", "xml", getContext().getPackageName());
int vtosterXml = getIdentifier("empty", "xml");
this.a(vtosterXml);
PreferencesUtil.addPreferenceCategory(this, getString("sprefsstickers"));
@@ -85,7 +85,7 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
@Override
public int aq() {
return getContext().getResources().getIdentifier("vtltgs", "string", getContext().getPackageName());
return getIdentifier("vtltgs", "string");
}
}
@@ -140,7 +140,7 @@ public class Globals {
} // Get res id
public static String getString(String resourcename) {
return getContext().getString(Integer.parseInt(String.valueOf(getContext().getResources().getIdentifier(resourcename, "string", getContext().getPackageName()))));
return getContext().getString(getIdentifier(resourcename, "string"));
} // Get string via getIdentifier
public static String getPackageName() {
@@ -148,7 +148,7 @@ public class Globals {
}
public static int convertDpToPixel(float f) {
return (int) (f * ((float) getContext().getResources().getDisplayMetrics().densityDpi / 160.0f));
return (int) (f * ((float) getResources().getDisplayMetrics().densityDpi / 160.0f));
}
public static SharedPreferences getPreferences() {
@@ -2,8 +2,9 @@ package ru.vtosters.lite.utils;
import static android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
import static java.util.Arrays.asList;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
import static ru.vtosters.lite.utils.Globals.getResources;
import static ru.vtosters.lite.utils.Preferences.color_grishka;
import static ru.vtosters.lite.utils.Preferences.isBGStickersEnabled;
import static ru.vtosters.lite.utils.Preferences.navbar;
@@ -71,19 +72,19 @@ public class Themes {
} // Header/Toolbar color text
public static int getAmoledTheme() {
return getContext().getResources().getIdentifier("BaseAmoledStyle", "style", getContext().getPackageName());
return getIdentifier("BaseAmoledStyle", "style");
} // Get Amoled theme id
public static int picFix() {
return getContext().getResources().getIdentifier("ActionBarThemeFix", "style", getContext().getPackageName());
return getIdentifier("ActionBarThemeFix", "style");
} // Fix tabbar color in photo viewer
public static int getAmoledImTheme() {
return getContext().getResources().getIdentifier("VkIm.Theme.VkApp.Amoled", "style", getContext().getPackageName());
return getIdentifier("VkIm.Theme.VkApp.Amoled", "style");
} // Get Amoled theme id for messages
public static int getAttrId(String attr) {
return getContext().getResources().getIdentifier(attr, "attr", getContext().getPackageName());
return getIdentifier(attr, "attr");
}
public static void setBarTheme(View getview) {
@@ -234,14 +235,14 @@ public class Themes {
if (Build.VERSION.SDK_INT >= 23) {
return context.getColor(i);
}
return context.getResources().getColor(i);
return getResources().getColor(i);
} // Android Support color injector + accent color checker
public static int getColor2(int i) {
if (isColorRefAccented(i) && isAndroidMonet()) {
return getAccentColor();
}
return getContext().getResources().getColor(i);
return getResources().getColor(i);
} // Android Support color injector + accent color checker
public static void setNavbarColor(Window window, int i) {
@@ -293,7 +294,7 @@ public class Themes {
public static void systemThemeChanger() {
if (!systemtheme())
return;
int currentNightMode = getContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
switch (currentNightMode) {
case Configuration.UI_MODE_NIGHT_UNDEFINED:
applyTheme(getLightTheme(), getImLightTheme());