regenerated R.java and public.xml, replaced getIdentifier calls to id constants
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package com.aefyr.tsg.g2;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
@@ -12,6 +10,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@@ -40,7 +39,7 @@ public class NotificationsHelper {
|
||||
downloadingPacksNotificationsIds = new HashMap<>();
|
||||
|
||||
if (oreo()) {
|
||||
NotificationChannel notificationChan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, AndroidUtils.getString("telegram_stickers_service"), NotificationManager.IMPORTANCE_HIGH);
|
||||
NotificationChannel notificationChan = new NotificationChannel(NOTIFICATION_CHANNEL_ID, AndroidUtils.getString(R.string.telegram_stickers_service), NotificationManager.IMPORTANCE_HIGH);
|
||||
((NotificationManager) c.getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(notificationChan);
|
||||
}
|
||||
}
|
||||
@@ -50,8 +49,8 @@ public class NotificationsHelper {
|
||||
downloadingPacksNotificationsIds.put(pack, notificationId);
|
||||
|
||||
Notification.Builder builder = commonBuilder();
|
||||
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.setContentTitle(pack.state == TelegramStickersPack.DOWNLOADING ? pack.title + AndroidUtils.getString(R.string.telegram_stickers_downloading) : pack.title + AndroidUtils.getString(R.string.telegram_stickers_updating));
|
||||
builder.setContentText(AndroidUtils.getString(R.string.telegram_stickers_gettinginfo));
|
||||
builder.setOngoing(true);
|
||||
|
||||
manager.notify(notificationId, builder.build());
|
||||
@@ -64,7 +63,7 @@ public class NotificationsHelper {
|
||||
lastNotificationTime.set(System.currentTimeMillis());
|
||||
|
||||
Notification.Builder builder = commonBuilder();
|
||||
builder.setContentTitle(pack.state == TelegramStickersPack.DOWNLOADING ? pack.title + AndroidUtils.getString("telegram_stickers_downloading") : pack.title + AndroidUtils.getString("telegram_stickers_updating"));
|
||||
builder.setContentTitle(pack.state == TelegramStickersPack.DOWNLOADING ? pack.title + AndroidUtils.getString(R.string.telegram_stickers_downloading) : pack.title + AndroidUtils.getString(R.string.telegram_stickers_updating));
|
||||
builder.setContentText(downloadProgress + "/" + pack.stickersCount);
|
||||
builder.setProgress(pack.stickersCount, downloadProgress, false);
|
||||
builder.setOngoing(true);
|
||||
@@ -78,13 +77,13 @@ public class NotificationsHelper {
|
||||
Notification.Builder builder = commonBuilder();
|
||||
builder.setProgress(0, 0, false);
|
||||
builder.setOngoing(false);
|
||||
builder.setContentTitle(AndroidUtils.getString("telegram_stickers_service"));
|
||||
builder.setContentTitle(AndroidUtils.getString(R.string.telegram_stickers_service));
|
||||
|
||||
String text;
|
||||
if (success)
|
||||
text = wasUpdate ? pack.title + AndroidUtils.getString("telegram_stickers_updated") : pack.title + AndroidUtils.getString("telegram_stickers_downloaded");
|
||||
text = wasUpdate ? pack.title + AndroidUtils.getString(R.string.telegram_stickers_updated) : pack.title + AndroidUtils.getString(R.string.telegram_stickers_downloaded);
|
||||
else
|
||||
text = wasUpdate ? pack.title + AndroidUtils.getString("telegram_stickers_error_update") : pack.title + AndroidUtils.getString("telegram_stickers_error_download");
|
||||
text = wasUpdate ? pack.title + AndroidUtils.getString(R.string.telegram_stickers_error_update) : pack.title + AndroidUtils.getString(R.string.telegram_stickers_error_download);
|
||||
|
||||
if (e instanceof TelegramStickersGrabber.TSGException) {
|
||||
text = pack.title + ": " + e.getMessage();
|
||||
@@ -100,7 +99,7 @@ public class NotificationsHelper {
|
||||
}
|
||||
|
||||
private Notification.Builder commonBuilder() {
|
||||
var builder = new Notification.Builder(c).setPriority(Notification.PRIORITY_MAX).setSmallIcon(getIdentifier("ic_download_24", "drawable"));
|
||||
var builder = new Notification.Builder(c).setPriority(Notification.PRIORITY_MAX).setSmallIcon(R.drawable.ic_download_24);
|
||||
if (oreo()) {
|
||||
builder.setChannelId(NOTIFICATION_CHANNEL_ID);
|
||||
}
|
||||
|
||||
+20633
-19623
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
package ru.vtosters.lite.deviceinfo;
|
||||
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.hasMiuiIncrCode;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.isEMUI;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.isMIUI;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.hasMiuiIncrCode;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.isSamsung;
|
||||
import static ru.vtosters.lite.utils.About.getBuildNumber;
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package ru.vtosters.lite.dnr;
|
||||
|
||||
import static com.vk.im.engine.h.im_ic_done;
|
||||
import static com.vk.im.engine.h.im_ic_edit_msg;
|
||||
import static com.vk.im.engine.h.im_ic_more_vertical;
|
||||
import static com.vk.im.engine.h.im_ic_pinned_msg_hide;
|
||||
import static com.vk.im.engine.h.im_ic_pinned_msg_show;
|
||||
import static com.vk.im.ui.c.im_ic_keyboard;
|
||||
import static ru.vtosters.lite.dnr.DNRModule.hookDNR;
|
||||
import static ru.vtosters.lite.dnr.DNRModule.hookDNT;
|
||||
import static ru.vtosters.lite.dnr.DNRModule.isDnrEnabledFor;
|
||||
@@ -13,8 +7,6 @@ import static ru.vtosters.lite.dnr.DNRModule.isDntEnabledFor;
|
||||
import static ru.vtosters.lite.encryption.EncryptProvider.decryptMessage;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
@@ -34,6 +26,7 @@ import com.vk.im.ui.components.common.DialogAction;
|
||||
import com.vk.im.ui.components.common.MsgAction;
|
||||
import com.vk.im.ui.components.viewcontrollers.popup.DelegateMsg;
|
||||
import com.vk.im.ui.views.dialog_actions.DialogActionsListView;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -49,6 +42,7 @@ import ru.vtosters.lite.encryption.EncryptProvider;
|
||||
import ru.vtosters.lite.encryption.base.IMProcessor;
|
||||
import ru.vtosters.lite.hooks.CryptImHook;
|
||||
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) {
|
||||
@@ -91,15 +85,15 @@ public class DNRInjector {
|
||||
}
|
||||
|
||||
public static LinkedHashMap<DialogAction, Integer> injectToHashMap(LinkedHashMap<DialogAction, Integer> hashMap) {
|
||||
hashMap.put(DialogAction.DOWNLOAD, getIdentifier("download_dl", "string"));
|
||||
hashMap.put(DialogAction.DOWNLOAD, R.string.download_dl);
|
||||
|
||||
hashMap.put(DialogAction.DNR_ON, getIdentifier("DNR_ON", "string"));
|
||||
hashMap.put(DialogAction.DNR_OFF, getIdentifier("DNR_OFF", "string"));
|
||||
hashMap.put(DialogAction.DNT_ON, getIdentifier("DNT_ON", "string"));
|
||||
hashMap.put(DialogAction.DNT_OFF, getIdentifier("DNT_OFF", "string"));
|
||||
hashMap.put(DialogAction.DNR_ON, R.string.DNR_ON);
|
||||
hashMap.put(DialogAction.DNR_OFF, R.string.DNR_OFF);
|
||||
hashMap.put(DialogAction.DNT_ON, R.string.DNT_ON);
|
||||
hashMap.put(DialogAction.DNT_OFF, R.string.DNT_OFF);
|
||||
|
||||
hashMap.put(DialogAction.ENCRYPT, getIdentifier("encryption", "string"));
|
||||
hashMap.put(DialogAction.ENCRYPT_SETT, getIdentifier("encryption_sett", "string"));
|
||||
hashMap.put(DialogAction.ENCRYPT, R.string.encryption);
|
||||
hashMap.put(DialogAction.ENCRYPT_SETT, R.string.encryption_sett);
|
||||
|
||||
// hashMap.put(DialogAction.pinmsg, getIdentifier("pinmsg", "string"));
|
||||
// hashMap.put(DialogAction.unpinmsg, getIdentifier("unpinmsg", "string"));
|
||||
@@ -109,20 +103,20 @@ public class DNRInjector {
|
||||
@SuppressLint("ResourceType")
|
||||
public static List<Object> injectToList(List<Object> actions) {
|
||||
var list = new ArrayList<>(actions);
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DOWNLOAD, 1, getIdentifier("im_ic_msgdl", "attr"), getIdentifier("download_dl", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DOWNLOAD, 1, R.attr.im_ic_msgdl, R.string.download_dl)); // DialogAction, Int, Icon, String
|
||||
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNR_ON, 2, im_ic_pinned_msg_hide, getIdentifier("DNR_ON", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNR_OFF, 2, im_ic_pinned_msg_show, getIdentifier("DNR_OFF", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNR_ON, 2, R.attr.im_ic_pinned_msg_hide, R.string.DNR_ON)); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNR_OFF, 2, R.attr.im_ic_pinned_msg_show, R.string.DNR_OFF)); // DialogAction, Int, Icon, String
|
||||
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNT_ON, 2, im_ic_edit_msg, getIdentifier("DNT_ON", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNT_OFF, 2, im_ic_edit_msg, getIdentifier("DNT_OFF", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNT_ON, 2, R.attr.im_ic_edit_msg, R.string.DNT_ON)); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNT_OFF, 2, R.attr.im_ic_edit_msg, R.string.DNT_OFF)); // DialogAction, Int, Icon, String
|
||||
|
||||
if (!isTablet()) {
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT, 3, im_ic_keyboard, getIdentifier("encryption", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT_SETT, 3, im_ic_more_vertical, getIdentifier("encryption_sett", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT, 3, R.attr.im_ic_keyboard, R.string.encryption)); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT_SETT, 3, R.attr.im_ic_more_vertical, R.string.encryption_sett)); // DialogAction, Int, Icon, String
|
||||
}
|
||||
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.MARK_AS_READ, 4, im_ic_done, getIdentifier("vkim_dialogs_list_option_mark_as_read", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.MARK_AS_READ, 4, R.attr.im_ic_done, R.string.vkim_dialogs_list_option_mark_as_read)); // DialogAction, Int, Icon, String
|
||||
|
||||
return list;
|
||||
}
|
||||
@@ -197,7 +191,7 @@ public class DNRInjector {
|
||||
try {
|
||||
new MessagesDownloader().downloadDialog(peerId, new MessagesDownloader.HtmlDialogDownloaderFormatProvider(), out);
|
||||
} catch (Exception e) {
|
||||
sendToast(getString("download_dl_error"));
|
||||
sendToast(AndroidUtils.getString(R.string.download_dl_error));
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
@@ -299,8 +293,8 @@ public class DNRInjector {
|
||||
}
|
||||
|
||||
public static LinkedHashMap<MsgAction, DelegateMsg.a.a> injectToHashMapMsg(LinkedHashMap<MsgAction, DelegateMsg.a.a> hashMap) {
|
||||
hashMap.put(MsgAction.valueOf("TRANSLATE"), new DelegateMsg.a.a(getIdentifier("translator", "string")));
|
||||
hashMap.put(MsgAction.valueOf("READTO"), new DelegateMsg.a.a(getIdentifier("readto", "string")));
|
||||
hashMap.put(MsgAction.valueOf("TRANSLATE"), new DelegateMsg.a.a(R.string.translator));
|
||||
hashMap.put(MsgAction.valueOf("READTO"), new DelegateMsg.a.a(R.string.readto));
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
@@ -331,13 +325,13 @@ public class DNRInjector {
|
||||
|
||||
if (action == MsgAction.valueOf("TRANSLATE")) {
|
||||
if (isTextExist && isReplyExist) {
|
||||
Translate.showTranslatedText(context, text + "\n\n" + getString("translator_reply") + "\n" + reply);
|
||||
Translate.showTranslatedText(context, text + "\n\n" + context.getString(R.string.translator_reply) + "\n" + reply);
|
||||
} else if (isReplyExist) {
|
||||
Translate.showTranslatedText(context, getString("translator_reply") + "\n" + reply);
|
||||
Translate.showTranslatedText(context, context.getString(R.string.translator_reply) + "\n" + reply);
|
||||
} else if (isTextExist) {
|
||||
Translate.showTranslatedText(context, text);
|
||||
} else {
|
||||
sendToast(getString("translator_no_text"));
|
||||
sendToast(context.getString(R.string.translator_no_text));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -366,7 +360,7 @@ public class DNRInjector {
|
||||
|
||||
thread.start();
|
||||
|
||||
sendToast(getString("pin_dialog") + " " + getString(needToBePinned ? "dialog_pinned" : "dialog_unpinned"));
|
||||
sendToast(AndroidUtils.getString(R.string.pin_dialog) + " " + AndroidUtils.getString(needToBePinned ? R.string.dialog_pinned : R.string.dialog_unpinned));
|
||||
}
|
||||
|
||||
public static void setDnr(Dialog dialog, boolean value) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.os.Environment;
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vk.dto.music.Playlist;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -113,7 +114,7 @@ public class AudioDownloader {
|
||||
|
||||
private static void downloadM3U8(MusicTrack track, boolean cache) {
|
||||
if (track.D == null) {
|
||||
ToastUtils.a(getString("link_audio_error"));
|
||||
ToastUtils.a(getString(R.string.link_audio_error));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,14 @@ import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getArray;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getResources;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.SparseArray;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -31,6 +32,8 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class MessagesDownloader {
|
||||
private static final String VK_DOMAIN = "vk.com";
|
||||
private static SimpleDateFormat sdformat;
|
||||
@@ -67,13 +70,19 @@ public class MessagesDownloader {
|
||||
pollHtml.append("<hr><p>").append(jsonObject.optString("text")).append(" · ").append(jsonObject.optString("votes")).append(" (").append(jsonObject.optString("rate")).append("%)</p>");
|
||||
}
|
||||
|
||||
pollHtml.append("<hr><p style=\"text-align:center;\">").append(getString("chat_export_poll_voted")).append(" ").append(poll.optString("votes")).append(" ").append(getString("chat_export_users_name")).append("</p>");
|
||||
pollHtml.append("<hr><p style=\"text-align:center;\">")
|
||||
.append(AndroidUtils.getString(R.string.chat_export_poll_voted))
|
||||
.append(" ")
|
||||
.append(poll.optString("votes"))
|
||||
.append(" ")
|
||||
.append(AndroidUtils.getString(R.string.chat_export_users_name))
|
||||
.append("</p>");
|
||||
|
||||
return pollHtml.append("</div>").toString();
|
||||
}
|
||||
|
||||
private static String getVideoHtml(JSONObject files) throws JSONException {
|
||||
if (files == null) return getString("chat_export_video_nolinks");
|
||||
if (files == null) return AndroidUtils.getString(R.string.chat_export_video_nolinks);
|
||||
|
||||
Iterator<?> keys = files.keys();
|
||||
StringBuilder videoHtml = new StringBuilder();
|
||||
@@ -110,7 +119,7 @@ public class MessagesDownloader {
|
||||
}
|
||||
fos.write(format.provideDocumentEnd().getBytes(StandardCharsets.UTF_8));
|
||||
fos.close();
|
||||
Toast.makeText(getGlobalContext(), getString("saved_as") + " " + out.getAbsolutePath(), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString(R.string.saved_as) + " " + out.getAbsolutePath(), Toast.LENGTH_SHORT).show();
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -318,7 +327,11 @@ public class MessagesDownloader {
|
||||
"\n" +
|
||||
"";
|
||||
|
||||
return "<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><meta charset=\"utf-8\"><title>" + getString("chat_export_title") + "</title><style>" + style + "</style></head><body>";
|
||||
return "<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><meta charset=\"utf-8\"><title>"
|
||||
+ AndroidUtils.getString(R.string.chat_export_title)
|
||||
+ "</title><style>"
|
||||
+ style
|
||||
+ "</style></head><body>";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -328,7 +341,7 @@ public class MessagesDownloader {
|
||||
|
||||
@Override
|
||||
String provideHeader(String dialogName, String date) {
|
||||
return "<div class=\"vtex-milk-header\"><h4 class=\"vtex-milk-header-txt\">VTLite</h4><h5 class=\"vtex-milk-header-sub\">" + getString("chat_export_header") + " (" + date + ")</h5></div><div class=\"vtex-milk-msgcont\">";
|
||||
return "<div class=\"vtex-milk-header\"><h4 class=\"vtex-milk-header-txt\">VTLite</h4><h5 class=\"vtex-milk-header-sub\">" + AndroidUtils.getString(R.string.chat_export_header) + " (" + date + ")</h5></div><div class=\"vtex-milk-msgcont\">";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -349,13 +362,13 @@ public class MessagesDownloader {
|
||||
}
|
||||
|
||||
String chatAction = (message.chat_action != null) ? getHtmlForChatAction(message.chat_action) : "";
|
||||
String attaches = (message.attachments.size() > 0) ? "<p class=\"msg-attaches\">" + getString("attachments") + ": " + getHtmlForAttach(message.attachments) + "</p>" : "";
|
||||
String attaches = (message.attachments.size() > 0) ? "<p class=\"msg-attaches\">" + AndroidUtils.getString(R.string.attachments) + ": " + getHtmlForAttach(message.attachments) + "</p>" : "";
|
||||
String reply = (message.reply_message != null) ? provideReply(message.reply_message) : "";
|
||||
String fwdMessages = (message.fwd_messages.size() > 0) ? provideForwardMessages(message.fwd_messages) : "";
|
||||
String userLink = (user.isGroup ? "club" : "id") + user.id;
|
||||
|
||||
return "<div class=\"vtex-milk-msg" + isOut + "\" id=\"" + message.id + "\">" +
|
||||
"<p class=\"msg-from\">" + getString("from_lower") + " <a href=\"https://" + VK_DOMAIN + "/" + userLink + "\">" + user.firstName + " " + user.lastName + "</a> <span class=\"msg-from-date\">" + formatTime(message.date) + "</span></p>" + // TODO photo100
|
||||
"<p class=\"msg-from\">" + AndroidUtils.getString(R.string.from_lower) + " <a href=\"https://" + VK_DOMAIN + "/" + userLink + "\">" + user.firstName + " " + user.lastName + "</a> <span class=\"msg-from-date\">" + formatTime(message.date) + "</span></p>" + // TODO photo100
|
||||
"<p class=\"msg-body\">" + mentionsReplace(message.text) + "</p>" +
|
||||
geoPosition +
|
||||
chatAction +
|
||||
@@ -378,12 +391,12 @@ public class MessagesDownloader {
|
||||
if (fwdMessages != null) {
|
||||
var length = fwdMessages.length();
|
||||
if (length > 0) text = length + " " + pluralMsg(length);
|
||||
} else text = getString("attachment"); // Вложение
|
||||
} else text = AndroidUtils.getString(R.string.attachment); // Вложение
|
||||
}
|
||||
|
||||
return "<a href=\"#" + messageId + "\" class=\"msg-attach-link\">" +
|
||||
"<div class=\"msg-reply\">" +
|
||||
"<p class=\"reply-header\">" + getString("vkim_msg_fwd_single") + "</p>" +
|
||||
"<p class=\"reply-header\">" + AndroidUtils.getString(R.string.vkim_msg_fwd_single) + "</p>" +
|
||||
"<p class=\"reply-content\">" + user.firstName + " " + user.lastName + ": " + text + "</p>" +
|
||||
"</div>" +
|
||||
"</a>";
|
||||
@@ -424,7 +437,7 @@ public class MessagesDownloader {
|
||||
|
||||
JSONObject reply_message = fwd_message.optJSONObject("reply_message");
|
||||
|
||||
var attachesHtml = (attaches.size() > 0) ? getString("attachments") + ": " + getHtmlForAttach(attaches) : "";
|
||||
var attachesHtml = (attaches.size() > 0) ? AndroidUtils.getString(R.string.attachments) + ": " + getHtmlForAttach(attaches) : "";
|
||||
var replyHtml = (reply_message != null) ? provideReply(reply_message) : "";
|
||||
var fwdsHtml = (fwdsMsg.size() > 0) ? provideForwardMessages(fwdsMsg) : ""; // recursion XD :>
|
||||
|
||||
@@ -447,7 +460,7 @@ public class MessagesDownloader {
|
||||
}
|
||||
|
||||
private String pluralMsg(int count) {
|
||||
String[] plurals = getArray("msg_plurals");
|
||||
String[] plurals = getArray(R.array.msg_plurals);
|
||||
|
||||
var hundredModulo = count % 100;
|
||||
var tenModulo = count % 10;
|
||||
@@ -466,22 +479,22 @@ public class MessagesDownloader {
|
||||
|
||||
switch (type) {
|
||||
case "chat_photo_update":
|
||||
htmlAction.append(getString("chat_export_avatar_update"));
|
||||
htmlAction.append(AndroidUtils.getString(R.string.chat_export_avatar_update));
|
||||
break;
|
||||
case "chat_photo_remove":
|
||||
htmlAction.append(getString("chat_export_avatar_remove"));
|
||||
htmlAction.append(AndroidUtils.getString(R.string.chat_export_avatar_remove));
|
||||
break;
|
||||
case "chat_create":
|
||||
var name = action.optString("text");
|
||||
htmlAction.append(getString("chat_export_chat_created")).append((!name.isEmpty()) ? " \"" + name + "\"" : "");
|
||||
htmlAction.append(AndroidUtils.getString(R.string.chat_export_chat_created)).append((!name.isEmpty()) ? " \"" + name + "\"" : "");
|
||||
break;
|
||||
case "chat_title_update":
|
||||
var newName = action.optString("text");
|
||||
htmlAction.append(getString("chat_export_name_changed")).append((!newName.isEmpty()) ? (" " + getString("chat_export_to") + " \"" + newName + "\"") : "");
|
||||
htmlAction.append(AndroidUtils.getString(R.string.chat_export_name_changed)).append((!newName.isEmpty()) ? (" " + AndroidUtils.getString(R.string.chat_export_to) + " \"" + newName + "\"") : "");
|
||||
break;
|
||||
case "chat_invite_user":
|
||||
var newUserId = action.optInt("member_id");
|
||||
htmlAction.append(getString("chat_export_user_added") + " ").append((newUserId > 0) ? getString("chat_export_type_user") : getString("chat_export_type_group"));
|
||||
htmlAction.append(AndroidUtils.getString(R.string.chat_export_user_added) + " ").append((newUserId > 0) ? AndroidUtils.getString(R.string.chat_export_type_user) : AndroidUtils.getString(R.string.chat_export_type_group));
|
||||
if (newUserId != 0) {
|
||||
var userLink = ((newUserId < 0) ? "club" : "id") + Math.abs(newUserId);
|
||||
htmlAction.append(" <a href=\"https://" + VK_DOMAIN + "/").append(userLink).append("\" class=\"msg-attach-link\">@").append(userLink).append("</a>");
|
||||
@@ -489,7 +502,7 @@ public class MessagesDownloader {
|
||||
break;
|
||||
case "chat_kick_user":
|
||||
var removedUserId = action.optInt("member_id");
|
||||
htmlAction.append(getString("chat_export_user_kicked") + " ").append((removedUserId > 0) ? getString("chat_export_type_user") : getString("chat_export_type_group"));
|
||||
htmlAction.append(AndroidUtils.getString(R.string.chat_export_user_kicked) + " ").append((removedUserId > 0) ? AndroidUtils.getString(R.string.chat_export_type_user) : AndroidUtils.getString(R.string.chat_export_type_group));
|
||||
if (removedUserId != 0) {
|
||||
var userLink = ((removedUserId < 0) ? "club" : "id") + Math.abs(removedUserId);
|
||||
htmlAction.append(" <a href=\"https://" + VK_DOMAIN + "/").append(userLink).append("\" class=\"msg-attach-link\">@").append(userLink).append("</a>");
|
||||
@@ -497,22 +510,22 @@ public class MessagesDownloader {
|
||||
break;
|
||||
case "chat_pin_message":
|
||||
var message = action.optString("message");
|
||||
htmlAction.append(getString("chat_export_msg_pinned")).append((!message.isEmpty()) ? (" \"" + message + "\"") : "");
|
||||
htmlAction.append(AndroidUtils.getString(R.string.chat_export_msg_pinned)).append((!message.isEmpty()) ? (" \"" + message + "\"") : "");
|
||||
break;
|
||||
case "chat_unpin_message":
|
||||
htmlAction.append(getString("chat_export_msg_unpinned"));
|
||||
htmlAction.append(AndroidUtils.getString(R.string.chat_export_msg_unpinned));
|
||||
break;
|
||||
case "chat_invite_user_by_link":
|
||||
htmlAction.append(getString("chat_export_join_by_link"));
|
||||
htmlAction.append(AndroidUtils.getString(R.string.chat_export_join_by_link));
|
||||
break;
|
||||
case "chat_screenshot":
|
||||
htmlAction.append(getString("chat_export_chat_screenshot"));
|
||||
htmlAction.append(AndroidUtils.getString(R.string.chat_export_chat_screenshot));
|
||||
break;
|
||||
case "custom":
|
||||
htmlAction.append(action.optString("message"));
|
||||
break;
|
||||
default:
|
||||
htmlAction.append(getString("vkim_msg_unsupported") + " (").append(type).append(")");
|
||||
htmlAction.append(AndroidUtils.getString(R.string.vkim_msg_unsupported) + " (").append(type).append(")");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -531,40 +544,40 @@ public class MessagesDownloader {
|
||||
switch (type) { // market_album is not supported
|
||||
case "photo":
|
||||
var sizes = item.getJSONArray("sizes");
|
||||
rs.append("<a href=\"").append(sizes.getJSONObject(sizes.length() - 1).getString("url")).append("\" class=\"msg-attach-link\">").append(getString("chat_export_type_photo")).append("</a>");
|
||||
rs.append("<a href=\"").append(sizes.getJSONObject(sizes.length() - 1).getString("url")).append("\" class=\"msg-attach-link\">").append(AndroidUtils.getString(R.string.chat_export_type_photo)).append("</a>");
|
||||
break;
|
||||
case "doc":
|
||||
rs.append("<a href=\"").append(item.getString("url")).append("\" class=\"msg-attach-link\">").append(getString("chat_export_type_doc")).append("</a>");
|
||||
rs.append("<a href=\"").append(item.getString("url")).append("\" class=\"msg-attach-link\">").append(AndroidUtils.getString(R.string.chat_export_type_doc)).append("</a>");
|
||||
break;
|
||||
case "link":
|
||||
rs.append("<a href=\"").append(item.getString("url")).append("\" class=\"msg-attach-link\">").append(getString("chat_export_type_link")).append("</a>");
|
||||
rs.append("<a href=\"").append(item.getString("url")).append("\" class=\"msg-attach-link\">").append(AndroidUtils.getString(R.string.chat_export_type_link)).append("</a>");
|
||||
break;
|
||||
case "wall":
|
||||
rs.append("<a href=\"https://" + VK_DOMAIN + "/wall").append(item.optString("to_id", item.optString("owner_id"))).append("_").append(item.getString("id")).append("\" class=\"msg-attach-link\">").append(getString("chat_export_type_wallpost")).append("</a>");
|
||||
rs.append("<a href=\"https://" + VK_DOMAIN + "/wall").append(item.optString("to_id", item.optString("owner_id"))).append("_").append(item.getString("id")).append("\" class=\"msg-attach-link\">").append(AndroidUtils.getString(R.string.chat_export_type_wallpost)).append("</a>");
|
||||
break;
|
||||
case "sticker":
|
||||
rs.append("<img style=\"width:128px;height:128px;\" src=\"").append(item.getJSONArray("images").getJSONObject(1).getString("url")).append("\"/>");
|
||||
break;
|
||||
case "audio_message":
|
||||
rs.append("<a href=\"").append(item.optString("link_mp3")).append("\" class=\"msg-attach-link\">").append(getString("chat_export_type_audiomsg")).append("</a>");
|
||||
rs.append("<a href=\"").append(item.optString("link_mp3")).append("\" class=\"msg-attach-link\">").append(AndroidUtils.getString(R.string.chat_export_type_audiomsg)).append("</a>");
|
||||
break;
|
||||
case "audio":
|
||||
rs.append(getString("chat_export_type_audio")).append(" (").append(item.optString("artist")).append(" — ").append(item.optString("title")).append(")");
|
||||
rs.append(AndroidUtils.getString(R.string.chat_export_type_audio)).append(" (").append(item.optString("artist")).append(" — ").append(item.optString("title")).append(")");
|
||||
break;
|
||||
case "video":
|
||||
rs.append(getString("chat_export_type_video")).append(" (").append(getVideoHtml(item.optJSONObject("files"))).append(")");
|
||||
rs.append(AndroidUtils.getString(R.string.chat_export_type_video)).append(" (").append(getVideoHtml(item.optJSONObject("files"))).append(")");
|
||||
break;
|
||||
case "wall_reply":
|
||||
var link = "https://" + VK_DOMAIN + "/wall" + item.optString("owner_id") + "_" + item.optString("post_id") + "?reply=" + item.optString("id");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(link).append("\">").append(getString("chat_export_type_wallreply")).append("</a>");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(link).append("\">").append(AndroidUtils.getString(R.string.chat_export_type_wallreply)).append("</a>");
|
||||
break;
|
||||
case "story":
|
||||
var story_link = "https://" + VK_DOMAIN + "/story" + item.optString("owner_id") + "_" + item.optString("id");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(story_link).append("\">").append(getString("chat_export_type_story")).append("</a>");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(story_link).append("\">").append(AndroidUtils.getString(R.string.chat_export_type_story)).append("</a>");
|
||||
break;
|
||||
case "podcast":
|
||||
var podcast_link = "https://" + VK_DOMAIN + "/podcast" + item.optString("owner_id") + "_" + item.optString("id");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(podcast_link).append("\">").append(getString("chat_export_type_podcast")).append("</a>");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(podcast_link).append("\">").append(AndroidUtils.getString(R.string.chat_export_type_podcast)).append("</a>");
|
||||
break;
|
||||
case "gift":
|
||||
rs.append("<img src=\"").append(item.optString("thumb_96")).append("\"/>");
|
||||
@@ -574,25 +587,25 @@ public class MessagesDownloader {
|
||||
|
||||
if (app != null) {
|
||||
var miniapp_link = "https://" + VK_DOMAIN + "/app" + app.optString("id");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(miniapp_link).append("\">").append(getString("chat_export_type_miniapp")).append("</a>");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(miniapp_link).append("\">").append(AndroidUtils.getString(R.string.chat_export_type_miniapp)).append("</a>");
|
||||
break;
|
||||
}
|
||||
|
||||
rs.append(getString("chat_export_error"));
|
||||
rs.append(AndroidUtils.getString(R.string.chat_export_error));
|
||||
break;
|
||||
case "audio_playlist":
|
||||
var playlist_link = "https://" + VK_DOMAIN + "/music/album/" + item.optString("owner_id") + "_" + item.optString("id") + "_" + item.optString("access_key");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(playlist_link).append("\">").append(getString("chat_export_type_playlist")).append(" (").append(item.optString("title")).append(")</a>");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(playlist_link).append("\">").append(AndroidUtils.getString(R.string.chat_export_type_playlist)).append(" (").append(item.optString("title")).append(")</a>");
|
||||
break;
|
||||
case "poll":
|
||||
rs.append(getString(item.optBoolean("anonymous") ? "chat_export_poll_anon" : "chat_export_poll_publ")).append(" ").append(getString("chat_export_type_poll")).append(" ").append(getPollHtml(item));
|
||||
rs.append(AndroidUtils.getString(item.optBoolean("anonymous") ? R.string.chat_export_poll_anon : R.string.chat_export_poll_publ)).append(" ").append(AndroidUtils.getString(R.string.chat_export_type_poll)).append(" ").append(getPollHtml(item));
|
||||
break;
|
||||
case "market":
|
||||
var market_item_link = "https://" + VK_DOMAIN + "/market" + item.optString("owner_id") + "_" + item.optString("id");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(market_item_link).append("\">").append(getString("chat_export_type_market")).append("</a>");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(market_item_link).append("\">").append(AndroidUtils.getString(R.string.chat_export_type_market)).append("</a>");
|
||||
break;
|
||||
default:
|
||||
rs.append(getString("vkim_msg_unsupported")).append(" (").append(type).append(")");
|
||||
rs.append(AndroidUtils.getString(R.string.vkim_msg_unsupported)).append(" (").append(type).append(")");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package ru.vtosters.lite.downloaders;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.DownloadManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -12,6 +10,7 @@ import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -50,7 +49,7 @@ public class OTADownloader {
|
||||
File apk = maxIndex == -1 ? new File(downloadDir, "VTLite.apk") : new File(downloadDir, "VTLite-" + maxIndex + ".apk");
|
||||
APKInstallActivity.installOta(context, FileUtils.uriFromFile(apk));
|
||||
} else if (status == DownloadManager.STATUS_FAILED) {
|
||||
AndroidUtils.sendToast(getString("downloaderr"));
|
||||
AndroidUtils.sendToast(context.getString(R.string.downloaderr));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,12 +73,12 @@ public class OTADownloader {
|
||||
e.printStackTrace();
|
||||
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setTitle(AndroidUtils.getString("update_error"))
|
||||
.setMessage(AndroidUtils.getString("update_error_text"))
|
||||
.setPositiveButton(AndroidUtils.getString("no"),
|
||||
.setTitle(R.string.update_error)
|
||||
.setMessage(R.string.update_error_text)
|
||||
.setPositiveButton(R.string.no,
|
||||
(dialog, which) -> dialog.cancel()
|
||||
)
|
||||
.setNeutralButton(AndroidUtils.getString("yes"),
|
||||
.setNeutralButton(R.string.yes,
|
||||
(dialog, which) -> {
|
||||
var intent = new Intent(Intent.ACTION_VIEW)
|
||||
.setData(Uri.parse("https://github.com/vtosters/lite/releases/latest/download/VTLite.apk"));
|
||||
|
||||
@@ -4,8 +4,6 @@ import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.app.DownloadManager;
|
||||
import android.app.ProgressDialog;
|
||||
@@ -28,7 +26,6 @@ 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 {
|
||||
@@ -48,7 +45,7 @@ public class VideoDownloader {
|
||||
public static void injectAction(ArrayList<MenuBottomSheetAction> list, VideoFile video) {
|
||||
if (!video.U && !video.I1()) {
|
||||
addAction(list, DOWNLOAD_ID, R.drawable.ic_download_outline_24, R.string.download, 9);
|
||||
addAction(list, OPEN_EXTERNAL_LINK_ID, R.drawable.ic_link_outline_28, getIdentifier("interfacevideoext_short", "string"), 9);
|
||||
addAction(list, OPEN_EXTERNAL_LINK_ID, R.drawable.ic_link_outline_28, R.string.interfacevideoext_short, 9);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +87,7 @@ public class VideoDownloader {
|
||||
}
|
||||
|
||||
if (list.isEmpty()) {
|
||||
ToastUtils.a(getString("videodownloaderr"));
|
||||
ToastUtils.a(context.getString(R.string.videodownloaderr));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -127,12 +124,12 @@ public class VideoDownloader {
|
||||
|
||||
public static void parseVideoLink(String url, Context ctx) {
|
||||
if (url.contains("vk.com/story")) {
|
||||
ToastUtils.a(AndroidUtils.getString("video_dl_stories_not_supported"));
|
||||
ToastUtils.a(ctx.getString(R.string.video_dl_stories_not_supported));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!url.contains("vk.com/video")) {
|
||||
ToastUtils.a(AndroidUtils.getString("video_dl_wrong_link"));
|
||||
ToastUtils.a(ctx.getString(R.string.video_dl_wrong_link));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -140,7 +137,7 @@ public class VideoDownloader {
|
||||
String ownerId = videoId.split("_")[0];
|
||||
|
||||
final ProgressDialog progressDialog = new ProgressDialog(ctx);
|
||||
progressDialog.setMessage(AndroidUtils.getString("video_dl_progress"));
|
||||
progressDialog.setMessage(ctx.getString(R.string.video_dl_progress));
|
||||
progressDialog.show();
|
||||
|
||||
makeRequest("https://" + getApi() + "/method/video.get?owner_id=" + ownerId + "&videos=" + videoId + "&v=5.99&access_token=" + getUserToken(),
|
||||
@@ -156,7 +153,7 @@ public class VideoDownloader {
|
||||
downloadVideo(videoFile, ctx);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(ctx, AndroidUtils.getString("video_dl_error"), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(ctx, ctx.getString(R.string.video_dl_error), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,7 +1,5 @@
|
||||
package ru.vtosters.lite.downloaders.notifications;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
@@ -10,18 +8,20 @@ import android.os.Build;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
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 = getString("music_downloading");
|
||||
public static final String MUSIC_DOWNLOAD_CHANNEL_DESCRIPTION = getString("music_downloading_progress");
|
||||
public static final String MUSIC_DOWNLOAD_CHANNEL_NAME = AndroidUtils.getString(R.string.music_downloading);
|
||||
public static final String MUSIC_DOWNLOAD_CHANNEL_DESCRIPTION = AndroidUtils.getString(R.string.music_downloading_progress);
|
||||
|
||||
public static final String MUSIC_PLAYLIST_DOWNLOAD_CHANNEL_ID = "music_playlist_download_channel";
|
||||
public static final String MUSIC_PLAYLIST_DOWNLOAD_CHANNEL_NAME = getString("playlist_downloading");
|
||||
public static final String MUSIC_PLAYLIST_DOWNLOAD_CHANNEL_DESCRIPTION = getString("playlist_downloading_progress");
|
||||
public static final String MUSIC_PLAYLIST_DOWNLOAD_CHANNEL_NAME = AndroidUtils.getString(R.string.playlist_downloading);
|
||||
public static final String MUSIC_PLAYLIST_DOWNLOAD_CHANNEL_DESCRIPTION = AndroidUtils.getString(R.string.playlist_downloading_progress);
|
||||
|
||||
public static final String MUSIC_CACHING_NAME = getString("caching_track_or_pic");
|
||||
public static final String MUSIC_CACHING_NAME = AndroidUtils.getString(R.string.caching_track_or_pic);
|
||||
|
||||
private static NotificationManagerCompat notificationManagerCompat;
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@ import static android.widget.Toast.makeText;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ProgressDialog;
|
||||
@@ -15,6 +13,7 @@ import android.util.Log;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -126,7 +125,7 @@ public class FoafBase {
|
||||
|
||||
public static void loadAndShow(Context context, int i) {
|
||||
ProgressDialog progressDialog = new ProgressDialog(context);
|
||||
progressDialog.setMessage(getString("com_facebook_loading"));
|
||||
progressDialog.setMessage(context.getString(R.string.com_facebook_loading));
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
@@ -145,16 +144,16 @@ public class FoafBase {
|
||||
getNormalHumanDate(Objects.requireNonNull(matcher2.group(1)));
|
||||
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setTitle(getIdentifier("addinf", "string"))
|
||||
.setMessage(getString("foafid") +
|
||||
" " + i + getString("foafregdate")
|
||||
+ " " + normalHumanDate + getString("foafdate")
|
||||
.setTitle(R.string.addinf)
|
||||
.setMessage(context.getString(R.string.foafid) +
|
||||
" " + i + context.getString(R.string.foafregdate)
|
||||
+ " " + normalHumanDate + context.getString(R.string.foafdate)
|
||||
+ " " + daysPassedFromFoafDate(normalHumanDate))
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
makeText(getGlobalContext(), getString("foaferr"), LENGTH_SHORT).show();
|
||||
makeText(getGlobalContext(), context.getString(R.string.foaferr), LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.NewsFeedFiltersUtils;
|
||||
|
||||
@@ -2,7 +2,6 @@ package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.dnr.DNRInjector.forceInvalidateDialogActions;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.getCurrentActivity;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
@@ -17,12 +16,14 @@ import android.widget.LinearLayout;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.im.engine.models.dialogs.Dialog;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.encryption.EncryptProvider;
|
||||
import ru.vtosters.lite.encryption.base.IMProcessor;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class CryptImHook {
|
||||
public static boolean isPrivateProcessor(int peerID) {
|
||||
@@ -42,7 +43,7 @@ public class CryptImHook {
|
||||
int enabledPosition = 0;
|
||||
|
||||
String[] titles = new String[processors.size() + 1];
|
||||
titles[0] = getString("encryption_disable");
|
||||
titles[0] = AndroidUtils.getString(R.string.encryption_disable);
|
||||
|
||||
for (int i = 0; i < processors.size(); i++) {
|
||||
IMProcessor proc = processors.get(i);
|
||||
@@ -59,12 +60,12 @@ public class CryptImHook {
|
||||
Activity ctx = getCurrentActivity();
|
||||
|
||||
if (ctx == null) {
|
||||
sendToast(getString("app_activities_error"));
|
||||
sendToast(AndroidUtils.getString(R.string.app_activities_error));
|
||||
return;
|
||||
}
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(getString("encryption_sett"))
|
||||
.setTitle(AndroidUtils.getString(R.string.encryption_sett))
|
||||
.setSingleChoiceItems(titles, enabledPosition, (dialog, which) -> {
|
||||
if (which == 0) {
|
||||
if (finalEnabled != null) finalEnabled.disableEncryptFor(peerId);
|
||||
@@ -96,7 +97,7 @@ public class CryptImHook {
|
||||
}
|
||||
|
||||
if (enabled != null && enabled.isPublic()) {
|
||||
sendToast(getString("encryption_public_algorithm_error"));
|
||||
sendToast(AndroidUtils.getString(R.string.encryption_public_algorithm_error));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ public class CryptImHook {
|
||||
Context ctx = getCurrentActivity();
|
||||
|
||||
if (ctx == null) {
|
||||
sendToast(getString("app_activities_error"));
|
||||
sendToast(ctx.getString(R.string.app_activities_error));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -130,8 +131,8 @@ public class CryptImHook {
|
||||
|
||||
IMProcessor finalEnabled = enabled;
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(getString("encryption_enter_key"))
|
||||
.setMessage(String.format(getString("encryption_current_algorithm_title"), enabled.getUIName()))
|
||||
.setTitle(R.string.encryption_enter_key)
|
||||
.setMessage(String.format(ctx.getString(R.string.encryption_current_algorithm_title), enabled.getUIName()))
|
||||
.setView(linearLayout)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
Editable edit = editText.getText();
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getStringDate;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class DateHook {
|
||||
public static boolean fulltime() {
|
||||
return getPrefsValue("dateformat").equals("noyear") || getPrefsValue("dateformat").equals("full") || getPrefsValue("dateformat").equals("noseconds");
|
||||
@@ -19,11 +21,11 @@ public class DateHook {
|
||||
public static String getDateFormat() {
|
||||
switch (getPrefsValue("dateformat")) {
|
||||
case "noyear":
|
||||
return getString("fulltime2");
|
||||
return AndroidUtils.getString(R.string.fulltime2);
|
||||
case "full":
|
||||
return getString("fulltime");
|
||||
return AndroidUtils.getString(R.string.fulltime);
|
||||
default:
|
||||
return getString("fulltime3");
|
||||
return AndroidUtils.getString(R.string.fulltime3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +40,7 @@ public class DateHook {
|
||||
if (!fulltime()) return null;
|
||||
|
||||
try {
|
||||
return getStringDate(isFemale ? getIdentifier("last_seen_profile_f", "string") : getIdentifier("last_seen_profile_m", "string"), date.format(new Date(time)));
|
||||
return getStringDate(isFemale ? R.string.last_seen_profile_f : R.string.last_seen_profile_m, date.format(new Date(time)));
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
return null;
|
||||
|
||||
@@ -3,9 +3,10 @@ package ru.vtosters.lite.hooks;
|
||||
import static ru.vtosters.lite.foaf.FoafBase.getBypassedOnlineInfo;
|
||||
import static ru.vtosters.lite.hooks.DateHook.getLocale;
|
||||
import static ru.vtosters.lite.hooks.OnlineFormatterHook.onlineHookProfiles;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.*;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogHeader;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogPlaylist;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogSeparator;
|
||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getPlaylist;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getStatic;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
@@ -24,6 +25,7 @@ import android.util.Log;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vk.core.util.DeviceIdProvider;
|
||||
import com.vk.core.util.LangUtils;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -31,7 +33,6 @@ import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
@@ -41,7 +42,6 @@ import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
import ru.vtosters.lite.music.cache.helpers.PlaylistHelper;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class JsonInjectors {
|
||||
}
|
||||
|
||||
public static JSONObject donateRecomm() throws JSONException {
|
||||
var title = AndroidUtils.getString("donate_to_vtl");
|
||||
var title = AndroidUtils.getString(R.string.donate_to_vtl);
|
||||
var link = "https://vk.com/vtosters_official";
|
||||
var text_color = "2D81E0";
|
||||
|
||||
@@ -112,7 +112,7 @@ public class JsonInjectors {
|
||||
}
|
||||
|
||||
public static JSONObject vktesters(int id) throws JSONException {
|
||||
var title = AndroidUtils.getString("tester_profile");
|
||||
var title = AndroidUtils.getString(R.string.tester_profile);
|
||||
var text_color = "2D81E0";
|
||||
var link = "https://" + getStatic() + "/bugs?lang=" + LangUtils.a() + "#/reporter" + id;
|
||||
|
||||
@@ -156,7 +156,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 = AndroidUtils.getString("no_data_error");
|
||||
var text = AndroidUtils.getString(R.string.no_data_error);
|
||||
var link = "https://vtosters.app"; // can be null
|
||||
var linktitle = "Test button"; // can be null
|
||||
|
||||
@@ -165,10 +165,10 @@ public class JsonInjectors {
|
||||
|
||||
var isPicture = pic.endsWith(".png") || pic.endsWith(".jpg") || pic.endsWith(".jpeg") || pic.endsWith(".webp");
|
||||
|
||||
if (isVerified(peerid)) text = AndroidUtils.getString("i_bought") + " VTosters Premium";
|
||||
if (isVerified(peerid)) text = AndroidUtils.getString(R.string.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");
|
||||
text = AndroidUtils.getString(R.string.i_bought) + " VTosters Premium Gold Prime Pro Plus";
|
||||
if (isDeveloper(peerid)) text = AndroidUtils.getString(R.string.i_created_poop);
|
||||
|
||||
if (!isVerified(peerid) || text.equals("") || peerid == AccountManagerUtils.getUserId() || peerid == 0) {
|
||||
if (getBoolValue("convBarRecomm", false)) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import static ru.vtosters.lite.hooks.JsonInjectors.setOnlineInfoUsers;
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
@@ -13,6 +12,8 @@ import static ru.vtosters.lite.utils.Preferences.getPrefsFromFile;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -64,37 +65,37 @@ public class OnlineFormatterHook {
|
||||
case 5027722:
|
||||
return "VK Messenger (Desktop)";
|
||||
case 6146827:
|
||||
return AndroidUtils.getString("vk_messenger") + " (Android)"; // VK Мессенджер (Android)
|
||||
return AndroidUtils.getString(R.string.vk_messenger) + " (Android)"; // VK Мессенджер (Android)
|
||||
case 6482950:
|
||||
return AndroidUtils.getString("vk_messenger") + " (iPhone)"; // VK Мессенджер (iPhone)
|
||||
return AndroidUtils.getString(R.string.vk_messenger) + " (iPhone)"; // VK Мессенджер (iPhone)
|
||||
case 6481715:
|
||||
return AndroidUtils.getString("vk_messenger") + " Dev (iPhone)"; // VK Мессенджер Dev (iPhone)
|
||||
return AndroidUtils.getString(R.string.vk_messenger) + " Dev (iPhone)"; // VK Мессенджер Dev (iPhone)
|
||||
case 7799655:
|
||||
return AndroidUtils.getString("vk_mail_online"); // VK Почта
|
||||
return AndroidUtils.getString(R.string.vk_mail_online); // VK Почта
|
||||
case 7598572:
|
||||
return AndroidUtils.getString("sferum_online") + " (Android)"; // Сферум (Android)
|
||||
return AndroidUtils.getString(R.string.sferum_online) + " (Android)"; // Сферум (Android)
|
||||
case 7571751:
|
||||
return AndroidUtils.getString("sferum_online") + " (iPhone)"; // Сферум (iPhone)
|
||||
return AndroidUtils.getString(R.string.sferum_online) + " (iPhone)"; // Сферум (iPhone)
|
||||
case 7556576:
|
||||
return AndroidUtils.getString("sferum_online"); // Сферум
|
||||
return AndroidUtils.getString(R.string.sferum_online); // Сферум
|
||||
case 7497650:
|
||||
return "VK ID";
|
||||
case 8094476:
|
||||
return AndroidUtils.getString("vk_calls_online") + " (Android)"; // VK Звонки (Android)
|
||||
return AndroidUtils.getString(R.string.vk_calls_online) + " (Android)"; // VK Звонки (Android)
|
||||
case 8093730:
|
||||
return AndroidUtils.getString("vk_calls_online") + " (iPhone)"; // VK Звонки (iPhone)
|
||||
return AndroidUtils.getString(R.string.vk_calls_online) + " (iPhone)"; // VK Звонки (iPhone)
|
||||
case 7793118:
|
||||
return AndroidUtils.getString("vk_calls_online") + " (Desktop)"; // VK Звонки (Desktop)
|
||||
return AndroidUtils.getString(R.string.vk_calls_online) + " (Desktop)"; // VK Звонки (Desktop)
|
||||
case 6767438:
|
||||
return AndroidUtils.getString("vk_music_online") + " (Android)"; // VK Музыка (Android)
|
||||
return AndroidUtils.getString(R.string.vk_music_online) + " (Android)"; // VK Музыка (Android)
|
||||
case 8113297:
|
||||
return AndroidUtils.getString("vk_clips_online") + " (Android)"; // VK Клипы (Android)
|
||||
return AndroidUtils.getString(R.string.vk_clips_online) + " (Android)"; // VK Клипы (Android)
|
||||
case 8106428:
|
||||
return AndroidUtils.getString("vk_clips_online") + " (iPhone)"; // VK Клипы (iPhone)
|
||||
return AndroidUtils.getString(R.string.vk_clips_online) + " (iPhone)"; // VK Клипы (iPhone)
|
||||
case 5044491:
|
||||
return "Candy";
|
||||
case 8114066:
|
||||
return AndroidUtils.getString("vk_video_online"); // VK Видео
|
||||
return AndroidUtils.getString(R.string.vk_video_online); // VK Видео
|
||||
case 4894723:
|
||||
return "Phoenix Lite";
|
||||
case 4994316:
|
||||
@@ -173,7 +174,7 @@ public class OnlineFormatterHook {
|
||||
|
||||
if (appname == null) return null;
|
||||
|
||||
return getString("custom_online") + " " + appname;
|
||||
return AndroidUtils.getString(R.string.custom_online) + " " + appname;
|
||||
}
|
||||
|
||||
public static JSONObject onlineHook(JSONObject json) throws ParseException, IOException, JSONException {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ClipData;
|
||||
@@ -46,7 +44,7 @@ public class PhotoViewer {
|
||||
static OkHttpClient client = new OkHttpClient();
|
||||
|
||||
public static boolean interceptClick(AttachmentWithMedia attachment, MenuItem item, View view) {
|
||||
if (item.getItemId() == AndroidUtils.getIdentifier("search_photo", "id")) {
|
||||
if (item.getItemId() == R.id.search_photo) {
|
||||
if (attachment instanceof PhotoAttachment) {
|
||||
searchPhoto(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
||||
} else if (attachment instanceof DocumentAttachment) {
|
||||
@@ -55,13 +53,13 @@ public class PhotoViewer {
|
||||
try {
|
||||
searchPhoto(getUrlFromDocumentAttachment(documentAttachment));
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
else
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
return true;
|
||||
} else if (item.getItemId() == AndroidUtils.getIdentifier("copy_photo_url", "id")) {
|
||||
} else if (item.getItemId() == R.id.copy_photo_url) {
|
||||
if (attachment instanceof PhotoAttachment) {
|
||||
copyPhotoUrl(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
||||
} else if (attachment instanceof DocumentAttachment) {
|
||||
@@ -70,13 +68,13 @@ public class PhotoViewer {
|
||||
try {
|
||||
copyPhotoUrl(getUrlFromDocumentAttachment(documentAttachment));
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
else
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
return true;
|
||||
} else if (item.getItemId() == AndroidUtils.getIdentifier("open_original_photo", "id")) {
|
||||
} else if (item.getItemId() == R.id.open_original_photo) {
|
||||
if (attachment instanceof PhotoAttachment) {
|
||||
openUrl(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
||||
} else if (attachment instanceof DocumentAttachment) {
|
||||
@@ -85,10 +83,10 @@ public class PhotoViewer {
|
||||
try {
|
||||
openUrl(getUrlFromDocumentAttachment(documentAttachment));
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
else
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -97,7 +95,7 @@ public class PhotoViewer {
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
public static void addMenuItems(AttachmentWithMedia attachment, ActionsPopup.b actionPopup, int i, boolean z) {
|
||||
actionPopup.a(getIdentifier("search_photo_content", "string"),
|
||||
actionPopup.a(R.string.search_photo_content,
|
||||
ThemesUtils.isDarkTheme()
|
||||
? AndroidUtils.getGlobalContext().getDrawable(R.drawable.ic_menu_search_outline_28)
|
||||
: new RecoloredDrawable(AndroidUtils.getGlobalContext().getDrawable(R.drawable.ic_menu_search_outline_28), ThemesUtils.getAccentColor()),
|
||||
@@ -111,15 +109,15 @@ public class PhotoViewer {
|
||||
try {
|
||||
searchPhoto(getUrlFromDocumentAttachment(documentAttachment));
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
else
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
);
|
||||
actionPopup.a(getIdentifier("copy_photo_url_content", "string"),
|
||||
actionPopup.a(R.string.copy_photo_url_content,
|
||||
!ThemesUtils.isDarkTheme()
|
||||
? new RecoloredDrawable(AndroidUtils.getGlobalContext().getDrawable(R.drawable.ic_copy_outline_28), ThemesUtils.getAccentColor())
|
||||
: new RecoloredDrawable(AndroidUtils.getGlobalContext().getDrawable(R.drawable.ic_copy_outline_28), Color.WHITE),
|
||||
@@ -133,15 +131,15 @@ public class PhotoViewer {
|
||||
try {
|
||||
copyPhotoUrl(getUrlFromDocumentAttachment(documentAttachment));
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
else
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
);
|
||||
actionPopup.a(getIdentifier("open_original_photo_content", "string"),
|
||||
actionPopup.a(R.string.open_original_photo_content,
|
||||
ThemesUtils.isDarkTheme()
|
||||
? AndroidUtils.getGlobalContext().getDrawable(R.drawable.ic_link_outline_28)
|
||||
: new RecoloredDrawable(AndroidUtils.getGlobalContext().getDrawable(R.drawable.ic_link_outline_28),
|
||||
@@ -156,10 +154,10 @@ public class PhotoViewer {
|
||||
try {
|
||||
openUrl(getUrlFromDocumentAttachment(documentAttachment));
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
else
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
ToastUtils.a(R.string.photo_get_error);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -248,7 +246,7 @@ public class PhotoViewer {
|
||||
if (url == null || url.isEmpty()) return;
|
||||
ClipboardManager manager = (ClipboardManager) AndroidUtils.getGlobalContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
manager.setPrimaryClip(ClipData.newPlainText("vk_photo_url", url));
|
||||
Toast.makeText(AndroidUtils.getGlobalContext(), AndroidUtils.getIdentifier("copied_to_clipboard", "string"), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(AndroidUtils.getGlobalContext(), R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private static void openUrl(String url) {
|
||||
|
||||
@@ -21,15 +21,14 @@ import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import com.vk.auth.ui.VkAuthTextView;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.ProxySettingsFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ProxyHook {
|
||||
public static void hookAuth(View v) {
|
||||
VkAuthTextView button = (VkAuthTextView) v;
|
||||
button.setText(AndroidUtils.getString("proxy_setup"));
|
||||
button.setText(R.string.proxy_setup);
|
||||
button.setOnClickListener(v1 -> callProxyDialog(v1.getContext()));
|
||||
}
|
||||
|
||||
@@ -54,16 +53,16 @@ public class ProxyHook {
|
||||
|
||||
rg.setPadding(dp2px(18f), dp2px(12f), dp2px(18f), 0);
|
||||
|
||||
rgDefault.setText(AndroidUtils.getString("proxy_disable"));
|
||||
rgDefault.setText(ctx.getString(R.string.proxy_disable));
|
||||
rgDefault.setTextColor(getTextAttr());
|
||||
|
||||
rgZaborona.setText(AndroidUtils.getString("proxy_enable") + " (Zaborona)");
|
||||
rgZaborona.setText(ctx.getString(R.string.proxy_enable) + " (Zaborona)");
|
||||
rgZaborona.setTextColor(getTextAttr());
|
||||
|
||||
rgRandomProxy.setText(AndroidUtils.getString("proxy_enable") + " (Random Socks Proxy)");
|
||||
rgRandomProxy.setText(ctx.getString(R.string.proxy_enable) + " (Random Socks Proxy)");
|
||||
rgRandomProxy.setTextColor(getTextAttr());
|
||||
|
||||
rgVika.setText(AndroidUtils.getString("proxy_enable") + " (Vika Mobile)");
|
||||
rgVika.setText(ctx.getString(R.string.proxy_enable) + " (Vika Mobile)");
|
||||
rgVika.setTextColor(getTextAttr());
|
||||
|
||||
rgZaborona.setChecked(isZaboronaEnabled());
|
||||
@@ -72,10 +71,10 @@ public class ProxyHook {
|
||||
rgVika.setChecked(isVikaProxyEnabled());
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(AndroidUtils.getString("vtlproxy"))
|
||||
.setMessage(AndroidUtils.getString("proxy_warning"))
|
||||
.setTitle(ctx.getString(R.string.vtlproxy))
|
||||
.setMessage(ctx.getString(R.string.proxy_warning))
|
||||
.setView(rg)
|
||||
.setPositiveButton(AndroidUtils.getString("vtl_confirm"), ((dialog, which) -> { // Применить
|
||||
.setPositiveButton(ctx.getString(R.string.vtl_confirm), ((dialog, which) -> { // Применить
|
||||
if (rgZaborona.isChecked()) {
|
||||
edit().putString("proxy", "zaborona").commit();
|
||||
restartApplication();
|
||||
@@ -90,7 +89,7 @@ public class ProxyHook {
|
||||
restartApplication();
|
||||
}
|
||||
}))
|
||||
.setNeutralButton(AndroidUtils.getString("proxy_settings"), ((dialog, which) -> {
|
||||
.setNeutralButton(ctx.getString(R.string.proxy_settings), ((dialog, which) -> {
|
||||
var intent = new Navigator(ProxySettingsFragment.class)
|
||||
.b(ctx)
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
@@ -5,7 +5,6 @@ import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAttrId;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getBackgroundContent;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getBackgroundPage;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getColorFromAttr;
|
||||
@@ -17,6 +16,7 @@ import static ru.vtosters.lite.utils.ThemesUtils.hex;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.vk.articles.preload.WebCachePreloader;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.data.ThemeTracker;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -61,10 +61,10 @@ public class VKUIHook {
|
||||
.replace("%header_text%", hex(getHeaderText()))
|
||||
.replace("%accent%", hex(getAccentColor()))
|
||||
.replace("%background_page%", hex(getBackgroundPage()))
|
||||
.replace("%content_tint_background%", hex(getColorFromAttr(getAttrId("content_tint_background"))))
|
||||
.replace("%button_primary_background%", hex(getColorFromAttr(getAttrId("button_primary_background"))))
|
||||
.replace("%button_outline_foreground%", hex(getColorFromAttr(getAttrId("button_outline_foreground"))))
|
||||
.replace("%button_outline_border%", hex(getColorFromAttr(getAttrId("button_outline_border"))))
|
||||
.replace("%content_tint_background%", hex(getColorFromAttr(R.attr.content_tint_background)))
|
||||
.replace("%button_primary_background%", hex(getColorFromAttr(R.attr.button_primary_background)))
|
||||
.replace("%button_outline_foreground%", hex(getColorFromAttr(R.attr.button_outline_foreground)))
|
||||
.replace("%button_outline_border%", hex(getColorFromAttr(R.attr.button_outline_border)))
|
||||
.replace("%text_primary%", hex(getTextAttr()));
|
||||
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@ package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.utils.Preferences.wbios;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class WritebarHook {
|
||||
public static int getWriteBar() {
|
||||
return AndroidUtils.getIdentifier((wbios() ? "write_bar_i" : "write_bar"), "layout");
|
||||
return wbios() ? R.layout.write_bar_i : R.layout.write_bar;
|
||||
}
|
||||
|
||||
public static int getIconsColors(int def) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.concurrent.Executors;
|
||||
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClientImpl;
|
||||
import ru.vtosters.lite.downloaders.AudioDownloader;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class MusicBottomSheetHook {
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
@@ -61,18 +60,18 @@ public class MusicBottomSheetHook {
|
||||
|
||||
if (isCached(trackid)) {
|
||||
actions.add(new MusicAction(
|
||||
AndroidUtils.getIdentifier("music_action_toggle_download", "id"),
|
||||
R.id.music_action_toggle_download,
|
||||
milkshake() ? R.drawable.ic_delete_outline_28 : R.drawable.ic_delete_24,
|
||||
AndroidUtils.getIdentifier("remove_from_cache", "string"),
|
||||
R.string.remove_from_cache,
|
||||
musicTrack.F1() ? R.color.music_action_button_gray_50_alpha : R.color.caption_gray,
|
||||
R.string.music_talkback_empty,
|
||||
false
|
||||
));
|
||||
} else {
|
||||
actions.add(new MusicAction(
|
||||
AndroidUtils.getIdentifier("music_action_toggle_download", "id"),
|
||||
R.id.music_action_toggle_download,
|
||||
milkshake() ? R.drawable.ic_download_outline_28 : R.drawable.ic_download_24,
|
||||
AndroidUtils.getIdentifier("add_to_cache", "string"),
|
||||
R.string.add_to_cache,
|
||||
musicTrack.F1() ? R.color.music_action_button_gray_50_alpha : R.color.caption_gray,
|
||||
R.string.music_talkback_empty,
|
||||
false
|
||||
@@ -103,10 +102,10 @@ public class MusicBottomSheetHook {
|
||||
}
|
||||
|
||||
public static boolean injectOnClick(int actionId, MusicTrack track, MusicPlaybackLaunchContext context, Playlist playlist) { // musictrack inj
|
||||
if (actionId == AndroidUtils.getIdentifier("play_in_vkx", "id"))
|
||||
if (actionId == R.id.play_in_vkx)
|
||||
return tryPlayInVKX(track, context, playlist);
|
||||
|
||||
if (actionId == AndroidUtils.getIdentifier("remove_from_cache_vkx", "id")) {
|
||||
if (actionId == R.id.remove_from_cache_vkx) {
|
||||
getInstance().runOnService(service -> {
|
||||
try {
|
||||
service.deleteTrackFromCache(track.d, track.e);
|
||||
@@ -115,7 +114,7 @@ public class MusicBottomSheetHook {
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else if (actionId == AndroidUtils.getIdentifier("add_to_cache_vkx", "id")) {
|
||||
} else if (actionId == R.id.add_to_cache_vkx) {
|
||||
getInstance().runOnService(service -> {
|
||||
try {
|
||||
service.addTrackToCache(track.d, track.e, (track.J != null) ? track.J : "");
|
||||
@@ -126,7 +125,7 @@ public class MusicBottomSheetHook {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (actionId == AndroidUtils.getIdentifier("download_mp3", "id")) {
|
||||
if (actionId == R.id.download_mp3) {
|
||||
if (isIntegrationEnabled()) {
|
||||
getInstance().runOnService(service -> {
|
||||
try {
|
||||
@@ -146,15 +145,15 @@ public class MusicBottomSheetHook {
|
||||
}
|
||||
|
||||
public static boolean injectOnClick(int actionId, Playlist playlist) { // playlist inj
|
||||
if (actionId == AndroidUtils.getIdentifier("play_in_vkx", "id"))
|
||||
if (actionId == R.id.play_in_vkx)
|
||||
return tryPlayInVKX(null, null, playlist);
|
||||
|
||||
if (actionId == AndroidUtils.getIdentifier("add_to_cache", "id")) {
|
||||
if (actionId == R.id.add_to_cache) {
|
||||
executor.submit(() -> AudioDownloader.cachePlaylist(playlist));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (actionId == AndroidUtils.getIdentifier("remove_from_cache_vkx", "id")) {
|
||||
if (actionId == R.id.remove_from_cache_vkx) {
|
||||
getInstance().runOnService(service -> {
|
||||
try {
|
||||
service.deletePlaylistFromCache(playlist.a, playlist.b);
|
||||
@@ -163,7 +162,7 @@ public class MusicBottomSheetHook {
|
||||
}
|
||||
});
|
||||
return true;
|
||||
} else if (actionId == AndroidUtils.getIdentifier("add_to_cache_vkx", "id")) {
|
||||
} else if (actionId == R.id.add_to_cache_vkx) {
|
||||
getInstance().runOnService(service -> {
|
||||
try {
|
||||
service.addPlaylistToCache(playlist.a, playlist.b, (playlist.Q != null) ? playlist.Q : "");
|
||||
@@ -174,7 +173,7 @@ public class MusicBottomSheetHook {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (actionId == AndroidUtils.getIdentifier("download_mp3", "id")) {
|
||||
if (actionId == R.id.download_mp3) {
|
||||
if (isIntegrationEnabled()) {
|
||||
getInstance().runOnService(service -> {
|
||||
try {
|
||||
@@ -207,9 +206,9 @@ public class MusicBottomSheetHook {
|
||||
|
||||
private static MusicAction getPlayInVKXAction() {
|
||||
return new MusicAction(
|
||||
AndroidUtils.getIdentifier("play_in_vkx", "id"),
|
||||
R.id.play_in_vkx,
|
||||
milkshake() ? R.drawable.ic_music_outline_24 : R.drawable.ic_music_24,
|
||||
AndroidUtils.getIdentifier("play_in_vkx", "string"),
|
||||
R.string.play_in_vkx,
|
||||
R.color.caption_gray,
|
||||
R.string.music_talkback_empty,
|
||||
false
|
||||
@@ -218,9 +217,9 @@ public class MusicBottomSheetHook {
|
||||
|
||||
private static MusicAction getRemoveCacheTrackAction() {
|
||||
return new MusicAction(
|
||||
AndroidUtils.getIdentifier("remove_from_cache", "id"),
|
||||
R.id.remove_from_cache,
|
||||
milkshake() ? R.drawable.ic_delete_outline_28 : R.drawable.ic_delete_24,
|
||||
AndroidUtils.getIdentifier("remove_from_cache", "string"),
|
||||
R.string.remove_from_cache,
|
||||
R.color.caption_gray,
|
||||
R.string.music_talkback_empty,
|
||||
false
|
||||
@@ -229,9 +228,9 @@ public class MusicBottomSheetHook {
|
||||
|
||||
private static MusicAction addToCacheTrackAction() {
|
||||
return new MusicAction(
|
||||
AndroidUtils.getIdentifier("add_to_cache", "id"),
|
||||
R.id.add_to_cache,
|
||||
milkshake() ? R.drawable.ic_add_outline_28 : R.drawable.ic_add_24,
|
||||
AndroidUtils.getIdentifier("add_to_cache", "string"),
|
||||
R.string.add_to_cache,
|
||||
R.color.caption_gray,
|
||||
R.string.music_talkback_empty,
|
||||
false
|
||||
@@ -240,9 +239,9 @@ public class MusicBottomSheetHook {
|
||||
|
||||
private static MusicAction getRemoveCacheTrackVkxAction() {
|
||||
return new MusicAction(
|
||||
AndroidUtils.getIdentifier("remove_from_cache_vkx", "id"),
|
||||
R.id.remove_from_cache_vkx,
|
||||
milkshake() ? R.drawable.ic_delete_outline_28 : R.drawable.ic_delete_24,
|
||||
AndroidUtils.getIdentifier("remove_from_cache_vkx", "string"),
|
||||
R.string.remove_from_cache_vkx,
|
||||
R.color.caption_gray,
|
||||
R.string.music_talkback_empty,
|
||||
false
|
||||
@@ -251,9 +250,9 @@ public class MusicBottomSheetHook {
|
||||
|
||||
private static MusicAction addToCacheTrackVkxAction() {
|
||||
return new MusicAction(
|
||||
AndroidUtils.getIdentifier("add_to_cache_vkx", "id"),
|
||||
R.id.add_to_cache_vkx,
|
||||
milkshake() ? R.drawable.ic_add_outline_28 : R.drawable.ic_add_24,
|
||||
AndroidUtils.getIdentifier("add_to_cache_vkx", "string"),
|
||||
R.string.add_to_cache_vkx,
|
||||
R.color.caption_gray,
|
||||
R.string.music_talkback_empty,
|
||||
false
|
||||
@@ -262,9 +261,9 @@ public class MusicBottomSheetHook {
|
||||
|
||||
private static MusicAction downloadAsMp3Action() {
|
||||
return new MusicAction(
|
||||
AndroidUtils.getIdentifier("download_mp3", "id"),
|
||||
R.id.download_mp3,
|
||||
milkshake() ? R.drawable.ic_download_outline_28 : R.drawable.ic_download_24,
|
||||
AndroidUtils.getIdentifier("download_mp3", "string"),
|
||||
R.string.download_mp3,
|
||||
R.color.caption_gray,
|
||||
R.string.music_talkback_empty,
|
||||
false
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.util.Log;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -112,7 +113,7 @@ public class LastFMScrobbler {
|
||||
|
||||
public static void authenticate(String username, String password) {
|
||||
if (TextUtils.isEmpty(username) || TextUtils.isEmpty(password)) {
|
||||
AndroidUtils.sendToast(AndroidUtils.getString("lastfm_credentials_empty"));
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.lastfm_credentials_empty));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -126,7 +127,7 @@ public class LastFMScrobbler {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("Scrobbler", "Auth failed", e);
|
||||
AndroidUtils.sendToast(AndroidUtils.getString("auth_error_vtl"));
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.auth_error_vtl));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,7 +195,7 @@ public class LastFMScrobbler {
|
||||
.putBoolean("lastfm_enabled", false)
|
||||
.apply();
|
||||
SCROBBLED_UUIDS.clear();
|
||||
AndroidUtils.sendToast(AndroidUtils.getString("lastfm_logout_success"));
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.lastfm_logout_success));
|
||||
}
|
||||
|
||||
public static boolean needScrobbling(String uid) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package ru.vtosters.lite.music.cache;
|
||||
|
||||
import static ru.vtosters.lite.music.cache.FileCacheImplementation.getCacheDir;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.IOUtils.deleteRecursive;
|
||||
|
||||
@@ -19,6 +18,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.List;
|
||||
import bruhcollective.itaysonlab.libvkx.ILibVkxService;
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClientImpl;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class CacheDatabaseDelegate {
|
||||
private static final int DB_VERSION = 0x1;
|
||||
@@ -85,7 +86,7 @@ public class CacheDatabaseDelegate {
|
||||
getHelper().getReadableDatabase().execSQL(formula);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ToastUtils.a(getString("track_bd_insert_err") + " [" + e.getMessage() + "]", true);
|
||||
ToastUtils.a(AndroidUtils.getString(R.string.track_bd_insert_err) + " [" + e.getMessage() + "]", true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +97,7 @@ public class CacheDatabaseDelegate {
|
||||
public static void clear() {
|
||||
getHelper().getReadableDatabase().execSQL(String.format("DELETE FROM %s", TABLE_NAME));
|
||||
deleteRecursive(getCacheDir());
|
||||
sendToast(getString("cached_tracks_deleted"));
|
||||
sendToast(AndroidUtils.getString(R.string.cached_tracks_deleted));
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package ru.vtosters.lite.music.cache;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package ru.vtosters.lite.music.cache.helpers;
|
||||
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserPhoto;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import com.vk.dto.music.Playlist;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -15,7 +14,7 @@ import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
import ru.vtosters.lite.music.cache.FileCacheImplementation;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class PlaylistHelper {
|
||||
|
||||
@@ -55,7 +54,7 @@ public class PlaylistHelper {
|
||||
.put("type", 1)
|
||||
.put("album_type", "main_only")
|
||||
.put("title", title)
|
||||
.put("description", albumId + "/ " + getString("cached_album_warning"))
|
||||
.put("description", albumId + "/ " + AndroidUtils.getString(R.string.cached_album_warning))
|
||||
.put("main_artists", new JSONArray()
|
||||
.put(new JSONObject().put("name", artist)
|
||||
.put("id", "-1")
|
||||
@@ -92,8 +91,8 @@ public class PlaylistHelper {
|
||||
.put("owner_id", getUserId())
|
||||
.put("type", 0)
|
||||
.put("album_type", "playlist")
|
||||
.put("title", getString("cached_tracks_title"))
|
||||
.put("description", getString("cached_tracks_desc"))
|
||||
.put("title", AndroidUtils.getString(R.string.cached_tracks_title))
|
||||
.put("description", AndroidUtils.getString(R.string.cached_tracks_desc))
|
||||
.put("access_key", "cache")
|
||||
.put("genres", new JSONArray())
|
||||
.put("is_following", false)
|
||||
@@ -135,7 +134,7 @@ public class PlaylistHelper {
|
||||
.put("data_type", "none")
|
||||
.put("layout", new JSONObject()
|
||||
.put("name", "header")
|
||||
.put("title", getString("cached_tracks_title")));
|
||||
.put("title", AndroidUtils.getString(R.string.cached_tracks_title)));
|
||||
}
|
||||
|
||||
public static JSONObject getCatalogSeparator() throws JSONException {
|
||||
|
||||
-1
@@ -21,7 +21,6 @@ import ru.vtosters.lite.downloaders.AudioDownloader;
|
||||
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
|
||||
import ru.vtosters.lite.music.cache.helpers.PlaylistHelper;
|
||||
import ru.vtosters.lite.music.cache.helpers.TracklistHelper;
|
||||
import ru.vtosters.lite.utils.NetworkUtils;
|
||||
|
||||
public class PlaylistInjector {
|
||||
|
||||
|
||||
+6
-5
@@ -1,13 +1,13 @@
|
||||
package ru.vtosters.lite.music.cache.injectors;
|
||||
|
||||
import static ru.vtosters.lite.music.cache.CacheDatabaseDelegate.hasTracks;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.catalog2.core.CatalogParser;
|
||||
import com.vk.catalog2.core.api.dto.CatalogResponse;
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -23,6 +23,7 @@ import io.reactivex.ObservableOnSubscribe;
|
||||
import ru.vtosters.lite.music.cache.helpers.PlaylistHelper;
|
||||
import ru.vtosters.lite.music.cache.helpers.TracklistHelper;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.NetworkUtils;
|
||||
|
||||
public class TracklistInjector {
|
||||
@@ -69,7 +70,7 @@ public class TracklistInjector {
|
||||
}
|
||||
|
||||
private static JSONObject getEmptyCatalog() throws JSONException {
|
||||
return new JSONObject("{\"catalog\":{\"default_section\":\"cache\",\"sections\":[{\"id\":\"cache\",\"title\":\"" + getString("cached_content_title") + "\",\"blocks\":[{\"data_type\":\"placeholder\",\"id\":\"0\",\"layout\":{\"name\":\"placeholder_big\"},\"placeholder_ids\":[\"_synth_trackEmpty\"]}]}]},\"audios\":[],\"playlists\":[],\"placeholders\":[{\"id\":\"_synth_trackEmpty\",\"title\":\"" + getString("cached_content_empty") + "\",\"text\":\"" + getString("cached_content_empty_desc") + "\",\"buttons\":[]}]}");
|
||||
return new JSONObject("{\"catalog\":{\"default_section\":\"cache\",\"sections\":[{\"id\":\"cache\",\"title\":\"" + AndroidUtils.getString(R.string.cached_content_title) + "\",\"blocks\":[{\"data_type\":\"placeholder\",\"id\":\"0\",\"layout\":{\"name\":\"placeholder_big\"},\"placeholder_ids\":[\"_synth_trackEmpty\"]}]}]},\"audios\":[],\"playlists\":[],\"placeholders\":[{\"id\":\"_synth_trackEmpty\",\"title\":\"" + AndroidUtils.getString(R.string.cached_content_empty) + "\",\"text\":\"" + AndroidUtils.getString(R.string.cached_content_empty_desc) + "\",\"buttons\":[]}]}");
|
||||
}
|
||||
|
||||
public static void injectIntoExistingCatalog(JSONObject catalogNode) {
|
||||
@@ -160,8 +161,8 @@ public class TracklistInjector {
|
||||
var catalogBanner = new JSONObject()
|
||||
.put("id", 1234)
|
||||
.put("image_mode", "cover")
|
||||
.put("title", getString("vkx_integration_title"))
|
||||
.put("text", getString("vkx_integration_desc"))
|
||||
.put("title", AndroidUtils.getString(R.string.vkx_integration_title))
|
||||
.put("text", AndroidUtils.getString(R.string.vkx_integration_desc))
|
||||
.put("click_action", new JSONObject().put("action", clickAction));
|
||||
var catalogBanners = new JSONArray()
|
||||
.put(catalogBanner);
|
||||
@@ -200,7 +201,7 @@ public class TracklistInjector {
|
||||
|
||||
var section = new JSONObject()
|
||||
.put("id", randomId)
|
||||
.put("title", getString("saved_tracks_title"))
|
||||
.put("title", AndroidUtils.getString(R.string.saved_tracks_title))
|
||||
.put("url", "synth:cache")
|
||||
.put("blocks", blocks);
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package ru.vtosters.lite.music.callback;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
|
||||
import ru.vtosters.lite.music.Callback;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class MusicCallbackBuilder {
|
||||
private static final NotificationManagerCompat notificationManager = NotificationChannels.getNotificationManager();
|
||||
@@ -35,7 +36,7 @@ public class MusicCallbackBuilder {
|
||||
public void onSuccess() {
|
||||
try {
|
||||
notification
|
||||
.setContentText(getString("player_download_finished"))
|
||||
.setContentText(AndroidUtils.getString(R.string.player_download_finished))
|
||||
.setProgress(0, 0, false)
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download_done);
|
||||
notificationManager.notify(notificationId, notification.build());
|
||||
@@ -48,7 +49,7 @@ public class MusicCallbackBuilder {
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
notification.setContentText(getString("load_audio_error")).setProgress(0, 0, false);
|
||||
notification.setContentText(AndroidUtils.getString(R.string.load_audio_error)).setProgress(0, 0, false);
|
||||
notificationManager.notify(notificationId, notification.build());
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ public class MusicCallbackBuilder {
|
||||
if (progress == playlistSize) {
|
||||
onSuccess();
|
||||
} else {
|
||||
notification.setContentText(String.format(getString("playlist_download_notf"), progress, playlistSize));
|
||||
notification.setContentText(String.format(AndroidUtils.getString(R.string.playlist_download_notf), progress, playlistSize));
|
||||
notification.setProgress(playlistSize, progress, false);
|
||||
}
|
||||
notificationManager.notify(notificationId, notification.build());
|
||||
@@ -74,13 +75,13 @@ public class MusicCallbackBuilder {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
notification.setContentText(getString("player_download_finished"));
|
||||
notification.setContentText(AndroidUtils.getString(R.string.player_download_finished));
|
||||
notification.setProgress(0, 0, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
notification.setContentText(getString("load_audio_error")).setProgress(0, 0, false);
|
||||
notification.setContentText(AndroidUtils.getString(R.string.load_audio_error)).setProgress(0, 0, false);
|
||||
notificationManager.notify(notificationId, notification.build());
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.arthenica.ffmpegkit.ReturnCode;
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vk.dto.music.Artist;
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -99,7 +100,7 @@ public class FFMpeg {
|
||||
private static void checkFFMpegLibs() {
|
||||
var lib = new File(AndroidUtils.getGlobalContext().getFilesDir(), "libffmpegkit_abidetect.so");
|
||||
if (!lib.exists()) {
|
||||
ToastUtils.a(AndroidUtils.getString("ffmpegkit_copy"));
|
||||
ToastUtils.a(R.string.ffmpegkit_copy);
|
||||
copyAssets();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package ru.vtosters.lite.music.notification;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.os.Build;
|
||||
|
||||
@@ -9,6 +7,7 @@ import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
@@ -20,7 +19,7 @@ public class MusicNotificationBuilder {
|
||||
public 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(getString("audio_downloading"))
|
||||
.setContentTitle(AndroidUtils.getString(R.string.audio_downloading))
|
||||
.setContentText(track.toString())
|
||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||
.setCategory(NotificationCompat.CATEGORY_PROGRESS)
|
||||
@@ -33,7 +32,7 @@ public class MusicNotificationBuilder {
|
||||
public static NotificationCompat.Builder buildPlaylistDownloadNotification(String playlistName, int id) {
|
||||
var notificationBuilder = new NotificationCompat.Builder(AndroidUtils.getGlobalContext(), NotificationChannels.MUSIC_PLAYLIST_DOWNLOAD_CHANNEL_ID)
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
.setContentTitle(getString("playlist_downloading") + " «" + playlistName + "»")
|
||||
.setContentTitle(AndroidUtils.getString(R.string.playlist_downloading) + " «" + playlistName + "»")
|
||||
.setContentText(playlistName)
|
||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||
.setCategory(NotificationCompat.CATEGORY_PROGRESS)
|
||||
@@ -46,8 +45,8 @@ public class MusicNotificationBuilder {
|
||||
public static NotificationCompat.Builder buildAllAudiosDownloadNotification(int id) {
|
||||
var notificationBuilder = new NotificationCompat.Builder(AndroidUtils.getGlobalContext(), NotificationChannels.MUSIC_PLAYLIST_DOWNLOAD_CHANNEL_ID)
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
.setContentTitle(getString("notf_audio_dl_user") + " " + AccountManagerUtils.getUsername())
|
||||
.setContentText(getString("all_audio"))
|
||||
.setContentTitle(AndroidUtils.getString(R.string.notf_audio_dl_user) + " " + AccountManagerUtils.getUsername())
|
||||
.setContentText(AndroidUtils.getString(R.string.all_audio))
|
||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||
.setCategory(NotificationCompat.CATEGORY_PROGRESS)
|
||||
.setAutoCancel(true)
|
||||
@@ -66,7 +65,7 @@ public class MusicNotificationBuilder {
|
||||
|
||||
builder.setSmallIcon(com.vtosters.lite.R.drawable.ic_download_outline_28)
|
||||
.setShowWhen(false)
|
||||
.setContentTitle(getString("cached_track") + ": " + track.toString());
|
||||
.setContentTitle(AndroidUtils.getString(R.string.cached_track) + ": " + track.toString());
|
||||
|
||||
notificationManager.notify(track.y1().hashCode(), builder.build());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.net;
|
||||
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -16,8 +15,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
public final class NetCall {
|
||||
private final NetRequest req;
|
||||
|
||||
@@ -4,10 +4,11 @@ import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class Jetkai {
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.proxy_setup_success) + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class TheSpeedX {
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.proxy_setup_success) + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class Jetkai {
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.proxy_setup_success) + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class Roosterkid {
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.proxy_setup_success) + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class Hookzof {
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.proxy_setup_success) + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class Jetkai {
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.proxy_setup_success) + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class Roosterkid {
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.proxy_setup_success) + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ import static ru.vtosters.lite.proxy.GithubList.getProxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class TheSpeedX {
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
AndroidUtils.sendToast(AndroidUtils.getString(R.string.proxy_setup_success) + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -46,12 +48,12 @@ public class LogWriterService extends Service {
|
||||
writeLog(intent, file);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
makeText(getGlobalContext(), AndroidUtils.getString("logfile_error"), LENGTH_SHORT).show();
|
||||
makeText(getGlobalContext(), AndroidUtils.getString(R.string.logfile_error), LENGTH_SHORT).show();
|
||||
}
|
||||
var notificationId = intent.getIntExtra("notificationId", 1);
|
||||
var manager = (NotificationManager) getGlobalContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
manager.cancel(notificationId);
|
||||
makeText(getGlobalContext(), AndroidUtils.getString("logfile_saved"), LENGTH_SHORT).show();
|
||||
makeText(getGlobalContext(), AndroidUtils.getString(R.string.logfile_saved), LENGTH_SHORT).show();
|
||||
|
||||
stopSelf();
|
||||
return START_NOT_STICKY;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.tgs;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
@@ -12,6 +11,7 @@ import com.vk.dto.common.Attachment;
|
||||
import com.vk.dto.stickers.StickerItem;
|
||||
import com.vk.dto.stickers.StickerStockItem;
|
||||
import com.vk.im.engine.models.attaches.Attach;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.attachments.PendingGraffitiAttachment;
|
||||
import com.vtosters.lite.im.AppAttachToImAttachConverter;
|
||||
import com.vtosters.lite.upload.Upload;
|
||||
@@ -23,6 +23,8 @@ import org.json.JSONObject;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class TGRoot {
|
||||
public static final int N = 76820000;
|
||||
public static final int X = 976820000;
|
||||
@@ -32,11 +34,11 @@ public class TGRoot {
|
||||
public static String getSummary() {
|
||||
switch (TGPref.getTGConnectMethod()) {
|
||||
case 0:
|
||||
return getString("ctypedirect");
|
||||
return AndroidUtils.getString(R.string.ctypedirect);
|
||||
case 2:
|
||||
return getString("ctypesocks");
|
||||
return AndroidUtils.getString(R.string.ctypesocks);
|
||||
default:
|
||||
return getString("ctypedisabled");
|
||||
return AndroidUtils.getString(R.string.ctypedisabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,16 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
import com.vtosters.lite.ui.MaterialSwitchPreference;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class PreferencesUtil {
|
||||
|
||||
public static void addListPreference(MaterialPreferenceToolbarFragment fragment, String key, String def, CharSequence title, CharSequence[] entries, CharSequence[] entriesValue) {
|
||||
public static void addListPreference(
|
||||
MaterialPreferenceToolbarFragment fragment,
|
||||
String key,
|
||||
String def,
|
||||
CharSequence title,
|
||||
CharSequence[] entries,
|
||||
CharSequence[] entriesValue
|
||||
) {
|
||||
ListPreference preference = new ListPreference(getGlobalContext());
|
||||
preference.setEntries(entries);
|
||||
preference.setEntryValues(entriesValue);
|
||||
@@ -41,7 +46,17 @@ public class PreferencesUtil {
|
||||
fragment.getPreferenceScreen().addPreference(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addListPreferenceIcon(MaterialPreferenceToolbarFragment fragment, String key, String def, CharSequence title, String icon, CharSequence summary, CharSequence[] entries, CharSequence[] entriesValue, Preference.OnPreferenceChangeListener listener) {
|
||||
public static void addListPreferenceIcon(
|
||||
MaterialPreferenceToolbarFragment fragment,
|
||||
String key,
|
||||
String def,
|
||||
CharSequence title,
|
||||
int iconRes,
|
||||
CharSequence summary,
|
||||
CharSequence[] entries,
|
||||
CharSequence[] entriesValue,
|
||||
Preference.OnPreferenceChangeListener listener
|
||||
) {
|
||||
ListPreference preference = new ListPreference(getGlobalContext());
|
||||
preference.setEntries(entries);
|
||||
preference.setEntryValues(entriesValue);
|
||||
@@ -53,12 +68,18 @@ public class PreferencesUtil {
|
||||
preference.setValue(def);
|
||||
preference.setOnPreferenceChangeListener(listener);
|
||||
|
||||
if (icon != null)
|
||||
preference.setIcon(setTint(getGlobalContext(), getDrawable(getGlobalContext(), icon))); // preference.setIcon
|
||||
if (iconRes != 0)
|
||||
preference.setIcon(setTint(getGlobalContext(), getDrawable(getGlobalContext(), iconRes))); // preference.setIcon
|
||||
fragment.getPreferenceScreen().addPreference(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment materialPreferenceToolbarFragment, String key, CharSequence title, CharSequence summary, boolean defValue) {
|
||||
public static void addMaterialSwitchPreference(
|
||||
MaterialPreferenceToolbarFragment materialPreferenceToolbarFragment,
|
||||
String key,
|
||||
CharSequence title,
|
||||
CharSequence summary,
|
||||
boolean defValue
|
||||
) {
|
||||
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(getGlobalContext());
|
||||
materialSwitchPreference.setTitle(title); // setTitle
|
||||
materialSwitchPreference.setSummary(summary); // setSummary
|
||||
@@ -68,21 +89,37 @@ public class PreferencesUtil {
|
||||
materialPreferenceToolbarFragment.getPreferenceScreen().addPreference(materialSwitchPreference); // materialPreferenceToolbarFragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, int icon, boolean defValue, Preference.OnPreferenceChangeListener listener) {
|
||||
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(getGlobalContext());
|
||||
materialSwitchPreference.setTitle(title); // setTitle
|
||||
materialSwitchPreference.setSummary(summary); // setSummary
|
||||
materialSwitchPreference.setKey(key); // setKey
|
||||
materialSwitchPreference.setDefaultValue(defValue); // setDefaultValue
|
||||
materialSwitchPreference.setOnPreferenceChangeListener(listener); // setOnPreferenceClickListener
|
||||
// public static void addMaterialSwitchPreference(
|
||||
// MaterialPreferenceToolbarFragment fragment,
|
||||
// String key,
|
||||
// CharSequence title,
|
||||
// CharSequence summary,
|
||||
// int iconRes,
|
||||
// boolean defValue,
|
||||
// Preference.OnPreferenceChangeListener listener
|
||||
// ) {
|
||||
// MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(getGlobalContext());
|
||||
// materialSwitchPreference.setTitle(title); // setTitle
|
||||
// materialSwitchPreference.setSummary(summary); // setSummary
|
||||
// materialSwitchPreference.setKey(key); // setKey
|
||||
// materialSwitchPreference.setDefaultValue(defValue); // setDefaultValue
|
||||
// materialSwitchPreference.setOnPreferenceChangeListener(listener); // setOnPreferenceClickListener
|
||||
//
|
||||
// if (iconRes != 0)
|
||||
// materialSwitchPreference.setIcon(setTint(getGlobalContext(), Objects.requireNonNull(ContextCompat.getDrawable(getGlobalContext(), iconRes)))); // preference.setIcon
|
||||
//
|
||||
// fragment.getPreferenceScreen().addPreference(materialSwitchPreference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
// }
|
||||
|
||||
if (icon != 1)
|
||||
materialSwitchPreference.setIcon(setTint(getGlobalContext(), Objects.requireNonNull(ContextCompat.getDrawable(getGlobalContext(), icon)))); // preference.setIcon
|
||||
|
||||
fragment.getPreferenceScreen().addPreference(materialSwitchPreference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, String icon, boolean defValue, Preference.OnPreferenceChangeListener listener) {
|
||||
public static void addMaterialSwitchPreference(
|
||||
MaterialPreferenceToolbarFragment fragment,
|
||||
String key,
|
||||
CharSequence title,
|
||||
CharSequence summary,
|
||||
int iconRes,
|
||||
boolean defValue,
|
||||
Preference.OnPreferenceChangeListener listener
|
||||
) {
|
||||
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(getGlobalContext());
|
||||
materialSwitchPreference.setTitle(title); // setTitle
|
||||
materialSwitchPreference.setSummary(summary); // setSummary
|
||||
@@ -90,14 +127,19 @@ public class PreferencesUtil {
|
||||
materialSwitchPreference.setDefaultValue(defValue); // setDefaultValue
|
||||
fragment.getPreferenceScreen().addPreference(materialSwitchPreference); // materialPreferenceToolbarFragment.getPreferenceScreen().addPreference(preference)
|
||||
|
||||
if (icon != null)
|
||||
materialSwitchPreference.setIcon(setTint(getGlobalContext(), getDrawable(getGlobalContext(), icon))); // preference.setIcon
|
||||
if (iconRes != 0)
|
||||
materialSwitchPreference.setIcon(setTint(getGlobalContext(), getDrawable(getGlobalContext(), iconRes))); // preference.setIcon
|
||||
materialSwitchPreference.setOnPreferenceChangeListener(listener); // setOnPreferenceClickListener(listener)
|
||||
|
||||
fragment.getPreferenceScreen().addPreference(materialSwitchPreference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary) {
|
||||
public static void addPreference(
|
||||
MaterialPreferenceToolbarFragment fragment,
|
||||
String key,
|
||||
CharSequence title,
|
||||
CharSequence summary
|
||||
) {
|
||||
Preference preference = new Preference(getGlobalContext());
|
||||
preference.setSummary(summary); // setSummary
|
||||
preference.setTitle(title); // setTitle
|
||||
@@ -106,32 +148,51 @@ public class PreferencesUtil {
|
||||
fragment.getPreferenceScreen().addPreference(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addPreference(MaterialPreferenceToolbarFragment fragment, CharSequence title, CharSequence summary, @Nullable String icon, Preference.OnPreferenceClickListener listener) {
|
||||
public static void addPreference(
|
||||
MaterialPreferenceToolbarFragment fragment,
|
||||
CharSequence title,
|
||||
CharSequence summary,
|
||||
int iconRes,
|
||||
Preference.OnPreferenceClickListener listener
|
||||
) {
|
||||
Preference preference = new Preference(getGlobalContext());
|
||||
preference.setSummary(summary); // setSummary
|
||||
preference.setTitle(title); // setTitle
|
||||
|
||||
if (icon != null)
|
||||
preference.setIcon(setTint(getGlobalContext(), getDrawable(getGlobalContext(), icon))); // preference.setIcon
|
||||
if (iconRes != 0)
|
||||
preference.setIcon(setTint(getGlobalContext(), getDrawable(getGlobalContext(), iconRes))); // preference.setIcon
|
||||
preference.setOnPreferenceClickListener(listener); // preference.setOnPreferenceClickListener(listener)
|
||||
|
||||
fragment.getPreferenceScreen().addPreference(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, @Nullable String icon, Preference.OnPreferenceClickListener listener) {
|
||||
public static void addPreference(
|
||||
MaterialPreferenceToolbarFragment fragment,
|
||||
String key,
|
||||
CharSequence title,
|
||||
CharSequence summary,
|
||||
int iconRes,
|
||||
Preference.OnPreferenceClickListener listener) {
|
||||
Preference preference = new Preference(getGlobalContext());
|
||||
preference.setSummary(summary); // setSummary
|
||||
preference.setTitle(title); // setTitle
|
||||
preference.setKey(key); // setKey
|
||||
|
||||
if (icon != null)
|
||||
preference.setIcon(setTint(getGlobalContext(), getDrawable(getGlobalContext(), icon))); // preference.setIcon
|
||||
if (iconRes != 0)
|
||||
preference.setIcon(setTint(getGlobalContext(), getDrawable(getGlobalContext(), iconRes))); // preference.setIcon
|
||||
preference.setOnPreferenceClickListener(listener); // preference.setOnPreferenceClickListener(listener)
|
||||
|
||||
fragment.getPreferenceScreen().addPreference(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addPreferenceDrawable(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, @Nullable Drawable icon, Preference.OnPreferenceClickListener listener) {
|
||||
public static void addPreferenceDrawable(
|
||||
MaterialPreferenceToolbarFragment fragment,
|
||||
String key,
|
||||
CharSequence title,
|
||||
CharSequence summary,
|
||||
@Nullable Drawable icon,
|
||||
Preference.OnPreferenceClickListener listener
|
||||
) {
|
||||
Preference preference = new Preference(getGlobalContext());
|
||||
preference.setSummary(summary); // setSummary
|
||||
preference.setTitle(title); // setTitle
|
||||
@@ -210,9 +271,8 @@ public class PreferencesUtil {
|
||||
return typedValue.data;
|
||||
}
|
||||
|
||||
private static Drawable getDrawable(Context ctx, String name) {
|
||||
var id = ctx.getResources().getIdentifier(name, "drawable", ctx.getPackageName());
|
||||
return ContextCompat.getDrawable(ctx, id);
|
||||
private static Drawable getDrawable(Context ctx, int drawableRes) {
|
||||
return ContextCompat.getDrawable(ctx, drawableRes);
|
||||
}
|
||||
|
||||
public interface EditTextPrefChangeListener {
|
||||
|
||||
@@ -11,7 +11,7 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class APKInstallActivity extends AppCompatActivity {
|
||||
public static final int REQUEST_INSTALL_PERMISSION = 1;
|
||||
@@ -67,7 +67,7 @@ public class APKInstallActivity extends AppCompatActivity {
|
||||
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, AndroidUtils.getString("apk_install_error") + " " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(this, getString(R.string.apk_install_error) + " " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
finish();
|
||||
|
||||
@@ -2,7 +2,6 @@ package ru.vtosters.lite.ui.adapters;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Typeface;
|
||||
@@ -17,6 +16,8 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -261,7 +262,7 @@ public class CategorizedAdapter extends RecyclerView.Adapter<CategorizedAdapter.
|
||||
}
|
||||
|
||||
public void bindCategory(boolean fist) {
|
||||
mCategoryTitle.setText(getString(fist ? "selected_items" : "unselected_items"));
|
||||
mCategoryTitle.setText(fist ? R.string.selected_items : R.string.unselected_items);
|
||||
mCategoryTitleContainer.setVisibility(View.VISIBLE);
|
||||
mMovingItemContainer.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.widget.TextViewCompat;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -92,7 +94,7 @@ public class ImagineArrayAdapter extends ArrayAdapter<ImagineArrayAdapter.Imagin
|
||||
|
||||
// if make radiobutton without layout inflation it can't be unclickable
|
||||
var checkedTextView = (CheckedTextView) LayoutInflater.from(getContext())
|
||||
.inflate(AndroidUtils.getIdentifier("select_dialog_singlechoice_material", "layout"), parent, false);
|
||||
.inflate(R.layout.select_dialog_singlechoice_material, parent, false);
|
||||
// for amoled
|
||||
var tintList = new ColorStateList(
|
||||
new int[][] { new int[] { android.R.attr.state_checked }, new int[] { -android.R.attr.state_checked }},
|
||||
|
||||
@@ -23,7 +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 = AndroidUtils.getArray("wallpaper_change_dialog");
|
||||
private final String[] mMessages = AndroidUtils.getArray(R.array.wallpaper_change_dialog);
|
||||
|
||||
private static int getColorFromAttribute(Context context, int attrId) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.ui.adapters;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getResources;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
@@ -22,12 +21,12 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.aefyr.tsg.g2.TelegramStickersPack;
|
||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import ru.vtosters.lite.tgs.TGPref;
|
||||
import ru.vtosters.lite.ui.components.IItemMovingListener;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.StickerPackViewHolder> implements IItemMovingListener {
|
||||
private static final TelegramStickersService sService = TelegramStickersService.getInstance(getGlobalContext());
|
||||
@@ -36,13 +35,12 @@ public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.
|
||||
@NonNull
|
||||
@Override
|
||||
public StickerPackViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
int resID = getIdentifier("tgs_entry", "layout");
|
||||
var view = LayoutInflater.from(parent.getContext()).inflate(resID, parent, false);
|
||||
var view = LayoutInflater.from(parent.getContext()).inflate(R.layout.tgs_entry, parent, false);
|
||||
var holder = new StickerPackViewHolder(view);
|
||||
|
||||
holder.mStickerPreview.setImageResource(getIdentifier("icon_vk_104", "drawable"));
|
||||
holder.mUpdateButton.setImageDrawable(recolorDrawable(getResources().getDrawable(getIdentifier("ic_camera_switch_48", "drawable"))));
|
||||
holder.mDeleteButton.setImageDrawable(recolorDrawable(getResources().getDrawable(getIdentifier("vkim_ic_msg_delete", "drawable"))));
|
||||
holder.mStickerPreview.setImageResource(R.drawable.icon_vk_104);
|
||||
holder.mUpdateButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.ic_camera_switch_48)));
|
||||
holder.mDeleteButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.vkim_ic_msg_delete)));
|
||||
|
||||
return holder;
|
||||
}
|
||||
@@ -132,7 +130,7 @@ public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.
|
||||
mName.setText(pack.title);
|
||||
mSwitch.setChecked(pack.enabled);
|
||||
mSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> sService.setPackEnabled(pack, isChecked, false));
|
||||
mStickersCount.setText(pack.stickersCount + " " + AndroidUtils.getString("stickerscount"));
|
||||
mStickersCount.setText(pack.stickersCount + " " + mStickersCount.getContext().getString(R.string.stickerscount));
|
||||
|
||||
// Color костыль
|
||||
int color = getTextAttr();
|
||||
|
||||
@@ -11,6 +11,8 @@ import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
@@ -43,7 +45,7 @@ public class BackupManager {
|
||||
|
||||
public static void backupOnlines() throws IOException {
|
||||
if (getPrefContent("onlines.xml") == null) {
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString("no_data_to_backup"), LENGTH_SHORT).show();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString(R.string.no_data_to_backup), LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,10 +57,10 @@ public class BackupManager {
|
||||
FileWriter out = new FileWriter(file);
|
||||
out.write(getPrefContent("onlines.xml"));
|
||||
out.close();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString("backup_saved_in") + " " + file.getAbsolutePath(), LENGTH_LONG).show();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString(R.string.backup_saved_in) + " " + file.getAbsolutePath(), LENGTH_LONG).show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString("backup_save_error"), LENGTH_SHORT).show();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString(R.string.backup_save_error), LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,10 +73,10 @@ public class BackupManager {
|
||||
FileWriter out = new FileWriter(file);
|
||||
out.write(getPrefContent("com.vtosters.lite_preferences.xml"));
|
||||
out.close();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString("backup_saved_in") + " " + file.getAbsolutePath(), LENGTH_LONG).show();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString(R.string.backup_saved_in) + " " + file.getAbsolutePath(), LENGTH_LONG).show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString("backup_save_error"), LENGTH_SHORT).show();
|
||||
Toast.makeText(getGlobalContext(), AndroidUtils.getString(R.string.backup_save_error), LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package ru.vtosters.lite.ui.components;
|
||||
|
||||
import static ru.vtosters.lite.utils.About.getBuildNumber;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
@@ -17,6 +14,8 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
@@ -65,13 +64,13 @@ public class CrashReporter {
|
||||
var psaveLogIntent = PendingIntent.getService(getGlobalContext(), 0, saveLogIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
|
||||
var builder = new Notification.Builder(getGlobalContext());
|
||||
builder.setSmallIcon(getIdentifier("ic_bug_24", "drawable"));
|
||||
builder.setContentTitle(getString("vtl_crashed"));
|
||||
builder.setSmallIcon(R.drawable.ic_bug_24);
|
||||
builder.setContentTitle(activity.getString(R.string.vtl_crashed));
|
||||
builder.setContentText(logString);
|
||||
builder.setStyle(new Notification.BigTextStyle().bigText(logString));
|
||||
builder.setAutoCancel(true);
|
||||
builder.addAction(new Notification.Action(0, getString("vtl_crash_upload"), PendingIntent.getActivity(getGlobalContext(), (int) (Math.random() * 100.0d), foxbinIntent, PendingIntent.FLAG_CANCEL_CURRENT)));
|
||||
builder.addAction(new Notification.Action(0, getString("vtl_crash_save"), psaveLogIntent));
|
||||
builder.addAction(new Notification.Action(0, activity.getString(R.string.vtl_crash_upload), PendingIntent.getActivity(getGlobalContext(), (int) (Math.random() * 100.0d), foxbinIntent, PendingIntent.FLAG_CANCEL_CURRENT)));
|
||||
builder.addAction(new Notification.Action(0, activity.getString(R.string.vtl_crash_save), psaveLogIntent));
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
builder.setChannelId("crashes");
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
package ru.vtosters.lite.ui.components;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
|
||||
import android.content.res.Resources;
|
||||
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class FragAnimationKit {
|
||||
|
||||
// Q
|
||||
private static final int actOpenEnter = getIdentifier("q_enter", "anim");
|
||||
private static final int actOpenExit = getIdentifier("q_exit", "anim");
|
||||
private static final int actCloseEnter = getIdentifier("q_pop_enter", "anim");
|
||||
private static final int actCloseExit = getIdentifier("q_pop_exit", "anim");
|
||||
private static final int actOpenEnter = R.anim.q_enter;
|
||||
private static final int actOpenExit = R.anim.q_exit;
|
||||
private static final int actCloseEnter = R.anim.q_pop_enter;
|
||||
private static final int actCloseExit = R.anim.q_pop_exit;
|
||||
// Slide
|
||||
private static final int SactOpenEnter = getIdentifier("legacy_enter", "anim");
|
||||
private static final int SactOpenExit = getIdentifier("legacy_exit", "anim");
|
||||
private static final int SactCloseEnter = getIdentifier("legacy_pop_enter", "anim");
|
||||
private static final int SactCloseExit = getIdentifier("legacy_pop_exit", "anim");
|
||||
private static final int SactOpenEnter = R.anim.legacy_enter;
|
||||
private static final int SactOpenExit = R.anim.legacy_exit;
|
||||
private static final int SactCloseEnter = R.anim.legacy_pop_enter;
|
||||
private static final int SactCloseExit = R.anim.legacy_pop_exit;
|
||||
// System
|
||||
private static final Resources resources = Resources.getSystem();
|
||||
private static final int SSactOpenEnter = resources.getIdentifier("activity_open_enter", "anim", "android");
|
||||
|
||||
@@ -7,6 +7,8 @@ import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
@@ -21,7 +23,7 @@ public class NewsfeedListManager {
|
||||
var list = new ArrayList<VBListItem>(filtersSet.size());
|
||||
|
||||
if (filtersSet.isEmpty()) {
|
||||
sendToast(AndroidUtils.getString("newsfeed_list_update_feed"));
|
||||
sendToast(activity.getString(R.string.newsfeed_list_update_feed));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,10 +35,10 @@ public class NewsfeedListManager {
|
||||
}
|
||||
|
||||
VBottomSheetBuilder.show(activity, new VBottomSheetBuilder.VBSContent(
|
||||
AndroidUtils.getString("newsfeed_list_choose_to_hide"),
|
||||
activity.getString(R.string.newsfeed_list_choose_to_hide),
|
||||
buildListOf(activity, list),
|
||||
new VBottomSheetBuilder.VBSContent.VBSButton(
|
||||
AndroidUtils.getString("save"),
|
||||
activity.getString(R.string.save),
|
||||
() -> {
|
||||
var newSelectedItems = "";
|
||||
for (VBListItem item : list)
|
||||
@@ -45,15 +47,17 @@ public class NewsfeedListManager {
|
||||
getDefaultPrefs().edit()
|
||||
.putString("news_feed_selected_items", newSelectedItems)
|
||||
.apply();
|
||||
sendToast(AndroidUtils.getString("newsfeed_list_update_feed_to_work"));
|
||||
sendToast(activity.getString(R.string.newsfeed_list_update_feed_to_work));
|
||||
}
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public static void resetHideItems() {
|
||||
getDefaultPrefs().edit().remove("news_feed_selected_items").remove("news_feed_items_set")
|
||||
getDefaultPrefs().edit()
|
||||
.remove("news_feed_selected_items")
|
||||
.remove("news_feed_items_set")
|
||||
.apply();
|
||||
sendToast(AndroidUtils.getString("newsfeed_list_hidden_reseted"));
|
||||
sendToast(AndroidUtils.getString(R.string.newsfeed_list_hidden_reseted));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -87,33 +89,33 @@ public class SuperAppEditorManager {
|
||||
private SuperAppItem getItemByTag(String tag) {
|
||||
switch (tag) {
|
||||
case "menu":
|
||||
return SuperAppItem.valuesOf("menu", AndroidUtils.getString("superapp_menu"));
|
||||
return SuperAppItem.valuesOf("menu", AndroidUtils.getString(R.string.superapp_menu));
|
||||
case "miniapps":
|
||||
return SuperAppItem.valuesOf("miniapps", AndroidUtils.getString("superapp_miniapps"));
|
||||
return SuperAppItem.valuesOf("miniapps", AndroidUtils.getString(R.string.superapp_miniapps));
|
||||
case "vkpay_slim":
|
||||
return SuperAppItem.valuesOf("vkpay_slim", AndroidUtils.getString("superapp_vkpay"));
|
||||
return SuperAppItem.valuesOf("vkpay_slim", AndroidUtils.getString(R.string.superapp_vkpay));
|
||||
case "greeting":
|
||||
return SuperAppItem.valuesOf("greeting", AndroidUtils.getString("superapp_greeting"));
|
||||
return SuperAppItem.valuesOf("greeting", AndroidUtils.getString(R.string.superapp_greeting));
|
||||
case "promo":
|
||||
return SuperAppItem.valuesOf("promo", AndroidUtils.getString("superapp_miniapps_promo"));
|
||||
return SuperAppItem.valuesOf("promo", AndroidUtils.getString(R.string.superapp_miniapps_promo));
|
||||
case "holiday":
|
||||
return SuperAppItem.valuesOf("holiday", AndroidUtils.getString("superapp_holiday"));
|
||||
return SuperAppItem.valuesOf("holiday", AndroidUtils.getString(R.string.superapp_holiday));
|
||||
case "weather":
|
||||
return SuperAppItem.valuesOf("weather", AndroidUtils.getString("superapp_weather"));
|
||||
return SuperAppItem.valuesOf("weather", AndroidUtils.getString(R.string.superapp_weather));
|
||||
case "sport":
|
||||
return SuperAppItem.valuesOf("sport", AndroidUtils.getString("superapp_sport"));
|
||||
return SuperAppItem.valuesOf("sport", AndroidUtils.getString(R.string.superapp_sport));
|
||||
case "games":
|
||||
return SuperAppItem.valuesOf("games", AndroidUtils.getString("superapp_games"));
|
||||
return SuperAppItem.valuesOf("games", AndroidUtils.getString(R.string.superapp_games));
|
||||
case "informer":
|
||||
return SuperAppItem.valuesOf("informer", AndroidUtils.getString("superapp_informer"));
|
||||
return SuperAppItem.valuesOf("informer", AndroidUtils.getString(R.string.superapp_informer));
|
||||
case "food":
|
||||
return SuperAppItem.valuesOf("food", AndroidUtils.getString("superapp_food"));
|
||||
return SuperAppItem.valuesOf("food", AndroidUtils.getString(R.string.superapp_food));
|
||||
case "event":
|
||||
return SuperAppItem.valuesOf("event", AndroidUtils.getString("superapp_event"));
|
||||
return SuperAppItem.valuesOf("event", AndroidUtils.getString(R.string.superapp_event));
|
||||
case "music":
|
||||
return SuperAppItem.valuesOf("music", AndroidUtils.getString("superapp_music"));
|
||||
return SuperAppItem.valuesOf("music", AndroidUtils.getString(R.string.superapp_music));
|
||||
case "vk_run":
|
||||
return SuperAppItem.valuesOf("vk_run", AndroidUtils.getString("superapp_vk_run"));
|
||||
return SuperAppItem.valuesOf("vk_run", AndroidUtils.getString(R.string.superapp_vk_run));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.deviceinfo.OEMDetector;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
@@ -18,21 +19,20 @@ public class DisableBattery {
|
||||
public static void alert(Activity activity) {
|
||||
if (!(OEMDetector.isOEM() && Build.VERSION.SDK_INT >= 23 && Preferences.getBoolValue("showDoze", true)))
|
||||
return;
|
||||
final var context = AndroidUtils.getGlobalContext();
|
||||
final var packName = context.getPackageName();
|
||||
final var manager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
final var packName = activity.getPackageName();
|
||||
final var manager = (PowerManager) activity.getSystemService(Context.POWER_SERVICE);
|
||||
if (manager.isIgnoringBatteryOptimizations(packName)) return;
|
||||
new VkAlertDialog.Builder(activity)
|
||||
.setTitle(AndroidUtils.getString("batteryissuetitle"))
|
||||
.setMessage(AndroidUtils.getString("batteryissuesumm"))
|
||||
.setTitle(R.string.batteryissuetitle)
|
||||
.setMessage(R.string.batteryissuesumm)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(AndroidUtils.getString("batteryissuebtn1"), (dialogInterface, i) -> {
|
||||
.setPositiveButton(R.string.batteryissuebtn1, (dialogInterface, i) -> {
|
||||
var intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
.setData(Uri.parse("package:" + packName));
|
||||
context.startActivity(intent);
|
||||
activity.startActivity(intent);
|
||||
})
|
||||
.setNeutralButton(AndroidUtils.getString("batteryissuebtn2"),
|
||||
.setNeutralButton(R.string.batteryissuebtn2,
|
||||
(dialogInterface, i) -> AndroidUtils.edit().putBoolean("showDoze", false).apply()
|
||||
)
|
||||
.show();
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package ru.vtosters.lite.ui.dialogs;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.GmsUtils.isGmsInstalled;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
@@ -11,6 +9,7 @@ import android.content.Intent;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
|
||||
|
||||
@@ -18,19 +17,18 @@ public class InstallGMS {
|
||||
public static void alert(final Activity activity) {
|
||||
if (!isGmsInstalled() && getBoolValue("showAlertGms", true)) {
|
||||
new VkAlertDialog.Builder(activity)
|
||||
.setTitle(getString("warning"))
|
||||
.setMessage(getString("gmsissuesumm"))
|
||||
.setTitle(activity.getString(R.string.warning))
|
||||
.setMessage(activity.getString(R.string.gmsissuesumm))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString("gmsissuebtn1"), (
|
||||
.setPositiveButton(activity.getString(R.string.gmsissuebtn1), (
|
||||
dialogInterface, i) -> edit().putBoolean("showAlertGms", false).apply()
|
||||
)
|
||||
.setNeutralButton(getString("gmsissuebtn2"), (dialogInterface, i) -> {
|
||||
.setNeutralButton(activity.getString(R.string.gmsissuebtn2), (dialogInterface, i) -> {
|
||||
edit().putBoolean("showAlertGms", false).apply();
|
||||
var context = getGlobalContext();
|
||||
var intent = new Navigator(InstallGMSFragment.class)
|
||||
.b(context)
|
||||
.b(activity)
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
activity.startActivity(intent);
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import androidx.appcompat.widget.SwitchCompat;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LayoutUtils;
|
||||
|
||||
public class MessageSettings {
|
||||
@@ -52,12 +51,12 @@ public class MessageSettings {
|
||||
four.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
five.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
|
||||
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.setText(context.getString(R.string.proxy_disable)); // Отключить
|
||||
one.setText(context.getString(R.string.message_self_destruct_15sec));
|
||||
two.setText(context.getString(R.string.message_self_destruct_1min));
|
||||
three.setText(context.getString(R.string.message_self_destruct_5min));
|
||||
four.setText(context.getString(R.string.message_self_destruct_1hour));
|
||||
five.setText(context.getString(R.string.message_self_destruct_24hours));
|
||||
|
||||
zero.setTextColor(getTextAttr());
|
||||
one.setTextColor(getTextAttr());
|
||||
@@ -89,7 +88,7 @@ public class MessageSettings {
|
||||
|
||||
@SuppressLint("UseSwitchCompatOrMaterialCode")
|
||||
var silentSwitch = new SwitchCompat(new ContextThemeWrapper(context, R.style.Widget_AppCompat_CompoundButton_Switch));
|
||||
silentSwitch.setText(AndroidUtils.getString("silent_messages"));
|
||||
silentSwitch.setText(context.getString(R.string.silent_messages));
|
||||
silentSwitch.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
silentSwitch.setTextColor(getTextAttr());
|
||||
silentSwitch.setChecked(isSilentEnabled);
|
||||
@@ -106,12 +105,12 @@ public class MessageSettings {
|
||||
mContainer.addView(silentSwitch, LayoutUtils.createLinear(-1, -2));
|
||||
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setTitle(AndroidUtils.getString("message_send_settings_title"))
|
||||
.setMessage(AndroidUtils.getString("silent_messages_time_select"))
|
||||
.setTitle(context.getString(R.string.message_send_settings_title))
|
||||
.setMessage(context.getString(R.string.silent_messages_time_select))
|
||||
.setCancelable(true)
|
||||
.setView(mContainer)
|
||||
.setNegativeButton(AndroidUtils.getString("cancel"), null)
|
||||
.setPositiveButton(AndroidUtils.getString("vtl_confirm"), (dialog, which) -> { // Применить
|
||||
.setNegativeButton(context.getString(R.string.cancel), null)
|
||||
.setPositiveButton(context.getString(R.string.vtl_confirm), (dialog, which) -> { // Применить
|
||||
var checked = rg.getCheckedRadioButtonId();
|
||||
|
||||
if (checked == zero.getId()) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package ru.vtosters.lite.ui.dialogs;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.downloaders.OTADownloader;
|
||||
import ru.vtosters.lite.ui.vkui.ModalBottomSheetWrapper;
|
||||
import ru.vtosters.lite.utils.OTAUtils;
|
||||
@@ -29,9 +29,9 @@ public class OTADialog implements OTAUtils.OTAListener {
|
||||
mActivity.runOnUiThread(() -> {
|
||||
// Toast.makeText(mActivity, "Обновления найдены", Toast.LENGTH_SHORT).show();
|
||||
new ModalBottomSheetWrapper(mActivity)
|
||||
.setTitle(getString("newversion") + " " + mHelper.getNewVersionName())
|
||||
.setTitle(mActivity.getString(R.string.newversion) + " " + mHelper.getNewVersionName())
|
||||
.setUpdateInfoView(mHelper.getUpdateDescription())
|
||||
.setPositiveButton(getString("updateanddownload"), () -> {
|
||||
.setPositiveButton(mActivity.getString(R.string.updateanddownload), () -> {
|
||||
OTADownloader.downloadBuild(mHelper.getDownloadUrl());
|
||||
})
|
||||
.show();
|
||||
|
||||
@@ -10,8 +10,8 @@ import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LayoutUtils;
|
||||
|
||||
public class RoundingSeekbarDialog {
|
||||
@@ -26,12 +26,12 @@ public class RoundingSeekbarDialog {
|
||||
mContainer.addView(seek, LayoutUtils.createLinear(-1, -2));
|
||||
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setTitle(AndroidUtils.getString("pic_rounding_title"))
|
||||
.setMessage(AndroidUtils.getString("pic_rounding_info"))
|
||||
.setTitle(context.getString(R.string.pic_rounding_title))
|
||||
.setMessage(context.getString(R.string.pic_rounding_info))
|
||||
.setCancelable(true)
|
||||
.setNegativeButton(AndroidUtils.getString("cancel"), null)
|
||||
.setNegativeButton(context.getString(R.string.cancel), null)
|
||||
.setView(mContainer)
|
||||
.setPositiveButton(AndroidUtils.getString("vtl_confirm"), (dialog, which) -> {
|
||||
.setPositiveButton(context.getString(R.string.vtl_confirm), (dialog, which) -> {
|
||||
edit().putInt("pic_rounding", seek.getProgress()).commit();
|
||||
restartApplicationWithTimer();
|
||||
})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.ui.dialogs;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
import android.app.Activity;
|
||||
@@ -10,8 +9,10 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.deviceinfo.OEMDetector;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class Start {
|
||||
public static void alert(final Activity activity) {
|
||||
@@ -20,13 +21,13 @@ public class Start {
|
||||
}
|
||||
if (getBoolValue("showAlert", true))
|
||||
new VkAlertDialog.Builder(activity)
|
||||
.setTitle(getString("warning"))
|
||||
.setTitle(R.string.warning)
|
||||
.setMessage(getWelcome())
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString("startbtn2"),
|
||||
.setPositiveButton(R.string.startbtn2,
|
||||
(dialogInterface, i) -> edit().putBoolean("showAlert", false).apply()
|
||||
)
|
||||
.setNeutralButton(getString("startbtn1"),
|
||||
.setNeutralButton(R.string.startbtn1,
|
||||
(dialogInterface, i) -> {
|
||||
edit().putBoolean("showAlert", false).apply();
|
||||
activity.startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/vtosters")));
|
||||
@@ -37,10 +38,10 @@ public class Start {
|
||||
}
|
||||
|
||||
private static String getWelcome() {
|
||||
String Default = getString("startsumm1");
|
||||
String Default = AndroidUtils.getString(R.string.startsumm1);
|
||||
|
||||
if (OEMDetector.isOEM()) {
|
||||
return Default + getString("startsumm2");
|
||||
return Default + AndroidUtils.getString(R.string.startsumm2);
|
||||
}
|
||||
|
||||
return Default;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package ru.vtosters.lite.ui.dialogs;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.isDarkTheme;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.hooks.VKUIHook;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
@@ -16,15 +16,15 @@ public class ThemeChanging {
|
||||
public static void changeTheme(Activity activity, float[] f) {
|
||||
if (Preferences.systemtheme()) {
|
||||
new VkAlertDialog.Builder(activity)
|
||||
.setTitle(getString("warning"))
|
||||
.setMessage(getString("system_theme_warning"))
|
||||
.setTitle(R.string.warning)
|
||||
.setMessage(R.string.system_theme_warning)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString("proxy_disable"), (dialogInterface, i) -> { // Отключить
|
||||
.setPositiveButton(R.string.proxy_disable, (dialogInterface, i) -> { // Отключить
|
||||
edit().putString("currsystemtheme", !isDarkTheme() ? "dark" : "light").commit();
|
||||
VKThemeHelper.b(activity, f);
|
||||
VKUIHook.clearWebCache();
|
||||
})
|
||||
.setNeutralButton(getString("cancel"), null)
|
||||
.setNeutralButton(R.string.cancel, null)
|
||||
.show();
|
||||
} else {
|
||||
VKThemeHelper.b(activity, f);
|
||||
|
||||
@@ -10,8 +10,8 @@ import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@@ -39,15 +39,15 @@ public class Translate {
|
||||
|
||||
private static void showDialog(Context context, String text) {
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setTitle(AndroidUtils.getString("translator_title"))
|
||||
.setTitle(R.string.translator_title)
|
||||
.setMessage(text)
|
||||
.setPositiveButton(AndroidUtils.getString("close"),
|
||||
.setPositiveButton(R.string.close,
|
||||
(dialog, which) -> dialog.cancel())
|
||||
.setNeutralButton(AndroidUtils.getString("copy"), (dialog, which) -> {
|
||||
.setNeutralButton(R.string.copy, (dialog, which) -> {
|
||||
var clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
var clip = ClipData.newPlainText("Copied Text", text);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(AndroidUtils.getString(R.string.copied_to_clipboard));
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package ru.vtosters.lite.ui.dialogs;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
import android.app.Activity;
|
||||
@@ -11,6 +10,7 @@ import android.content.Intent;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.VKUIwrapper;
|
||||
|
||||
@@ -18,12 +18,12 @@ public class VKIDProtection {
|
||||
public static void alert(final Activity activity) {
|
||||
if (!getBoolValue("showAlertVkId", true)) return;
|
||||
new VkAlertDialog.Builder(activity)
|
||||
.setTitle(getString("warning"))
|
||||
.setMessage(getString("vkidsumm"))
|
||||
.setTitle(R.string.warning)
|
||||
.setMessage(R.string.vkidsumm)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getString("startbtn2"),
|
||||
.setPositiveButton(R.string.startbtn2,
|
||||
(dialogInterface, i) -> edit().putBoolean("showAlertVkId", false).apply())
|
||||
.setNeutralButton(getString("vkiddisable"), (dialogInterface, i) -> {
|
||||
.setNeutralButton(R.string.vkiddisable, (dialogInterface, i) -> {
|
||||
edit().putBoolean("showAlertVkId", false).apply();
|
||||
VKUIwrapper.setLink(
|
||||
isAnyProxyEnabled()
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.Preferences.offline;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
public class ActivityFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_activity", "xml"));
|
||||
addPreferencesFromResource(R.xml.preferences_activity);
|
||||
findPreference("setoffline").setEnabled(offline());
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ public class ActivityFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("vtlactivity", "string");
|
||||
return R.string.vtlactivity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
|
||||
import android.os.Bundle;
|
||||
@@ -25,14 +24,13 @@ import com.vtosters.lite.R;
|
||||
import ru.vtosters.lite.ui.adapters.CategorizedAdapter;
|
||||
import ru.vtosters.lite.ui.components.DockBarEditorManager;
|
||||
import ru.vtosters.lite.ui.components.ItemMovingCallback;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class DockBarEditorFragment extends BaseToolbarFragment {
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public View onCreateContent(@NonNull LayoutInflater inflater, @Nullable Bundle bundle) {
|
||||
setTitle(getIdentifier("dockbar_editor", "string"));
|
||||
setTitle(R.string.dockbar_editor);
|
||||
|
||||
FrameLayout content = new FrameLayout(getContext());
|
||||
|
||||
@@ -50,7 +48,7 @@ public class DockBarEditorFragment extends BaseToolbarFragment {
|
||||
container.addView(buttonsContainer, new LinearLayout.LayoutParams(-1, -2));
|
||||
|
||||
TextView save = new TextView(new ContextThemeWrapper(getContext(), R.style.VKUIButton_Primary));
|
||||
save.setText(AndroidUtils.getString("save"));
|
||||
save.setText(requireContext().getString(R.string.save));
|
||||
save.setOnClickListener(v -> {
|
||||
DockBarEditorManager.getInstance().save();
|
||||
restartApplication();
|
||||
@@ -64,7 +62,7 @@ public class DockBarEditorFragment extends BaseToolbarFragment {
|
||||
buttonsContainer.addView(divider, new LinearLayout.LayoutParams(dp2px(10), 0));
|
||||
|
||||
TextView reset = new TextView(new ContextThemeWrapper(getContext(), R.style.VKUIButton_Primary));
|
||||
reset.setText(AndroidUtils.getString("reset"));
|
||||
reset.setText(requireContext().getString(R.string.reset));
|
||||
reset.setOnClickListener(v -> {
|
||||
DockBarEditorManager.getInstance().reset();
|
||||
restartApplication();
|
||||
|
||||
@@ -2,7 +2,6 @@ package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
|
||||
@@ -18,16 +17,16 @@ import androidx.preference.Preference;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vk.newsfeed.NewsfeedSettingsFragment;
|
||||
import com.vtosters.lite.R;
|
||||
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
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_feed", "xml"));
|
||||
addPreferencesFromResource(R.xml.preferences_feed);
|
||||
prefs();
|
||||
}
|
||||
|
||||
@@ -73,7 +72,7 @@ public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
var str = getDefaultPrefs().getString("news_feed_selected_items", "");
|
||||
findPreference("newsfeedlistmanager").setSummary(
|
||||
String.format(AndroidUtils.getString("feed_hidden"), (!TextUtils.isEmpty(str) ? str.split(",").length : 0))
|
||||
String.format(requireContext().getString(R.string.feed_hidden), (!TextUtils.isEmpty(str) ? str.split(",").length : 0))
|
||||
);
|
||||
findPreference("newsfeedlistmanager_reset").setOnPreferenceClickListener(preference -> {
|
||||
NewsfeedListManager.resetHideItems();
|
||||
@@ -86,23 +85,23 @@ public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
||||
var count = text.split(", ").length;
|
||||
|
||||
if (count < 1 || text.isEmpty()) {
|
||||
return AndroidUtils.getString("feed_no_elements");
|
||||
return requireContext().getString(R.string.feed_no_elements);
|
||||
} else {
|
||||
return String.format(AndroidUtils.getString("feed_elements_count"), count);
|
||||
return String.format(requireContext().getString(R.string.feed_elements_count), count);
|
||||
}
|
||||
}
|
||||
|
||||
private void remdialog(String key, Context context) {
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setTitle(AndroidUtils.getString("warning"))
|
||||
.setMessage(AndroidUtils.getString("delete_elements_confirm"))
|
||||
.setTitle(requireContext().getString(R.string.warning))
|
||||
.setMessage(requireContext().getString(R.string.delete_elements_confirm))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(AndroidUtils.getString("yes"), (dialogInterface, i) -> {
|
||||
.setPositiveButton(requireContext().getString(R.string.yes), (dialogInterface, i) -> {
|
||||
edit().remove(key).apply();
|
||||
sendToast(AndroidUtils.getString("elements_deleted_success"));
|
||||
sendToast(requireContext().getString(R.string.elements_deleted_success));
|
||||
setupFilters();
|
||||
})
|
||||
.setNegativeButton(AndroidUtils.getString("cancel"),
|
||||
.setNegativeButton(requireContext().getString(R.string.cancel),
|
||||
(dialogInterface, i) -> dialogInterface.dismiss())
|
||||
.show();
|
||||
}
|
||||
@@ -119,9 +118,9 @@ public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
||||
var count = str.toString().split(", ").length;
|
||||
|
||||
if (count < 1 || (str.length() == 0)) {
|
||||
return AndroidUtils.getString("feed_no_elements");
|
||||
return requireContext().getString(R.string.feed_no_elements);
|
||||
} else {
|
||||
return String.format(AndroidUtils.getString("feed_elements_count"), count);
|
||||
return String.format(requireContext().getString(R.string.feed_elements_count), count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,6 +145,6 @@ public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("vtlfeed", "string");
|
||||
return R.string.vtlfeed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,9 @@ import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
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) {
|
||||
@@ -63,7 +62,7 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
|
||||
rgVK.setText("VK");
|
||||
rgVK.setTextColor(getTextAttr());
|
||||
|
||||
rgVKontakte.setText(AndroidUtils.getString("app_name_alter"));
|
||||
rgVKontakte.setText(ctx.getString(R.string.app_name_alter));
|
||||
rgVKontakte.setTextColor(getTextAttr());
|
||||
|
||||
rgVKontakte.setChecked(defname.contains("vkontakte"));
|
||||
@@ -71,9 +70,9 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
|
||||
rgDefault.setChecked(defname.contains("vt") || defname.isEmpty());
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(AndroidUtils.getString("app_name_select_title"))
|
||||
.setTitle(R.string.app_name_select_title)
|
||||
.setView(rg)
|
||||
.setPositiveButton(AndroidUtils.getString("vtl_confirm"), ((dialog, which) -> {
|
||||
.setPositiveButton(R.string.vtl_confirm, ((dialog, which) -> {
|
||||
if (rgDefault.isChecked()) {
|
||||
edit().putString("appname", "vt").commit();
|
||||
edit().putString("selectedicon", appicon).commit();
|
||||
@@ -91,7 +90,7 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
|
||||
switchComponent(appicon, "vkontakte", deficon, defname);
|
||||
}
|
||||
}))
|
||||
.setNegativeButton(AndroidUtils.getString("cancel"),
|
||||
.setNegativeButton(R.string.cancel,
|
||||
((dialog, which) -> dialog.dismiss()))
|
||||
.show();
|
||||
}
|
||||
@@ -101,17 +100,16 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
|
||||
int vtosterXml = getIdentifier("empty", "xml");
|
||||
this.addPreferencesFromResource(vtosterXml);
|
||||
this.addPreferencesFromResource(R.xml.empty);
|
||||
|
||||
if (!hasVerification() && !getBoolValue("dialogrecomm", false)) {
|
||||
addPreference(this, "", AndroidUtils.getString("icons_warning"), AndroidUtils.getString("icons_warning_info"), "ic_about_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.icons_warning), requireContext().getString(R.string.icons_warning_info), R.drawable.ic_about_outline_28, preference -> {
|
||||
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://vtosters.app/donate/")));
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
addPreferenceCategory(this, AndroidUtils.getString("icons_title"));
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.icons_title));
|
||||
|
||||
for (var i = 0; i < icons().size(); i++) {
|
||||
if (icons().get(i) == null || iconsValues().get(i) == null) return;
|
||||
@@ -119,20 +117,20 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
|
||||
String iconname = icons().get(i);
|
||||
String icon = iconsValues().get(i);
|
||||
|
||||
String icondrawable;
|
||||
int iconRes;
|
||||
|
||||
if (icon.equals("vt")) {
|
||||
icondrawable = "vt_launcher_round";
|
||||
iconRes = R.mipmap.vt_launcher_round;
|
||||
} else if (icon.contains("standard")) {
|
||||
icondrawable = "ic_launcher_round";
|
||||
iconRes = R.mipmap.ic_launcher_round;
|
||||
} else {
|
||||
icondrawable = "ic_launcher_" + icon;
|
||||
iconRes = getIdentifier("ic_launcher_" + icon, "mipmap");
|
||||
}
|
||||
|
||||
Drawable drawable = ResourcesCompat.getDrawable(getResources(), getIdentifier(icondrawable, "mipmap"), null);
|
||||
Drawable drawable = ResourcesCompat.getDrawable(getResources(), iconRes, null);
|
||||
|
||||
if (drawable == null) {
|
||||
drawable = ResourcesCompat.getDrawable(getResources(), getIdentifier("ic_bug_outline_28", "drawable"), null);
|
||||
drawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_bug_outline_28, null);
|
||||
}
|
||||
|
||||
addPreferenceDrawable(this, icon, iconname, "", drawable, preference -> {
|
||||
@@ -142,7 +140,7 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
if (!hasVerification() && !getBoolValue("dialogrecomm", false)) {
|
||||
addPreferenceCategory(this, AndroidUtils.getString("unavailable_icons"));
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.unavailable_icons));
|
||||
|
||||
for (var i = 2; i < sIconsPlusNames.size(); i++) {
|
||||
if (sIconsPlusNames.get(i) == null || sIconsPlus.get(i) == null) return;
|
||||
@@ -150,24 +148,24 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
|
||||
String iconname = sIconsPlusNames.get(i);
|
||||
String icon = sIconsPlus.get(i);
|
||||
|
||||
String icondrawable;
|
||||
int iconRes;
|
||||
|
||||
if (icon.equals("vt")) {
|
||||
icondrawable = "vt_launcher_round";
|
||||
iconRes = R.mipmap.vt_launcher_round;
|
||||
} else if (icon.contains("standard")) {
|
||||
icondrawable = "ic_launcher_round";
|
||||
iconRes = R.mipmap.ic_launcher_round;
|
||||
} else {
|
||||
icondrawable = "ic_launcher_" + icon;
|
||||
iconRes = getIdentifier("ic_launcher_" + icon, "mipmap");
|
||||
}
|
||||
|
||||
Drawable drawable = ResourcesCompat.getDrawable(getResources(), getIdentifier(icondrawable, "mipmap"), null);
|
||||
Drawable drawable = ResourcesCompat.getDrawable(getResources(), iconRes, null);
|
||||
|
||||
if (drawable == null) {
|
||||
drawable = ResourcesCompat.getDrawable(getResources(), getIdentifier("ic_bug_outline_28", "drawable"), null);
|
||||
drawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_bug_outline_28, null);
|
||||
}
|
||||
|
||||
addPreferenceDrawable(this, icon, iconname, "", drawable, preference -> {
|
||||
sendToast(AndroidUtils.getString("unavailable_icon_warning"));
|
||||
sendToast(requireContext().getString(R.string.unavailable_icon_warning));
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
public class InstallGMSFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_gms", "xml"));
|
||||
addPreferencesFromResource(R.xml.preferences_gms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("installgms", "string");
|
||||
return R.string.installgms;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
@@ -10,16 +9,16 @@ import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
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
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_interface", "xml"));
|
||||
addPreferencesFromResource(R.xml.preferences_interface);
|
||||
prefs();
|
||||
}
|
||||
|
||||
@@ -43,9 +42,9 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
if (getPreferences().getInt("pic_rounding", 0) == 0) {
|
||||
findPreference("customrounding").setSummary(AndroidUtils.getString("disabled"));
|
||||
findPreference("customrounding").setSummary(requireContext().getString(R.string.disabled));
|
||||
} else {
|
||||
findPreference("customrounding").setSummary(String.format(AndroidUtils.getString("rounding_size"), getPreferences().getInt("pic_rounding", 0)));
|
||||
findPreference("customrounding").setSummary(String.format(requireContext().getString(R.string.rounding_size), getPreferences().getInt("pic_rounding", 0)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +62,6 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("vtlinterface", "string");
|
||||
return R.string.vtlinterface;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
@@ -29,6 +28,7 @@ import androidx.preference.Preference;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import org.json.JSONObject;
|
||||
@@ -66,8 +66,8 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
container.addView(input, lp);
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(AndroidUtils.getString("video_dl_enter_link"))
|
||||
.setPositiveButton(AndroidUtils.getString("download"),
|
||||
.setTitle(R.string.video_dl_enter_link)
|
||||
.setPositiveButton(R.string.download,
|
||||
(dialog, which) -> VideoDownloader.parseVideoLink(input.getText().toString(), ctx))
|
||||
.setView(container)
|
||||
.show();
|
||||
@@ -76,7 +76,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_media", "xml"));
|
||||
addPreferencesFromResource(R.xml.preferences_media);
|
||||
prefs();
|
||||
}
|
||||
|
||||
@@ -107,15 +107,15 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
if (isLoggedIn()) {
|
||||
findPreference("lastfm_auth").setSummary(AndroidUtils.getString("lastfm_authorized_as") + " " + LastFMScrobbler.getUserName());
|
||||
findPreference("lastfm_auth").setSummary(requireContext().getString(R.string.lastfm_authorized_as) + " " + LastFMScrobbler.getUserName());
|
||||
} else {
|
||||
findPreference("lastfm_enabled").setEnabled(false);
|
||||
}
|
||||
|
||||
findPreference("cached_tracks").setSummary(String.format(AndroidUtils.getString("cached_tracks_counter"), CacheDatabaseDelegate.getTrackCount()));
|
||||
findPreference("cached_tracks").setSummary(String.format(requireContext().getString(R.string.cached_tracks_counter), CacheDatabaseDelegate.getTrackCount()));
|
||||
findPreference("cached_tracks").setOnPreferenceClickListener(preference -> {
|
||||
if (CacheDatabaseDelegate.getTrackCount() == 0) {
|
||||
sendToast(AndroidUtils.getString("no_cache_error"));
|
||||
sendToast(requireContext().getString(R.string.no_cache_error));
|
||||
} else {
|
||||
delcache(requireContext());
|
||||
}
|
||||
@@ -133,9 +133,9 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
findPreference("select_photo_search_engine").setOnPreferenceClickListener(preference -> {
|
||||
var items = Arrays.asList(
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("yandex", "drawable"), "Yandex"),
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("google", "drawable"), "Google"),
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("microsoft", "drawable"), "Bing")
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.yandex, "Yandex"),
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.google, "Google"),
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.microsoft, "Bing")
|
||||
);
|
||||
|
||||
var adapter = new ImagineArrayAdapter(getContext(), items);
|
||||
@@ -156,7 +156,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
final EditText fn = new EditText(ctx);
|
||||
fn.setHint(AndroidUtils.getString("lastfm_login"));
|
||||
fn.setHint(R.string.lastfm_login);
|
||||
fn.setTextColor(getTextAttr());
|
||||
fn.setHintTextColor(getSTextAttr());
|
||||
fn.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
@@ -167,7 +167,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
fn.setLayoutParams(margin);
|
||||
|
||||
final EditText ln = new EditText(ctx);
|
||||
ln.setHint(AndroidUtils.getString("lastfm_password"));
|
||||
ln.setHint(R.string.lastfm_password);
|
||||
ln.setTextColor(getTextAttr());
|
||||
ln.setHintTextColor(getSTextAttr());
|
||||
ln.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
@@ -176,8 +176,8 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
ln.setLayoutParams(margin);
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(AndroidUtils.getString("lastfm_enter_credentials"))
|
||||
.setPositiveButton(AndroidUtils.getString("lastfm_enter"),
|
||||
.setTitle(R.string.lastfm_enter_credentials)
|
||||
.setPositiveButton(R.string.lastfm_enter,
|
||||
(dialog, which) -> {
|
||||
String login = fn.getText().toString();
|
||||
String pass = ln.getText().toString();
|
||||
@@ -190,22 +190,22 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
private void logout(Context ctx) {
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(AndroidUtils.getString("lastfm_logout_title"))
|
||||
.setMessage(AndroidUtils.getString("lastfm_logout_confirm"))
|
||||
.setPositiveButton(AndroidUtils.getString("vkim_yes"),
|
||||
.setTitle(R.string.lastfm_logout_title)
|
||||
.setMessage(R.string.lastfm_logout_confirm)
|
||||
.setPositiveButton(R.string.vkim_yes,
|
||||
(dialog, which) -> LastFMScrobbler.logout())
|
||||
.setNeutralButton(AndroidUtils.getString("vkim_no"),
|
||||
.setNeutralButton(R.string.vkim_no,
|
||||
(dialog, which) -> dialog.cancel())
|
||||
.show();
|
||||
}
|
||||
|
||||
private void delcache(Context ctx) {
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(AndroidUtils.getString("warning"))
|
||||
.setMessage(AndroidUtils.getString("cached_tracks_remove_confirm"))
|
||||
.setPositiveButton(AndroidUtils.getString("yes"),
|
||||
.setTitle(R.string.warning)
|
||||
.setMessage(R.string.cached_tracks_remove_confirm)
|
||||
.setPositiveButton(R.string.yes,
|
||||
(dialog, which) -> executor.submit(CacheDatabaseDelegate::clear))
|
||||
.setNeutralButton(AndroidUtils.getString("no"),
|
||||
.setNeutralButton(R.string.no,
|
||||
(dialog, which) -> dialog.cancel())
|
||||
.show();
|
||||
}
|
||||
@@ -217,12 +217,12 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(AndroidUtils.getString("download_method"))
|
||||
.setMessage(AndroidUtils.getString("download_method_desc"))
|
||||
.setPositiveButton(AndroidUtils.getString("download_method_cache"), (dialog, which) -> {
|
||||
.setTitle(R.string.download_method)
|
||||
.setMessage(R.string.download_method_desc)
|
||||
.setPositiveButton(R.string.download_method_cache, (dialog, which) -> {
|
||||
executor.submit(AudioDownloader::cacheAllAudios);
|
||||
})
|
||||
.setNegativeButton(AndroidUtils.getString("download_method_mp3"), (dialog, which) -> {
|
||||
.setNegativeButton(R.string.download_method_mp3, (dialog, which) -> {
|
||||
executor.submit(AudioDownloader::downloadAllAudios);
|
||||
})
|
||||
.show();
|
||||
@@ -240,9 +240,9 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
var response = new JSONObject(new OkHttpClient().a(request).execute().a().g());
|
||||
|
||||
if (response.optInt("response") == 1) {
|
||||
requireActivity().runOnUiThread(() -> sendToast(AndroidUtils.getString("video_history_cleaned")));
|
||||
requireActivity().runOnUiThread(() -> sendToast(requireContext().getString(R.string.video_history_cleaned)));
|
||||
} else {
|
||||
requireActivity().runOnUiThread(() -> sendToast(AndroidUtils.getString("delete_video_history_error")));
|
||||
requireActivity().runOnUiThread(() -> sendToast(requireContext().getString(R.string.delete_video_history_error)));
|
||||
}
|
||||
|
||||
Log.d("VideoHistory", response.toString());
|
||||
@@ -259,12 +259,12 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
private void deleteVideoHistoryDialog(Context context) {
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setTitle(AndroidUtils.getString("warning"))
|
||||
.setMessage(AndroidUtils.getString("delete_video_history_confirm"))
|
||||
.setTitle(R.string.warning)
|
||||
.setMessage(R.string.delete_video_history_confirm)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(AndroidUtils.getString("yes"),
|
||||
.setPositiveButton(R.string.yes,
|
||||
(dialogInterface, i) -> deleteVideoHistory())
|
||||
.setNegativeButton(AndroidUtils.getString("cancel"),
|
||||
.setNegativeButton(R.string.cancel,
|
||||
(dialogInterface, i) -> dialogInterface.dismiss())
|
||||
.show();
|
||||
}
|
||||
@@ -288,6 +288,6 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("vtlmedia", "string");
|
||||
return R.string.vtlmedia;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
@@ -18,6 +17,7 @@ import androidx.preference.Preference;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -29,7 +29,7 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_messages", "xml"));
|
||||
addPreferencesFromResource(R.xml.preferences_messages);
|
||||
prefs();
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
findPreference("lang_service").setOnPreferenceClickListener(preference -> {
|
||||
var items = Arrays.asList(
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("ic_yandex_translate_icon", "drawable"), "Yandex Translate"),
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("ic_google_translate_logo", "drawable"), "Google Translate")
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.ic_yandex_translate_icon, "Yandex Translate"),
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.ic_google_translate_logo, "Google Translate")
|
||||
// new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("ic_deepl_logo_icon", "drawable"), "DeepL")
|
||||
);
|
||||
|
||||
@@ -63,8 +63,8 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
findPreference("vkme_notifs").setEnabled(vkme());
|
||||
findPreference("wallpapers").setIcon(recolorDrawable(getGlobalContext().getDrawable(getIdentifier("ic_media_outline_28", "drawable"))));
|
||||
findPreference("vkme").setIcon(getIdentifier("ic_vkme_28", "drawable"));
|
||||
findPreference("wallpapers").setIcon(recolorDrawable(getGlobalContext().getDrawable(R.drawable.ic_media_outline_28)));
|
||||
findPreference("vkme").setIcon(R.drawable.ic_vkme_28);
|
||||
|
||||
if (isTablet()) {
|
||||
findPreference("alteremoji").setVisible(false);
|
||||
@@ -111,6 +111,6 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("vtlmessages", "string");
|
||||
return R.string.vtlmessages;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import static ru.vtosters.lite.ui.components.BackupManager.restoreBackup;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
@@ -46,6 +45,7 @@ import com.vk.mediastore.MediaStorage;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vk.pushes.PushSubscriber;
|
||||
import com.vk.stickers.Stickers;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.auth.VKAccountManager;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
import com.vtosters.lite.im.ImEngineProvider;
|
||||
@@ -63,7 +63,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_other", "xml"));
|
||||
addPreferencesFromResource(R.xml.preferences_other);
|
||||
prefs();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,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(), AndroidUtils.getString("token_saved"), LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.token_saved), LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,22 +112,22 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
var pref = getDefaultPrefs().getString("autoclearcache", "Default");
|
||||
switch (pref) {
|
||||
case "Default":
|
||||
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_disabled"));
|
||||
findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_disabled));
|
||||
break;
|
||||
case "100mb":
|
||||
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_100mb"));
|
||||
findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_100mb));
|
||||
break;
|
||||
case "500mb":
|
||||
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_500mb"));
|
||||
findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_500mb));
|
||||
break;
|
||||
case "1gb":
|
||||
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_1gb"));
|
||||
findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_1gb));
|
||||
break;
|
||||
case "2gb":
|
||||
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_2gb"));
|
||||
findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_2gb));
|
||||
break;
|
||||
case "5gb":
|
||||
findPreference("autoclearcache").setSummary(AndroidUtils.getString("cache_5gb"));
|
||||
findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_5gb));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -160,12 +160,12 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
rg.setPadding(dp2px(18f), dp2px(12f), dp2px(18f), 0);
|
||||
|
||||
RadioButton zero = new RadioButton(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton one = new RadioButton(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton two = new RadioButton(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton three = new RadioButton(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton four = new RadioButton(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton five = new RadioButton(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton zero = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton one = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton two = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton three = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton four = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton five = new RadioButton(new ContextThemeWrapper(getContext(), R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
|
||||
rg.addView(zero);
|
||||
rg.addView(one);
|
||||
@@ -181,7 +181,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
four.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
five.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
|
||||
zero.setText(AndroidUtils.getString("autoclearcachedisabled"));
|
||||
zero.setText(requireContext().getString(R.string.autoclearcachedisabled));
|
||||
one.setText("100 MB");
|
||||
two.setText("500 MB");
|
||||
three.setText("1 GB");
|
||||
@@ -203,12 +203,12 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
five.setChecked(val == 5);
|
||||
|
||||
new VkAlertDialog.Builder(getContext())
|
||||
.setTitle(AndroidUtils.getString("cache_clean_title"))
|
||||
.setMessage(AndroidUtils.getString("cache_select_size"))
|
||||
.setTitle(requireContext().getString(R.string.cache_clean_title))
|
||||
.setMessage(requireContext().getString(R.string.cache_select_size))
|
||||
.setCancelable(true)
|
||||
.setNegativeButton(AndroidUtils.getString("cancel"), null)
|
||||
.setNegativeButton(requireContext().getString(R.string.cancel), null)
|
||||
.setView(rg)
|
||||
.setPositiveButton(AndroidUtils.getString("save"), (dialog, which) -> {
|
||||
.setPositiveButton(requireContext().getString(R.string.save), (dialog, which) -> {
|
||||
var sizes = new String[] { "Default", "100mb", "500mb", "1gb", "2gb", "5gb" };
|
||||
var id = rg.getCheckedRadioButtonId();
|
||||
getDefaultPrefs().edit()
|
||||
@@ -221,8 +221,8 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
private void cacheCleanDialog() {
|
||||
new VkAlertDialog.Builder(getContext())
|
||||
.setTitle(AndroidUtils.getString("select_which_clean"))
|
||||
.setItems(AndroidUtils.getArray("cache_cleaner"), (dialog, which) -> {
|
||||
.setTitle(requireContext().getString(R.string.select_which_clean))
|
||||
.setItems(AndroidUtils.getArray(R.array.cache_cleaner), (dialog, which) -> {
|
||||
switch (which) {
|
||||
case 0: {
|
||||
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||
@@ -262,7 +262,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
clearWebViewCache();
|
||||
break;
|
||||
}
|
||||
Toast.makeText(getContext(), AndroidUtils.getString("cache_cleaned"), LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.cache_cleaned), LENGTH_SHORT).show();
|
||||
})
|
||||
.show();
|
||||
}
|
||||
@@ -273,14 +273,14 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
private void delprefs(Context context) {
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setTitle(AndroidUtils.getString("warning"))
|
||||
.setMessage(AndroidUtils.getString("settings_reset_confirm"))
|
||||
.setTitle(requireContext().getString(R.string.warning))
|
||||
.setMessage(requireContext().getString(R.string.settings_reset_confirm))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(AndroidUtils.getString("yes"), (dialogInterface, i) -> {
|
||||
.setPositiveButton(requireContext().getString(R.string.yes), (dialogInterface, i) -> {
|
||||
deletePrefs();
|
||||
restartApplication();
|
||||
})
|
||||
.setNegativeButton(AndroidUtils.getString("cancel"), (dialogInterface, i) -> dialogInterface.dismiss())
|
||||
.setNegativeButton(requireContext().getString(R.string.cancel), (dialogInterface, i) -> dialogInterface.dismiss())
|
||||
.show();
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
try {
|
||||
backupOnlines();
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(getContext(), AndroidUtils.getString("no_data_to_backup"), LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.no_data_to_backup), LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -326,8 +326,8 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
class c implements Preference.OnPreferenceClickListener {
|
||||
public void copy(Context context, String str) {
|
||||
((ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", str));
|
||||
makeText(context, AndroidUtils.getString("copybtn"), LENGTH_SHORT).show();
|
||||
ToastUtils.a(AndroidUtils.getString("tokenwarning"));
|
||||
makeText(context, requireContext().getString(R.string.copybtn), LENGTH_SHORT).show();
|
||||
ToastUtils.a(requireContext().getString(R.string.tokenwarning));
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
@@ -342,12 +342,12 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
VKAccount b = VKAccountManager.d();
|
||||
PushSubscriber.e.a();
|
||||
ToastUtils.a(AndroidUtils.getString("fcmtokenrem"));
|
||||
ToastUtils.a(requireContext().getString(R.string.fcmtokenrem));
|
||||
AndroidUtils.getGlobalContext().getSharedPreferences("gcm", 0).edit().clear().apply();
|
||||
OtherFragment.this.getListView().postDelayed(() -> {
|
||||
PushSubscriber.e.a(true);
|
||||
ToastUtils.a(AndroidUtils.getString("fcmtokenget"));
|
||||
ToastUtils.a(AndroidUtils.getString("fcmtokenfixed"));
|
||||
ToastUtils.a(requireContext().getString(R.string.fcmtokenget));
|
||||
ToastUtils.a(requireContext().getString(R.string.fcmtokenfixed));
|
||||
}, 1000);
|
||||
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(AndroidUtils.getString("select_backup"))
|
||||
.setTitle(requireContext().getString(R.string.select_backup))
|
||||
.setAdapter(adapter, (dialog, which) -> {
|
||||
try {
|
||||
restoreBackup(arr[which]);
|
||||
Toast.makeText(getContext(), AndroidUtils.getString("backup_success"), LENGTH_LONG).show();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.backup_success), LENGTH_LONG).show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(getContext(), AndroidUtils.getString("backup_error"), LENGTH_LONG).show();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.backup_error), LENGTH_LONG).show();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
@@ -376,6 +376,6 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("vtlother", "string");
|
||||
return R.string.vtlother;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,25 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.proxy.RandomProxy.setupNewProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class ProxySettingsFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_proxy", "xml"));
|
||||
addPreferencesFromResource(R.xml.preferences_proxy);
|
||||
findPreference("random_proxy").setOnPreferenceClickListener(preference -> {
|
||||
try {
|
||||
setupNewProxy();
|
||||
} catch (IOException e) {
|
||||
sendToast(AndroidUtils.getString("get_proxy_error"));
|
||||
sendToast(requireContext().getString(R.string.get_proxy_error));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@@ -29,6 +27,6 @@ public class ProxySettingsFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("vtlproxy", "string");
|
||||
return R.string.vtlproxy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
|
||||
import android.os.Build;
|
||||
@@ -21,10 +20,11 @@ import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.ui.adapters.CategorizedAdapter;
|
||||
import ru.vtosters.lite.ui.components.ItemMovingCallback;
|
||||
import ru.vtosters.lite.ui.components.SuperAppEditorManager;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LayoutUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SuperAppEditorFragment extends BaseToolbarFragment {
|
||||
@CallSuper
|
||||
@Override
|
||||
public View onCreateContent(@NonNull LayoutInflater inflater, @Nullable Bundle bundle) {
|
||||
setTitle(getIdentifier("superapp_editor", "string"));
|
||||
setTitle(R.string.superapp_editor);
|
||||
|
||||
FrameLayout content = new FrameLayout(getContext());
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SuperAppEditorFragment extends BaseToolbarFragment {
|
||||
content.addView(container, new FrameLayout.LayoutParams(-1, -1));
|
||||
|
||||
TextView message = new TextView(getContext());
|
||||
message.setText(AndroidUtils.getString("superapp_editor_message"));
|
||||
message.setText(R.string.superapp_editor_message);
|
||||
message.setTextSize(16.0f);
|
||||
message.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||
message.setTextColor(ThemesUtils.getTextAttr());
|
||||
@@ -64,7 +64,7 @@ public class SuperAppEditorFragment extends BaseToolbarFragment {
|
||||
container.addView(buttonsContainer, new LinearLayout.LayoutParams(-1, -2));
|
||||
|
||||
TextView save = new TextView(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.VKUIButton_Primary));
|
||||
save.setText(AndroidUtils.getString("save"));
|
||||
save.setText(R.string.save);
|
||||
save.setOnClickListener(v -> {
|
||||
SuperAppEditorManager.getInstance().save();
|
||||
restartApplication();
|
||||
@@ -78,7 +78,7 @@ public class SuperAppEditorFragment extends BaseToolbarFragment {
|
||||
buttonsContainer.addView(divider, new LinearLayout.LayoutParams(dp2px(10), 0));
|
||||
|
||||
TextView reset = new TextView(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.VKUIButton_Primary));
|
||||
reset.setText(AndroidUtils.getString("reset"));
|
||||
reset.setText(R.string.reset);
|
||||
reset.setOnClickListener(v -> {
|
||||
SuperAppEditorManager.getInstance().reset();
|
||||
restartApplication();
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.detectMiuiV2;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.getEmuiVersionCode;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.getMiuiUiVersionCode;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.getMiuiUiVersionIncrementalCode;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.getMiuiUiVersionName;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.getOneUiMajorVersion;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.getOneUiMinorVersion;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.hasMiuiIncrCode;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.isEMUI;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.isFlyme;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.isMIUI;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.hasMiuiIncrCode;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.isOneUi;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.isSamsung;
|
||||
import static ru.vtosters.lite.deviceinfo.OEMDetector.isVivo;
|
||||
@@ -18,7 +17,6 @@ import static ru.vtosters.lite.deviceinfo.OEMDetector.isZenUI;
|
||||
import static ru.vtosters.lite.ui.PreferencesUtil.addPreference;
|
||||
import static ru.vtosters.lite.ui.PreferencesUtil.addPreferenceCategory;
|
||||
import static ru.vtosters.lite.utils.About.getBuildNumber;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.isValidSignature;
|
||||
@@ -29,16 +27,15 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class SystemInfo extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("empty", "xml"));
|
||||
addPreferencesFromResource(R.xml.empty);
|
||||
|
||||
var oneUiMajorVersion = String.valueOf(getOneUiMajorVersion());
|
||||
var oneUiMinorVersion = String.valueOf(getOneUiMinorVersion());
|
||||
@@ -70,124 +67,124 @@ public class SystemInfo extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
addPreferenceCategory(this, "App information");
|
||||
|
||||
addPreference(this, "", "Package name", packageName, null, preference -> {
|
||||
addPreference(this, "", "Package name", packageName, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", packageName));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", "Commit", commit, null, preference -> {
|
||||
addPreference(this, "", "Commit", commit, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", commit));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", "Valid Signature", "Value: " + isValidSignature, null, null);
|
||||
addPreference(this, "", "Valid Signature", "Value: " + isValidSignature, 0, null);
|
||||
|
||||
addPreference(this, "", "isTablet", "Value: " + isTablet, null, null);
|
||||
addPreference(this, "", "isTablet", "Value: " + isTablet, 0, null);
|
||||
|
||||
addPreferenceCategory(this, "System information");
|
||||
|
||||
addPreference(this, "", "SDK Version", sdkVersion, null, preference -> {
|
||||
addPreference(this, "", "SDK Version", sdkVersion, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", sdkVersion));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", "Product Name", productName, null, preference -> {
|
||||
addPreference(this, "", "Product Name", productName, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", productName));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", "Device Name", deviceName, null, preference -> {
|
||||
addPreference(this, "", "Device Name", deviceName, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", deviceName));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", "Board Name", boardName, null, preference -> {
|
||||
addPreference(this, "", "Board Name", boardName, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", boardName));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", "Manufacturer Name", manufacturerName, null, preference -> {
|
||||
addPreference(this, "", "Manufacturer Name", manufacturerName, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", manufacturerName));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", "Brand Name", brandName, null, preference -> {
|
||||
addPreference(this, "", "Brand Name", brandName, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", brandName));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", "Model Name", modelName, null, preference -> {
|
||||
addPreference(this, "", "Model Name", modelName, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", modelName));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreferenceCategory(this, "OEM Information");
|
||||
|
||||
if (isOneUi){
|
||||
addPreference(this, "", "OneUiMajorVersion", oneUiMajorVersion, null, preference -> {
|
||||
addPreference(this, "", "OneUiMajorVersion", oneUiMajorVersion, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", oneUiMajorVersion));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", "OneUiMinorVersion", oneUiMinorVersion, null, preference -> {
|
||||
addPreference(this, "", "OneUiMinorVersion", oneUiMinorVersion, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", oneUiMinorVersion));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
} else if (isMiui) {
|
||||
addPreference(this, "", "miuiUiVersionName", miuiUiVersionName, null, preference -> {
|
||||
addPreference(this, "", "miuiUiVersionName", miuiUiVersionName, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", miuiUiVersionName));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", "miuiUiVersionCodeName", miuiUiVersionCodeName, null, preference -> {
|
||||
addPreference(this, "", "miuiUiVersionCodeName", miuiUiVersionCodeName, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", miuiUiVersionCodeName));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
|
||||
if (hasMiuiIncrCode) {
|
||||
addPreference(this, "", "miuiIncrementalCodeName", miuiIncrementalCodeName, null, preference -> {
|
||||
addPreference(this, "", "miuiIncrementalCodeName", miuiIncrementalCodeName, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", miuiIncrementalCodeName));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
}
|
||||
} else if (isEMUI){
|
||||
addPreference(this, "", "emuiVersionCode", emuiVersionCode, null, preference -> {
|
||||
addPreference(this, "", "emuiVersionCode", emuiVersionCode, 0, preference -> {
|
||||
((ClipboardManager) requireActivity().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", emuiVersionCode));
|
||||
sendToast(AndroidUtils.getString("copied_to_clipboard"));
|
||||
sendToast(requireContext().getString(R.string.copied_to_clipboard));
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
addPreference(this, "", "No info", "No information about OEM", null, null);
|
||||
addPreference(this, "", "No info", "No information about OEM", 0, null);
|
||||
}
|
||||
|
||||
addPreferenceCategory(this, "OEM List");
|
||||
|
||||
addPreference(this, "", "isOneUi", "Value: " + isOneUi, null, null);
|
||||
addPreference(this, "", "isOneUi", "Value: " + isOneUi, 0, null);
|
||||
|
||||
addPreference(this, "", "isMiui", "Value: " + isMiui, null, null);
|
||||
addPreference(this, "", "isMiui", "Value: " + isMiui, 0, null);
|
||||
|
||||
addPreference(this, "", "isEMUI", "Value: " + isEMUI, null, null);
|
||||
addPreference(this, "", "isEMUI", "Value: " + isEMUI, 0, null);
|
||||
|
||||
addPreference(this, "", "isFlyme", "Value: " + isFlyme, null, null);
|
||||
addPreference(this, "", "isFlyme", "Value: " + isFlyme, 0, null);
|
||||
|
||||
addPreference(this, "", "isSamsung", "Value: " + isSamsung, null, null);
|
||||
addPreference(this, "", "isSamsung", "Value: " + isSamsung, 0, null);
|
||||
|
||||
addPreference(this, "", "isVivo", "Value: " + isVivo, null, null);
|
||||
addPreference(this, "", "isVivo", "Value: " + isVivo, 0, null);
|
||||
|
||||
addPreference(this, "", "isZenUI", "Value: " + isZenUI, null, null);
|
||||
addPreference(this, "", "isZenUI", "Value: " + isZenUI, 0, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
import static ru.vtosters.lite.utils.Preferences.*;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -13,17 +12,16 @@ import android.os.Bundle;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
|
||||
public class ThemesFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_themes", "xml"));
|
||||
addPreferencesFromResource(R.xml.preferences_themes);
|
||||
prefs();
|
||||
}
|
||||
|
||||
@@ -83,6 +81,6 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("vtlthemes", "string");
|
||||
return R.string.vtlthemes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static com.vtosters.lite.NotificationUtils.Type.Default;
|
||||
import static ru.vtosters.lite.ui.PreferencesUtil.addListPreferenceIcon;
|
||||
import static ru.vtosters.lite.ui.PreferencesUtil.addMaterialSwitchPreference;
|
||||
import static ru.vtosters.lite.ui.PreferencesUtil.addPreference;
|
||||
@@ -12,7 +11,6 @@ import static ru.vtosters.lite.utils.AccountManagerUtils.getUserPhoto;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUsername;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.isVKTester;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.humanReadableByteCountBin;
|
||||
@@ -44,6 +42,8 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||
import com.vk.about.AboutAppFragment;
|
||||
import com.vk.balance.BalanceFragment;
|
||||
@@ -51,6 +51,7 @@ import com.vk.navigation.Navigator;
|
||||
import com.vk.notifications.settings.NotificationsSettingsFragment;
|
||||
import com.vk.webapp.fragments.PrivacyFragment;
|
||||
import com.vtosters.lite.MainActivity;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.auth.VKAccountManager;
|
||||
import com.vtosters.lite.auth.VKAuth;
|
||||
import com.vtosters.lite.fragments.money.music.control.subscription.MusicSubscriptionControlFragment;
|
||||
@@ -72,35 +73,35 @@ import ru.vtosters.lite.utils.SSFSUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
public static String getValAsString(String stringid, Boolean value) {
|
||||
public static String getValAsString(@StringRes int strRes, Boolean value) {
|
||||
if (disableSettingsSumms()) return null;
|
||||
|
||||
if (value) {
|
||||
return AndroidUtils.getString(stringid) + ": " + AndroidUtils.getString("vtlsettenabled");
|
||||
return AndroidUtils.getString(strRes) + ": " + AndroidUtils.getString(R.string.vtlsettenabled);
|
||||
}
|
||||
|
||||
return AndroidUtils.getString(stringid) + ": " + AndroidUtils.getString("vtlsettdisabled");
|
||||
return AndroidUtils.getString(strRes) + ": " + AndroidUtils.getString(R.string.vtlsettdisabled);
|
||||
}
|
||||
|
||||
public static String getSSFSsumm() {
|
||||
if (disableSettingsSumms()) return null;
|
||||
|
||||
if (hasSpecialVerif())
|
||||
return AndroidUtils.getString("vtlssfssumm") + ": " + AndroidUtils.getString("vtlsettverifyes");
|
||||
return AndroidUtils.getString(R.string.vtlssfssumm) + ": " + AndroidUtils.getString(R.string.vtlsettverifyes);
|
||||
|
||||
return AndroidUtils.getString("vtlssfssumm") + ": " + AndroidUtils.getString("vtlsettverifno");
|
||||
return AndroidUtils.getString(R.string.vtlssfssumm) + ": " + AndroidUtils.getString(R.string.vtlsettverifno);
|
||||
}
|
||||
|
||||
public static String getDocksumm() {
|
||||
if (disableSettingsSumms()) return null;
|
||||
|
||||
return AndroidUtils.getString("vtldocksumm") + ": " + DockBarEditorManager.getInstance().getSelectedTabs().size();
|
||||
return AndroidUtils.getString(R.string.vtldocksumm) + ": " + DockBarEditorManager.getInstance().getSelectedTabs().size();
|
||||
}
|
||||
|
||||
public static String getTGSsumm() {
|
||||
if (disableSettingsSumms()) return null;
|
||||
|
||||
return AndroidUtils.getString("vtltgssumm") + ": " + TelegramStickersService.getInstance(AndroidUtils.getGlobalContext()).getPacksListReference().size();
|
||||
return AndroidUtils.getString(R.string.vtltgssumm) + ": " + TelegramStickersService.getInstance(AndroidUtils.getGlobalContext()).getPacksListReference().size();
|
||||
}
|
||||
|
||||
public static String getProxysumm() {
|
||||
@@ -109,9 +110,9 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
if (disableSettingsSumms()) return null;
|
||||
|
||||
if (type.equals("noproxy") || type.isEmpty())
|
||||
type = AndroidUtils.getString("vtlsettdisabled");
|
||||
type = AndroidUtils.getString(R.string.vtlsettdisabled);
|
||||
|
||||
return AndroidUtils.getString("vtlproxysumm") + ": " + type;
|
||||
return AndroidUtils.getString(R.string.vtlproxysumm) + ": " + type;
|
||||
}
|
||||
|
||||
public static String getThemesumm() {
|
||||
@@ -142,13 +143,13 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
public static String getSuperappsumm() {
|
||||
if (disableSettingsSumms()) return null;
|
||||
|
||||
return AndroidUtils.getString("elements_hidden_count") + ": " + SuperAppEditorManager.getInstance().getDisabledTabs().size();
|
||||
return AndroidUtils.getString(R.string.elements_hidden_count) + ": " + SuperAppEditorManager.getInstance().getDisabledTabs().size();
|
||||
}
|
||||
|
||||
public static String getCachesumm() {
|
||||
if (disableSettingsSumms()) return null;
|
||||
|
||||
return AndroidUtils.getString("autoclearcachesumm") + " " + humanReadableByteCountBin(CacheUtils.getInstance().size);
|
||||
return AndroidUtils.getString(R.string.autoclearcachesumm) + " " + humanReadableByteCountBin(CacheUtils.getInstance().size);
|
||||
}
|
||||
|
||||
private void switchTheme(boolean isDarkTheme) {
|
||||
@@ -160,24 +161,23 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
|
||||
var feedsumm = getValAsString("vtlfeedsumm", ads());
|
||||
var feedsumm = getValAsString(R.string.vtlfeedsumm, ads());
|
||||
var docksumm = getDocksumm();
|
||||
var msgsumm = isTablet() ? getValAsString("autotranslate_title", autotranslate()) : getValAsString("vtlmsgsumm", vkme());
|
||||
var activitysumm = getValAsString("vtlactivitysumm", offline());
|
||||
var themessumm = getValAsString("vtlthemessumm", navbar());
|
||||
var msgsumm = isTablet() ? getValAsString(R.string.autotranslate_title, autotranslate()) : getValAsString(R.string.vtlmsgsumm, vkme());
|
||||
var activitysumm = getValAsString(R.string.vtlactivitysumm, offline());
|
||||
var themessumm = getValAsString(R.string.vtlthemessumm, navbar());
|
||||
var tgssumm = getTGSsumm();
|
||||
var superapp = getSuperappsumm();
|
||||
var mediasumm = getValAsString("vtlinterfacesumm", shortinfo());
|
||||
var interfacesumm = getValAsString("showstories", stories());
|
||||
var mediasumm = getValAsString(R.string.vtlinterfacesumm, shortinfo());
|
||||
var interfacesumm = getValAsString(R.string.showstories, stories());
|
||||
var proxysumm = getProxysumm();
|
||||
var othersumm = getValAsString("vtlothersumm", vtverif());
|
||||
var othersumm = getValAsString(R.string.vtlothersumm, vtverif());
|
||||
var ssfs = getSSFSsumm();
|
||||
var about = "Commit: " + getBuildNumber();
|
||||
|
||||
int vtosterXml = getIdentifier("empty", "xml");
|
||||
this.addPreferencesFromResource(vtosterXml);
|
||||
this.addPreferencesFromResource(R.xml.empty);
|
||||
|
||||
addPreferenceDrawable(this, "", getUsername(), AndroidUtils.getString("vtllogout"), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28", true, true), preference -> {
|
||||
addPreferenceDrawable(this, "", getUsername(), requireContext().getString(R.string.vtllogout), getDrawableFromUrl(getUserPhoto(), R.drawable.ic_user_circle_outline_28, true, true), preference -> {
|
||||
try {
|
||||
VKAuth.a("logout", false);
|
||||
} catch (Exception ignored) {
|
||||
@@ -192,7 +192,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtssfs"), ssfs, "ic_link_circle_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtssfs), ssfs, R.drawable.ic_link_circle_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
VKUIwrapper.setLink(SSFSUtils.getSSFSLink());
|
||||
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
|
||||
@@ -201,15 +201,15 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreferenceCategory(this, AndroidUtils.getString("appearance_theme_use_system"));
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.appearance_theme_use_system));
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 28 && milkshake()) {
|
||||
addListPreferenceIcon(
|
||||
this,
|
||||
"currsystemtheme",
|
||||
"system",
|
||||
AndroidUtils.getString("appearance_theme_use_system"),
|
||||
"ic_palette_outline_28", getThemesumm(),
|
||||
requireContext().getString(R.string.appearance_theme_use_system),
|
||||
R.drawable.ic_palette_outline_28, getThemesumm(),
|
||||
new String[] { "Системная тема", "Тёмная тема", "Светлая тема" },
|
||||
new String[] { "system", "dark", "light" },
|
||||
(preference, o) -> {
|
||||
@@ -223,7 +223,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
} else {
|
||||
addMaterialSwitchPreference(this, "", AndroidUtils.getString("vtsettdarktheme"), "", "ic_palette_outline_28", isDarkTheme(), (preference, o) -> {
|
||||
addMaterialSwitchPreference(this, "", requireContext().getString(R.string.vtsettdarktheme), "", R.drawable.ic_palette_outline_28, isDarkTheme(), (preference, o) -> {
|
||||
final var switchPreference = (MaterialSwitchPreference) preference;
|
||||
final var isDarkTheme = !switchPreference.isChecked();
|
||||
switchTheme(isDarkTheme);
|
||||
@@ -232,9 +232,9 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
if (!isGmsInstalled()) {
|
||||
addPreferenceCategory(this, AndroidUtils.getString("gmsname"));
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.gmsname));
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("installgms"), "", "ic_about_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.installgms), "", R.drawable.ic_about_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(InstallGMSFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -244,9 +244,9 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
if (devmenu()) {
|
||||
addPreferenceCategory(this, AndroidUtils.getString("sett_debug"));
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.sett_debug));
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("sett_debug"), "", "ic_bug_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.sett_debug), "", R.drawable.ic_bug_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(SettingsDebugFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -254,16 +254,16 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addMaterialSwitchPreference(this, "ssl", AndroidUtils.getString("debug_developer_force_ssl"), AndroidUtils.getString("debug_developer_force_ssl_summary"), "ic_globe_outline_28", true, (preference, o) -> {
|
||||
addMaterialSwitchPreference(this, "ssl", requireContext().getString(R.string.debug_developer_force_ssl), requireContext().getString(R.string.debug_developer_force_ssl_summary), R.drawable.ic_globe_outline_28, true, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("ssl", value).commit();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
addPreferenceCategory(this, AndroidUtils.getString("vtsettaccount"));
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.vtsettaccount));
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vkconnect"), "", "ic_user_circle_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vkconnect), "", R.drawable.ic_user_circle_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
VKUIwrapper.officalLinks("account");
|
||||
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
|
||||
@@ -272,7 +272,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("privacy_settings"), "", "ic_privacy_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.privacy_settings), "", R.drawable.ic_privacy_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(PrivacyFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -280,7 +280,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("sett_account"), "", "ic_user_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.sett_account), "", R.drawable.ic_user_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(SettingsAccountFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -289,7 +289,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
if (isVKTester()) {
|
||||
addPreference(this, "", AndroidUtils.getString("bugs"), "", "ic_bug_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.bugs), "", R.drawable.ic_bug_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
VKUIwrapper.officalLinks("bugs");
|
||||
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
|
||||
@@ -299,9 +299,9 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
}
|
||||
|
||||
addPreferenceCategory(this, AndroidUtils.getString("vtlvksettings"));
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.vtlvksettings));
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("sett_general"), "", "ic_settings_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.sett_general), "", R.drawable.ic_settings_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(SettingsGeneralFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -309,7 +309,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("blacklist"), "", "ic_users_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.blacklist), "", R.drawable.ic_users_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(BlacklistFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -317,7 +317,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("sett_notifications"), "", "ic_menu_notification_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.sett_notifications), "", R.drawable.ic_menu_notification_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(NotificationsSettingsFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -326,7 +326,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
if (VKAccountManager.d().isMusicSubs()) {
|
||||
addPreference(this, "", AndroidUtils.getString("subscription_music"), "", "ic_music_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.subscription_music), "", R.drawable.ic_music_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(MusicSubscriptionControlFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -335,7 +335,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
}
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("votes"), "", "ic_coins_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.votes), "", R.drawable.ic_coins_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(BalanceFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -343,12 +343,12 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreferenceCategory(this, AndroidUtils.getString("vtsettmod"));
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.vtsettmod));
|
||||
|
||||
if (vkme()) {
|
||||
addPreference(this, "", AndroidUtils.getString("warning"), AndroidUtils.getString("vkme_mode_info"), "ic_about_outline_28", preference -> false);
|
||||
addPreference(this, "", requireContext().getString(R.string.warning), requireContext().getString(R.string.vkme_mode_info), R.drawable.ic_about_outline_28, preference -> false);
|
||||
} else {
|
||||
addPreference(this, "", AndroidUtils.getString("vtlfeed"), feedsumm, "ic_newsfeed_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtlfeed), feedsumm, R.drawable.ic_newsfeed_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(FeedFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -357,7 +357,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
}
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlmedia"), mediasumm, "ic_media_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtlmedia), mediasumm, R.drawable.ic_media_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(MediaFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -365,7 +365,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlmessages"), msgsumm, "ic_message_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtlmessages), msgsumm, R.drawable.ic_message_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(MessagesFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -373,7 +373,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtltgs"), tgssumm, "ic_telegram_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtltgs), tgssumm, R.drawable.ic_telegram_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(StickersFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -381,7 +381,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlthemes"), themessumm, "ic_write_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtlthemes), themessumm, R.drawable.ic_write_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(ThemesFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -389,7 +389,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlinterface"), interfacesumm, "ic_interface_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtlinterface), interfacesumm, R.drawable.ic_interface_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(InterfaceFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -399,7 +399,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
if(!vkme()){
|
||||
if (!isTablet()) {
|
||||
addPreference(this, "", AndroidUtils.getString("dockbar_editor"), docksumm, "ic_list_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.dockbar_editor), docksumm, R.drawable.ic_list_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent intent = new Navigator(DockBarEditorFragment.class).b(context);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -408,7 +408,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
if (milkshake() && superapp()) {
|
||||
addPreference(this, "", AndroidUtils.getString("superapp_editor"), superapp, "ic_services_outline_28", (preference) -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.superapp_editor), superapp, R.drawable.ic_services_outline_28, (preference) -> {
|
||||
Context context = requireContext();
|
||||
Intent intent = new Navigator(SuperAppEditorFragment.class).b(context);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -419,7 +419,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
}
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlactivity"), activitysumm, "ic_write_outline_28_new_accent", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtlactivity), activitysumm, R.drawable.ic_write_outline_28_new_accent, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(ActivityFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -427,7 +427,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlproxy"), proxysumm, "ic_globe_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtlproxy), proxysumm, R.drawable.ic_globe_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(ProxySettingsFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -435,7 +435,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlother"), othersumm, "ic_more_horizontal_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtlother), othersumm, R.drawable.ic_more_horizontal_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(OtherFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -443,9 +443,9 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreferenceCategory(this, AndroidUtils.getString("vtsettaboutmod"));
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.vtsettaboutmod));
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("menu_about"), about, "ic_about_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.menu_about), about, R.drawable.ic_about_outline_28, preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(AboutAppFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -453,25 +453,25 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("opencommit"), "", "ic_link_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.opencommit), "", R.drawable.ic_link_outline_28, preference -> {
|
||||
requireContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse(getCommitLink())));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtfaq"), AndroidUtils.getString("vtfaqsumm"), "ic_help_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.vtfaq), requireContext().getString(R.string.vtfaqsumm), R.drawable.ic_help_outline_28, preference -> {
|
||||
requireContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/s/vtosters_faq")));
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("reportbug"), AndroidUtils.getString("reportbugsumm"), "ic_bug_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.reportbug), requireContext().getString(R.string.reportbugsumm), R.drawable.ic_bug_outline_28, preference -> {
|
||||
requireContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://github.com/vtosters/lite/issues")));
|
||||
return false;
|
||||
});
|
||||
|
||||
if (isValidSignature()) {
|
||||
addPreferenceCategory(this, AndroidUtils.getString("updates"));
|
||||
addPreferenceCategory(this, requireContext().getString(R.string.updates));
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("checkforupdates"), "", "ic_download_outline_28", preference -> {
|
||||
addPreference(this, "", requireContext().getString(R.string.checkforupdates), "", R.drawable.ic_download_outline_28, preference -> {
|
||||
OTADialog.checkUpdates(getActivity());
|
||||
return false;
|
||||
});
|
||||
@@ -485,6 +485,6 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("notification_settings", "string");
|
||||
return R.string.notification_settings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static android.widget.Toast.makeText;
|
||||
import static ru.vtosters.lite.tgs.TGPref.setTGBotKey;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
@@ -38,6 +37,7 @@ import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -45,7 +45,6 @@ import ru.vtosters.lite.tgs.TGPref;
|
||||
import ru.vtosters.lite.ui.adapters.StickerPackAdapter;
|
||||
import ru.vtosters.lite.ui.components.StickerTouchHelperCallback;
|
||||
import ru.vtosters.lite.ui.fragments.BaseToolbarFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class StickersFragment extends BaseToolbarFragment {
|
||||
public final static String ACTION_RELOAD = "com.vtosters.lite.action.RELOAD_TGS_LIST";
|
||||
@@ -84,7 +83,7 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
protected void onCreateMenu(Menu menu) {
|
||||
var item = menu.add(0, 0, 0, "");
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
item.setIcon(getIdentifier("ic_settings_24", "drawable"));
|
||||
item.setIcon(R.drawable.ic_settings_24);
|
||||
|
||||
super.onCreateMenu(menu);
|
||||
}
|
||||
@@ -115,7 +114,7 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
|
||||
@Override
|
||||
public View onCreateContent(@NonNull LayoutInflater inflater, @Nullable Bundle bundle) {
|
||||
setTitle(getIdentifier("vtltgs", "string"));
|
||||
setTitle(R.string.vtltgs);
|
||||
|
||||
FrameLayout layout = new FrameLayout(getContext());
|
||||
|
||||
@@ -131,7 +130,7 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
layout.addView(mRecycler, new ViewGroup.LayoutParams(-1, -1));
|
||||
|
||||
FloatingActionButton mAddStickerPack = new FloatingActionButton(getContext());
|
||||
mAddStickerPack.setImageResource(getIdentifier("ic_add_24", "drawable"));
|
||||
mAddStickerPack.setImageResource(R.drawable.ic_add_24);
|
||||
mAddStickerPack.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
mAddStickerPack.setOnClickListener(v2 -> fabClick());
|
||||
|
||||
@@ -158,14 +157,14 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
private void fabClick() {
|
||||
int method = TGPref.getTGConnectMethod();
|
||||
if (method == -1) {
|
||||
openMenu(AndroidUtils.getString("stickersconnection"));
|
||||
openMenu(requireContext().getString(R.string.stickersconnection));
|
||||
return;
|
||||
}
|
||||
|
||||
initGrabber();
|
||||
if (method == TYPE_SOCKS) {
|
||||
if (TGPref.getTGProxyIP() == null) {
|
||||
openMenu(AndroidUtils.getString("stickersproxy1"));
|
||||
openMenu(requireContext().getString(R.string.stickersproxy1));
|
||||
}
|
||||
} else if (method == TYPE_DIRECT) {
|
||||
final Runnable callback = () -> {
|
||||
@@ -182,8 +181,8 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
editText.setLayoutParams(margin);
|
||||
|
||||
new VkAlertDialog.Builder(getContext())
|
||||
.setTitle(AndroidUtils.getString("stickershelp1"))
|
||||
.setMessage(AndroidUtils.getString("stickershelp2"))
|
||||
.setTitle(requireContext().getString(R.string.stickershelp1))
|
||||
.setMessage(requireContext().getString(R.string.stickershelp2))
|
||||
.setView(linearLayout)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
String pack = editText.getText().toString();
|
||||
@@ -240,8 +239,8 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
editText.setLayoutParams(margin);
|
||||
|
||||
new VkAlertDialog.Builder(getContext())
|
||||
.setTitle(AndroidUtils.getString("stickersapi5"))
|
||||
.setMessage(AndroidUtils.getString("stickersapi6"))
|
||||
.setTitle(requireContext().getString(R.string.stickersapi5))
|
||||
.setMessage(requireContext().getString(R.string.stickersapi6))
|
||||
.setView(linearLayout)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
setTGBotKey(editText.getText().toString());
|
||||
@@ -250,11 +249,11 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
.setNegativeButton(android.R.string.cancel,
|
||||
(dialog, which) -> dialog.dismiss()
|
||||
)
|
||||
.setNeutralButton(AndroidUtils.getString("stickersapi7"),
|
||||
.setNeutralButton(requireContext().getString(R.string.stickersapi7),
|
||||
(dialog, which) -> new VkAlertDialog.Builder(getContext())
|
||||
.setTitle(AndroidUtils.getString("stickersapi8"))
|
||||
.setMessage(AndroidUtils.getString("stickersapi9") +
|
||||
AndroidUtils.getString("stickersapi10"))
|
||||
.setTitle(requireContext().getString(R.string.stickersapi8))
|
||||
.setMessage(requireContext().getString(R.string.stickersapi9) +
|
||||
requireContext().getString(R.string.stickersapi10))
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show()
|
||||
)
|
||||
@@ -268,7 +267,7 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
|
||||
final ProgressDialog progressDialog = new ProgressDialog(context);
|
||||
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progressDialog.setMessage(AndroidUtils.getString("stickersapi1"));
|
||||
progressDialog.setMessage(requireContext().getString(R.string.stickersapi1));
|
||||
progressDialog.show();
|
||||
|
||||
mGrabber.checkKey(new TelegramStickersGrabber.KeyCheckListener() {
|
||||
@@ -276,7 +275,7 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
public void onKeyChecked(boolean ok) {
|
||||
progressDialog.dismiss();
|
||||
if (!ok) {
|
||||
makeText(context, AndroidUtils.getString("stickersapi2"), LENGTH_SHORT).show();
|
||||
makeText(context, requireContext().getString(R.string.stickersapi2), LENGTH_SHORT).show();
|
||||
setTGBotKey(null);
|
||||
return;
|
||||
}
|
||||
@@ -289,9 +288,9 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
public void onNetError() {
|
||||
progressDialog.dismiss();
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setMessage(AndroidUtils.getString("stickersapi3"))
|
||||
.setMessage(requireContext().getString(R.string.stickersapi3))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(AndroidUtils.getString("stickersapi4"), (arg0, arg1) -> checkApiKey(callback))
|
||||
.setPositiveButton(requireContext().getString(R.string.stickersapi4), (arg0, arg1) -> checkApiKey(callback))
|
||||
.show();
|
||||
}
|
||||
});
|
||||
|
||||
+16
-18
@@ -1,17 +1,15 @@
|
||||
package ru.vtosters.lite.ui.fragments.tgstickers;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import ru.vtosters.lite.tgs.TGPref;
|
||||
import ru.vtosters.lite.tgs.TGRoot;
|
||||
import ru.vtosters.lite.ui.PreferencesUtil;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@@ -19,19 +17,19 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
|
||||
int vtosterXml = getIdentifier("empty", "xml");
|
||||
int vtosterXml = R.xml.empty;
|
||||
addPreferencesFromResource(vtosterXml);
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, AndroidUtils.getString("sprefsstickers"));
|
||||
PreferencesUtil.addPreference(this, "", AndroidUtils.getString("sprefsdelkey"), "", null, preference -> {
|
||||
PreferencesUtil.addPreferenceCategory(this, requireContext().getString(R.string.sprefsstickers));
|
||||
PreferencesUtil.addPreference(this, "", requireContext().getString(R.string.sprefsdelkey), "", 0, preference -> {
|
||||
TGPref.setTGBotKey(null);
|
||||
ToastUtils.a(AndroidUtils.getString("sprefsdelkey2"));
|
||||
ToastUtils.a(requireContext().getString(R.string.sprefsdelkey2));
|
||||
return false;
|
||||
});
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, AndroidUtils.getString("sprefsnetwork"));
|
||||
PreferencesUtil.addListPreference(this, "VTGS:CM", "0", AndroidUtils.getString("sprefsctype"), new CharSequence[]{
|
||||
AndroidUtils.getString("ctypedirect"), AndroidUtils.getString("ctypesocks")
|
||||
PreferencesUtil.addPreferenceCategory(this, requireContext().getString(R.string.sprefsnetwork));
|
||||
PreferencesUtil.addListPreference(this, "VTGS:CM", "0", requireContext().getString(R.string.sprefsctype), new CharSequence[]{
|
||||
requireContext().getString(R.string.ctypedirect), requireContext().getString(R.string.ctypesocks)
|
||||
}, new String[]{
|
||||
"0", "2"
|
||||
});
|
||||
@@ -46,22 +44,22 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
||||
return true;
|
||||
});
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, AndroidUtils.getString("ssocks"));
|
||||
PreferencesUtil.addPreferenceCategory(this, requireContext().getString(R.string.ssocks));
|
||||
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_host", AndroidUtils.getString("ssockshost"), (preference, o) -> {
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_host", requireContext().getString(R.string.ssockshost), (preference, o) -> {
|
||||
TGPref.setTGProxyIP((String) o);
|
||||
return true;
|
||||
});
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_port", AndroidUtils.getString("ssocksport"), (preference, o) -> {
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_port", requireContext().getString(R.string.ssocksport), (preference, o) -> {
|
||||
try {
|
||||
TGPref.setTGProxyPort(Integer.parseInt((String) o));
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(AndroidUtils.getString("ssockswport"));
|
||||
ToastUtils.a(requireContext().getString(R.string.ssockswport));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "tg_proxy_auth", AndroidUtils.getString("ssocksauth"), "", null, false, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "tg_proxy_auth", requireContext().getString(R.string.ssocksauth), "", 0, false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
|
||||
findPreference("tg_proxy_login").setEnabled(value); // findPreference("tg_proxy_login").setEnabled(value);
|
||||
@@ -70,11 +68,11 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
||||
TGPref.setTGProxyPassEnabled(value);
|
||||
return true;
|
||||
});
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_login", AndroidUtils.getString("ssockslogin"), (preference, o) -> {
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_login", requireContext().getString(R.string.ssockslogin), (preference, o) -> {
|
||||
TGPref.setTGProxyUserPass((String) o, TGPref.getTGProxyPass());
|
||||
return true;
|
||||
});
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_pass", AndroidUtils.getString("ssockspass"), (preference, o) -> {
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_pass", requireContext().getString(R.string.ssockspass), (preference, o) -> {
|
||||
TGPref.setTGProxyUserPass(TGPref.getTGProxyUser(), (String) o);
|
||||
return true;
|
||||
});
|
||||
@@ -85,7 +83,7 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("vtltgs", "string");
|
||||
return R.string.vtltgs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import static ru.vtosters.lite.foaf.FoafBase.loadAndShow;
|
||||
import static ru.vtosters.lite.hooks.NewsfeedHook.setWhitelistedAd;
|
||||
import static ru.vtosters.lite.hooks.NewsfeedHook.setWhitelistedFilter;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserID;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
import android.content.ClipData;
|
||||
@@ -17,6 +16,7 @@ import android.view.View;
|
||||
import com.vk.core.dialogs.actionspopup.ActionsPopup;
|
||||
import com.vk.profile.ui.components.CommunityFragmentActionsMenuBuilder;
|
||||
import com.vk.profile.ui.components.ProfileFragmentActionsMenuBuilder;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.api.ExtendedCommunityProfile;
|
||||
import com.vtosters.lite.api.ExtendedUserProfile;
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.Objects;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.b.Functions;
|
||||
import ru.vtosters.lite.hooks.NewsfeedHook;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.RenameTool;
|
||||
|
||||
public class MenuBuilder {
|
||||
@@ -58,17 +59,17 @@ public class MenuBuilder {
|
||||
try {
|
||||
final ExtendedUserProfile eup = (ExtendedUserProfile) pfambObject.get(mb);
|
||||
final Context ctx = ((View) Objects.requireNonNull(apView.get(builder))).getContext();
|
||||
addItem(builder, getString("menu_copy_id"), () -> {
|
||||
addItem(builder, AndroidUtils.getString(R.string.menu_copy_id), () -> {
|
||||
copy(ctx, String.valueOf(getUserID(eup)));
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
addItem(builder, getString("menu_addon_info"), () -> {
|
||||
addItem(builder, AndroidUtils.getString(R.string.menu_addon_info), () -> {
|
||||
loadAndShow(ctx, getUserID(eup));
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
addItem(builder, getString("menu_change_name"), () -> {
|
||||
addItem(builder, AndroidUtils.getString(R.string.menu_change_name), () -> {
|
||||
RenameTool.createDialog(eup, ctx);
|
||||
return Unit.a;
|
||||
});
|
||||
@@ -85,25 +86,25 @@ public class MenuBuilder {
|
||||
final boolean isPageWhitelistedFilter = NewsfeedHook.isWhitelistedFilter(ecp);
|
||||
final boolean isPageWhitelistedAds = NewsfeedHook.isWhitelistedAd(ecp);
|
||||
|
||||
addItem(builder, getString("menu_copy_id"), () -> {
|
||||
addItem(builder, AndroidUtils.getString(R.string.menu_copy_id), () -> {
|
||||
copy(ctx, String.valueOf(getUserID(ecp)));
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
addItem(builder, getString("menu_change_name"), () -> {
|
||||
addItem(builder, AndroidUtils.getString(R.string.menu_change_name), () -> {
|
||||
RenameTool.createDialogGroup(ecp, ctx);
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
addItem(builder, getString(isPageWhitelistedFilter ? "remove_from_filter_whitelist" : "add_to_filter_whitelist"), () -> {
|
||||
addItem(builder, AndroidUtils.getString(isPageWhitelistedFilter ? R.string.remove_from_filter_whitelist : R.string.add_to_filter_whitelist), () -> {
|
||||
setWhitelistedFilter(ecp, !isPageWhitelistedFilter);
|
||||
sendToast(getString(isPageWhitelistedFilter ? "removed_from_whitelist_success" : "added_to_whitelist_success"));
|
||||
sendToast(AndroidUtils.getString(isPageWhitelistedFilter ? R.string.removed_from_whitelist_success : R.string.added_to_whitelist_success));
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
addItem(builder, getString(isPageWhitelistedAds ? "remove_from_ads_whitelist" : "add_to_ads_whitelist"), () -> {
|
||||
addItem(builder, AndroidUtils.getString(isPageWhitelistedAds ? R.string.remove_from_ads_whitelist : R.string.add_to_ads_whitelist), () -> {
|
||||
setWhitelistedAd(ecp, !isPageWhitelistedAds);
|
||||
sendToast(getString(isPageWhitelistedAds ? "removed_from_whitelist_success" : "added_to_whitelist_success"));
|
||||
sendToast(AndroidUtils.getString(isPageWhitelistedAds ? R.string.removed_from_whitelist_success : R.string.added_to_whitelist_success));
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
@@ -117,7 +118,7 @@ public class MenuBuilder {
|
||||
ClipData clip = ClipData.newPlainText("MBH-ST", txt);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
|
||||
sendToast(getString("menu_copied"));
|
||||
sendToast(AndroidUtils.getString(R.string.menu_copied));
|
||||
}
|
||||
|
||||
public static void addItem(final ActionsPopup.b builder, final String title, final Functions onClick) throws InvocationTargetException, IllegalAccessException {
|
||||
|
||||
@@ -2,7 +2,6 @@ package ru.vtosters.lite.ui.vkui;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@@ -12,6 +11,7 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.vk.core.dialogs.bottomsheet.ModalBottomSheet;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class ModalBottomSheetWrapper {
|
||||
public final ModalBottomSheet.a builder;
|
||||
@@ -34,7 +34,7 @@ public class ModalBottomSheetWrapper {
|
||||
container.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
changelogView.setPadding(0, dp2px(8), 0, 0);
|
||||
changelogView.setText(getString("changelog") + ": \n" + changelog);
|
||||
changelogView.setText(context.getString(R.string.changelog) + ": \n" + changelog);
|
||||
changelogView.setTextColor(getTextAttr());
|
||||
container.addView(changelogView, new LinearLayout.LayoutParams(-1, -2));
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaperFile;
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.removeWallpaper;
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.requestUpdateWallpaper;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
|
||||
@@ -21,6 +20,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.ListPreference;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
import com.vtosters.lite.im.ImEngineProvider;
|
||||
|
||||
@@ -53,23 +53,22 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
|
||||
int vtosterXml = getIdentifier("empty", "xml");
|
||||
addPreferencesFromResource(vtosterXml);
|
||||
addPreferencesFromResource(R.xml.empty);
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, AndroidUtils.getString("vkim_settings_appearance_chat_preview_title"));
|
||||
PreferencesUtil.addPreferenceCategory(this, requireContext().getString(R.string.vkim_settings_appearance_chat_preview_title));
|
||||
|
||||
mWPPreviewPref = new WallpaperPreferences(getContext());
|
||||
mWPPreviewPref.setIcon(null);
|
||||
mWPPreviewPref.setIconSpaceReserved(false);
|
||||
getPreferenceScreen().addPreference(mWPPreviewPref);
|
||||
|
||||
PreferencesUtil.addPreference(this, "wp_set", AndroidUtils.getString("wallpaper_select"), AndroidUtils.getString("wallpaper_from_gallery"), "ic_picture_outline_28", preference -> {
|
||||
PreferencesUtil.addPreference(this, "wp_set", requireContext().getString(R.string.wallpaper_select), requireContext().getString(R.string.wallpaper_from_gallery), R.drawable.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", AndroidUtils.getString("wallpaper_remove"), "", "ic_delete_outline_28", preference -> {
|
||||
PreferencesUtil.addPreference(this, "wp_clear", requireContext().getString(R.string.wallpaper_remove), "", R.drawable.ic_delete_outline_28, preference -> {
|
||||
removeWallpaper();
|
||||
requestUpdateWallpaper();
|
||||
mWPPreviewPref.redraw();
|
||||
@@ -77,30 +76,30 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, AndroidUtils.getString("vtlfilters"));
|
||||
PreferencesUtil.addPreferenceCategory(this, requireContext().getString(R.string.vtlfilters));
|
||||
|
||||
if (!hasVerification() && !getBoolValue("dialogrecomm", false)) {
|
||||
PreferencesUtil.addPreference(this, "", AndroidUtils.getString("filters_warning"), AndroidUtils.getString("icons_warning_info"), null, preference -> {
|
||||
PreferencesUtil.addPreference(this, "", requireContext().getString(R.string.filters_warning), requireContext().getString(R.string.icons_warning_info), 0, preference -> {
|
||||
requireContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://vtosters.app/donate/")));
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
PreferencesUtil.addListPreference(this, "msg_blur_radius", "disabled", AndroidUtils.getString("filter_blur"), AndroidUtils.getArray("filter_types"), new String[]{
|
||||
PreferencesUtil.addListPreference(this, "msg_blur_radius", "disabled", requireContext().getString(R.string.filter_blur), AndroidUtils.getArray(R.array.filter_types), new String[]{
|
||||
"disabled", "low", "med", "high"
|
||||
});
|
||||
|
||||
PreferencesUtil.addListPreference(this, "msg_dim", "off", AndroidUtils.getString("filter_dim"), AndroidUtils.getArray("filter_dim_types"), new String[]{
|
||||
PreferencesUtil.addListPreference(this, "msg_dim", "off", requireContext().getString(R.string.filter_dim), AndroidUtils.getArray(R.array.filter_dim_types), new String[]{
|
||||
"off", "dim_black", "dim_white"
|
||||
});
|
||||
|
||||
|
||||
PreferencesUtil.addListPreference(this, "msg_mosaic", "disabled", AndroidUtils.getString("filter_mosaic"), AndroidUtils.getArray("filter_types"), new String[]{
|
||||
PreferencesUtil.addListPreference(this, "msg_mosaic", "disabled", requireContext().getString(R.string.filter_mosaic), AndroidUtils.getArray(R.array.filter_types), new String[]{
|
||||
"disabled", "low", "med", "high"
|
||||
});
|
||||
|
||||
if (hasVerification()) {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_monochrome", AndroidUtils.getString("filter_monochrome"), "", null, false, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_monochrome", requireContext().getString(R.string.filter_monochrome), "", 0, false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("msg_monochrome", value).commit();
|
||||
requestUpdateWallpaper();
|
||||
@@ -108,7 +107,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_invert", AndroidUtils.getString("filter_invert_colors"), "", null, false, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_invert", requireContext().getString(R.string.filter_invert_colors), "", 0, false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("msg_invert", value).commit();
|
||||
requestUpdateWallpaper();
|
||||
@@ -116,7 +115,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_sepia", AndroidUtils.getString("filter_sepia"), "", null, false, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_sepia", requireContext().getString(R.string.filter_sepia), "", 0, false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("msg_sepia", value).commit();
|
||||
requestUpdateWallpaper();
|
||||
@@ -124,7 +123,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_emboss", AndroidUtils.getString("filter_emboss"), AndroidUtils.getString("filter_maybe_lag"), null, false, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_emboss", requireContext().getString(R.string.filter_emboss), requireContext().getString(R.string.filter_maybe_lag), 0, false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("msg_emboss", value).commit();
|
||||
requestUpdateWallpaper();
|
||||
@@ -132,7 +131,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_engrave", AndroidUtils.getString("filter_engrave"), AndroidUtils.getString("filter_maybe_lag"), null, false, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_engrave", requireContext().getString(R.string.filter_engrave), requireContext().getString(R.string.filter_maybe_lag), 0, false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("msg_engrave", value).commit();
|
||||
requestUpdateWallpaper();
|
||||
@@ -140,7 +139,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_flea", AndroidUtils.getString("filter_flea"), "", null, false, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_flea", requireContext().getString(R.string.filter_flea), "", 0, false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("msg_flea", value).commit();
|
||||
requestUpdateWallpaper();
|
||||
@@ -148,7 +147,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_snow", AndroidUtils.getString("filter_flea"), "", null, false, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "msg_snow", requireContext().getString(R.string.filter_flea), "", 0, false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("msg_snow", value).commit();
|
||||
requestUpdateWallpaper();
|
||||
@@ -157,7 +156,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
}
|
||||
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "compresswp", AndroidUtils.getString("compress_wallpaper_title"), AndroidUtils.getString("compress_wallpaper_summ"), null, true, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "compresswp", requireContext().getString(R.string.compress_wallpaper_title), requireContext().getString(R.string.compress_wallpaper_summ), 0, true, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("compresswp", value).commit();
|
||||
requestUpdateWallpaper();
|
||||
@@ -232,6 +231,6 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return getIdentifier("wallpapers", "string");
|
||||
return R.string.wallpapers;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package ru.vtosters.lite.ui.wallpapers;
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getFilteredFile;
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaperFile;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -16,6 +15,8 @@ import androidx.preference.PreferenceViewHolder;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.ui.adapters.MessagesPreviewAdapter;
|
||||
|
||||
public class WallpaperPreferences extends Preference {
|
||||
@@ -38,21 +39,21 @@ public class WallpaperPreferences extends Preference {
|
||||
|
||||
public WallpaperPreferences(Context context, AttributeSet attributeSet, int defStyleAttr, int i1) {
|
||||
super(context, attributeSet, defStyleAttr, i1);
|
||||
setLayoutResource(getIdentifier("wppreview", "layout"));
|
||||
setLayoutResource(R.layout.wppreview);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder preferenceViewHolder) {
|
||||
super.onBindViewHolder(preferenceViewHolder);
|
||||
|
||||
mRecyclerView = (RecyclerView) preferenceViewHolder.findViewById(getIdentifier("install_btn_container", "id"));
|
||||
mRecyclerView = (RecyclerView) preferenceViewHolder.findViewById(R.id.install_btn_container);
|
||||
mRecyclerView.setPadding(0, dp2px(8), 0, 0);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
mRecyclerView.setAdapter((mAdapter = new MessagesPreviewAdapter()));
|
||||
mRecyclerView.setClickable(false);
|
||||
mRecyclerView.setFocusable(false);
|
||||
|
||||
mChatBackground = (ImageView) preferenceViewHolder.findViewById(getIdentifier("author", "id"));
|
||||
mChatBackground = (ImageView) preferenceViewHolder.findViewById(R.id.author);
|
||||
requestBg();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import static com.vk.im.engine.h.im_bg_chat;
|
||||
import static ru.vtosters.lite.ui.wallpapers.ImageFilters.getFilteredDrawable;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
@@ -14,10 +13,13 @@ import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
import vigo.sdk.Log;
|
||||
|
||||
@@ -74,8 +76,8 @@ public class WallpapersHooks {
|
||||
}
|
||||
|
||||
private static Boolean eligibleWallpaperFile(File file) {
|
||||
if (file.length() >= 6291456) {
|
||||
sendToast(getString("wallpaper_size_limit"));
|
||||
if (file.length() >= 0x600000) {
|
||||
sendToast(AndroidUtils.getString(R.string.wallpaper_size_limit));
|
||||
removeWallpaper();
|
||||
return false;
|
||||
} else {
|
||||
@@ -134,13 +136,13 @@ public class WallpapersHooks {
|
||||
String radius = getPreferences().getString("msg_blur_radius", "disabled");
|
||||
switch (radius) {
|
||||
case "low":
|
||||
return getString("wallpapers_low");
|
||||
return AndroidUtils.getString(R.string.wallpapers_low);
|
||||
case "med":
|
||||
return getString("wallpapers_med");
|
||||
return AndroidUtils.getString(R.string.wallpapers_med);
|
||||
case "high":
|
||||
return getString("wallpapers_high");
|
||||
return AndroidUtils.getString(R.string.wallpapers_high);
|
||||
default:
|
||||
return getString("wallpapers_disabled");
|
||||
return AndroidUtils.getString(R.string.wallpapers_disabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,11 +150,11 @@ public class WallpapersHooks {
|
||||
String radius = getPreferences().getString("msg_dim", "disabled");
|
||||
switch (radius) {
|
||||
case "dim_black":
|
||||
return getString("wallpapers_dim_black");
|
||||
return AndroidUtils.getString(R.string.wallpapers_dim_black);
|
||||
case "dim_white":
|
||||
return getString("wallpapers_dim_white");
|
||||
return AndroidUtils.getString(R.string.wallpapers_dim_white);
|
||||
default:
|
||||
return getString("wallpapers_disabled");
|
||||
return AndroidUtils.getString(R.string.wallpapers_disabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,13 +162,13 @@ public class WallpapersHooks {
|
||||
String radius = getPreferences().getString("msg_mosaic", "disabled");
|
||||
switch (radius) {
|
||||
case "low":
|
||||
return getString("wallpapers_low");
|
||||
return AndroidUtils.getString(R.string.wallpapers_low);
|
||||
case "med":
|
||||
return getString("wallpapers_med");
|
||||
return AndroidUtils.getString(R.string.wallpapers_med);
|
||||
case "high":
|
||||
return getString("wallpapers_high");
|
||||
return AndroidUtils.getString(R.string.wallpapers_high);
|
||||
default:
|
||||
return getString("wallpapers_disabled");
|
||||
return AndroidUtils.getString(R.string.wallpapers_disabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ import static ru.vtosters.lite.utils.Preferences.isValidSignature;
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Scanner;
|
||||
|
||||
@@ -22,10 +24,10 @@ public class About {
|
||||
public static void injectToToolBar(View view) {
|
||||
view.setOnLongClickListener(v -> {
|
||||
if (devmenu()) {
|
||||
sendToast(AndroidUtils.getString("debug_menu_already_activated"));
|
||||
sendToast(AndroidUtils.getString(R.string.debug_menu_already_activated));
|
||||
} else {
|
||||
edit().putBoolean("devmenu", true).apply();
|
||||
sendToast(AndroidUtils.getString("debug_menu_activated"));
|
||||
sendToast(AndroidUtils.getString(R.string.debug_menu_activated));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -68,10 +68,14 @@ public class AndroidUtils {
|
||||
return 0;
|
||||
} // Get res id
|
||||
|
||||
public static String[] getArray(String resourcename) {
|
||||
return getResources().getStringArray(getIdentifier(resourcename, "array"));
|
||||
public static String[] getArray(int arrayId) {
|
||||
return getResources().getStringArray(arrayId);
|
||||
} // Get array from arrays.xml
|
||||
|
||||
public static String getString(int id) {
|
||||
return getGlobalContext().getString(id);
|
||||
}
|
||||
|
||||
public static String getString(String resourcename) {
|
||||
return getGlobalContext().getString(getIdentifier(resourcename, "string"));
|
||||
} // Get string via getIdentifier
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.vk.im.ui.providers.audiomsg.PlayerActionSources;
|
||||
import com.vk.imageloader.VKImageLoader;
|
||||
import com.vk.media.player.cache.AutoPlayCacheHolder;
|
||||
import com.vk.stickers.Stickers;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
import java.text.StringCharacterIterator;
|
||||
@@ -48,7 +49,7 @@ public class CacheUtils {
|
||||
size = IOUtils.getDirSize(getGlobalContext().getCacheDir());
|
||||
|
||||
if (size >= getSizeForDelete()) {
|
||||
if (dev()) sendToast(AndroidUtils.getString("cache_cleaned"));
|
||||
if (dev()) sendToast(AndroidUtils.getString(R.string.cache_cleaned));
|
||||
VKImageLoader.e();
|
||||
ImAudioMsgPlayerProvider.b().e(PlayerActionSources.a);
|
||||
ImAudioMsgPlayerProvider.b().d(PlayerActionSources.a);
|
||||
|
||||
@@ -4,7 +4,6 @@ import static androidx.core.app.ActivityCompat.requestPermissions;
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
import android.Manifest;
|
||||
@@ -23,6 +22,7 @@ import com.vk.auth.VKAuthUtils;
|
||||
import com.vk.contacts.ContactsSyncAdapterService;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.auth.VKAccountManager;
|
||||
|
||||
import org.json.JSONException;
|
||||
@@ -42,7 +42,7 @@ public class ContactsUtils {
|
||||
Log.d("ContactsUtils", "Result: " + mainJson + ", enabled sync: " + enabled);
|
||||
} catch (JSONException e) {
|
||||
Log.d("ContactsUtils", e.getMessage());
|
||||
sendToast(getString("contact_sync_error"));
|
||||
sendToast(AndroidUtils.getString(R.string.contact_sync_error));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -50,9 +50,9 @@ public class ContactsUtils {
|
||||
public static void uploadContacts(Activity ctx) {
|
||||
try {
|
||||
if (ContextCompat.checkSelfPermission(ctx, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
|
||||
sendToast(getString("contact_permission_toast"));
|
||||
sendToast(ctx.getString(R.string.contact_permission_toast));
|
||||
requestPermissions(LifecycleUtils.getCurrentActivity(), new String[]{Manifest.permission.READ_CONTACTS}, 11111);
|
||||
sendToast(getString("contact_permission_toast"));
|
||||
sendToast(ctx.getString(R.string.contact_permission_toast));
|
||||
requestPermissions(ctx, new String[]{Manifest.permission.READ_CONTACTS}, 11111);
|
||||
} else {
|
||||
var account = VKAuthUtils.a.a(VKAccountManager.d().Z());
|
||||
@@ -65,7 +65,7 @@ public class ContactsUtils {
|
||||
|
||||
public static void getContactsStatus(Context ctx) {
|
||||
final ProgressDialog progressDialog = new ProgressDialog(ctx);
|
||||
progressDialog.setMessage(getString("contact_info_loading"));
|
||||
progressDialog.setMessage(ctx.getString(R.string.contact_info_loading));
|
||||
progressDialog.show();
|
||||
|
||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||
@@ -88,10 +88,10 @@ public class ContactsUtils {
|
||||
boolean enabledsync = resp.equals("contact");
|
||||
|
||||
new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(getString("contact_sync_title"))
|
||||
.setMessage(getString("contact_sync_state") + ": " + getString(enabledsync ? "contact_sync_enabled" : "contact_sync_disabled"))
|
||||
.setTitle(R.string.contact_sync_title)
|
||||
.setMessage(ctx.getString(R.string.contact_sync_state) + ": " + ctx.getString(enabledsync ? R.string.contact_sync_enabled : R.string.contact_sync_disabled))
|
||||
.setCancelable(true)
|
||||
.setPositiveButton(getString(!enabledsync ? "enable" : "proxy_disable"),
|
||||
.setPositiveButton(!enabledsync ? R.string.enable : R.string.proxy_disable,
|
||||
(dialog, which) -> setContactsSync(!enabledsync)
|
||||
)
|
||||
// .setNegativeButton("Импортировать контакты",
|
||||
|
||||
@@ -5,6 +5,8 @@ import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class GmsUtils {
|
||||
|
||||
public static boolean isGmsInstalled() {
|
||||
@@ -21,7 +23,7 @@ public class GmsUtils {
|
||||
NotificationManager notificationManager = (NotificationManager) AndroidUtils.getGlobalContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
||||
if (notificationManager.getNotificationChannel("audio_playback_channel") == null) {
|
||||
notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", AndroidUtils.getResources().getString(AndroidUtils.getIdentifier("audio_message_play_error", "string")), NotificationManager.IMPORTANCE_LOW));
|
||||
notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", AndroidUtils.getResources().getString(R.string.audio_message_play_error), NotificationManager.IMPORTANCE_LOW));
|
||||
}
|
||||
}
|
||||
} // Music channels fix
|
||||
|
||||
@@ -32,15 +32,15 @@ public class ImageUtils {
|
||||
|
||||
public static Bitmap bmp = null;
|
||||
|
||||
public static Drawable getDrawableFromUrl(String url, String def, Boolean rounded, Boolean scaled) {
|
||||
public static Drawable getDrawableFromUrl(String url, int defDrawableRes, Boolean rounded, Boolean scaled) {
|
||||
if (!NetworkUtils.isNetworkConnected()) {
|
||||
if (def == null) return null;
|
||||
return getDrawable(AndroidUtils.getGlobalContext(), AndroidUtils.getIdentifier(def, "drawable"));
|
||||
if (defDrawableRes == 0) return null;
|
||||
return getDrawable(AndroidUtils.getGlobalContext(), defDrawableRes);
|
||||
}
|
||||
|
||||
if (NetworkUtils.isNetworkIsSlow()) {
|
||||
if (def == null) return null;
|
||||
return getDrawable(AndroidUtils.getGlobalContext(), AndroidUtils.getIdentifier(def, "drawable"));
|
||||
if (defDrawableRes == 0) return null;
|
||||
return getDrawable(AndroidUtils.getGlobalContext(), defDrawableRes);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -63,8 +63,8 @@ public class ImageUtils {
|
||||
});
|
||||
|
||||
if (bmp == null) {
|
||||
if (def == null) return null;
|
||||
return getDrawable(AndroidUtils.getGlobalContext(), AndroidUtils.getIdentifier(def, "drawable"));
|
||||
if (defDrawableRes == 0) return null;
|
||||
return getDrawable(AndroidUtils.getGlobalContext(), defDrawableRes);
|
||||
}
|
||||
|
||||
bmp = rounded ? getBitmapClippedCircle(bmp) : bmp; // rounding
|
||||
@@ -73,9 +73,9 @@ public class ImageUtils {
|
||||
|
||||
return new BitmapDrawable(AndroidUtils.getResources(), bmp); // return our drawable
|
||||
} catch (Exception e) {
|
||||
if (def == null) return null; // default pic can be null
|
||||
if (defDrawableRes == 0) return null; // default pic can be null
|
||||
|
||||
return getDrawable(AndroidUtils.getGlobalContext(), AndroidUtils.getIdentifier(def, "drawable")); // get default drawable via res
|
||||
return getDrawable(AndroidUtils.getGlobalContext(), defDrawableRes); // get default drawable via res
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ package ru.vtosters.lite.utils;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserID;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.profile.presenter.UserPresenter;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.api.ExtendedUserProfile;
|
||||
import com.vtosters.lite.fragments.messages.chat.vc.MsgSendVc;
|
||||
|
||||
@@ -27,32 +27,13 @@ public class ProfileHider {
|
||||
|
||||
public static void injectMap(HashMap<Integer, UserPresenter.a.a> hashMap) {
|
||||
if (VTVerifications.isServiceAccount(getUserId())) {
|
||||
hashMap.put(100, makeSecond(
|
||||
"service_account_admin_100_info",
|
||||
"service_account_admin_100",
|
||||
"ic_custom_avatar_id100")
|
||||
);
|
||||
hashMap.put(101, makeSecond(
|
||||
"service_account_admin_101_info",
|
||||
"service_account_admin_101",
|
||||
"ic_custom_avatar_id101")
|
||||
);
|
||||
hashMap.put(333, makeSecond(
|
||||
"service_account_mobile_info",
|
||||
"service_account_admin_333",
|
||||
"ic_custom_avatar_id333")
|
||||
hashMap.put(100, new UserPresenter.a.a(R.string.service_account_admin_100_info, R.color.service_account_admin_100, R.drawable.ic_custom_avatar_id100));
|
||||
hashMap.put(101, new UserPresenter.a.a(R.string.service_account_admin_101_info, R.color.service_account_admin_101, R.drawable.ic_custom_avatar_id101));
|
||||
hashMap.put(333, new UserPresenter.a.a(R.string.service_account_mobile_info, R.color.service_account_admin_333, R.drawable.ic_custom_avatar_id333)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static UserPresenter.a.a makeSecond(String stringRes, String colorRes, String drawableRes) {
|
||||
return new UserPresenter.a.a(
|
||||
getIdentifier(stringRes, "string"),
|
||||
getIdentifier(colorRes, "color"),
|
||||
getIdentifier(drawableRes, "drawable")
|
||||
);
|
||||
}
|
||||
|
||||
public static void fetchInfo(ExtendedUserProfile extendedUserProfile) {
|
||||
int userID = getUserID(extendedUserProfile.a);
|
||||
if (VTVerifications.isServiceAccount(userID)) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import androidx.core.util.Pair;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.dto.user.UserProfile;
|
||||
import com.vk.im.engine.models.users.User;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.api.ExtendedCommunityProfile;
|
||||
import com.vtosters.lite.api.ExtendedUserProfile;
|
||||
|
||||
@@ -149,7 +150,7 @@ public class RenameTool {
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
final EditText fn = new EditText(ctx);
|
||||
fn.setHint(AndroidUtils.getString("vk_auth_sign_up_first_name"));
|
||||
fn.setHint(R.string.vk_auth_sign_up_first_name);
|
||||
fn.setTextColor(getTextAttr());
|
||||
fn.setHintTextColor(getSTextAttr());
|
||||
fn.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
@@ -160,7 +161,7 @@ public class RenameTool {
|
||||
fn.setLayoutParams(margin);
|
||||
|
||||
final EditText ln = new EditText(ctx);
|
||||
ln.setHint(AndroidUtils.getString("vk_auth_sign_up_last_name"));
|
||||
ln.setHint(R.string.vk_auth_sign_up_last_name);
|
||||
ln.setTextColor(getTextAttr());
|
||||
ln.setHintTextColor(getSTextAttr());
|
||||
ln.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
@@ -175,8 +176,8 @@ public class RenameTool {
|
||||
int id = AccountManagerUtils.getUserID(profile);
|
||||
|
||||
var builder = new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(AndroidUtils.getString("rename_title"))
|
||||
.setMessage(AndroidUtils.getString("rename_message"))
|
||||
.setTitle(R.string.rename_title)
|
||||
.setMessage(R.string.rename_message)
|
||||
.setView(linearLayout)
|
||||
.setPositiveButton("OK", (dialog, which) -> {
|
||||
String firstName = fn.getText().toString();
|
||||
@@ -203,14 +204,14 @@ public class RenameTool {
|
||||
}
|
||||
ctx.sendBroadcast(new Intent("com.vkontakte.android.ACTION_PROFILE_UPDATED").putExtra("uid", id));
|
||||
|
||||
sendToast(AndroidUtils.getString("rename_success"));
|
||||
sendToast(ctx.getString(R.string.rename_success));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
sendToast(AndroidUtils.getString("rename_error"));
|
||||
sendToast(ctx.getString(R.string.rename_error));
|
||||
}
|
||||
});
|
||||
if (isChangedName(id))
|
||||
builder.setNeutralButton(AndroidUtils.getString("rename_reset"), (dialog, which) -> {
|
||||
builder.setNeutralButton(R.string.rename_reset, (dialog, which) -> {
|
||||
getHelper().getWritableDatabase().execSQL(
|
||||
String.format(
|
||||
"DELETE FROM %s WHERE %s='%s'",
|
||||
@@ -221,7 +222,7 @@ public class RenameTool {
|
||||
}
|
||||
updateRequested = true;
|
||||
ctx.sendBroadcast(new Intent("com.vkontakte.android.ACTION_PROFILE_UPDATED").putExtra("uid", id));
|
||||
sendToast(AndroidUtils.getString("rename_remove_from_bd_success"));
|
||||
sendToast(ctx.getString(R.string.rename_remove_from_bd_success));
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
@@ -231,7 +232,7 @@ public class RenameTool {
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
final EditText fn = new EditText(ctx);
|
||||
fn.setHint(AndroidUtils.getString("vk_auth_sign_up_first_name"));
|
||||
fn.setHint(R.string.vk_auth_sign_up_first_name);
|
||||
fn.setHintTextColor(getSTextAttr());
|
||||
fn.setTextColor(getTextAttr());
|
||||
fn.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
@@ -250,8 +251,8 @@ public class RenameTool {
|
||||
final int id = fid;
|
||||
|
||||
var builder = new VkAlertDialog.Builder(ctx)
|
||||
.setTitle(AndroidUtils.getString("rename_title"))
|
||||
.setMessage(AndroidUtils.getString("rename_message"))
|
||||
.setTitle(R.string.rename_title)
|
||||
.setMessage(R.string.rename_message)
|
||||
.setView(linearLayout)
|
||||
.setPositiveButton("OK", (dialog, which) -> {
|
||||
String firstName = fn.getText().toString();
|
||||
@@ -273,16 +274,16 @@ public class RenameTool {
|
||||
id, URLEncoder.encode(firstName, "UTF-8")));
|
||||
}
|
||||
updateRequested = true;
|
||||
sendToast(AndroidUtils.getString("rename_group_success"));
|
||||
sendToast(AndroidUtils.getString(R.string.rename_group_success));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
if (isChangedNameGroup(id))
|
||||
builder.setNeutralButton(AndroidUtils.getString("rename_reset"), (dialog, which) -> {
|
||||
builder.setNeutralButton(R.string.rename_reset, (dialog, which) -> {
|
||||
getHelper().getWritableDatabase().execSQL(String.format("DELETE FROM %s WHERE %s='%s'", TABLE_NAME_GROUP, COLUMN_VKID, id));
|
||||
updateRequested = true;
|
||||
sendToast(AndroidUtils.getString("rename_remove_group_from_bd_success"));
|
||||
sendToast(ctx.getString(R.string.rename_remove_group_from_bd_success));
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
|
||||
@@ -100,35 +100,35 @@ public class ThemesUtils {
|
||||
}
|
||||
|
||||
public static int getAccentColor() {
|
||||
return getColorFromAttr(getAttrId("accent"));
|
||||
return getColorFromAttr(R.attr.accent);
|
||||
} // Color accent
|
||||
|
||||
public static int getTextAttr() {
|
||||
return getColorFromAttr(getAttrId("text_primary"));
|
||||
return getColorFromAttr(R.attr.text_primary);
|
||||
} // Text Primary color
|
||||
|
||||
public static int getSTextAttr() {
|
||||
return getColorFromAttr(getAttrId("text_secondary"));
|
||||
return getColorFromAttr(R.attr.text_secondary);
|
||||
} // Text Secondary color
|
||||
|
||||
public static int getTabbarBackground() {
|
||||
return getColorFromAttr(getAttrId("tabbar_background"));
|
||||
return getColorFromAttr(R.attr.tabbar_background);
|
||||
} // Tabbar/Navbar background
|
||||
|
||||
public static int getBackgroundContent() {
|
||||
return getColorFromAttr(getAttrId("background_content"));
|
||||
return getColorFromAttr(R.attr.background_content);
|
||||
} // Background color in app
|
||||
|
||||
public static int getBackgroundPage() {
|
||||
return getColorFromAttr(getAttrId("background_page"));
|
||||
return getColorFromAttr(R.attr.background_page);
|
||||
} // Background color in app
|
||||
|
||||
public static int getHeaderBackground() {
|
||||
return getColorFromAttr(getAttrId("header_background"));
|
||||
return getColorFromAttr(R.attr.header_background);
|
||||
} // Toolbar/Header background
|
||||
|
||||
public static int getHeaderText() {
|
||||
return getColorFromAttr(getAttrId("header_text"));
|
||||
return getColorFromAttr(R.attr.header_text);
|
||||
} // Header/Toolbar color text
|
||||
|
||||
public static int getAmoledTheme() {
|
||||
@@ -167,7 +167,7 @@ public class ThemesUtils {
|
||||
|
||||
public static int getDarkThemeRes() {
|
||||
if (getPrefsValue("darktheme").equals("amoled")) {
|
||||
return isMilkshake() ? getIdentifier("VkMilkAmoledStyle", "style") : getIdentifier("VkAmoledStyle", "style");
|
||||
return isMilkshake() ? R.style.VkMilkAmoledStyle : R.style.VkAmoledStyle;
|
||||
}
|
||||
return isMilkshake() ? R.style.VkMilkDarkStyle : R.style.VkDarkStyle;
|
||||
} // Return needed res theme
|
||||
|
||||
@@ -5,11 +5,12 @@ import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getOauth;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -34,7 +35,7 @@ public class VKMeHandler {
|
||||
setToken(mainJson.getString("access_token"));
|
||||
} else if (mainJson.has("error_description")) {
|
||||
Log.d("VKMeHandler", mainJson.getString("error_description"));
|
||||
sendToast(getString("auth_error_vtl") + ": " + mainJson.getString("error_description"));
|
||||
sendToast(AndroidUtils.getString(R.string.auth_error_vtl) + ": " + mainJson.getString("error_description"));
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
|
||||
+20633
-19623
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user