compiling fix

This commit is contained in:
gdlbo
2022-07-31 13:34:23 +03:00
parent 858fced1aa
commit 265d3afbff
5 changed files with 21 additions and 16 deletions
@@ -18,7 +18,7 @@ public abstract class BaseTranslator {
private static final int DEEPL = 2;
@NonNull
abstract String translate(String text);
public abstract String translate(String text);
@NonNull
public final String getTranslation(String text) {
@@ -56,7 +56,7 @@ public class DeepLTranslator extends BaseTranslator {
@NonNull
@Override
String translate(String text) {
public String translate(String text) {
try {
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
@@ -46,7 +46,7 @@ public class GoogleTranslator extends BaseTranslator {
@NonNull
@Override
String translate(String text) {
public String translate(String text) {
try {
var request = new Request.a()
.b("https://translate.googleapis.com/translate_a/single?dj=1" +
@@ -29,7 +29,7 @@ public class YandexTranslator extends BaseTranslator {
@NonNull
@Override
String translate(String text) {
public String translate(String text) {
try {
var request = new Request.a()
.b("https://translate.yandex.net/api/v1/tr.json/translate?&srv=android&id=" + uuid + "-0-0")
@@ -1,11 +1,13 @@
package ru.vtosters.lite.ui.dialogs;
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.TypedValue;
import android.widget.LinearLayout;
import android.widget.RadioButton;
@@ -19,8 +21,10 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
import ru.vtosters.lite.utils.LayoutUtils;
public class MessageSettings {
public static Boolean isSilentEnabled = false;
public static String bombCount = "0";
public static int id;
public static SharedPreferences prefs = getGlobalContext().getSharedPreferences("message_settings", Context.MODE_PRIVATE);
public static Boolean silent = prefs.getBoolean("silent_" + id, false);
public static String bomb = prefs.getString("bomb_" + id, "0");
@SuppressLint("SetTextI18n")
public static void argDialog(Context context) {
@@ -65,7 +69,7 @@ public class MessageSettings {
four.setTextColor(getTextAttr());
five.setTextColor(getTextAttr());
switch (bombCount) {
switch (bomb) {
case "15s":
one.setChecked(true);
break;
@@ -90,10 +94,10 @@ public class MessageSettings {
var silentSwitch = new SwitchCompat(new ContextThemeWrapper(context, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_Switch));
silentSwitch.setText("Бесшумные сообщения");
silentSwitch.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
silentSwitch.setTextColor(getSTextAttr());
silentSwitch.setChecked(isSilentEnabled);
silentSwitch.setTextColor(getTextAttr());
silentSwitch.setChecked(silent);
silentSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
isSilentEnabled = isChecked;
prefs.edit().putBoolean("silent_" + id, isChecked).apply();
});
silentSwitch.setPadding(dp2px(24f), dp2px(12f), dp2px(18f), dp2px(12f));
@@ -114,18 +118,19 @@ public class MessageSettings {
var checked = rg.getCheckedRadioButtonId();
if (checked == zero.getId()) {
bombCount = "0";
prefs.edit().putString("bomb_" + id, "0").apply();
} else if (checked == one.getId()) {
bombCount = "15s";
prefs.edit().putString("bomb_" + id, "15s").apply();
} else if (checked == two.getId()) {
bombCount = "1m";
prefs.edit().putString("bomb_" + id, "1m").apply();
} else if (checked == three.getId()) {
bombCount = "5m";
prefs.edit().putString("bomb_" + id, "5m").apply();
} else if (checked == four.getId()) {
bombCount = "1h";
prefs.edit().putString("bomb_" + id, "1h").apply();
} else if (checked == five.getId()) {
bombCount = "24h";
prefs.edit().putString("bomb_" + id, "24h").apply();
}
});
builder.show();