Merge branch 'main' into music
# Conflicts: # app/src/main/java/ru/vtosters/lite/music/MP3Downloader.java
This commit is contained in:
@@ -29,3 +29,4 @@ smali2/build/resources.zip
|
||||
smali/build/resources.zip
|
||||
smali/assets/version.properties
|
||||
*.keystore
|
||||
gradle.properties
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
* Лента
|
||||
* Блокировка рекламы в ленте
|
||||
* Блокировка постов через фильтры
|
||||
* Возможность добавлять в вайтлист фильтров группы, чтобы в них не удалялись посты
|
||||
* Возможность отключить рекомендации от ВК
|
||||
* Редактор докбара
|
||||
* Редактор элементов Superapp
|
||||
@@ -68,8 +69,7 @@
|
||||
* Результаты опросов без участия
|
||||
* Возможность указывать папку для загрузки фото/видео/музыки/всего
|
||||
* Интеграция с <a href="https://www.last.fm/">LAST.FM</a> (а также возможность скробблинга)
|
||||
* Новый раздел музыки
|
||||
* Возможность скачивать видео
|
||||
* Возможность скачивать видео, очищать историю просмотра видео
|
||||
* Возможность найти фотографию через поисковые системы
|
||||
* Интеграция с <a href="https://vkx.app/">VK X</a>
|
||||
* Сообщения
|
||||
@@ -77,18 +77,20 @@
|
||||
* Возможность выключения кнопки записи голосовых сообщений
|
||||
* Возможность скрыть блок рекомендаций в сообщениях
|
||||
* Режим **VK Me**
|
||||
* Возможность вернуть вкладку уведомлений
|
||||
* Возможность вернуть вкладку уведомлений для режима VK Me
|
||||
* Встроенный переводчик текста для сообщений
|
||||
* Возможность выбрать язык перевода
|
||||
* Автоматический перевод ваших сообщений на выбранный язык
|
||||
* Автоматический перевод ваших сообщений на выбранный язык
|
||||
* Альтернативный дизайн эмодзи меню
|
||||
* Возможность использовать системные эмодзи
|
||||
* Возможнсть использовать Enter с аппаратной клавиатуры
|
||||
* Активность
|
||||
* Возможность видеть удаленные сообщения
|
||||
* Функционал, позволяющий оставаться в «оффлайне» (принудительный оффлайн/не отправлять статус онлайна и т.п.)
|
||||
* Нечиталка/неписалка для ЛС/бесед/ботов/групп
|
||||
* Возможность отключить информацию о том, что вы просмотрели историю/прослушали голосовое сообщение
|
||||
* Возможность видеть онлайн пользователей, если у вас скрыт онлайн через VK Messenger
|
||||
* Возможность сохранять настройки бесшумных сообщений/сообщений-бомбочек
|
||||
* Отключить уведомление о том, что вы сделали скриншот в беседе
|
||||
* Отключение редиректа через away.php
|
||||
* Отключение отправки метрики
|
||||
@@ -115,6 +117,7 @@
|
||||
* Возможность скрыть блок рекомендаций друзей в разделе «Друзья»
|
||||
* Возможность скрыть подписи в настройках
|
||||
* Прокси
|
||||
* Поддержка сторонних прокси, таких как: Zaborona, VikaMobile, рандомные прокси и прочие
|
||||
* Возможность использовать **HTTP/HTTPS/SOCKS** прокси, менять домены **API/OAuth/Static**
|
||||
* Другое
|
||||
* Очистка кеша приложения (**всё/стикеры/изображения/видео/сообщения/WebView**)
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ task exportDex {
|
||||
|
||||
android {
|
||||
compileSdkVersion 32
|
||||
buildToolsVersion '32.0.0'
|
||||
buildToolsVersion '33.0.0'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "ru.vtosters.lite.utils.lite"
|
||||
|
||||
@@ -54,7 +54,13 @@ public class LibVKXClient {
|
||||
return getInstance().runOnService(action);
|
||||
}
|
||||
|
||||
public static void lambdaplay(List<MusicTrack> list, MusicTrack musicTrack, ILibVkxService iLibVkxService) {
|
||||
public static void lambdaplay(List<MusicTrack> list, MusicTrack musicTrack, ILibVkxService iLibVkxService, MusicPlaybackLaunchContext playerRefer) {
|
||||
var playbackContext = "";
|
||||
|
||||
if (playerRefer != null) {
|
||||
playbackContext = playerRefer.v0();
|
||||
}
|
||||
|
||||
int indexOf = list.indexOf(musicTrack);
|
||||
var ids = new ArrayList<String>();
|
||||
for (var track : list) {
|
||||
@@ -65,12 +71,16 @@ public class LibVKXClient {
|
||||
}
|
||||
|
||||
try {
|
||||
iLibVkxService.play(ids, indexOf, "");
|
||||
iLibVkxService.play(ids, indexOf, playbackContext);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void lambdaplay(List<MusicTrack> list, MusicTrack musicTrack, ILibVkxService iLibVkxService){
|
||||
lambdaplay(list, musicTrack, iLibVkxService, null);
|
||||
}
|
||||
|
||||
private static String asId(MusicTrack musicTrack) {
|
||||
String str = musicTrack.e + "_" + musicTrack.d;
|
||||
if (musicTrack.O == null || musicTrack.O.equals("")) {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package com.vk.core.util;
|
||||
|
||||
import static ru.vtosters.lite.utils.Preferences.getDownloadsDir;
|
||||
import static ru.vtosters.lite.utils.Preferences.getMusicDir;
|
||||
import static ru.vtosters.lite.utils.Preferences.getPhotosDir;
|
||||
import static ru.vtosters.lite.utils.Preferences.getVideosDir;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.DownloadManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
@@ -13,6 +8,7 @@ import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -25,6 +21,8 @@ import com.vk.metrics.eventtracking.VkTracker;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.util.HashSet;
|
||||
@@ -51,49 +49,62 @@ public class DownloadUtils {
|
||||
ToastUtils.a(context.getString(R.string.error) + " [" + e2.getMessage() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
private static void b(final Context context, String str, String str2, boolean z) {
|
||||
if (TextUtils.isEmpty(str2)) {
|
||||
|
||||
private static void b(final Context context, String str, String uri, boolean z) {
|
||||
if (TextUtils.isEmpty(uri)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String file = a(str, str2);
|
||||
File b2;
|
||||
boolean c2 = MediaUtils.c(MediaUtils.b(str2));
|
||||
String fileName = a(str, uri);
|
||||
File file;
|
||||
|
||||
if (file.endsWith(".jpg") || file.endsWith(".png") || file.endsWith(".jpeg")) {
|
||||
b2 = new File(getPhotosDir(), file);
|
||||
} else if (file.endsWith(".mp3") || file.endsWith(".wav") || file.endsWith(".ogg") || file.endsWith(".aac") || file.endsWith(".flac") || file.endsWith(".m4a")) {
|
||||
b2 = new File(getMusicDir(), file);
|
||||
} else if (file.endsWith(".mp4") || file.endsWith(".mkv") || file.endsWith(".avi") || file.endsWith(".flv") || file.endsWith(".wmv") || file.endsWith(".mov") || file.endsWith(".3gp")) {
|
||||
b2 = new File(getVideosDir(), file);
|
||||
Log.v("DownloadUtils", "download: filename = " + fileName + " | str = " + str + "| str2 = " + uri);
|
||||
|
||||
if (fileName.endsWith(".jpg") || fileName.endsWith(".png") || fileName.endsWith(".jpeg")) {
|
||||
file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath(), fileName);
|
||||
} else if (fileName.endsWith(".mp3") || fileName.endsWith(".wav") || fileName.endsWith(".ogg") || fileName.endsWith(".aac") || fileName.endsWith(".flac") || fileName.endsWith(".m4a")) {
|
||||
file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath(), fileName);
|
||||
} else if (fileName.endsWith(".mp4") || fileName.endsWith(".mkv") || fileName.endsWith(".avi") || fileName.endsWith(".flv") || fileName.endsWith(".wmv") || fileName.endsWith(".mov") || fileName.endsWith(".3gp")) {
|
||||
file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath(), fileName);
|
||||
} else {
|
||||
b2 = new File(getDownloadsDir(), file);
|
||||
file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath(), fileName);
|
||||
}
|
||||
|
||||
if (c2) {
|
||||
EncodedImage c3 = VKImageLoader.c(Uri.parse(str2));
|
||||
final InputStream h = c3 == null ? null : c3.h();
|
||||
boolean isImage = MediaUtils.c(FileUtils.f(file));
|
||||
|
||||
if (isImage) {
|
||||
EncodedImage encodedImage = VKImageLoader.c(Uri.parse(uri));
|
||||
final InputStream h = encodedImage == null ? null : encodedImage.h();
|
||||
if (h != null) {
|
||||
try {
|
||||
if (b2.getParentFile() != null) {
|
||||
b2.createNewFile();
|
||||
if (file.getParentFile() != null) {
|
||||
file.createNewFile();
|
||||
}
|
||||
if (file.exists()) {
|
||||
VkExecutors.x.e().execute(() -> {
|
||||
try {
|
||||
FileUtils.b.a(h, new FileOutputStream(file), h.available(), null);
|
||||
ToastUtils.a(context.getString(R.string.file_saved, file.getAbsoluteFile()));
|
||||
} catch (IOException e) {
|
||||
ToastUtils.a(context.getString(R.string.error) + " [" + e.getMessage() + "]");
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (b2.exists()) {
|
||||
VkExecutors.x.a().execute(() -> ToastUtils.a(context.getString(R.string.file_saved, b2.getAbsoluteFile())));
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
L.a(e2);
|
||||
}
|
||||
CameraUtils.a(context, b2, null);
|
||||
|
||||
CameraUtils.a(context, file, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(str2));
|
||||
request.setDestinationUri(Uri.fromFile(b2));
|
||||
request.setMimeType(FileUtils.f(new File(str)));
|
||||
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(uri));
|
||||
var mimeType = FileUtils.f(file);
|
||||
request.setDestinationUri(Uri.fromFile(file));
|
||||
request.setMimeType(mimeType);
|
||||
request.setNotificationVisibility(1);
|
||||
request.allowScanningByMediaScanner();
|
||||
request.setTitle(str);
|
||||
@@ -182,10 +193,12 @@ public class DownloadUtils {
|
||||
}
|
||||
Intent intent = new Intent("android.intent.action.VIEW");
|
||||
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
String f2 = FileUtils.f(file);
|
||||
if (!TextUtils.isEmpty(f2)) {
|
||||
var mimeType = FileUtils.f(file);
|
||||
var uri = FileUtils.uriFromFile(file);
|
||||
Log.d("DownloadUtils", "openFile: " + file.getAbsolutePath() + "| mimetype " + mimeType + "| uri " + uri);
|
||||
if (!TextUtils.isEmpty(mimeType)) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setDataAndType(FileUtils.uriFromFile(file), f2);
|
||||
intent.setDataAndType(uri, mimeType);
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
@@ -206,9 +219,13 @@ public class DownloadUtils {
|
||||
|
||||
private static boolean a(Context context, File file) {
|
||||
if (file != null && file.exists()) {
|
||||
var mimeType = FileUtils.f(file);
|
||||
var uri = FileUtils.uriFromFile(file);
|
||||
|
||||
Intent intent = new Intent("android.intent.action.VIEW");
|
||||
intent.setDataAndType(Uri.parse(file.getAbsolutePath()), "application/*");
|
||||
intent.setDataAndType(uri, mimeType);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
Log.d("DownloadUtils", "openFile: " + file.getAbsolutePath() + "| mimetype " + mimeType + "| uri " + uri);
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
|
||||
@@ -35,5 +35,6 @@ public enum DialogAction {
|
||||
pinmsg,
|
||||
unpinmsg,
|
||||
ENCRYPT_SETT,
|
||||
ENCRYPT
|
||||
ENCRYPT,
|
||||
DOWNLOAD
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
@@ -36,8 +35,6 @@ import com.vtosters.lite.a0;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
@UiThread
|
||||
public class TargetImageView extends VKMultiImageView {
|
||||
private static final int I = Screen.a(2);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.vk.stories.view;
|
||||
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getColor2;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -29,7 +27,6 @@ import com.facebook.imagepipeline.request.ImageRequest;
|
||||
import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
||||
import com.facebook.u.b.a.PipelineDraweeControllerBuilder;
|
||||
import com.facebook.x.g.CloseableImage;
|
||||
import com.vk.core.drawable.BorderDrawable;
|
||||
import com.vk.core.ui.themes.Themable;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.core.util.DrawableUtils;
|
||||
@@ -50,8 +47,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class StoryCircleImageView extends BorderedCircleImageView implements Themable{
|
||||
private static final HashSet<Integer> B0 = new HashSet<>();
|
||||
private final PipelineDraweeControllerBuilder f0;
|
||||
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
package com.vtosters.lite.ui.bottomnavigation;
|
||||
|
||||
import static ru.vtosters.lite.utils.Preferences.*;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getCSTDock;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@@ -31,7 +31,6 @@ import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import me.grishka.appkit.utils.V;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
public class BottomNavigationItemView extends FrameLayout implements MenuView.ItemView {
|
||||
private final TextView mSmallLabel;
|
||||
|
||||
@@ -5,26 +5,28 @@ 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.engine.h.im_ic_write_msg;
|
||||
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;
|
||||
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;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.core.network.Network;
|
||||
import com.vk.im.engine.ImEngine1;
|
||||
import com.vk.im.engine.events.OnDialogUpdateEvent;
|
||||
import com.vk.im.engine.models.EntityIntMap;
|
||||
import com.vk.im.engine.models.ProfilesSimpleInfo;
|
||||
import com.vk.im.engine.models.dialogs.Dialog;
|
||||
import com.vk.im.engine.models.messages.Msg;
|
||||
import com.vk.im.engine.models.messages.MsgFromUser;
|
||||
@@ -33,6 +35,7 @@ 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 java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -41,20 +44,30 @@ import java.util.List;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.vtosters.lite.downloaders.MessagesDownloader;
|
||||
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) {
|
||||
int peerId = 0;
|
||||
|
||||
if (dialog != null) {
|
||||
peerId = dialog.getId();
|
||||
try {
|
||||
peerId = dialog.getId();
|
||||
} catch (Exception e){
|
||||
Log.d("DialoggetId", "null");
|
||||
}
|
||||
}
|
||||
|
||||
if (peerId == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
list.add(DialogAction.DOWNLOAD);
|
||||
|
||||
list.add(DialogAction.pinmsg);
|
||||
list.add(DialogAction.unpinmsg);
|
||||
|
||||
@@ -78,6 +91,8 @@ public class DNRInjector {
|
||||
}
|
||||
|
||||
public static LinkedHashMap<DialogAction, Integer> injectToHashMap(LinkedHashMap<DialogAction, Integer> hashMap) {
|
||||
hashMap.put(DialogAction.DOWNLOAD, getIdentifier("download_dl", "string"));
|
||||
|
||||
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"));
|
||||
@@ -94,6 +109,7 @@ 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.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
|
||||
@@ -101,8 +117,10 @@ public class DNRInjector {
|
||||
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.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
|
||||
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.MARK_AS_READ, 4, im_ic_done, getIdentifier("vkim_dialogs_list_option_mark_as_read", "string"))); // DialogAction, Int, Icon, String
|
||||
|
||||
@@ -119,9 +137,19 @@ public class DNRInjector {
|
||||
int peerId = 0;
|
||||
|
||||
if (dialog != null) {
|
||||
peerId = dialog.getId();
|
||||
try {
|
||||
peerId = dialog.getId();
|
||||
} catch (Exception e){
|
||||
Log.d("DialoggetId", "null");
|
||||
}
|
||||
}
|
||||
|
||||
if (peerId == 0) {
|
||||
return actions;
|
||||
}
|
||||
|
||||
actions.add(DialogAction.DOWNLOAD);
|
||||
|
||||
if (isDnrEnabledFor(peerId)) {
|
||||
actions.add(DialogAction.DNR_OFF);
|
||||
} else {
|
||||
@@ -148,7 +176,15 @@ public class DNRInjector {
|
||||
int peerId = 0;
|
||||
|
||||
if (dialog != null) {
|
||||
peerId = dialog.getId();
|
||||
try {
|
||||
peerId = dialog.getId();
|
||||
} catch (Exception e){
|
||||
Log.d("DialoggetId", "null");
|
||||
}
|
||||
}
|
||||
|
||||
if (peerId == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == DialogAction.MARK_AS_READ) {
|
||||
@@ -156,6 +192,17 @@ public class DNRInjector {
|
||||
forceInvalidateDialogActions(dialog);
|
||||
}
|
||||
|
||||
if (action == DialogAction.DOWNLOAD) {
|
||||
File out = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "dialog-" + peerId + ".html");
|
||||
try {
|
||||
new MessagesDownloader().downloadDialog(peerId, new MessagesDownloader.HtmlDialogDownloaderFormatProvider(), out);
|
||||
} catch (Exception e) {
|
||||
sendToast(getString("download_dl_error"));
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == DialogAction.DNR_ON) {
|
||||
setDnr(dialog, true);
|
||||
forceInvalidateDialogActions(dialog);
|
||||
@@ -191,13 +238,31 @@ public class DNRInjector {
|
||||
int peerId = 0;
|
||||
|
||||
if (dialog != null) {
|
||||
peerId = dialog.getId();
|
||||
try {
|
||||
peerId = dialog.getId();
|
||||
} catch (Exception e){
|
||||
Log.d("DialoggetId", "null");
|
||||
}
|
||||
}
|
||||
|
||||
if (peerId == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == DialogAction.MARK_AS_READ) {
|
||||
DNRModule.hookRead(dialog);
|
||||
}
|
||||
|
||||
if (action == DialogAction.DOWNLOAD) {
|
||||
File out = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), peerId + "-dialog.html");
|
||||
try {
|
||||
new MessagesDownloader().downloadDialog(peerId, new MessagesDownloader.HtmlDialogDownloaderFormatProvider(), out);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == DialogAction.DNR_ON) {
|
||||
setDnr(dialog, true);
|
||||
return true;
|
||||
@@ -240,37 +305,40 @@ public class DNRInjector {
|
||||
}
|
||||
|
||||
public static boolean onClickMsg(Context context, MsgAction action, Msg msg) {
|
||||
var text = ((MsgFromUser) msg).f();
|
||||
var peerId = msg.v1();
|
||||
var fullMsg = ((MsgFromUser) msg).j2(); // text + reply
|
||||
var reply = fullMsg.substring(text.length() + 1);
|
||||
|
||||
if (action == MsgAction.valueOf("READTO")) {
|
||||
DNRModule.hookReadStartMsgTo(msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
var isTextExist = !text.isEmpty() && !text.equals(" ");
|
||||
var isReplyExist = !reply.isEmpty() && !reply.equals(" ");
|
||||
if (msg instanceof MsgFromUser){
|
||||
var text = ((MsgFromUser) msg).f();
|
||||
var fullMsg = ((MsgFromUser) msg).j2(); // text + reply
|
||||
var reply = fullMsg.substring(text.length() + 1);
|
||||
|
||||
var isTextExist = !text.isEmpty() && !text.equals(" ");
|
||||
var isReplyExist = !reply.isEmpty() && !reply.equals(" ");
|
||||
|
||||
|
||||
if (isReplyExist) {
|
||||
reply = decryptMessage(reply, peerId);
|
||||
}
|
||||
if (isReplyExist) {
|
||||
reply = decryptMessage(reply, peerId);
|
||||
}
|
||||
|
||||
if (isTextExist) {
|
||||
text = decryptMessage(text, peerId);
|
||||
}
|
||||
if (isTextExist) {
|
||||
text = decryptMessage(text, peerId);
|
||||
}
|
||||
|
||||
if (action == MsgAction.valueOf("TRANSLATE")) {
|
||||
if (isTextExist && isReplyExist) {
|
||||
Translate.showTranslatedText(context, text + "\n\n" + AndroidUtils.getString("translator_reply") + "\n" + reply);
|
||||
} else if (isReplyExist) {
|
||||
Translate.showTranslatedText(context, AndroidUtils.getString("translator_reply") + "\n" + reply);
|
||||
} else if (isTextExist) {
|
||||
Translate.showTranslatedText(context, text);
|
||||
} else {
|
||||
sendToast(AndroidUtils.getString("translator_no_text"));
|
||||
if (action == MsgAction.valueOf("TRANSLATE")) {
|
||||
if (isTextExist && isReplyExist) {
|
||||
Translate.showTranslatedText(context, text + "\n\n" + getString("translator_reply") + "\n" + reply);
|
||||
} else if (isReplyExist) {
|
||||
Translate.showTranslatedText(context, getString("translator_reply") + "\n" + reply);
|
||||
} else if (isTextExist) {
|
||||
Translate.showTranslatedText(context, text);
|
||||
} else {
|
||||
sendToast(getString("translator_no_text"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,7 +349,7 @@ public class DNRInjector {
|
||||
Thread thread = new Thread(() -> {
|
||||
try {
|
||||
var request = new Request.a()
|
||||
.b("https://api.vk.com/method/" + (needToBePinned ? "messages.pinConversation" : "messages.unpinConversation") + "?peer_id=" + dialogid + "&access_token=" + getUserToken() + "&v=5.119")
|
||||
.b("https://" + getApi() + "/method/" + (needToBePinned ? "messages.pinConversation" : "messages.unpinConversation") + "?peer_id=" + dialogid + "&access_token=" + getUserToken() + "&v=5.119")
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"))
|
||||
.a();
|
||||
|
||||
@@ -298,7 +366,7 @@ public class DNRInjector {
|
||||
|
||||
thread.start();
|
||||
|
||||
sendToast(AndroidUtils.getString("pin_dialog") + " " + (needToBePinned ? AndroidUtils.getString("dialog_pinned") : AndroidUtils.getString("dialog_unpinned")));
|
||||
sendToast(getString("pin_dialog") + " " + getString(needToBePinned ? "dialog_pinned" : "dialog_unpinned"));
|
||||
}
|
||||
|
||||
public static void setDnr(Dialog dialog, boolean value) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package ru.vtosters.lite.dnr;
|
||||
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
@@ -0,0 +1,604 @@
|
||||
package ru.vtosters.lite.downloaders;
|
||||
import static ru.vtosters.lite.encryption.EncryptProvider.decryptMessage;
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getResources;
|
||||
|
||||
import android.util.SparseArray;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class MessagesDownloader{
|
||||
private static SimpleDateFormat sdformat;
|
||||
|
||||
private static SparseArray<MiniUser> usersArray;
|
||||
|
||||
private static final String VK_DOMAIN = "vk.com";
|
||||
|
||||
public static String formatTime(long now){
|
||||
return sdformat.format(new Date(now));
|
||||
}
|
||||
|
||||
public static String join(CharSequence delimiter, Iterable<? extends CharSequence> elements){
|
||||
Objects.requireNonNull(delimiter);
|
||||
Objects.requireNonNull(elements);
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (CharSequence cs : elements) {
|
||||
builder.append(cs).append(delimiter);
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public void downloadDialog(int peer_id, DialogDownloaderFormatProvider format, File out) throws Exception{
|
||||
sdformat = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss", getResources().getConfiguration().locale);
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(out);
|
||||
|
||||
// fix TODO with conversation name (API method messages.getConversationsById)
|
||||
fos.write(format.provideDocumentStart("TODO", formatTime(System.currentTimeMillis())).getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
fetchDialogInfo(peer_id, 0, ((users, messages) -> {
|
||||
try {
|
||||
fos.write(format.provideHeader("TODO", formatTime(System.currentTimeMillis())).getBytes(StandardCharsets.UTF_8));
|
||||
for (MiniMsg msg : messages) {
|
||||
fos.write(format.provideMessage(msg, users.get(msg.fromId)).getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
fos.write(format.provideDocumentEnd().getBytes(StandardCharsets.UTF_8));
|
||||
fos.close();
|
||||
Toast.makeText(getGlobalContext(), "Сохранено как " + out.getAbsolutePath(), Toast.LENGTH_SHORT).show();
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public void fetchDialogInfo(int peer_id, int offset, FetchListener fl){
|
||||
makeRequest("https://" + getApi() + "/method/messages.getHistory?extended=1&v=5.140&offset=" + offset + "&count=200&peer_id=" + peer_id + "&access_token=" + getUserToken(),
|
||||
response -> {
|
||||
try {
|
||||
JSONObject mainJson = new JSONObject(response);
|
||||
JSONObject obj = mainJson.getJSONObject("response");
|
||||
|
||||
SparseArray<MiniUser> users = new SparseArray<>();
|
||||
parseUsers(users, obj.optJSONArray("profiles"), false);
|
||||
parseUsers(users, obj.optJSONArray("groups"), true);
|
||||
|
||||
List<MiniMsg> msgs = parseMessages(obj.getJSONArray("items"));
|
||||
|
||||
usersArray = users;
|
||||
|
||||
fl.onReceive(users, msgs);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private List<MiniMsg> parseMessages(JSONArray jsonArray) throws JSONException{
|
||||
ArrayList<MiniMsg> thing = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
MiniMsg msg = new MiniMsg(jsonArray.getJSONObject(i));
|
||||
thing.add(msg);
|
||||
}
|
||||
|
||||
return thing;
|
||||
}
|
||||
|
||||
private void parseUsers(SparseArray<MiniUser> array, @Nullable JSONArray jsonArray, boolean groups) throws JSONException{
|
||||
if (jsonArray == null) return;
|
||||
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
MiniUser user = new MiniUser(jsonArray.getJSONObject(i), groups);
|
||||
array.put(groups ? -user.id : user.id, user);
|
||||
}
|
||||
}
|
||||
|
||||
interface FetchListener{
|
||||
void onReceive(SparseArray<MiniUser> users, List<MiniMsg> messages);
|
||||
}
|
||||
|
||||
static class MiniUser{
|
||||
public String firstName;
|
||||
public String lastName;
|
||||
public boolean isGroup;
|
||||
int id;
|
||||
String photo100;
|
||||
|
||||
public MiniUser(JSONObject obj, boolean is_group) throws JSONException {
|
||||
id = obj.getInt("id");
|
||||
firstName = obj.optString("first_name", obj.optString("name"));
|
||||
lastName = obj.optString("last_name", "");
|
||||
photo100 = obj.getString("photo_100");
|
||||
isGroup = is_group;
|
||||
}
|
||||
}
|
||||
|
||||
static class MiniMsg{
|
||||
long date;
|
||||
int fromId;
|
||||
int id; // message id
|
||||
String text;
|
||||
List<JSONObject> attachments;
|
||||
List<JSONObject> fwd_messages;
|
||||
JSONObject reply_message; // one reply
|
||||
JSONObject chat_action;
|
||||
JSONObject geo;
|
||||
|
||||
public MiniMsg(JSONObject obj) throws JSONException{
|
||||
date = obj.getLong("date") * 1000;
|
||||
fromId = obj.getInt("from_id");
|
||||
id = obj.getInt("id");
|
||||
text = decryptMessage(obj.getString("text"), obj.getInt("peer_id"));
|
||||
reply_message = obj.optJSONObject("reply_message");
|
||||
chat_action = obj.optJSONObject("action");
|
||||
geo = obj.optJSONObject("geo");
|
||||
|
||||
attachments = new ArrayList<>();
|
||||
fwd_messages = new ArrayList<>();
|
||||
|
||||
JSONArray arr = obj.optJSONArray("attachments");
|
||||
if (arr != null)
|
||||
for (int i = 0; i < arr.length(); i++) attachments.add(arr.getJSONObject(i));
|
||||
|
||||
JSONArray fwdArr = obj.optJSONArray("fwd_messages");
|
||||
if (fwdArr != null)
|
||||
for (int i = 0; i < fwdArr.length(); i++) fwd_messages.add(fwdArr.getJSONObject(i));
|
||||
}
|
||||
}
|
||||
|
||||
// This class defines everything which is needed to create an output file
|
||||
abstract static class DialogDownloaderFormatProvider{
|
||||
// Internal, for JSON/HTML
|
||||
abstract String provideDocumentStart(String dialogName, String date);
|
||||
|
||||
abstract String provideDocumentEnd();
|
||||
|
||||
abstract String provideHeader(String dialogName, String date);
|
||||
|
||||
abstract String provideMessage(MiniMsg message, MiniUser user) throws JSONException;
|
||||
}
|
||||
|
||||
public static class HtmlDialogDownloaderFormatProvider extends DialogDownloaderFormatProvider{
|
||||
@Override
|
||||
String provideDocumentStart(String dialogName, String date){
|
||||
String style = ".vtex-milk-msg {\n" +
|
||||
" border-radius: 8px;\n" +
|
||||
" padding: 24px;\n" +
|
||||
" background: white;\n" +
|
||||
" margin: 16px;\n" +
|
||||
" box-shadow: 0 4px 8px 0 rgba(0,0,0,0.07);\n" +
|
||||
" word-wrap: break-word;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".vtex-milk-msgcont br {\n" +
|
||||
" display: none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".vtex-milk-msg p {\n" +
|
||||
" margin: 0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".vtex-milk-msg.vtex-milk-msg-out {\n" +
|
||||
" background: #ADD3FF;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"p.msg-attaches {\n" +
|
||||
" margin-top: 8px;\n" +
|
||||
" font-style: italic;\n" +
|
||||
"}\n" +
|
||||
"p.chat-action {\n" +
|
||||
" font-style: italic;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".vtex-milk-header {\n" +
|
||||
" border-radius: 8px;\n" +
|
||||
" padding: 24px;\n" +
|
||||
" background: white;\n" +
|
||||
" margin: 16px;\n" +
|
||||
" box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"h4.vtex-milk-header-txt {\n" +
|
||||
" margin: 0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"h5.vtex-milk-header-sub {\n" +
|
||||
" margin: 0;\n" +
|
||||
" padding-top: 8px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"a.msg-attach-link {\n" +
|
||||
" color: #5181B8;\n" +
|
||||
" text-decoration: none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".msg-from a {\n" +
|
||||
" color: #5181B8;\n" +
|
||||
" text-decoration: none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".msg-from-date {\n" +
|
||||
" color: rgba(0, 0, 0, 0.75);\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"body {\n" +
|
||||
" font-family: Roboto, system-ui, sans-serif;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".msg-body {\n" +
|
||||
" padding-top: 4px;\n" +
|
||||
"}\n" +
|
||||
".msg-reply {\n" +
|
||||
" border-left: 3px solid #7aa7f6;\n" +
|
||||
" margin-top: 5px;\n" +
|
||||
" padding-left: 3px;\n" +
|
||||
"}\n\n" +
|
||||
".msg-reply p {\n" +
|
||||
" padding-left: 5px;\n" +
|
||||
"}\n\n" +
|
||||
".msg-reply p.reply-header {\n" +
|
||||
" color: #5181B8;\n" +
|
||||
"}\n\n" +
|
||||
".msg-reply p.reply-content {\n" +
|
||||
" color: #000000;\n" +
|
||||
"}\n" +
|
||||
".vtex-milk-msg.poll {\n" +
|
||||
" width: 45%;\n" +
|
||||
" background: linear-gradient(to bottom right, #707c8c, #4d5565);\n" +
|
||||
" font-style: normal;" +
|
||||
"}\n" +
|
||||
".vtex-milk-msg.poll p { color: white; }\n" +
|
||||
".vtex-milk-msg.poll hr { border-top: 1px; background: #ffffff; }\n" +
|
||||
"\n" +
|
||||
"";
|
||||
|
||||
return "<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><meta charset=\"utf-8\"><title>Экспорт из VTLite</title><style>" + style + "</style></head><body>";
|
||||
}
|
||||
|
||||
@Override
|
||||
String provideDocumentEnd(){
|
||||
return "</div></body></html>";
|
||||
}
|
||||
|
||||
@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\">Экспорт истории чата (" + date + ")</h5></div><div class=\"vtex-milk-msgcont\">";
|
||||
}
|
||||
|
||||
@Override
|
||||
String provideMessage(MiniMsg message, MiniUser user) throws JSONException{
|
||||
String isOut = (user.id == getUserId()) ? " vtex-milk-msg-out" : "";
|
||||
|
||||
String geoPosition = "";
|
||||
if (message.geo != null) {
|
||||
var coordinates = message.geo.optJSONObject("coordinates");
|
||||
if (coordinates != null) {
|
||||
var latitude = coordinates.optDouble("latitude");
|
||||
var longitude = coordinates.optDouble("longitude");
|
||||
var ll = longitude + "," + latitude;
|
||||
geoPosition = "<a href=\"https://yandex.ru/maps/?ll=" + ll + "&mode=search&sll=" + ll + "&text=" + latitude + "," + longitude + "&z=12\">" +
|
||||
"<img src=\"https://static-maps.yandex.ru/1.x/?ll=" + longitude + "," + latitude + "&z=12&l=map&size=300,200&pt=" + ll + ",vkgrm\"/>" +
|
||||
"</a>";
|
||||
}
|
||||
}
|
||||
|
||||
String chatAction = (message.chat_action != null) ? getHtmlForChatAction(message.chat_action) : "";
|
||||
String attaches = (message.attachments.size() > 0) ? "<p class=\"msg-attaches\">Вложения: " + 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\">от <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 +
|
||||
attaches +
|
||||
reply +
|
||||
fwdMessages +
|
||||
"</div>";
|
||||
}
|
||||
|
||||
private String provideReply(JSONObject replyMessage) {
|
||||
var messageId = replyMessage.optInt("id");
|
||||
var userId = replyMessage.optInt("from_id");
|
||||
var peerId = replyMessage.optInt("peer_id");
|
||||
var text = mentionsReplace(decryptMessage(replyMessage.optString("text"), peerId));
|
||||
var fwdMessages = replyMessage.optJSONArray("fwd_messages");
|
||||
|
||||
var user = usersArray.get(userId);
|
||||
|
||||
if (text.isEmpty()) {
|
||||
if (fwdMessages != null) {
|
||||
var length = fwdMessages.length();
|
||||
if (length > 0) text = length + " " + pluralMsg(length);
|
||||
} else text = "Вложение";
|
||||
}
|
||||
|
||||
return "<a href=\"#" + messageId + "\" class=\"msg-attach-link\">" +
|
||||
"<div class=\"msg-reply\">" +
|
||||
"<p class=\"reply-header\">Пересланное сообщение</p>" +
|
||||
"<p class=\"reply-content\">" + user.firstName + " " + user.lastName + ": " + text + "</p>" +
|
||||
"</div>" +
|
||||
"</a>";
|
||||
}
|
||||
|
||||
private String provideForwardMessages(List<JSONObject> fwd_messages) throws JSONException {
|
||||
StringBuilder fwdmsgs = new StringBuilder("<div class=\"msg-reply\">");
|
||||
|
||||
for (JSONObject fwd_message : fwd_messages) {
|
||||
|
||||
if (fwd_message == null) continue;
|
||||
|
||||
List<JSONObject> attaches = new ArrayList<>();
|
||||
|
||||
JSONArray arr = fwd_message.optJSONArray("attachments");
|
||||
if (arr != null) {
|
||||
for (int i = 0; i < arr.length(); i++) {
|
||||
try {
|
||||
attaches.add(arr.getJSONObject(i));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<JSONObject> fwdsMsg = new ArrayList<>();
|
||||
|
||||
JSONArray fwd_msgs = fwd_message.optJSONArray("fwd_messages");
|
||||
if (fwd_msgs != null) {
|
||||
for (int i = 0; i < fwd_msgs.length(); i++) {
|
||||
try {
|
||||
fwdsMsg.add(fwd_msgs.getJSONObject(i));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject reply_message = fwd_message.optJSONObject("reply_message");
|
||||
|
||||
var attachesHtml = (attaches.size() > 0) ? "Вложения: " + getHtmlForAttach(attaches) : "";
|
||||
var replyHtml = (reply_message != null) ? provideReply(reply_message) : "";
|
||||
var fwdsHtml = (fwdsMsg.size() > 0) ? provideForwardMessages(fwdsMsg) : ""; // recursion XD :>
|
||||
|
||||
var userId = fwd_message.optInt("from_id");
|
||||
var peerId = fwd_message.optInt("peer_id");
|
||||
var text = mentionsReplace(decryptMessage(fwd_message.optString("text"), peerId));
|
||||
|
||||
var userLink = ((userId < 0) ? "club" : "id") + Math.abs(userId);
|
||||
|
||||
fwdmsgs.append("<p class=\"reply-content\"><a class=\"msg-attach-link\" href=\"https://" + VK_DOMAIN + "/").append(userLink).append("\">@").append(userLink).append("</a>: ").append(text).append(attachesHtml).append(replyHtml).append(fwdsHtml);
|
||||
}
|
||||
|
||||
return fwdmsgs.append("</div>").toString();
|
||||
}
|
||||
|
||||
private String mentionsReplace(String text) {
|
||||
var matcher = Pattern.compile("\\[((?:club|id|public)\\d+)\\|([^]]+)\\]").matcher(text);
|
||||
|
||||
return matcher.replaceAll("<a class=\"msg-attach-link\" href=\"https://" + VK_DOMAIN + "/$1\">$2</a>");
|
||||
}
|
||||
|
||||
private String pluralMsg(int count) {
|
||||
String[] plurals = {"сообщение", "сообщения", "сообщений"};
|
||||
|
||||
var hundredModulo = count % 100;
|
||||
var tenModulo = count % 10;
|
||||
|
||||
if (hundredModulo > 10 && hundredModulo < 20) return plurals[2];
|
||||
else if (tenModulo > 1 && tenModulo < 5) return plurals[1];
|
||||
else if (tenModulo == 1) return plurals[0];
|
||||
|
||||
return plurals[2];
|
||||
}
|
||||
|
||||
private String getHtmlForChatAction(JSONObject action) {
|
||||
var type = action.optString("type");
|
||||
|
||||
StringBuilder htmlAction = new StringBuilder("<p class=\"chat-action\">");
|
||||
|
||||
switch(type) {
|
||||
case "chat_photo_update":
|
||||
htmlAction.append("Обновил фотографию беседы");
|
||||
break;
|
||||
case "chat_photo_remove":
|
||||
htmlAction.append("Удалил фотографию беседы");
|
||||
break;
|
||||
case "chat_create":
|
||||
var name = action.optString("text");
|
||||
htmlAction.append("Создал беседу").append((!name.isEmpty()) ? " с названием \"" + name + "\"" : "");
|
||||
break;
|
||||
case "chat_title_update":
|
||||
var newName = action.optString("text");
|
||||
htmlAction.append("Сменил название беседы").append((!newName.isEmpty()) ? " на \"" + newName : "\"");
|
||||
break;
|
||||
case "chat_invite_user":
|
||||
var newUserId = action.optInt("member_id");
|
||||
htmlAction.append("Добавил ").append((newUserId > 0) ? "пользователя" : "группу");
|
||||
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>");
|
||||
}
|
||||
break;
|
||||
case "chat_kick_user":
|
||||
var removedUserId = action.optInt("member_id");
|
||||
htmlAction.append("Исключил ").append((removedUserId > 0) ? "пользователя" : "группу");
|
||||
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>");
|
||||
}
|
||||
break;
|
||||
case "chat_pin_message":
|
||||
var message = action.optString("message");
|
||||
htmlAction.append("Закрепил сообщение").append((!message.isEmpty()) ? (" с текстом: \"" + message + "\"") : "");
|
||||
break;
|
||||
case "chat_unpin_message":
|
||||
htmlAction.append("Открепил сообщение");
|
||||
break;
|
||||
case "chat_invite_user_by_link":
|
||||
htmlAction.append("Вступил в беседу по ссылке");
|
||||
break;
|
||||
case "chat_screenshot":
|
||||
htmlAction.append("Сделал скриншот беседы");
|
||||
break;
|
||||
case "custom":
|
||||
htmlAction.append(action.optString("message"));
|
||||
break;
|
||||
default:
|
||||
htmlAction.append("Действие не поддерживается (").append(type).append(")");
|
||||
break;
|
||||
}
|
||||
|
||||
return htmlAction.append("</p>").toString();
|
||||
}
|
||||
|
||||
private String getHtmlForAttach(List<JSONObject> attaches) throws JSONException{
|
||||
StringBuilder rs = new StringBuilder();
|
||||
|
||||
for (JSONObject attach : attaches) {
|
||||
String type = attach.getString("type");
|
||||
JSONObject item = attach.optJSONObject(type);
|
||||
|
||||
if (item == null) continue;
|
||||
|
||||
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\">фотография</a>");
|
||||
break;
|
||||
case "doc":
|
||||
rs.append("<a href=\"").append(item.getString("url")).append("\" class=\"msg-attach-link\">документ</a>");
|
||||
break;
|
||||
case "link":
|
||||
rs.append("<a href=\"").append(item.getString("url")).append("\" class=\"msg-attach-link\">ссылка</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\">запись на стене</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\">голосовое сообщение</a>");
|
||||
break;
|
||||
case "audio":
|
||||
rs.append("аудиозапись (").append(item.optString("artist")).append(" — ").append(item.optString("title")).append(")");
|
||||
break;
|
||||
case "video":
|
||||
rs.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("\">комментарий на стене</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("\">история</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("\">подкаст</a>");
|
||||
break;
|
||||
case "gift":
|
||||
rs.append("<img src=\"").append(item.optString("thumb_96")).append("\"/>");
|
||||
break;
|
||||
case "mini_app":
|
||||
var app = item.optJSONObject("app");
|
||||
|
||||
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("\">мини-приложение</a>");
|
||||
break;
|
||||
}
|
||||
|
||||
rs.append("ошибка");
|
||||
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(item.optString("title")).append(")</a>");
|
||||
break;
|
||||
case "poll":
|
||||
rs.append((item.optBoolean("anonymous") ? "анонимный" : "публичный")).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("\">товар</a>");
|
||||
break;
|
||||
default:
|
||||
rs.append("не поддерживается (").append(type).append(")");
|
||||
break;
|
||||
}
|
||||
|
||||
rs.append(" ");
|
||||
}
|
||||
|
||||
return rs.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private static String getPollHtml(JSONObject poll) throws JSONException {
|
||||
StringBuilder pollHtml = new StringBuilder(
|
||||
"<div class=\"vtex-milk-msg poll\">" +
|
||||
"<p style=\"text-align:center;\">" + poll.optString("question") + "</p>"
|
||||
);
|
||||
|
||||
var answers = poll.optJSONArray("answers");
|
||||
|
||||
for (int i = 0; i < answers.length(); i++) {
|
||||
var jsonObject = answers.optJSONObject(i);
|
||||
if (jsonObject != null)
|
||||
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(poll.optString("votes")).append(" чел.</p>");
|
||||
|
||||
return pollHtml.append("</div>").toString();
|
||||
}
|
||||
|
||||
private static String getVideoHtml(JSONObject files) throws JSONException {
|
||||
if (files == null) return "ссылки отсутствуют";
|
||||
|
||||
Iterator< ? > keys = files.keys();
|
||||
StringBuilder videoHtml = new StringBuilder();
|
||||
|
||||
int qualityIndex = 0;
|
||||
String[] quality = {"144", "240", "360", "480", "720", "1080", "1440", "2160"};
|
||||
|
||||
while (keys.hasNext()) {
|
||||
String key = (String) keys.next();
|
||||
if (key.equals("mp4_" + quality[qualityIndex])) {
|
||||
videoHtml.append("<a class=\"msg-attach-link\" href=\"").append(files.get(key)).append("\">").append(quality[qualityIndex]).append("p</a>").append(" ");
|
||||
|
||||
if (qualityIndex == quality.length - 1) break;
|
||||
++qualityIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return videoHtml.toString();
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package ru.vtosters.lite.downloaders;
|
||||
|
||||
import static ru.vtosters.lite.downloaders.VideoDownloader.downloadVideo;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.Preferences.getPhotosDir;
|
||||
|
||||
import android.app.DownloadManager;
|
||||
import android.content.Context;
|
||||
@@ -23,8 +22,9 @@ public class StoryDownloader {
|
||||
String url = imageSizes.get(imageSizes.size() - 1).url;
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.setTitle("photo" + story.E.a);
|
||||
request.setDestinationInExternalPublicDir(getPhotosDir().getAbsolutePath(), "/Stories/photo" + story.E.a + ".jpg");
|
||||
request.setTitle("photo" + story.E.a + ".jpg");
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES, "photo" + story.E.a + ".jpg");
|
||||
request.allowScanningByMediaScanner();
|
||||
((DownloadManager) getGlobalContext().getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package ru.vtosters.lite.downloaders;
|
||||
|
||||
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 static ru.vtosters.lite.utils.Preferences.getVideosDir;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.DownloadManager;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
@@ -15,6 +14,7 @@ import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.dialogs.bottomsheet.MenuBottomSheetAction;
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vk.dto.common.VideoFile;
|
||||
@@ -106,30 +106,32 @@ public class VideoDownloader {
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.setTitle(videoFile.toString());
|
||||
request.setDestinationInExternalPublicDir(getVideosDir().getAbsolutePath(), videoFile + ".mp4");
|
||||
request.allowScanningByMediaScanner();
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile + ".mp4");
|
||||
((DownloadManager) getGlobalContext().getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
||||
return;
|
||||
}
|
||||
|
||||
var builder = new AlertDialog.Builder(context);
|
||||
var builder = new VkAlertDialog.Builder(context);
|
||||
builder.setItems(max, ((dialog, which) -> {
|
||||
var url = urls.get(which);
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.setTitle(videoFile.toString());
|
||||
request.setDestinationInExternalPublicDir(getVideosDir().getAbsolutePath(), videoFile + ".mp4");
|
||||
request.allowScanningByMediaScanner();
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile + ".mp4");
|
||||
((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
||||
}));
|
||||
builder.show();
|
||||
}
|
||||
|
||||
public static void parseVideoLink(String url, Context ctx) {
|
||||
if (url.contains("vk.com/story")) {
|
||||
if (url.contains("vk.com/story") || url.contains("vk.com/story")) {
|
||||
ToastUtils.a(AndroidUtils.getString("video_dl_stories_not_supported"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!url.contains("vk.com/video")) {
|
||||
if (!url.contains("vk.com/video") || !url.contains("vk.com/video")) {
|
||||
ToastUtils.a(AndroidUtils.getString("video_dl_wrong_link"));
|
||||
return;
|
||||
}
|
||||
@@ -141,7 +143,7 @@ public class VideoDownloader {
|
||||
progressDialog.setMessage(AndroidUtils.getString("video_dl_progress"));
|
||||
progressDialog.show();
|
||||
|
||||
makeRequest("https://" + "api.vk.com" + "/method/video.get?owner_id=" + ownerId + "&videos=" + videoId + "&v=5.99&access_token=" + getUserToken(),
|
||||
makeRequest("https://" + getApi() + "/method/video.get?owner_id=" + ownerId + "&videos=" + videoId + "&v=5.99&access_token=" + getUserToken(),
|
||||
response -> {
|
||||
progressDialog.cancel();
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@ package ru.vtosters.lite.foaf;
|
||||
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
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 static ru.vtosters.lite.proxy.ProxyUtils.isApiProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ProgressDialog;
|
||||
@@ -35,13 +35,12 @@ import java.util.regex.Pattern;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import ru.vtosters.lite.net.Request;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
|
||||
public class FoafBase {
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||
private static final Pattern FOAF_REGEX_LAST_SEEN = Pattern.compile("<ya:lastLoggedIn dc:date=\"(.*)(((\\+|-)\\d\\d):(\\d\\d))\"\\/>");
|
||||
private static final Pattern FOAF_REGEX_LOGIN = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||
private static final String API_VKNEXT = "https://api.vknext.net/v1/getBypassedOnlineInfo?json=1&ids=";
|
||||
private static final String API_VKNEXT = "https://api.vtosters.app/v1/getBypassedOnlineInfo?json=1&ids=";
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
|
||||
public static long getLastSeen(long origtime, int id) throws ParseException, IOException {
|
||||
@@ -115,7 +114,7 @@ public class FoafBase {
|
||||
private static String getLink(int i) {
|
||||
String str;
|
||||
StringBuilder sb;
|
||||
if (isApiProxyEnabled()) {
|
||||
if (isAnyProxyEnabled()) {
|
||||
sb = new StringBuilder();
|
||||
str = "https://" + getApi() + "/_/vk.com/foaf.php?id=";
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.checkCaption;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.checkCopyright;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isBadNews;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsgroup;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsstories;
|
||||
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONArray;
|
||||
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;
|
||||
|
||||
public class AdBlockHook {
|
||||
public static Boolean discoverAdBlock(JSONObject jsonObject) {
|
||||
if (jsonObject == null) return true;
|
||||
|
||||
try {
|
||||
var type = jsonObject.optString("type");
|
||||
var post = jsonObject.optJSONObject("post");
|
||||
|
||||
if (jsonObject.optString("template").contains("ads") || jsonObject.has("ads")) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + (post != null ? post.optInt("post_id") : 0) + " from discover, Reason: ads");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isAds(post, type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (authorsrecomm() && (type.equals("authors_rec")
|
||||
|| type.startsWith("recommended_") && (type.endsWith("audios")
|
||||
|| type.endsWith("artists")
|
||||
|| type.endsWith("playlists")
|
||||
|| type.endsWith("groups")))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + (post != null ? post.optInt("post_id") : 0) + " from discover, Reason: authorsrecomm");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (postsrecomm() && (type.equals("inline_user_rec") || type.equals("live_recommended"))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + (post != null ? post.optInt("post_id") : 0) + " from discover, Reason: postsrecomm");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (friendsrecomm() && (type.equals("user_rec") || type.equals("friends_recomm"))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + (post != null ? post.optInt("post_id") : 0) + " from discover, Reason: friendsrecomm");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (adsgroup() && (post != null ? post.optInt("marked_as_ads") : 0) == 1 && !isWhitelistedAd(post)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + post.optInt("post_id") + " from discover, Reason: marked_as_ads is true");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (post != null) {
|
||||
if (isBadNews(post.optString("text")) && !isWhitelistedFilters(post)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + post.optInt("post_id") + " from discover, Reason: text filters");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkCopyright(post) && !isWhitelistedFilters(post)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + post.optInt("post_id") + " from discover, Reason: copyright filters");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkCaption(post) && !isWhitelistedFilters(post)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + post.optInt("post_id") + " from discover, Reason: caption filters");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NewsFeedFiltersUtils.injectFiltersReposts(post) && !isWhitelistedFilters(post)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + post.optInt("post_id") + " from discover, Reason: repost ad");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("NewsfeedAdBlockV2", "discover: " + e.getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static JSONObject discoverInject(JSONObject json) throws JSONException {
|
||||
var items = json.optJSONArray("items");
|
||||
var newObj = new JSONArray();
|
||||
|
||||
// newObj.put(discoverObj()); // template injection
|
||||
|
||||
for (int i = 0; i < (items != null ? items.length() : 0); i++) {
|
||||
try {
|
||||
var curr = items.getJSONObject(i);
|
||||
if (!curr.optString("template").contains("info") && discoverAdBlock(curr)) {
|
||||
newObj.put(items.optJSONObject(i));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("NewsfeedAdBlockV2", "discover: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
json.put("items", newObj);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject discoverObj() throws JSONException {
|
||||
var mainjson = new JSONObject();
|
||||
|
||||
var info = new JSONObject();
|
||||
info.put("title", "Test Injection");
|
||||
info.put("text_color", "#ffffff");
|
||||
info.put("description", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat");
|
||||
|
||||
var image = new JSONArray();
|
||||
var imageQuality1 = new JSONObject();
|
||||
imageQuality1.put("url", "https://w7.pngwing.com/pngs/505/1021/png-transparent-konata-izumi-lucky-star-desktop-anime-anime-blue-mammal-face.png");
|
||||
imageQuality1.put("width", 72); // 72, 108, 144, 216, 288
|
||||
imageQuality1.put("height", 72); // 72, 108, 144, 216, 288
|
||||
image.put(imageQuality1);
|
||||
|
||||
var background = new JSONArray();
|
||||
var backgroundQuality1 = new JSONObject();
|
||||
backgroundQuality1.put("url", "https://2ch.life/vg/arch/2022-08-22/src/38524739/16440606579870.jpg");
|
||||
backgroundQuality1.put("width", 344); // 344, 516, 680, 1032, 1376
|
||||
backgroundQuality1.put("height", 215); // 215, 323, 426, 645, 860
|
||||
background.put(backgroundQuality1);
|
||||
|
||||
info.put("image", image);
|
||||
info.put("background", background);
|
||||
|
||||
mainjson.put("info", info);
|
||||
mainjson.put("track_code", "info_banner_donut_catalog");
|
||||
mainjson.put("template", "info");
|
||||
|
||||
var action = new JSONObject();
|
||||
action.put("type", "open_url");
|
||||
action.put("url", "vk.com/vtosters_official");
|
||||
action.put("target", "internal");
|
||||
|
||||
mainjson.put("action", action);
|
||||
|
||||
return mainjson;
|
||||
}
|
||||
|
||||
public static JSONArray feedInject(JSONArray items) {
|
||||
if (items.length() == 0) return items;
|
||||
|
||||
try {
|
||||
var newItems = new JSONArray();
|
||||
|
||||
for (int j = 0; j < items.length(); j++) {
|
||||
var list = items.optJSONObject(j);
|
||||
|
||||
if (list == null) continue;
|
||||
|
||||
var type = list.optString("type");
|
||||
|
||||
if (isAds(list, type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (authorsrecomm() && (type.equals("authors_rec")
|
||||
|| type.startsWith("recommended_") && (type.endsWith("audios")
|
||||
|| type.endsWith("artists")
|
||||
|| type.endsWith("playlists")
|
||||
|| type.endsWith("groups")))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: authorsrecomm");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (postsrecomm() && (type.equals("inline_user_rec") || type.equals("live_recommended"))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: postsrecomm");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (friendsrecomm() && (type.equals("user_rec") || type.equals("friends_recomm"))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: friendsrecomm");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (adsgroup() && list.optInt("marked_as_ads") == 1 && !isWhitelistedAd(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: marked_as_ads is true");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isBadNews(list.optString("text")) && !isWhitelistedFilters(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: text filters");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (checkCopyright(list) && !isWhitelistedFilters(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: copyright filters");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (checkCaption(list) && !isWhitelistedFilters(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: caption filters");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NewsFeedFiltersUtils.injectFiltersReposts(list) && !isWhitelistedFilters(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: repost ad");
|
||||
continue;
|
||||
}
|
||||
|
||||
newItems.put(list);
|
||||
}
|
||||
|
||||
return newItems;
|
||||
} catch (Exception e) {
|
||||
Log.d("NewsfeedAdBlockV2", e.getMessage());
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
public static JSONObject storiesads(JSONObject json, boolean isDeleteFix) throws JSONException {
|
||||
if (!adsstories()) {
|
||||
return json;
|
||||
}
|
||||
|
||||
if (json.has("ads")) {
|
||||
var ad = json.optJSONObject("ads");
|
||||
if (isDeleteFix) {
|
||||
if (ad != null) {
|
||||
ad.optJSONObject("settings")
|
||||
.put("stories_interval", 0)
|
||||
.put("authors_interval", 0)
|
||||
.put("time_interval", 0)
|
||||
.put("stories_init", 0)
|
||||
.put("authors_init", 0)
|
||||
.put("time_init", 0);
|
||||
}
|
||||
if (dev()) Log.d("StoriesAds", "Set ads settings at zero values");
|
||||
} else {
|
||||
json.remove("ads");
|
||||
if (dev()) Log.d("StoriesAds", "Removed ads block");
|
||||
}
|
||||
}
|
||||
|
||||
if (!json.has("items")) return json;
|
||||
|
||||
var items = json.optJSONArray("items");
|
||||
if (items != null) {
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
var item = items.optJSONObject(i);
|
||||
if (item != null) {
|
||||
parseStoriesItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
private static void parseStoriesItem(JSONObject item) throws JSONException {
|
||||
var stories = item.optJSONArray("stories");
|
||||
var newStories = new JSONArray();
|
||||
|
||||
if (stories == null) return;
|
||||
|
||||
for (int j = 0; j < stories.length(); j++) {
|
||||
var story = stories.optJSONObject(j);
|
||||
|
||||
if (!story.optBoolean("is_ads") && !story.optBoolean("is_promo")) {
|
||||
newStories.put(story);
|
||||
} else {
|
||||
if (dev())
|
||||
Log.d("StoriesAds", "Fetched ad, owner id " + story.optString("owner_id") + ", caption " + story.optString("caption"));
|
||||
}
|
||||
}
|
||||
|
||||
item.put("stories", newStories);
|
||||
}
|
||||
|
||||
public static Boolean isAds(JSONObject list, String type) throws JSONException {
|
||||
if (list == null || type == null || !ads()) return false;
|
||||
|
||||
if (list.has("ads")
|
||||
|| type.equals("ads")
|
||||
|| type.equals("carousel")
|
||||
|| type.equals("html5_ad")
|
||||
|| type.equals("ads_easy_promote")) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: ads");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type.equals("promo_button")
|
||||
|| type.equals("app_widget")
|
||||
|| type.equals("app_video")
|
||||
|| type.equals("app_slider")
|
||||
|| type.equals("tags_suggestions")) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: promo");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Boolean isWhitelistedFilters(JSONObject list) {
|
||||
var id = String.valueOf(list.optInt("owner_id"));
|
||||
|
||||
if (id.equals("0")) {
|
||||
id = String.valueOf(list.optInt("source_id"));
|
||||
}
|
||||
|
||||
if (id.equals("-189659924")){
|
||||
return true;
|
||||
}
|
||||
|
||||
var whitelist = AndroidUtils.getDefaultPrefs().getStringSet("whitelisted_filters_groups", Collections.synchronizedSet(new LinkedHashSet<>()));
|
||||
|
||||
return whitelist.contains(id);
|
||||
}
|
||||
|
||||
public static Boolean isWhitelistedAd(JSONObject list) {
|
||||
var id = String.valueOf(list.optInt("owner_id"));
|
||||
|
||||
if (id.equals("0")) {
|
||||
id = String.valueOf(list.optInt("source_id"));
|
||||
}
|
||||
|
||||
var whitelist = AndroidUtils.getDefaultPrefs().getStringSet("whitelisted_ad_groups", Collections.synchronizedSet(new LinkedHashSet<>()));
|
||||
|
||||
return whitelist.contains(id);
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,10 @@ import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class DeviceInfoHook{
|
||||
public static String getDeviceInfo(String input) {
|
||||
Log.d("DeviceInfoHook", "getDeviceInfo: " + input);
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.vk.core.fragments.FragmentImpl;
|
||||
import com.vk.core.util.StringUtils;
|
||||
import com.vk.navigation.right.RightMenu;
|
||||
import com.vtosters.lite.MenuCountersState;
|
||||
import com.vtosters.lite.fragments.ProfileFragment;
|
||||
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationMenuView;
|
||||
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationView;
|
||||
|
||||
|
||||
@@ -1,25 +1,16 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.foaf.FoafBase.getLastSeen;
|
||||
import static ru.vtosters.lite.foaf.FoafBase.getBypassedOnlineInfo;
|
||||
import static ru.vtosters.lite.hooks.OnlineFormatterHook.onlineHookProfiles;
|
||||
import static ru.vtosters.lite.hooks.DateHook.getLocale;
|
||||
import static ru.vtosters.lite.hooks.OnlineFormatterHook.onlineHookProfiles;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getStatic;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.Base64Utils.decode;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.checkCaption;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.checkCopyright;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isBadNews;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsgroup;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsstories;
|
||||
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.friendsblock;
|
||||
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
import static ru.vtosters.lite.utils.Preferences.podcastcatalog;
|
||||
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.isDeveloper;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.isPrometheus;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.isVerified;
|
||||
@@ -47,7 +38,6 @@ import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.NewsFeedFiltersUtils;
|
||||
|
||||
public class JsonInjectors {
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
@@ -118,7 +108,7 @@ public class JsonInjectors {
|
||||
public static JSONObject vktesters(int id) throws JSONException {
|
||||
var title = AndroidUtils.getString("tester_profile");
|
||||
var text_color = "2D81E0";
|
||||
var link = "https://static.vk.com/bugs?lang=" + LangUtils.a() + "#/reporter" + id;
|
||||
var link = "https://" + getStatic() + "/bugs?lang=" + LangUtils.a() + "#/reporter" + id;
|
||||
|
||||
var json = new JSONObject();
|
||||
var icons = new JSONArray();
|
||||
@@ -164,23 +154,16 @@ public class JsonInjectors {
|
||||
var link = "https://vtosters.app"; // can be null
|
||||
var linktitle = "Test button"; // can be null
|
||||
|
||||
// "{\"layout\":\"tertiary\",\"text\":\"" + linktitle + "\",\"type\":\"link\",\"link\":\"" + link + "\"}";
|
||||
var buttons = decode("eyJsYXlvdXQiOiJ0ZXJ0aWFyeSIsInRleHQiOiI=") + linktitle + decode("IiwidHlwZSI6ImxpbmsiLCJsaW5rIjoi") + link + decode("In0=");
|
||||
// ,"icon":" + pic + "
|
||||
var icon = decode("LCJpY29uIjoi") + pic + decode("Ig==");
|
||||
|
||||
var hasIcon = !pic.isEmpty();
|
||||
var hasButton = !buttons.isEmpty();
|
||||
var isPicture = pic.endsWith(".png") || pic.endsWith(".jpg") || pic.endsWith(".jpeg") || pic.endsWith(".webp");
|
||||
var hasButton = !link.isEmpty();
|
||||
|
||||
if (!isPicture) hasIcon = false;
|
||||
if (!hasIcon) icon = "";
|
||||
if (!hasButton) buttons = "";
|
||||
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 (isPrometheus(peerid)) text = AndroidUtils.getString("i_bought") + " VTosters Premium Gold Prime Pro Plus";
|
||||
if (isDeveloper(peerid)) text = AndroidUtils.getString("i_created_poop");
|
||||
if (!isVerified(peerid) || text.equals("")) {
|
||||
|
||||
if (!isVerified(peerid) || text.equals("") || peerid == AccountManagerUtils.getUserId() || peerid == 0) {
|
||||
if (getBoolValue("convBarRecomm", false)) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -188,14 +171,27 @@ public class JsonInjectors {
|
||||
}
|
||||
}
|
||||
|
||||
if (!dev()) return orig.optJSONObject("conversation_bar");
|
||||
if (!dev()) return orig.optJSONObject("conversation_bar"); // for devs only
|
||||
|
||||
// JSONObject("{\"name\":\"group_admin_welcome\",\"text\":\"" + textverif + "\",\"buttons\":[],\"icon\":\"" + pic + "\"}");
|
||||
return new JSONObject(decode("eyJuYW1lIjoiZ3JvdXBfYWRtaW5fd2VsY29tZSIsInRleHQiOiI=")
|
||||
+ text + decode("IiwiYnV0dG9ucyI6Ww==")
|
||||
+ buttons + decode("XQ==")
|
||||
+ icon
|
||||
+ decode("fQ=="));
|
||||
var json = new JSONObject();
|
||||
|
||||
var buttonsJson = new JSONObject();
|
||||
buttonsJson.put("layout", "tertiary");
|
||||
buttonsJson.put("text", linktitle);
|
||||
buttonsJson.put("type", "link");
|
||||
buttonsJson.put("link", link);
|
||||
|
||||
var buttonsjson = new JSONArray(); // max 3 buttons in array
|
||||
if (hasButton) buttonsjson.put(buttonsJson);
|
||||
|
||||
json.put("name", "group_admin_welcome");
|
||||
json.put("text", text);
|
||||
json.put("buttons", buttonsjson);
|
||||
if (hasIcon && isPicture) {
|
||||
json.put("icon", pic);
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject menu(JSONObject orig) throws JSONException {
|
||||
@@ -240,30 +236,12 @@ public class JsonInjectors {
|
||||
}
|
||||
|
||||
public static JSONObject musiclink(JSONObject json) {
|
||||
var oldItems = json.optJSONArray("links");
|
||||
var section = json.optJSONObject("section");
|
||||
var linksblock = section.optJSONArray("blocks");
|
||||
var newBlock = new JSONArray();
|
||||
var links = json.optJSONArray("links");
|
||||
|
||||
if (oldItems != null) {
|
||||
if (oldItems.optJSONObject(0).optString("url").contains("?section=recent")) {
|
||||
if (links != null) {
|
||||
if (links.optJSONObject(0).optString("url").contains("?section=recent")) {
|
||||
json.remove("links");
|
||||
|
||||
for (int i = 0; i < linksblock.length(); i++) {
|
||||
var item = linksblock.optJSONObject(i);
|
||||
var datatype = item.optString("data_type");
|
||||
var layname = item.optJSONObject("layout").optString("name");
|
||||
if (!datatype.equals("links") && !layname.equals("separator")) {
|
||||
newBlock.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
section.putOpt("blocks", newBlock);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Removed links buttons");
|
||||
}
|
||||
}
|
||||
@@ -271,7 +249,7 @@ public class JsonInjectors {
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject setOnlineInfo(JSONObject json) throws ParseException, IOException, JSONException {
|
||||
public static JSONObject setOnlineInfo(JSONObject json) throws JSONException {
|
||||
var id = json.optInt("id");
|
||||
if (id == AccountManagerUtils.getUserId()) {
|
||||
return json;
|
||||
@@ -300,7 +278,7 @@ public class JsonInjectors {
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONArray setOnlineInfoUsers(JSONArray profiles) throws ParseException, IOException, JSONException {
|
||||
public static JSONArray setOnlineInfoUsers(JSONArray profiles) throws JSONException {
|
||||
if (profiles == null || profiles.length() == 0) return profiles;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var curVkId = AccountManagerUtils.getUserId();
|
||||
@@ -348,87 +326,6 @@ public class JsonInjectors {
|
||||
return profiles;
|
||||
}
|
||||
|
||||
|
||||
public static JSONObject storiesads(JSONObject json, boolean isDeleteFix) throws JSONException {
|
||||
if (!adsstories()) {
|
||||
return json;
|
||||
}
|
||||
|
||||
if (json.has("ads")) {
|
||||
if (isDeleteFix) {
|
||||
json.optJSONObject("ads").optJSONObject("settings")
|
||||
.put("stories_interval", 0)
|
||||
.put("authors_interval", 0)
|
||||
.put("time_interval", 0)
|
||||
.put("stories_init", 0)
|
||||
.put("authors_init", 0)
|
||||
.put("time_init", 0);
|
||||
if (dev()) Log.d("StoriesAds", "Set ads settings at zero values");
|
||||
} else {
|
||||
json.remove("ads");
|
||||
if (dev()) Log.d("StoriesAds", "Removed ads block");
|
||||
}
|
||||
}
|
||||
|
||||
if (!json.has("items")) return json;
|
||||
|
||||
var items = json.optJSONArray("items");
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
var item = items.optJSONObject(i);
|
||||
if (item != null) {
|
||||
parseStoriesItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
private static void parseStoriesItem(JSONObject item) throws JSONException {
|
||||
var stories = item.optJSONArray("stories");
|
||||
var newStories = new JSONArray();
|
||||
|
||||
if (stories == null) return;
|
||||
|
||||
for (int j = 0; j < stories.length(); j++) {
|
||||
var story = stories.optJSONObject(j);
|
||||
|
||||
if (!story.optBoolean("is_ads") && !story.optBoolean("is_promo")) {
|
||||
newStories.put(story);
|
||||
} else {
|
||||
if (dev())
|
||||
Log.d("StoriesAds", "Fetched ad, owner id " + story.optString("owner_id") + ", caption " + story.optString("caption"));
|
||||
}
|
||||
}
|
||||
|
||||
item.put("stories", newStories);
|
||||
}
|
||||
|
||||
public static Boolean isAds(JSONObject list, String type) throws JSONException {
|
||||
if (list == null || type == null || !ads()) return false;
|
||||
|
||||
if (list.has("ads")
|
||||
|| type.equals("ads")
|
||||
|| type.equals("carousel")
|
||||
|| type.equals("html5_ad")
|
||||
|| type.equals("ads_easy_promote")) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: ads");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type.equals("promo_button")
|
||||
|| type.equals("app_widget")
|
||||
|| type.equals("app_video")
|
||||
|| type.equals("app_slider")
|
||||
|| type.equals("tags_suggestions")) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: promo");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static JSONArray newsfeedlist(JSONArray items) throws JSONException {
|
||||
var selectedItems = getDefaultPrefs().getString("news_feed_selected_items", "");
|
||||
var filtersSet = getDefaultPrefs().getStringSet("news_feed_items_set", null);
|
||||
@@ -466,76 +363,6 @@ public class JsonInjectors {
|
||||
return items;
|
||||
}
|
||||
|
||||
public static JSONArray newsfeedadtest(JSONArray items) throws JSONException {
|
||||
if (!getBoolValue("newadblock", true)) return items;
|
||||
var newItems = new JSONArray();
|
||||
|
||||
for (int j = 0; j < items.length(); j++) {
|
||||
var list = items.optJSONObject(j);
|
||||
var type = list.optString("type");
|
||||
|
||||
if (isAds(list, type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (authorsrecomm() && (type.equals("authors_rec")
|
||||
|| type.startsWith("recommended_") && (type.endsWith("audios")
|
||||
|| type.endsWith("artists")
|
||||
|| type.endsWith("playlists")
|
||||
|| type.endsWith("groups")))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: authorsrecomm");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (postsrecomm() && (type.equals("inline_user_rec") || type.equals("live_recommended"))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: postsrecomm");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (friendsrecomm() && (type.equals("user_rec") || type.equals("friends_recomm"))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: friendsrecomm");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (adsgroup() && list.optInt("marked_as_ads") == 1) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: marked_as_ads is true");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isBadNews(list.optString("text"))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: text filters");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (checkCopyright(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: copyright filters");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (checkCaption(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: caption filters");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NewsFeedFiltersUtils.injectFiltersReposts(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: repost ad");
|
||||
continue;
|
||||
}
|
||||
|
||||
newItems.put(list);
|
||||
}
|
||||
|
||||
return newItems;
|
||||
}
|
||||
|
||||
public static JSONObject music(JSONObject json) throws JSONException {
|
||||
var catalog = json.optJSONObject("catalog");
|
||||
|
||||
@@ -623,7 +450,7 @@ public class JsonInjectors {
|
||||
if (section == null) return null;
|
||||
|
||||
var request = new Request.a()
|
||||
.b("https://api.vk.com/method/catalog.getAudio"
|
||||
.b("https://" + getApi() + "/method/catalog.getAudio"
|
||||
+ "?v=5.119"
|
||||
+ "&https=1"
|
||||
+ "&need_blocks=1"
|
||||
@@ -647,7 +474,7 @@ public class JsonInjectors {
|
||||
|
||||
public static JSONObject fetchCatalogPodcast() {
|
||||
var request = new Request.a()
|
||||
.b("https://api.vk.com/method/catalog.getPodcasts"
|
||||
.b("https://" + getApi() + "/method/catalog.getPodcasts"
|
||||
+ "?v=5.119"
|
||||
+ "&https=1"
|
||||
+ "&need_blocks=1"
|
||||
@@ -733,10 +560,7 @@ public class JsonInjectors {
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
public static boolean haveDonateButton() {
|
||||
int randomshower = new Random().nextInt(6);
|
||||
|
||||
return hasVerification() || randomshower != 1;
|
||||
return hasVerification() || new Random().nextInt(6) != 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.ui.dialogs.ServerDialog.sendRequest;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.getInstance;
|
||||
import static ru.vtosters.lite.utils.DeletedMessagesHandler.reloadMessagesList;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
|
||||
import static ru.vtosters.lite.utils.Preferences.checkupdates;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.isDarkTheme;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.setNeededTheme;
|
||||
@@ -11,21 +11,24 @@ import android.app.Activity;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.vk.core.concurrent.VkExecutors;
|
||||
|
||||
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
|
||||
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
|
||||
import ru.vtosters.lite.ui.dialogs.DisableBattery;
|
||||
import ru.vtosters.lite.ui.dialogs.InstallGMS;
|
||||
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
||||
import ru.vtosters.lite.ui.dialogs.ServerDialog;
|
||||
import ru.vtosters.lite.ui.dialogs.Start;
|
||||
import ru.vtosters.lite.utils.DeletedMessagesHandler;
|
||||
|
||||
public class MainActivityInjector {
|
||||
|
||||
public static void inject(Activity activity) {
|
||||
public class MainActivityInjector{
|
||||
public static void inject(Activity activity){
|
||||
setNeededTheme(activity);
|
||||
ServerDialog.activity = activity;
|
||||
sendRequest();
|
||||
if (checkupdates()) OTADialog.checkUpdates(activity);
|
||||
reloadMessagesList();
|
||||
VkExecutors.x.f().a(DeletedMessagesHandler::reloadMessagesList); // ioScheduler
|
||||
Start.alert(activity);
|
||||
InstallGMS.alert(activity);
|
||||
DisableBattery.alert(activity);
|
||||
@@ -33,7 +36,14 @@ public class MainActivityInjector {
|
||||
.edit()
|
||||
.putBoolean("isdark", isDarkTheme())
|
||||
.commit();
|
||||
getInstance().autoCleaningCache();
|
||||
SystemThemeChangerHook.onThemeChanged(activity.getResources().getConfiguration());
|
||||
|
||||
VkExecutors.x.q().a(() -> {
|
||||
getInstance().autoCleaningCache();
|
||||
}); // slowTasksScheduler
|
||||
|
||||
setupFilters();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannels.createChannels();
|
||||
}
|
||||
|
||||
@@ -12,11 +12,10 @@ import android.view.View;
|
||||
|
||||
import com.vk.api.internal.MethodCall;
|
||||
|
||||
import ru.vtosters.lite.translators.BaseTranslator;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.vtosters.lite.translators.BaseTranslator;
|
||||
|
||||
public class MessagesHook {
|
||||
public static String injectOwnText(String oldText) {
|
||||
|
||||
@@ -1,19 +1,9 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static java.lang.Long.MAX_VALUE;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.checkCaption;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.checkCopyright;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.injectFiltersReposts;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isAds;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isAuthorRecommendations;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isBadNews;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isFriendsRecommendations;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isGroupAds;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isMusicBlock;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isNewsBlock;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isPostRecommendations;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isRecomsGroup;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsslider;
|
||||
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
|
||||
@@ -21,43 +11,21 @@ import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
|
||||
import com.vk.core.preference.Preference;
|
||||
import android.content.Context;
|
||||
import android.os.PowerManager;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import com.vk.core.preference.Preference;
|
||||
import com.vtosters.lite.api.ExtendedCommunityProfile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
|
||||
public class NewsfeedHook {
|
||||
public static boolean injectFilters(JSONObject obj) throws JSONException {
|
||||
if (getBoolValue("newadblock", true)) return true;
|
||||
|
||||
var optString = obj.optString("type", "");
|
||||
if (isAds(optString) || isAuthorRecommendations(optString) || isPostRecommendations(optString) || isFriendsRecommendations(optString) || isRecomsGroup(optString) || isMusicBlock(optString) || isNewsBlock(optString)) {
|
||||
return false;
|
||||
}
|
||||
optString = obj.optString("post_type", "");
|
||||
if (isAds(optString) || isAuthorRecommendations(optString) || isPostRecommendations(optString) || isFriendsRecommendations(optString) || isMusicBlock(optString) || isNewsBlock(optString)) {
|
||||
return false;
|
||||
}
|
||||
optString = obj.optString("filters", "");
|
||||
if (isAds(optString) || isAuthorRecommendations(optString) || isPostRecommendations(optString) || isFriendsRecommendations(optString)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkCopyright(obj)) return false;
|
||||
|
||||
if (isBadNews(obj.optString("text", ""))) return false;
|
||||
|
||||
if (checkCaption(obj)) return false;
|
||||
|
||||
if (isGroupAds(obj)) return false;
|
||||
|
||||
return !injectFiltersReposts(obj);
|
||||
} // inject our filters to newsfeed, getpost and discover
|
||||
|
||||
public static long getUpdateNewsfeed(boolean refresh_timeout) {
|
||||
if (vkme()) {
|
||||
return MAX_VALUE;
|
||||
@@ -85,7 +53,7 @@ public class NewsfeedHook {
|
||||
params.add("photo");
|
||||
params.add("photo_tag");
|
||||
|
||||
if (!friendsrecomm()) {
|
||||
if (!friendsrecomm() && !getBoolValue("donotgetads", false)) {
|
||||
params.add("friends_recomm");
|
||||
}
|
||||
|
||||
@@ -94,26 +62,74 @@ public class NewsfeedHook {
|
||||
params.add("promo_button");
|
||||
}
|
||||
|
||||
if (!authorsrecomm()) {
|
||||
if (!authorsrecomm() && !getBoolValue("donotgetads", false)) {
|
||||
params.add("authors_rec");
|
||||
}
|
||||
|
||||
return params.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public static boolean isWhitelistedFilter(ExtendedCommunityProfile eup) {
|
||||
return getDefaultPrefs().getStringSet("whitelisted_filters_groups", Collections.synchronizedSet(new LinkedHashSet<>())).contains(String.valueOf(AccountManagerUtils.getUserID(eup)));
|
||||
}
|
||||
|
||||
public static boolean isWhitelistedAd(ExtendedCommunityProfile eup) {
|
||||
return getDefaultPrefs().getStringSet("whitelisted_ad_groups", Collections.synchronizedSet(new LinkedHashSet<>())).contains(String.valueOf(AccountManagerUtils.getUserID(eup)));
|
||||
}
|
||||
|
||||
public static void setWhitelistedFilter(ExtendedCommunityProfile eup, boolean needWhitelist) {
|
||||
var mutableAdsSet = Collections.synchronizedSet(new LinkedHashSet<String>());
|
||||
var id = String.valueOf(AccountManagerUtils.getUserID(eup));
|
||||
|
||||
mutableAdsSet.addAll(getDefaultPrefs().getStringSet("whitelisted_filters_groups", mutableAdsSet));
|
||||
|
||||
if (needWhitelist) {
|
||||
mutableAdsSet.add(id);
|
||||
} else {
|
||||
mutableAdsSet.remove(id);
|
||||
}
|
||||
|
||||
getDefaultPrefs().edit().putStringSet("whitelisted_filters_groups", mutableAdsSet).apply();
|
||||
}
|
||||
|
||||
public static void setWhitelistedAd(ExtendedCommunityProfile eup, boolean needWhitelist) {
|
||||
var mutableAdsSet = Collections.synchronizedSet(new LinkedHashSet<String>());
|
||||
var id = String.valueOf(AccountManagerUtils.getUserID(eup));
|
||||
|
||||
mutableAdsSet.addAll(getDefaultPrefs().getStringSet("whitelisted_ad_groups", mutableAdsSet));
|
||||
|
||||
if (needWhitelist) {
|
||||
mutableAdsSet.add(id);
|
||||
} else {
|
||||
mutableAdsSet.remove(id);
|
||||
}
|
||||
|
||||
getDefaultPrefs().edit().putStringSet("whitelisted_ad_groups", mutableAdsSet).apply();
|
||||
}
|
||||
|
||||
public static void adsParams(HashSet<String> hashSet) {
|
||||
if (ads() || adsslider()) {
|
||||
if (ads()) {
|
||||
hashSet.add("ads_disabled");
|
||||
return;
|
||||
if (getBoolValue("donotgetads", false)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hashSet.add("ads_app");
|
||||
hashSet.add("ads_site");
|
||||
hashSet.add("ads_post");
|
||||
hashSet.add("ads_app_slider");
|
||||
if (!adsslider()) {
|
||||
hashSet.add("ads_app_slider");
|
||||
}
|
||||
hashSet.add("ads_site_slider");
|
||||
hashSet.add("ads_app_video");
|
||||
hashSet.add("ads_post_pretty_cards");
|
||||
hashSet.add("ads_post_snippet_video");
|
||||
}
|
||||
|
||||
public static boolean isPowerSaveMode() {
|
||||
var pw = (PowerManager) getGlobalContext().getSystemService(Context.POWER_SERVICE);
|
||||
|
||||
return !getBoolValue("force_disable_psm", false) && pw.isPowerSaveMode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package ru.vtosters.lite.hooks;
|
||||
import static ru.vtosters.lite.hooks.JsonInjectors.setOnlineInfo;
|
||||
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;
|
||||
import static ru.vtosters.lite.utils.Preferences.getPrefsFromFile;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
@@ -130,6 +130,12 @@ public class OnlineFormatterHook {
|
||||
return "Miranda NG (bridge)";
|
||||
case 8043814:
|
||||
return "Quise";
|
||||
case 7221936:
|
||||
return "Вечный Online";
|
||||
case 6892935:
|
||||
return "VK Helper";
|
||||
case 6248661:
|
||||
return "MemeVoices for VK";
|
||||
default:
|
||||
return getAppNameFromOnline(appid);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
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;
|
||||
@@ -67,7 +67,19 @@ public class PhotoViewer {
|
||||
: new RecoloredDrawable(AndroidUtils.getGlobalContext().getDrawable(R.drawable.ic_menu_search_outline_28), ThemesUtils.getAccentColor()),
|
||||
false,
|
||||
() -> {
|
||||
searchPhoto(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
||||
if (attachment instanceof PhotoAttachment) {
|
||||
searchPhoto(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
||||
} else if (attachment instanceof DocumentAttachment) {
|
||||
var documentAttachment = (DocumentAttachment) attachment;
|
||||
if (documentAttachment.J != null)
|
||||
try {
|
||||
searchPhoto(getUrlFromDocumentAttachment(documentAttachment));
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
}
|
||||
else
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
);
|
||||
@@ -77,7 +89,19 @@ public class PhotoViewer {
|
||||
: new RecoloredDrawable(AndroidUtils.getGlobalContext().getDrawable(R.drawable.ic_copy_outline_28), Color.WHITE),
|
||||
false,
|
||||
() -> {
|
||||
copyPhotoUrl(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
||||
if (attachment instanceof PhotoAttachment) {
|
||||
copyPhotoUrl(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
||||
} else if (attachment instanceof DocumentAttachment) {
|
||||
var documentAttachment = (DocumentAttachment) attachment;
|
||||
if (documentAttachment.J != null)
|
||||
try {
|
||||
copyPhotoUrl(getUrlFromDocumentAttachment(documentAttachment));
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
}
|
||||
else
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
);
|
||||
@@ -93,7 +117,11 @@ public class PhotoViewer {
|
||||
} else if (attachment instanceof DocumentAttachment) {
|
||||
var documentAttachment = (DocumentAttachment) attachment;
|
||||
if (documentAttachment.J != null)
|
||||
openUrl(getUrlFromDocumentAttachment(documentAttachment));
|
||||
try {
|
||||
openUrl(getUrlFromDocumentAttachment(documentAttachment));
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
}
|
||||
else
|
||||
ToastUtils.a(getString("photo_get_error"));
|
||||
}
|
||||
@@ -103,8 +131,11 @@ public class PhotoViewer {
|
||||
}
|
||||
|
||||
private static String getUrlFromDocumentAttachment(DocumentAttachment attachment) {
|
||||
var imageSizes = attachment.J.t1();
|
||||
return getUrlFromImageSizeList(imageSizes);
|
||||
List<ImageSize> imageSizes = null;
|
||||
if (attachment.J != null) {
|
||||
imageSizes = attachment.J.t1();
|
||||
}
|
||||
return getUrlFromImageSizeList(imageSizes != null ? imageSizes : null);
|
||||
}
|
||||
|
||||
private static String getUrlFromPhotoAttachment(PhotoAttachment attachment) {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isRandomProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isVikaProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isZaboronaEnabled;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isRandomProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isZaboronaEnabled;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
@@ -41,14 +42,17 @@ public class ProxyHook {
|
||||
RadioButton rgDefault = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton rgZaborona = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton rgRandomProxy = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
RadioButton rgVika = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
|
||||
rg.addView(rgDefault);
|
||||
rg.addView(rgVika);
|
||||
rg.addView(rgZaborona);
|
||||
rg.addView(rgRandomProxy);
|
||||
|
||||
rgDefault.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
rgZaborona.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
rgRandomProxy.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
rgVika.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
|
||||
rg.setPadding(dp2px(18f), dp2px(12f), dp2px(18f), 0);
|
||||
|
||||
@@ -58,12 +62,16 @@ public class ProxyHook {
|
||||
rgZaborona.setText(AndroidUtils.getString("proxy_enable") + " (Zaborona)");
|
||||
rgZaborona.setTextColor(getTextAttr());
|
||||
|
||||
rgRandomProxy.setText(AndroidUtils.getString("proxy_enable") + " (RandomProxy)");
|
||||
rgRandomProxy.setText(AndroidUtils.getString("proxy_enable") + " (Random Socks Proxy)");
|
||||
rgRandomProxy.setTextColor(getTextAttr());
|
||||
|
||||
rgVika.setText(AndroidUtils.getString("proxy_enable") + " (Vika Mobile)");
|
||||
rgVika.setTextColor(getTextAttr());
|
||||
|
||||
rgZaborona.setChecked(isZaboronaEnabled());
|
||||
rgDefault.setChecked(!isZaboronaEnabled());
|
||||
rgDefault.setChecked(!isZaboronaEnabled() && !isRandomProxyEnabled() && !isVikaProxyEnabled());
|
||||
rgRandomProxy.setChecked(isRandomProxyEnabled());
|
||||
rgVika.setChecked(isVikaProxyEnabled());
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(ctx, getAlertStyle());
|
||||
builder.setTitle(AndroidUtils.getString("vtlproxy"));
|
||||
@@ -76,6 +84,9 @@ public class ProxyHook {
|
||||
} else if (rgRandomProxy.isChecked()) {
|
||||
edit().putString("proxy", "randomproxy").commit();
|
||||
restartApplication();
|
||||
} else if (rgVika.isChecked()) {
|
||||
edit().putString("proxy", "vika").commit();
|
||||
restartApplication();
|
||||
} else {
|
||||
edit().putString("proxy", "noproxy").commit();
|
||||
restartApplication();
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.encryption.EncryptProvider.decryptMessage;
|
||||
|
||||
import com.vk.im.engine.models.ProfilesSimpleInfo;
|
||||
import com.vk.im.engine.models.messages.MsgFromUser;
|
||||
import com.vk.im.engine.models.messages.NestedMsg;
|
||||
import com.vk.im.ui.views.ReplyView;
|
||||
|
||||
public class ReplyMsgHook {
|
||||
public static void injectWithDecrypt(ReplyView replyView, MsgFromUser msgFromUser, ProfilesSimpleInfo profilesSimpleInfo, boolean someBool) {
|
||||
msgFromUser.d(decryptMessage(msgFromUser)); // set new value of text in MsgFromUser class
|
||||
replyView.a(msgFromUser, profilesSimpleInfo, someBool);
|
||||
}
|
||||
|
||||
public static void injectWithDecrypt(ReplyView replyView, NestedMsg nestedMsg, ProfilesSimpleInfo profilesSimpleInfo, boolean someBool) {
|
||||
nestedMsg.d(decryptMessage(nestedMsg.f(), nestedMsg.t1())); // set new value of text in NestedMsg class
|
||||
replyView.a(nestedMsg, profilesSimpleInfo, someBool);
|
||||
}
|
||||
|
||||
public static void injectWithDecrypt(ReplyView replyView, NestedMsg nestedMsg, ProfilesSimpleInfo profilesSimpleInfo, boolean someBool, int i) {
|
||||
if ((i & 4) != 0) someBool = false;
|
||||
injectWithDecrypt(replyView, nestedMsg, profilesSimpleInfo, someBool);
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,9 @@ import com.vk.api.internal.MethodCall;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public class RequestDumper{
|
||||
public static void addParams(MethodCall.a paramslist, String method, LinkedHashMap params, String apiver) {
|
||||
public static void addParams(MethodCall.a paramslist, String method, LinkedHashMap<String, String> params, String apiver) {
|
||||
if (method.contains("execute.getGiftByStickerId") ) {
|
||||
apiver = "5.187";
|
||||
apiver = "5.186";
|
||||
}
|
||||
|
||||
if (dev()) {
|
||||
|
||||
@@ -6,16 +6,14 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.superapp;
|
||||
import static ru.vtosters.lite.utils.Preferences.useNewSettings;
|
||||
import static ru.vtosters.lite.utils.Preferences.videonewcatalog;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
|
||||
import com.vk.apps.AppsFragment;
|
||||
import com.vk.discover.ThemedFeedFragment;
|
||||
import com.vk.discover.DiscoverFragment;
|
||||
import com.vk.fave.fragments.FaveTabFragment;
|
||||
import com.vk.menu.MenuFragment;
|
||||
import com.vk.menu.SearchMenuFragment;
|
||||
import com.vk.music.fragment.MusicCatalogFragment1;
|
||||
import com.vk.music.fragment.MusicFragment;
|
||||
import com.vk.newsfeed.HomeFragment;
|
||||
import com.vk.newsfeed.NewsfeedFragment;
|
||||
import com.vk.notifications.NotificationsContainerFragment;
|
||||
@@ -47,19 +45,19 @@ public class StartFragmentHook {
|
||||
case "groups":
|
||||
return milkshake() ? CommunitiesCatalogFragment.class : GroupsFragment1.class;
|
||||
case "music":
|
||||
return getBoolValue("musicnewcatalog", true) ? MusicCatalogFragment1.class : MusicFragment.class;
|
||||
return MusicCatalogFragment1.class;
|
||||
case "friends":
|
||||
return FriendsFragment.class;
|
||||
case "photos":
|
||||
return PhotosFragment.class;
|
||||
case "videos":
|
||||
return videonewcatalog() ? VideoCatalogFragment.class : VideosFragment.class;
|
||||
return VideoCatalogFragment.class;
|
||||
case "settings":
|
||||
return useNewSettings();
|
||||
case "apps":
|
||||
return AppsFragment.class;
|
||||
case "discover":
|
||||
return ThemedFeedFragment.class;
|
||||
return DiscoverFragment.class;
|
||||
case "notifications":
|
||||
return NotificationsContainerFragment.class;
|
||||
case "money":
|
||||
|
||||
@@ -4,7 +4,6 @@ import static ru.vtosters.lite.utils.Preferences.feedcache;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.miniapps;
|
||||
import static ru.vtosters.lite.utils.Preferences.musicnewcatalog;
|
||||
import static ru.vtosters.lite.utils.Preferences.postsredesign;
|
||||
import static ru.vtosters.lite.utils.Preferences.superapp;
|
||||
|
||||
@@ -133,8 +132,6 @@ public class TogglesHook {
|
||||
case FEATURE_MILKSHAKE_FORCE_DISABLED:
|
||||
case FEATURE_MILKSHAKE_ACTIVATION_DISABLED:
|
||||
return !milkshake();
|
||||
case FEATURE_MUSIC_NEW_CATALOG:
|
||||
return musicnewcatalog();
|
||||
case AB_NEWS_VIDEO_LAYOUT_TEXT:
|
||||
case FEATURE_COMPACT_REPOST:
|
||||
case EXPERIMENT_NEWS_VIDEO_LAYOUT_TEXT:
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.encryption.EncryptProvider.decryptMessage;
|
||||
|
||||
import com.vk.im.engine.models.ProfilesSimpleInfo;
|
||||
import com.vk.im.engine.models.messages.MsgFromUser;
|
||||
import com.vk.im.ui.views.ReplyView;
|
||||
|
||||
public class WritebarReplyHook {
|
||||
public static void injectWithDecrypt(ReplyView replyView, MsgFromUser msgFromUser, ProfilesSimpleInfo profilesSimpleInfo) {
|
||||
msgFromUser.d(decryptMessage(msgFromUser)); // set new value of text in MsgFromUser class
|
||||
replyView.a(msgFromUser, profilesSimpleInfo, msgFromUser.H1());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package ru.vtosters.lite.hooks.ui;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vk.dto.music.Playlist;
|
||||
import com.vk.music.bottomsheets.a.MusicAction;
|
||||
import com.vk.music.common.MusicPlaybackLaunchContext;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClientImpl;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class MusicBottomSheetHook {
|
||||
public static ArrayList<MusicAction> hook(ArrayList<MusicAction> actions) {
|
||||
if (LibVKXClient.isVkxInstalled()) {
|
||||
actions.add(getPlayInVKXAction());
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
public static boolean tryPlayInVKX(int actionId, MusicTrack track, MusicPlaybackLaunchContext context, Playlist playlist) {
|
||||
if (actionId != AndroidUtils.getIdentifier("play_in_vkx", "id")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var trackList = new ArrayList<MusicTrack>();
|
||||
|
||||
if (playlist != null) {
|
||||
trackList.addAll(playlist.R);
|
||||
} else {
|
||||
trackList.add(track);
|
||||
}
|
||||
|
||||
LibVKXClientImpl.LibVKXAction action = iLibVkxService -> LibVKXClient.lambdaplay(trackList, track, iLibVkxService, context);
|
||||
return LibVKXClient.getInstance().runOnService(action);
|
||||
}
|
||||
|
||||
private static MusicAction getPlayInVKXAction() {
|
||||
return new MusicAction(
|
||||
AndroidUtils.getIdentifier("play_in_vkx", "id"),
|
||||
R.drawable.ic_music_24,
|
||||
AndroidUtils.getIdentifier("play_in_vkx", "string"),
|
||||
R.color.caption_gray,
|
||||
R.string.music_talkback_empty,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package ru.vtosters.lite.hooks.ui;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class SystemThemeChangerHook {
|
||||
public static void onThemeChanged(Configuration configuration) {
|
||||
if (Preferences.systemtheme()) {
|
||||
switch (configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK) {
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
// Night mode is active, we're using dark theme
|
||||
ThemesUtils.applyTheme(ThemesUtils.getDarkTheme());
|
||||
break;
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
case Configuration.UI_MODE_NIGHT_UNDEFINED:
|
||||
// Night mode is not active, we're using light theme
|
||||
ThemesUtils.applyTheme(ThemesUtils.getLightTheme());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package ru.vtosters.lite.proxy;
|
||||
|
||||
import static java.lang.System.clearProperty;
|
||||
import static ru.vtosters.lite.proxy.api.VikaMobile.getApiHost;
|
||||
import static ru.vtosters.lite.proxy.api.VikaMobile.getOauthHost;
|
||||
import static ru.vtosters.lite.proxy.api.VikaMobile.getStaticHost;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
|
||||
@@ -23,13 +26,49 @@ public class ProxyUtils{
|
||||
public static String getApi(){
|
||||
var proxyapi = getPrefsValue("proxyapi");
|
||||
|
||||
if (isApiProxyEnabled() & !proxyapi.isEmpty()) {
|
||||
if (isVikaProxyEnabled()) {
|
||||
proxyapi = getApiHost();
|
||||
}
|
||||
|
||||
if (isAnyProxyEnabled() & !proxyapi.isEmpty()) {
|
||||
return proxyapi;
|
||||
}
|
||||
|
||||
return "api.vk.com";
|
||||
}
|
||||
|
||||
public static String getOauth(){
|
||||
var oauth = getPrefsValue("proxyoauth");
|
||||
|
||||
if (isVikaProxyEnabled()) {
|
||||
oauth = getOauthHost();
|
||||
}
|
||||
|
||||
if (isAnyProxyEnabled() & !oauth.isEmpty()) {
|
||||
return oauth;
|
||||
}
|
||||
|
||||
return "oauth.vk.com";
|
||||
}
|
||||
|
||||
public static String getStatic(){
|
||||
var staticapi = getPrefsValue("proxystatic");
|
||||
|
||||
if (isVikaProxyEnabled()) {
|
||||
staticapi = getStaticHost();
|
||||
}
|
||||
|
||||
if (isAnyProxyEnabled() & !staticapi.isEmpty()) {
|
||||
return staticapi;
|
||||
}
|
||||
|
||||
return "static.vk.com";
|
||||
}
|
||||
|
||||
public static Boolean isAnyProxyEnabled(){
|
||||
return isApiProxyEnabled() || isVikaProxyEnabled();
|
||||
}
|
||||
|
||||
public static Boolean isZaboronaEnabled(){
|
||||
return getPrefsValue("proxy").equals("zaborona");
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package ru.vtosters.lite.proxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.resetProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.preferences;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package ru.vtosters.lite.proxy.api;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isApiProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isVikaProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ApiProxy{
|
||||
proxystatic = VikaMobile.getStaticHost();
|
||||
}
|
||||
|
||||
if (!isApiProxyEnabled() || link.isEmpty()) {
|
||||
if (!isAnyProxyEnabled() || link.isEmpty()) {
|
||||
return link;
|
||||
}
|
||||
|
||||
@@ -31,24 +31,42 @@ public class ApiProxy{
|
||||
}
|
||||
|
||||
if (link.contains(vkapi)) {
|
||||
return link.replace(proxyapi, vkapi);
|
||||
return link.replaceAll(vkapi, proxyapi);
|
||||
}
|
||||
|
||||
if (link.contains(oauth)) {
|
||||
return link.replace(proxyoauth, oauth);
|
||||
return link.replaceAll(oauth, proxyoauth);
|
||||
}
|
||||
|
||||
if (link.contains(vkstatic)) {
|
||||
return link.replace(proxystatic, vkstatic);
|
||||
return link.replaceAll(vkstatic, proxystatic);
|
||||
}
|
||||
|
||||
return link;
|
||||
}
|
||||
|
||||
public static String staticFix(String str) {
|
||||
var string = getPrefsValue("proxystatic");
|
||||
|
||||
if (isVikaProxyEnabled()) {
|
||||
string = VikaMobile.getStaticHost();
|
||||
}
|
||||
|
||||
if (isAnyProxyEnabled() && !string.isEmpty()) {
|
||||
return str.replaceAll(string, "static.vk.com");
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
public static String getAwayPhpCom(){
|
||||
var proxyapi = getPrefsValue("proxyapi");
|
||||
|
||||
if (isApiProxyEnabled() & !proxyapi.isEmpty()) {
|
||||
if (isVikaProxyEnabled()) {
|
||||
proxyapi = VikaMobile.getApiHost();
|
||||
}
|
||||
|
||||
if (isAnyProxyEnabled() && !proxyapi.isEmpty()) {
|
||||
return proxyapi;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class Jetkai{
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast("Прокси установлен, хост: " + proxy);
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class TheSpeedX{
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast("Прокси установлен, хост: " + proxy);
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class Jetkai{
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast("Прокси установлен, хост: " + proxy);
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class Roosterkid{
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast("Прокси установлен, хост: " + proxy);
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class Hookzof{
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast("Прокси установлен, хост: " + proxy);
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class Jetkai{
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast("Прокси установлен, хост: " + proxy);
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class Roosterkid{
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast("Прокси установлен, хост: " + proxy);
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class TheSpeedX{
|
||||
Log.d(TAG, "Setting proxy: " + proxy.split(":")[0] + ":" + proxy.split(":")[1]);
|
||||
|
||||
if (RandomProxy.showProxyResult) {
|
||||
AndroidUtils.sendToast("Прокси установлен, хост: " + proxy);
|
||||
AndroidUtils.sendToast(getString("proxy_setup_success") + " " + proxy);
|
||||
RandomProxy.showProxyResult = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.ui.activities;
|
||||
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getOauth;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@@ -20,7 +22,7 @@ import ru.vtosters.lite.utils.LayoutUtils;
|
||||
|
||||
public class VKAdminTokenActivity extends AppCompatActivity {
|
||||
|
||||
private static final String URL = "https://oauth.vk.com/authorize?client_id=6121396&scope=1073737727&redirect_uri=https://oauth.vk.com/blank.html&display=page&response_type=token&revoke=1";
|
||||
private static final String URL = "https://" + getOauth() +"/authorize?client_id=6121396&scope=1073737727&redirect_uri=https://oauth.vk.com/blank.html&display=page&response_type=token&revoke=1";
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle bundle) {
|
||||
@@ -37,7 +39,7 @@ public class VKAdminTokenActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||
var url = request.getUrl().toString();
|
||||
if (url.startsWith("https://oauth.vk.com/auth_redirect?")) {
|
||||
if (url.startsWith("https://" + getOauth() + "/auth_redirect?")) {
|
||||
var redirectUri = Uri.parse(URLDecoder.decode(url));
|
||||
var authorizeUrl = redirectUri.getQueryParameter("authorize_url");
|
||||
var accessToken = authorizeUrl.substring(authorizeUrl.indexOf("=") + 1, authorizeUrl.indexOf("&"));
|
||||
|
||||
@@ -24,11 +24,13 @@ import com.aefyr.tsg.g2.TelegramStickersPack;
|
||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
|
||||
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> {
|
||||
public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.StickerPackViewHolder> implements IItemMovingListener {
|
||||
private static final TelegramStickersService sService = TelegramStickersService.getInstance(getGlobalContext());
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
@@ -62,6 +64,26 @@ public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.
|
||||
return sService.getPacksListReference().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDismiss(int index) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemMove(int fromPosition, int toPosition) {
|
||||
if (fromPosition < toPosition) {
|
||||
for (int i = fromPosition; i < toPosition; i++) {
|
||||
sService.swap(sService.getPacksListReference().get(i), sService.getPacksListReference().get(i + 1));
|
||||
}
|
||||
} else {
|
||||
for (int i = fromPosition; i > toPosition; i--) {
|
||||
sService.swap(sService.getPacksListReference().get(i), sService.getPacksListReference().get(i - 1));
|
||||
}
|
||||
}
|
||||
notifyItemMoved(fromPosition, toPosition);
|
||||
return true;
|
||||
}
|
||||
|
||||
public class StickerPackViewHolder extends RecyclerView.ViewHolder {
|
||||
private final LinearLayout mContainer;
|
||||
private final ImageView mStickerPreview;
|
||||
|
||||
@@ -6,21 +6,19 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.superapp;
|
||||
import static ru.vtosters.lite.utils.Preferences.useNewSettings;
|
||||
import static ru.vtosters.lite.utils.Preferences.videonewcatalog;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme_notifs;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import com.vk.apps.AppsFragment;
|
||||
import com.vk.discover.ThemedFeedFragment;
|
||||
import com.vk.discover.DiscoverFragment;
|
||||
import com.vk.fave.fragments.FaveTabFragment;
|
||||
import com.vk.feedlikes.d.FeedLikesFragment;
|
||||
import com.vk.friends.catalog.FriendsCatalogFragment;
|
||||
import com.vk.menu.MenuFragment;
|
||||
import com.vk.menu.SearchMenuFragment;
|
||||
import com.vk.music.fragment.MusicCatalogFragment1;
|
||||
import com.vk.music.fragment.MusicFragment;
|
||||
import com.vk.newsfeed.HomeFragment;
|
||||
import com.vk.newsfeed.NewsfeedFragment;
|
||||
import com.vk.notifications.NotificationsContainerFragment;
|
||||
@@ -97,7 +95,7 @@ public class DockBarEditorManager {
|
||||
private void parseSelectedTabs(String[] selectedTabsTags) {
|
||||
List<String> allTags = new ArrayList<>(Arrays.asList("tab_news", "tab_superapps", "tab_messages", "tab_feedback", "tab_profile",
|
||||
"tab_friends", "tab_groups", "tab_photos", "tab_audios", "tab_videos", "tab_lives", "tab_games", "tab_liked",
|
||||
"tab_fave", "tab_documents", "tab_payments", "tab_vk_apps", "tab_settings", "tab_menu"));
|
||||
"tab_fave", "tab_documents", "tab_payments", "tab_vk_apps", "tab_settings"));
|
||||
|
||||
for (String tag : selectedTabsTags) {
|
||||
mSelectedTabs.add(getTabByTag(tag));
|
||||
@@ -154,7 +152,7 @@ public class DockBarEditorManager {
|
||||
milkshake() ? R.drawable.ic_services_outline_28 : R.drawable.ic_menu_search_outline_28,
|
||||
milkshake() ? R.string.super_app_title : R.string.search,
|
||||
R.id.tab_discover,
|
||||
milkshake() ? (superapp() ? SuperAppFragment.class : SearchMenuFragment.class) : ThemedFeedFragment.class);
|
||||
milkshake() ? (superapp() ? SuperAppFragment.class : SearchMenuFragment.class) : DiscoverFragment.class);
|
||||
case "tab_messages":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_messages",
|
||||
@@ -203,14 +201,14 @@ public class DockBarEditorManager {
|
||||
R.drawable.ic_music_outline_28,
|
||||
R.string.music,
|
||||
R.id.menu_audios,
|
||||
getBoolValue("musicnewcatalog", true) ? MusicCatalogFragment1.class : MusicFragment.class);
|
||||
MusicCatalogFragment1.class);
|
||||
case "tab_videos":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_videos",
|
||||
R.drawable.ic_video_outline_28,
|
||||
R.string.videos,
|
||||
R.id.menu_videos,
|
||||
videonewcatalog() ? VideoCatalogFragment.class : VideosFragment.class);
|
||||
VideoCatalogFragment.class);
|
||||
case "tab_lives":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_lives",
|
||||
@@ -260,13 +258,6 @@ public class DockBarEditorManager {
|
||||
R.string.menu_apps,
|
||||
R.id.menu_vk_apps,
|
||||
AppsFragment.class);
|
||||
case "tab_menu":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_menu",
|
||||
milkshake() ? R.drawable.ic_user_circle_outline_28 : R.drawable.ic_menu_more_outline_28,
|
||||
milkshake() ? R.string.profile : R.string.menu,
|
||||
R.id.tab_menu,
|
||||
milkshake() ? ProfileFragment.class : MenuFragment.class);
|
||||
case "tab_settings":
|
||||
default:
|
||||
return DockBarTab.valuesOf(
|
||||
|
||||
@@ -22,7 +22,7 @@ public class NewsfeedListManager {
|
||||
var list = new ArrayList<VBListItem>();
|
||||
|
||||
if (filtersSet.size() == 0) {
|
||||
sendToast(AndroidUtils.getString("newsfeed_update_feed"));
|
||||
sendToast(AndroidUtils.getString("newsfeed_list_update_feed"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,8 +55,7 @@ public class NewsfeedListManager {
|
||||
}
|
||||
|
||||
public static void resetHideItems() {
|
||||
getDefaultPrefs().edit()
|
||||
.putString("news_feed_selected_items", "")
|
||||
getDefaultPrefs().edit().remove("news_feed_selected_items").remove("news_feed_items_set")
|
||||
.apply();
|
||||
sendToast(AndroidUtils.getString("newsfeed_list_hidden_reseted"));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package ru.vtosters.lite.ui.components;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class StickerTouchHelperCallback extends ItemTouchHelper.Callback {
|
||||
private final IItemMovingListener itemAdapter;
|
||||
|
||||
public StickerTouchHelperCallback(IItemMovingListener adapter) {
|
||||
itemAdapter = adapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLongPressDragEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemViewSwipeEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
|
||||
int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN |
|
||||
ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
|
||||
|
||||
int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
|
||||
return makeMovementFlags(dragFlags, swipeFlags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
|
||||
itemAdapter.onItemMove(viewHolder.getAdapterPosition(), target.getAdapterPosition());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import ru.vtosters.lite.ui.items.DockBarTab;
|
||||
import ru.vtosters.lite.ui.items.SuperAppItem;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public class InstallGMS {
|
||||
public static void alert(final Activity activity) {
|
||||
if (!isGmsInstalled()) {
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("debug_warning"));
|
||||
builder.setTitle(getString("warning"));
|
||||
builder.setMessage(getString("gmsissuesumm"));
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(getString("gmsissuebtn1"), (dialogInterface, i) -> edit().putBoolean("showAlertGms", false).apply());
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.content.Context;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
@@ -40,28 +40,28 @@ public class ServerDialog {
|
||||
public static void sendRequest() {
|
||||
if (getBoolValue("dialogrecomm", false)) return;
|
||||
|
||||
if (isNetworkIsSlow()) return;
|
||||
if (!isNetworkIsSlow() && !getBoolValue("isRoamingState", false)) {
|
||||
Request request = new Request.a()
|
||||
.b("https://vtosters.app/dialog.json")
|
||||
.a();
|
||||
|
||||
Request request = new Request.a()
|
||||
.b("https://vtosters.app/dialog.json")
|
||||
.a();
|
||||
|
||||
client.a(request).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d(TAG, "" + e);
|
||||
showAlert = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response) {
|
||||
try {
|
||||
getResponse(response.a().g());
|
||||
} catch (Exception e) {
|
||||
client.a(request).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d(TAG, "" + e);
|
||||
showAlert = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response) {
|
||||
try {
|
||||
getResponse(response.a().g());
|
||||
} catch (Exception e) {
|
||||
showAlert = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static Boolean showForNotVerified() {
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Start {
|
||||
activity.requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 228);
|
||||
}
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("debug_warning"));
|
||||
builder.setTitle(getString("warning"));
|
||||
builder.setMessage(getWelcome());
|
||||
builder.setCancelable(false);
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
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;
|
||||
@@ -15,7 +17,7 @@ import ru.vtosters.lite.ui.fragments.VKUIwrapper;
|
||||
public class VKIDProtection {
|
||||
public static void alert(final Activity activity) {
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("debug_warning"));
|
||||
builder.setTitle(getString("warning"));
|
||||
builder.setMessage(getString("vkidsumm"));
|
||||
builder.setCancelable(false);
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
@@ -23,7 +25,7 @@ public class VKIDProtection {
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
builder.setNeutralButton(getString("vkiddisable"), (dialogInterface, i) -> {
|
||||
edit().putBoolean("showAlertVkId", false).apply();
|
||||
VKUIwrapper.setLink("https://id.vk.com/account");
|
||||
VKUIwrapper.setLink((isAnyProxyEnabled() ? "https://id.vk.com/account" : "https://" + getApi() + "/_/id.vk.com/account"));
|
||||
Intent a2 = new Navigator(VKUIwrapper.class).b(activity);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(a2);
|
||||
|
||||
@@ -22,8 +22,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.ui.adapters.CategorizedAdapter;
|
||||
import ru.vtosters.lite.ui.components.DockBarEditorManager;
|
||||
import ru.vtosters.lite.ui.components.ItemMovingCallback;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
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;
|
||||
import static ru.vtosters.lite.utils.Preferences.copyright_post;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -12,6 +15,7 @@ import android.text.TextUtils;
|
||||
|
||||
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.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
@@ -19,21 +23,50 @@ 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 {
|
||||
public class FeedFragment extends MaterialPreferenceToolbarFragment{
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
public void onCreate(Bundle bundle){
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_feed", "xml"));
|
||||
prefs();
|
||||
}
|
||||
|
||||
private void prefs() {
|
||||
private void prefs(){
|
||||
findPreference("officialnewssett").setOnPreferenceClickListener(new openofficialsett());
|
||||
findPreference("cringecopyright").setEnabled(!copyright_post());
|
||||
|
||||
findPreference("spamfilters").setSummary(count(getPrefsValue("spamfilters")));
|
||||
findPreference("sourcenamefilter").setSummary(count(getPrefsValue("sourcenamefilter")));
|
||||
findPreference("linkfilter").setSummary(count(getPrefsValue("linkfilter")));
|
||||
|
||||
findPreference("spamfilters").setOnPreferenceClickListener(preference -> {
|
||||
setupFilters();
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("sourcenamefilter").setOnPreferenceClickListener(preference -> {
|
||||
setupFilters();
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("linkfilter").setOnPreferenceClickListener(preference -> {
|
||||
setupFilters();
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("whitelisted_ad_groups").setSummary(countSet("whitelisted_ad_groups"));
|
||||
findPreference("whitelisted_filters_groups").setSummary(countSet("whitelisted_filters_groups"));
|
||||
|
||||
findPreference("whitelisted_ad_groups").setOnPreferenceClickListener(preference -> {
|
||||
remdialog("whitelisted_ad_groups", getContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("whitelisted_filters_groups").setOnPreferenceClickListener(preference -> {
|
||||
remdialog("whitelisted_filters_groups", getContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("newsfeedlistmanager").setOnPreferenceClickListener(preference -> {
|
||||
NewsfeedListManager.callEditorPopup(getActivity());
|
||||
return true;
|
||||
@@ -48,7 +81,7 @@ public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
}
|
||||
|
||||
private String count(String text) {
|
||||
private String count(String text){
|
||||
// count comma separated words in string
|
||||
var count = text.split(", ").length;
|
||||
|
||||
@@ -59,16 +92,50 @@ public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private void remdialog(String key, Context context){
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context);
|
||||
builder.setTitle(AndroidUtils.getString("warning"));
|
||||
builder.setMessage(AndroidUtils.getString("delete_elements_confirm"));
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(AndroidUtils.getString("yes"), (dialogInterface, i) -> {
|
||||
edit().remove(key).apply();
|
||||
sendToast(AndroidUtils.getString("elements_deleted_success"));
|
||||
setupFilters();
|
||||
});
|
||||
builder.setNegativeButton(AndroidUtils.getString("cancel"), (dialogInterface, i) -> dialogInterface.dismiss());
|
||||
builder.show();
|
||||
}
|
||||
|
||||
private String countSet(String key){
|
||||
var set = getDefaultPrefs().getStringSet(key, null);
|
||||
StringBuilder str = new StringBuilder();
|
||||
if (set != null) {
|
||||
for (var s : set) {
|
||||
str.append(s).append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
var count = str.toString().split(", ").length;
|
||||
|
||||
if (count < 1 || (str.length() == 0)) {
|
||||
return AndroidUtils.getString("feed_no_elements");
|
||||
} else {
|
||||
return String.format(AndroidUtils.getString("feed_elements_count"), count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(Preference preference) {
|
||||
public boolean onPreferenceTreeClick(Preference preference){
|
||||
findPreference("cringecopyright").setEnabled(!copyright_post());
|
||||
setupFilters();
|
||||
return super.onPreferenceTreeClick(preference);
|
||||
}
|
||||
|
||||
public class openofficialsett implements Preference.OnPreferenceClickListener {
|
||||
public class openofficialsett implements Preference.OnPreferenceClickListener{
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Context context = getContext();
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(NewsfeedSettingsFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
|
||||
@@ -2,9 +2,12 @@ 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;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
@@ -26,11 +29,20 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
|
||||
findPreference("swipe").setOnPreferenceClickListener(new restart());
|
||||
findPreference("is_likes_on_right").setOnPreferenceClickListener(new restart());
|
||||
|
||||
if (isTablet()){
|
||||
findPreference("menusett").setVisible(false);
|
||||
findPreference("swipe").setVisible(false);
|
||||
}
|
||||
|
||||
findPreference("customrounding").setOnPreferenceClickListener(preference -> {
|
||||
RoundingSeekbarDialog.dialog(getContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 33){
|
||||
findPreference("anim_rtrn_type").setVisible(false);
|
||||
}
|
||||
|
||||
if (getPreferences().getInt("pic_rounding", 0) == 0) {
|
||||
findPreference("customrounding").setSummary(AndroidUtils.getString("disabled"));
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.isVkxInstalled;
|
||||
import static ru.vtosters.lite.music.Scrobbler.isLoggedIn;
|
||||
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;
|
||||
@@ -8,12 +10,12 @@ 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;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
@@ -33,6 +35,8 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -43,8 +47,7 @@ import ru.vtosters.lite.downloaders.VideoDownloader;
|
||||
import ru.vtosters.lite.music.Scrobbler;
|
||||
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.FileUriUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
private final int REQUEST_CODE_SET_DOWNLOAD_DIRECTORY = 665;
|
||||
@@ -62,31 +65,6 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
var path = data.getData();
|
||||
if (path != null) {
|
||||
var prefs = getPreferences();
|
||||
var editor = prefs.edit();
|
||||
var actualPath = FileUriUtils.getFullPathFromTreeUri(path, getContext());
|
||||
switch (requestCode) {
|
||||
case REQUEST_CODE_SET_DOWNLOAD_DIRECTORY:
|
||||
editor.putString("downloads_directory", actualPath);
|
||||
break;
|
||||
case REQUEST_CODE_SET_MUSIC_DIRECTORY:
|
||||
editor.putString("music_directory", actualPath);
|
||||
break;
|
||||
case REQUEST_CODE_SET_PHOTOS_DIRECTORY:
|
||||
editor.putString("photos_directory", actualPath);
|
||||
break;
|
||||
case REQUEST_CODE_SET_VIDEOS_DIRECTORY:
|
||||
editor.putString("videos_directory", actualPath);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
editor.apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +76,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
private void prefs() {
|
||||
findPreference("download_video").setOnPreferenceClickListener(new MediaFragment.download());
|
||||
findPreference("clearvideohistory").setOnPreferenceClickListener(preference -> {
|
||||
deleteVideoHistory();
|
||||
deleteVideoHistoryDialog(requireContext());
|
||||
return true;
|
||||
});
|
||||
findPreference("dateformat").setOnPreferenceChangeListener(new MediaFragment.restart());
|
||||
@@ -111,56 +89,16 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("downloads_directory").setSummary(
|
||||
AndroidUtils.getString("current_download_folder") + " " + Preferences.getDownloadsDir()
|
||||
);
|
||||
|
||||
findPreference("photos_directory").setSummary(
|
||||
AndroidUtils.getString("current_download_folder") + " " + Preferences.getPhotosDir()
|
||||
);
|
||||
|
||||
findPreference("videos_directory").setSummary(
|
||||
AndroidUtils.getString("current_download_folder") + " " + Preferences.getVideosDir()
|
||||
);
|
||||
|
||||
findPreference("music_directory").setSummary(
|
||||
AndroidUtils.getString("current_download_folder") + " " + Preferences.getMusicDir()
|
||||
);
|
||||
|
||||
findPreference("downloads_directory").setOnPreferenceClickListener(preference -> {
|
||||
var intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
startActivityForResult(intent, REQUEST_CODE_SET_DOWNLOAD_DIRECTORY);
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("photos_directory").setOnPreferenceClickListener(preference -> {
|
||||
var intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
startActivityForResult(intent, REQUEST_CODE_SET_PHOTOS_DIRECTORY);
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("videos_directory").setOnPreferenceClickListener(preference -> {
|
||||
var intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
startActivityForResult(intent, REQUEST_CODE_SET_VIDEOS_DIRECTORY);
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("music_directory").setOnPreferenceClickListener(preference -> {
|
||||
var intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
startActivityForResult(intent, REQUEST_CODE_SET_MUSIC_DIRECTORY);
|
||||
return true;
|
||||
});
|
||||
|
||||
if (isLoggedIn()) {
|
||||
findPreference("lastfm_auth").setSummary(AndroidUtils.getString("lastfm_authorized_as") + " " + Scrobbler.getUserName());
|
||||
} else {
|
||||
findPreference("lastfm_enabled").setEnabled(false);
|
||||
}
|
||||
|
||||
if (!isVkxInstalled()){
|
||||
findPreference("vkx_sett").setVisible(false);
|
||||
}
|
||||
|
||||
findPreference("select_photo_search_engine").setOnPreferenceClickListener(preference -> {
|
||||
var items = Arrays.asList(
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("yandex", "drawable"), "Yandex"),
|
||||
@@ -244,13 +182,20 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
Thread thread = new Thread(() -> {
|
||||
try {
|
||||
var request = new Request.a()
|
||||
.b("https://api.vk.com/method/" + "video.clearViewingHistoryRecords" + "?https=1" + "&access_token=" + getUserToken() + "&v=5.187")
|
||||
.b("https://" + getApi() + "/method/" + "video.clearViewingHistoryRecords" + "?https=1" + "&access_token=" + getUserToken() + "&v=5.119")
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"))
|
||||
.a();
|
||||
|
||||
try {
|
||||
var response = new OkHttpClient().a(request).execute().a().g();
|
||||
Log.d("VideoHistory", response);
|
||||
var response = new JSONObject(new OkHttpClient().a(request).execute().a().g());
|
||||
|
||||
if (response.optInt("response") == 1){
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> sendToast(AndroidUtils.getString("video_history_cleaned")));
|
||||
} else {
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> sendToast("Ошибка при очистке истории. Подробности в логах"));
|
||||
}
|
||||
|
||||
Log.d("VideoHistory", response.toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -260,8 +205,18 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
thread.start();
|
||||
}
|
||||
|
||||
sendToast(AndroidUtils.getString("video_history_cleaned"));
|
||||
private void deleteVideoHistoryDialog(Context context){
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context);
|
||||
builder.setTitle(AndroidUtils.getString("warning"));
|
||||
builder.setMessage("Вы действительно хотите очистить историю видео?");
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(AndroidUtils.getString("yes"), (dialogInterface, i) -> {
|
||||
deleteVideoHistory();
|
||||
});
|
||||
builder.setNegativeButton(AndroidUtils.getString("cancel"), (dialogInterface, i) -> dialogInterface.dismiss());
|
||||
builder.show();
|
||||
}
|
||||
|
||||
public static void download(Context ctx) {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.*;
|
||||
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;
|
||||
import static ru.vtosters.lite.utils.Preferences.autoalltranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.*;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.recolorDrawable;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -22,12 +23,9 @@ import com.vk.navigation.Navigator;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
||||
import ru.vtosters.lite.ui.wallpapers.WallpaperMenuFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
@@ -72,6 +70,11 @@ 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"));
|
||||
|
||||
if (isTablet()){
|
||||
findPreference("alteremoji").setVisible(false);
|
||||
findPreference("vkmesett").setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,10 +106,11 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
public class openwp implements Preference.OnPreferenceClickListener {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(WallpaperMenuFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
// sendToast("Обои временно недоступны. Следите за новостями на @vtosters в Telegram");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,9 @@ import static ru.vtosters.lite.ui.components.BackupManager.deletePrefs;
|
||||
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.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.deleteCache;
|
||||
import static ru.vtosters.lite.utils.ContactsUtils.setContactsSync;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
@@ -57,6 +56,7 @@ import b.h.g.m.FileUtils;
|
||||
import ru.vtosters.lite.ui.activities.VKAdminTokenActivity;
|
||||
import ru.vtosters.lite.ui.components.BackupManager;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ContactsUtils;
|
||||
|
||||
public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
private static final int VK_ADMIN_TOKEN_REQUEST_CODE = 1;
|
||||
@@ -96,9 +96,8 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("resetfolders").setOnPreferenceClickListener(preference -> {
|
||||
edit().remove("photos_directory").remove("videos_directory").remove("audios_directory").remove("downloads_directory").apply();
|
||||
Toast.makeText(getContext(), AndroidUtils.getString("download_folders_reseted"), LENGTH_SHORT).show();
|
||||
findPreference("contacts_sync").setOnPreferenceClickListener((preference) -> {
|
||||
ContactsUtils.getContactsStatus(requireContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -124,7 +123,11 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
break;
|
||||
}
|
||||
|
||||
findPreference("deleteprefs").setOnPreferenceClickListener(new deleteprefs());
|
||||
findPreference("deleteprefs").setOnPreferenceClickListener(preference -> {
|
||||
delprefs(getContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("saveonlines").setOnPreferenceClickListener(new onlines());
|
||||
|
||||
findPreference("saveprefs").setOnPreferenceClickListener(new saveprefs());
|
||||
@@ -303,13 +306,17 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
}
|
||||
|
||||
public static class deleteprefs implements Preference.OnPreferenceClickListener {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
private void delprefs(Context context) {
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context);
|
||||
builder.setTitle(AndroidUtils.getString("warning"));
|
||||
builder.setMessage("Вы действительно хотите сбросить настройки?");
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(AndroidUtils.getString("yes"), (dialogInterface, i) -> {
|
||||
deletePrefs();
|
||||
restartApplication();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(AndroidUtils.getString("cancel"), (dialogInterface, i) -> dialogInterface.dismiss());
|
||||
builder.show();
|
||||
}
|
||||
|
||||
class c implements Preference.OnPreferenceClickListener {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.proxy.RandomProxy.setupNewProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
@@ -11,7 +10,7 @@ import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ru.vtosters.lite.proxy.RandomProxy;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class ProxySettingsFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
@@ -22,7 +21,7 @@ public class ProxySettingsFragment extends MaterialPreferenceToolbarFragment {
|
||||
try {
|
||||
setupNewProxy();
|
||||
} catch (IOException e) {
|
||||
sendToast("Ошибка при получении прокси");
|
||||
sendToast(AndroidUtils.getString("get_proxy_error"));
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ 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.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -32,19 +33,19 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
|
||||
findPreference("darktheme").setOnPreferenceChangeListener(new restartdark());
|
||||
findPreference("lighttheme").setOnPreferenceChangeListener(new restartlight());
|
||||
findPreference("iconmanager").setOnPreferenceClickListener(new openicons());
|
||||
findPreference("dockbar_tab_titles").setOnPreferenceChangeListener((preference, o) -> {
|
||||
getPreferences().edit().putBoolean("dockbar_tab_titles", (boolean) o).commit();
|
||||
LifecycleUtils.restartApplication();
|
||||
return false;
|
||||
});
|
||||
findPreference("dockbar_tab_titles").setOnPreferenceClickListener(new restart());
|
||||
findPreference("dockbar_accent").setOnPreferenceClickListener(new restart());
|
||||
findPreference("dockcounter").setOnPreferenceClickListener(new restart());
|
||||
|
||||
if (isTablet()){
|
||||
findPreference("dockbarsett").setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public class openicons implements Preference.OnPreferenceClickListener {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(IconsFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
|
||||
@@ -12,10 +12,12 @@ 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;
|
||||
import static ru.vtosters.lite.utils.GmsUtils.isGmsInstalled;
|
||||
import static ru.vtosters.lite.utils.ImageUtils.getDrawableFromUrl;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
import static ru.vtosters.lite.utils.Preferences.autotranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.devmenu;
|
||||
import static ru.vtosters.lite.utils.Preferences.disableSettingsSumms;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasSpecialVerif;
|
||||
@@ -30,6 +32,7 @@ import static ru.vtosters.lite.utils.Preferences.superapp;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getDarkTheme;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getLightTheme;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.isDarkTheme;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.setTheme;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.vtverif;
|
||||
|
||||
@@ -43,6 +46,7 @@ import android.os.Bundle;
|
||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||
import com.vk.about.AboutAppFragment;
|
||||
import com.vk.balance.BalanceFragment;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vk.notifications.settings.NotificationsSettingsFragment;
|
||||
import com.vk.webapp.fragments.PrivacyFragment;
|
||||
@@ -55,13 +59,16 @@ import com.vtosters.lite.fragments.w2.BlacklistFragment;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
import com.vtosters.lite.general.fragments.SettingsAccountFragment;
|
||||
import com.vtosters.lite.general.fragments.SettingsGeneralFragment;
|
||||
import com.vtosters.lite.ui.MaterialSwitchPreference;
|
||||
|
||||
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
|
||||
import ru.vtosters.lite.ui.components.DockBarEditorManager;
|
||||
import ru.vtosters.lite.ui.components.SuperAppEditorManager;
|
||||
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
||||
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.CacheUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.SSFSUtils;
|
||||
|
||||
public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
@@ -123,13 +130,18 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return AndroidUtils.getString("autoclearcachesumm") + " " + humanReadableByteCountBin(CacheUtils.getInstance().size);
|
||||
}
|
||||
|
||||
private void switchTheme(boolean isDarkTheme) {
|
||||
setTheme(isDarkTheme ? getDarkTheme() : getLightTheme(), requireActivity());
|
||||
edit().putBoolean("isdark", isDarkTheme).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
|
||||
var feedsumm = getValAsString("vtlfeedsumm", ads());
|
||||
var docksumm = getDocksumm();
|
||||
var msgsumm = getValAsString("vtlmsgsumm", vkme());
|
||||
var msgsumm = isTablet() ? getValAsString("autotranslate_title", autotranslate()) : getValAsString("vtlmsgsumm", vkme());
|
||||
var activitysumm = getValAsString("vtlactivitysumm", offline());
|
||||
var themessumm = getValAsString("vtlthemessumm", navbar());
|
||||
var tgssumm = getTGSsumm();
|
||||
@@ -147,44 +159,60 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
addPreferenceDrawable(this, "", getUsername(), hasVerification() ? AndroidUtils.getString("thanksfordonate") : AndroidUtils.getString("getdonate"), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28", true, true), preference -> {
|
||||
try {
|
||||
VKAuth.a("logout", false);
|
||||
} catch (Exception ignored) { }
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
var intent = new Intent(getContext(), MainActivity.class);
|
||||
var intent = new Intent(requireContext(), MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
getContext().startActivity(intent);
|
||||
requireContext().startActivity(intent);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreferenceCategory(this, AndroidUtils.getString("vtsettdarktheme"));
|
||||
|
||||
addMaterialSwitchPreference(this, "isdark", AndroidUtils.getString("vtsettdarktheme"), "", "ic_palette_outline_28", false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
addMaterialSwitchPreference(this, "", AndroidUtils.getString("vtsettdarktheme"), "", "ic_palette_outline_28", isDarkTheme(), (preference, o) -> {
|
||||
final var switchPreference = (MaterialSwitchPreference) preference;
|
||||
final var isDarkTheme = !switchPreference.isChecked();
|
||||
|
||||
if (!value) { // inverted
|
||||
setTheme(getLightTheme(), this.getActivity());
|
||||
} else {
|
||||
setTheme(getDarkTheme(), this.getActivity());
|
||||
if (Preferences.systemtheme()) {
|
||||
new VkAlertDialog.Builder(requireActivity())
|
||||
.setTitle("Внимание!")
|
||||
.setMessage("У вас включена системная тема \n" +
|
||||
"При переключении темы системная тема будет отключена \n\n" +
|
||||
"Вы действительно хотите отключить её?")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Отключить", (dialogInterface, i) -> {
|
||||
switchPreference.setChecked(isDarkTheme);
|
||||
((MaterialSwitchPreference) findPreference("systemtheme")).setChecked(false);
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
switchTheme(isDarkTheme);
|
||||
});
|
||||
})
|
||||
.setNeutralButton("Отмена", null)
|
||||
.show();
|
||||
return false;
|
||||
}
|
||||
|
||||
edit().putBoolean("isdark", value).commit();
|
||||
switchTheme(isDarkTheme);
|
||||
return true;
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 28 && false) { // TODO refactoring system theme
|
||||
addMaterialSwitchPreference(this, "systemtheme", AndroidUtils.getString("appearance_theme_use_system"), AndroidUtils.getString("appearance_theme_use_system_summary"), "ic_recent_outline_28", true, (preference, o) -> {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
addMaterialSwitchPreference(this, "systemtheme", AndroidUtils.getString("appearance_theme_use_system"), "", "ic_recent_outline_28", true, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
|
||||
edit().putBoolean("systemtheme", value).commit();
|
||||
|
||||
SystemThemeChangerHook.onThemeChanged(getResources().getConfiguration());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
if (!isGmsInstalled()) {
|
||||
addPreference(this, "", AndroidUtils.getString("installgms"), "", "ic_warning_24", preference -> {
|
||||
Context context = getContext();
|
||||
addPreference(this, "", AndroidUtils.getString("installgms"), "", "ic_about_outline_28", preference -> {
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(InstallGMSFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -196,7 +224,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
addPreferenceCategory(this, AndroidUtils.getString("sett_debug"));
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("sett_debug"), "", "ic_bug_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(SettingsDebugFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -213,7 +241,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
addPreferenceCategory(this, AndroidUtils.getString("vtsettaccount"));
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vkconnect"), "", "ic_user_circle_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
VKUIwrapper.officalLinks("account");
|
||||
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -222,7 +250,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("privacy_settings"), "", "ic_privacy_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(PrivacyFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -230,7 +258,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("sett_account"), "", "ic_user_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(SettingsAccountFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -239,7 +267,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
if (isVKTester()) {
|
||||
addPreference(this, "", AndroidUtils.getString("bugs"), "", "ic_bug_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
VKUIwrapper.officalLinks("bugs");
|
||||
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -249,7 +277,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtssfs"), ssfs, "ic_link_circle_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
VKUIwrapper.setLink(SSFSUtils.getSSFSLink());
|
||||
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@@ -260,7 +288,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
addPreferenceCategory(this, AndroidUtils.getString("notification_settings"));
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("sett_general"), "", "ic_settings_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(SettingsGeneralFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -268,7 +296,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("blacklist"), "", "ic_users_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(BlacklistFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -276,7 +304,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("sett_notifications"), "", "ic_menu_notification_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(NotificationsSettingsFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -285,7 +313,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
if (VKAccountManager.d().isMusicSubs()) {
|
||||
addPreference(this, "", AndroidUtils.getString("subscription_music"), "", "ic_music_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(MusicSubscriptionControlFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -294,7 +322,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("votes"), "", "ic_coins_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(BalanceFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -305,36 +333,38 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
if (!vkme()) {
|
||||
addPreference(this, "", AndroidUtils.getString("vtlfeed"), feedsumm, "ic_newsfeed_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(FeedFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("dockbar_editor"), docksumm, "ic_list_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Intent intent = new Navigator(DockBarEditorFragment.class).b(context);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
return false;
|
||||
});
|
||||
|
||||
if (milkshake() && superapp()) {
|
||||
addPreference(this, "", AndroidUtils.getString("superapp_editor"), superapp, "ic_services_outline_28", (preference) -> {
|
||||
Context context = getContext();
|
||||
Intent intent = new Navigator(SuperAppEditorFragment.class).b(context);
|
||||
if (!isTablet()) {
|
||||
addPreference(this, "", AndroidUtils.getString("dockbar_editor"), docksumm, "ic_list_outline_28", preference -> {
|
||||
Context context = requireContext();
|
||||
Intent intent = new Navigator(DockBarEditorFragment.class).b(context);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (milkshake() && superapp()) {
|
||||
addPreference(this, "", AndroidUtils.getString("superapp_editor"), superapp, "ic_services_outline_28", (preference) -> {
|
||||
Context context = requireContext();
|
||||
Intent intent = new Navigator(SuperAppEditorFragment.class).b(context);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addPreference(this, "", AndroidUtils.getString("debug_warning"), AndroidUtils.getString("vkme_mode_info"), "ic_about_outline_28", preference -> false);
|
||||
addPreference(this, "", AndroidUtils.getString("warning"), AndroidUtils.getString("vkme_mode_info"), "ic_about_outline_28", preference -> false);
|
||||
}
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlmedia"), mediasumm, "ic_media_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(MediaFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -342,7 +372,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlmessages"), msgsumm, "ic_message_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(MessagesFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -350,7 +380,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlactivity"), activitysumm, "ic_write_outline_28_new_accent", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(ActivityFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -358,7 +388,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlthemes"), themessumm, "ic_write_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(ThemesFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -366,7 +396,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtltgs"), tgssumm, "ic_telegram_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(StickersFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -374,7 +404,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlinterface"), interfacesumm, "ic_interface_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(InterfaceFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -382,7 +412,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlproxy"), proxysumm, "ic_globe_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(ProxySettingsFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -390,7 +420,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("vtlother"), othersumm, "ic_more_horizontal_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(OtherFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -400,7 +430,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
addPreferenceCategory(this, AndroidUtils.getString("vtsettaboutmod"));
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("menu_about"), about, "ic_about_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
Context context = requireContext();
|
||||
Intent a2 = new Navigator(AboutAppFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
@@ -408,17 +438,17 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("opencommit"), "", "ic_link_outline_28", preference -> {
|
||||
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse(getCommitLink())));
|
||||
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 -> {
|
||||
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/s/vtosters_faq")));
|
||||
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 -> {
|
||||
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://github.com/vtosters/lite/issues")));
|
||||
requireContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://github.com/vtosters/lite/issues")));
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -429,14 +459,6 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
OTADialog.checkUpdates(getActivity());
|
||||
return false;
|
||||
});
|
||||
|
||||
addMaterialSwitchPreference(this, "checkupdates", AndroidUtils.getString("checkupdates"), "", "ic_recent_outline_28", true, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
|
||||
edit().putBoolean("checkupdates", value).commit();
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
@@ -40,10 +41,10 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
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;
|
||||
|
||||
@@ -121,6 +122,11 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
|
||||
mAdapter = new StickerPackAdapter();
|
||||
RecyclerView mRecycler = new RecyclerView(getContext());
|
||||
|
||||
var callback = new StickerTouchHelperCallback(mAdapter);
|
||||
var touchHelper = new ItemTouchHelper(callback);
|
||||
touchHelper.attachToRecyclerView(mRecycler);
|
||||
|
||||
mRecycler.setAdapter(mAdapter);
|
||||
mRecycler.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
|
||||
layout.addView(mRecycler, new ViewGroup.LayoutParams(-1, -1));
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package ru.vtosters.lite.ui.vkui;
|
||||
|
||||
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;
|
||||
@@ -24,7 +27,7 @@ import java.util.Objects;
|
||||
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.b.Functions;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.hooks.NewsfeedHook;
|
||||
import ru.vtosters.lite.utils.RenameTool;
|
||||
|
||||
public class MenuBuilder {
|
||||
@@ -55,18 +58,17 @@ public class MenuBuilder {
|
||||
try {
|
||||
final ExtendedUserProfile eup = (ExtendedUserProfile) pfambObject.get(mb);
|
||||
final Context ctx = ((View) Objects.requireNonNull(apView.get(builder))).getContext();
|
||||
|
||||
addItem(builder, AndroidUtils.getString("menu_copy_id"), () -> {
|
||||
addItem(builder, getString("menu_copy_id"), () -> {
|
||||
copy(ctx, String.valueOf(getUserID(eup)));
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
addItem(builder, AndroidUtils.getString("menu_addon_info"), () -> {
|
||||
addItem(builder, getString("menu_addon_info"), () -> {
|
||||
loadAndShow(ctx, getUserID(eup));
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
addItem(builder, AndroidUtils.getString("menu_change_name"), () -> {
|
||||
addItem(builder, getString("menu_change_name"), () -> {
|
||||
RenameTool.createDialog(eup, ctx);
|
||||
return Unit.a;
|
||||
});
|
||||
@@ -80,17 +82,31 @@ public class MenuBuilder {
|
||||
try {
|
||||
final ExtendedCommunityProfile ecp = (ExtendedCommunityProfile) cfambObject.get(mb);
|
||||
final Context ctx = ((View) apView.get(builder)).getContext();
|
||||
final boolean isPageWhitelistedFilter = NewsfeedHook.isWhitelistedFilter(ecp);
|
||||
final boolean isPageWhitelistedAds = NewsfeedHook.isWhitelistedAd(ecp);
|
||||
|
||||
addItem(builder, AndroidUtils.getString("menu_copy_id"), () -> {
|
||||
addItem(builder, getString("menu_copy_id"), () -> {
|
||||
copy(ctx, String.valueOf(getUserID(ecp)));
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
addItem(builder, AndroidUtils.getString("menu_change_name"), () -> {
|
||||
addItem(builder, getString("menu_change_name"), () -> {
|
||||
RenameTool.createDialogGroup(ecp, ctx);
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
addItem(builder, getString(isPageWhitelistedFilter ? "remove_from_filter_whitelist" : "add_to_filter_whitelist"), () -> {
|
||||
setWhitelistedFilter(ecp, !isPageWhitelistedFilter);
|
||||
sendToast(getString(isPageWhitelistedFilter ? "removed_from_whitelist_success" : "added_to_whitelist_success"));
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
addItem(builder, getString(isPageWhitelistedAds ? "remove_from_ads_whitelist" : "add_to_ads_whitelist"), () -> {
|
||||
setWhitelistedAd(ecp, !isPageWhitelistedAds);
|
||||
sendToast(getString(isPageWhitelistedAds ? "removed_from_whitelist_success" : "added_to_whitelist_success"));
|
||||
return Unit.a;
|
||||
});
|
||||
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -101,7 +117,7 @@ public class MenuBuilder {
|
||||
ClipData clip = ClipData.newPlainText("MBH-ST", txt);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
|
||||
sendToast(AndroidUtils.getString("menu_copied"));
|
||||
sendToast(getString("menu_copied"));
|
||||
}
|
||||
|
||||
public static void addItem(final ActionsPopup.b builder, final String title, final Functions onClick) throws InvocationTargetException, IllegalAccessException {
|
||||
|
||||
@@ -3,18 +3,18 @@ package ru.vtosters.lite.ui.wallpapers;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
|
||||
public class ConvolutionMatrix {
|
||||
public class ConvolutionMatrix{
|
||||
public static final int SIZE = 3;
|
||||
|
||||
public double[][] Matrix;
|
||||
public double Factor = 1;
|
||||
public double Offset = 1;
|
||||
|
||||
public ConvolutionMatrix(int size) {
|
||||
public ConvolutionMatrix(int size){
|
||||
Matrix = new double[size][size];
|
||||
}
|
||||
|
||||
public static Bitmap computeConvolution3x3(Bitmap src, ConvolutionMatrix matrix) {
|
||||
public static Bitmap computeConvolution3x3(Bitmap src, ConvolutionMatrix matrix){
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
Bitmap result = Bitmap.createBitmap(width, height, src.getConfig());
|
||||
@@ -81,7 +81,7 @@ public class ConvolutionMatrix {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setAll(double value) {
|
||||
public void setAll(double value){
|
||||
for (int x = 0; x < SIZE; ++x) {
|
||||
for (int y = 0; y < SIZE; ++y) {
|
||||
Matrix[x][y] = value;
|
||||
@@ -89,7 +89,7 @@ public class ConvolutionMatrix {
|
||||
}
|
||||
}
|
||||
|
||||
public void applyConfig(double[][] config) {
|
||||
public void applyConfig(double[][] config){
|
||||
for (int x = 0; x < SIZE; ++x) {
|
||||
for (int y = 0; y < SIZE; ++y) {
|
||||
Matrix[x][y] = config[x][y];
|
||||
|
||||
@@ -2,6 +2,7 @@ package ru.vtosters.lite.ui.wallpapers;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getResources;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
@@ -12,22 +13,46 @@ import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.medianative.MediaNative;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ImageFilters {
|
||||
public class ImageFilters{
|
||||
public static final double PI = 3.14159d;
|
||||
public static final double HALF_CIRCLE_DEGREE = 180d;
|
||||
public static final double RANGE = 256d;
|
||||
public static final int COLOR_MIN = 0x00;
|
||||
public static final int COLOR_MAX = 0xFF;
|
||||
|
||||
public static Drawable getFilteredDrawable(Drawable orig) {
|
||||
public static Drawable getFilteredDrawable(Drawable orig){
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig;
|
||||
Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
if (!getPreferences().getString("msg_blur_radius", "disabled").equals("disabled")) {
|
||||
orig = getBlurredWallpaper(orig, getRadius());
|
||||
}
|
||||
|
||||
if (!getPreferences().getString("msg_dim", "off").equals("off")) {
|
||||
orig = getDimmed(orig);
|
||||
}
|
||||
|
||||
if (!getPreferences().getString("msg_mosaic", "disabled").equals("disabled")) {
|
||||
orig = getMosaic(orig);
|
||||
}
|
||||
|
||||
if (!hasVerification()) {
|
||||
return orig;
|
||||
}
|
||||
|
||||
if (getPreferences().getBoolean("msg_monochrome", false)) {
|
||||
orig = getMonochrome(orig);
|
||||
}
|
||||
|
||||
Bitmap bm = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
Bitmap instance = bm.copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
if (getPreferences().getBoolean("msg_invert", false)) {
|
||||
instance = applyInvertEffect(instance);
|
||||
@@ -56,11 +81,26 @@ public class ImageFilters {
|
||||
return new BitmapDrawable(getResources(), instance);
|
||||
}
|
||||
|
||||
public static Drawable getBlurredWallpaper(Drawable orig, int radius) {
|
||||
private static int getRadius(){
|
||||
String radius = getPreferences().getString("msg_blur_radius", "disabled");
|
||||
switch(radius) {
|
||||
case "low":
|
||||
return 8;
|
||||
case "med":
|
||||
return 14;
|
||||
default:
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
|
||||
public static Drawable getBlurredWallpaper(Drawable orig, int radius){
|
||||
try {
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig; // we need only BitmapDrawable
|
||||
Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
|
||||
Bitmap bm = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
Bitmap instance = bm.copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
MediaNative.blurBitmap(instance, radius);
|
||||
return new BitmapDrawable(getResources(), instance);
|
||||
} catch (Exception e) {
|
||||
@@ -69,15 +109,20 @@ public class ImageFilters {
|
||||
}
|
||||
}
|
||||
|
||||
public static Drawable getMosaic(Drawable orig) {
|
||||
public static Drawable getMosaic(Drawable orig){
|
||||
int scale = 100;
|
||||
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig;
|
||||
Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
|
||||
Bitmap bm = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
|
||||
Bitmap instance = bm.copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
|
||||
String radius = getPreferences().getString("msg_mosaic", "disabled");
|
||||
|
||||
switch (radius) {
|
||||
switch(radius) {
|
||||
case "high":
|
||||
scale = 25;
|
||||
break;
|
||||
@@ -94,12 +139,15 @@ public class ImageFilters {
|
||||
return new BitmapDrawable(getResources(), mosaicBitmap);
|
||||
}
|
||||
|
||||
public static Drawable getDimmed(Drawable orig) {
|
||||
public static Drawable getDimmed(Drawable orig){
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig;
|
||||
Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
|
||||
Bitmap bm = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
Bitmap instance = bm.copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
String radius = getPreferences().getString("msg_dim", "disabled");
|
||||
switch (radius) {
|
||||
switch(radius) {
|
||||
case "dim_black":
|
||||
darken(instance);
|
||||
case "dim_white":
|
||||
@@ -108,10 +156,12 @@ public class ImageFilters {
|
||||
return new BitmapDrawable(getResources(), instance);
|
||||
}
|
||||
|
||||
public static Drawable getMonochrome(Drawable orig) {
|
||||
public static Drawable getMonochrome(Drawable orig){
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig;
|
||||
Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
|
||||
Bitmap bm = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
Bitmap instance = bm.copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
Bitmap bwBitmap = Bitmap.createBitmap(instance.getWidth(), instance.getHeight(), Bitmap.Config.RGB_565);
|
||||
float[] hsv = new float[3];
|
||||
@@ -129,23 +179,31 @@ public class ImageFilters {
|
||||
return new BitmapDrawable(getResources(), bwBitmap);
|
||||
}
|
||||
|
||||
private static void darken(Bitmap bm) {
|
||||
Canvas canvas = new Canvas(bm);
|
||||
Paint p = new Paint(Color.RED);
|
||||
ColorFilter filter = new LightingColorFilter(0xFF7F7F7F, 0x00000000); // darken
|
||||
p.setColorFilter(filter);
|
||||
canvas.drawBitmap(bm, new Matrix(), p);
|
||||
private static void darken(Bitmap bm){
|
||||
try {
|
||||
Canvas canvas = new Canvas(bm);
|
||||
Paint p = new Paint(Color.RED);
|
||||
ColorFilter filter = new LightingColorFilter(0xFF7F7F7F, 0x00000000); // darken
|
||||
p.setColorFilter(filter);
|
||||
canvas.drawBitmap(bm, new Matrix(), p);
|
||||
} catch (Exception e) {
|
||||
Log.d("WallpaperD", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void lighten(Bitmap bm) {
|
||||
Canvas canvas = new Canvas(bm);
|
||||
Paint p = new Paint(Color.RED);
|
||||
ColorFilter filter = new LightingColorFilter(0xFFFFFFFF, 0x00222222); // lighten
|
||||
p.setColorFilter(filter);
|
||||
canvas.drawBitmap(bm, new Matrix(), p);
|
||||
private static void lighten(Bitmap bm){
|
||||
try {
|
||||
Canvas canvas = new Canvas(bm);
|
||||
Paint p = new Paint(Color.RED);
|
||||
ColorFilter filter = new LightingColorFilter(0xFFFFFFFF, 0x00222222); // lighten
|
||||
p.setColorFilter(filter);
|
||||
canvas.drawBitmap(bm, new Matrix(), p);
|
||||
} catch (Exception e) {
|
||||
Log.d("WallpaperL", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static Bitmap applyInvertEffect(Bitmap src) {
|
||||
public static Bitmap applyInvertEffect(Bitmap src){
|
||||
// create new bitmap with the same settings as source bitmap
|
||||
Bitmap bmOut = Bitmap.createBitmap(src.getWidth(), src.getHeight(), src.getConfig());
|
||||
// color info
|
||||
@@ -175,7 +233,7 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public static Bitmap applySepiaEffect(Bitmap src) {
|
||||
public static Bitmap applySepiaEffect(Bitmap src){
|
||||
// image size
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
@@ -212,8 +270,8 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public static Bitmap applyEmbossEffect(Bitmap src) {
|
||||
double[][] EmbossConfig = new double[][]{
|
||||
public static Bitmap applyEmbossEffect(Bitmap src){
|
||||
double[][] EmbossConfig = new double[][] {
|
||||
{-1, 0, -1},
|
||||
{0, 4, 0},
|
||||
{-1, 0, -1}
|
||||
@@ -225,7 +283,7 @@ public class ImageFilters {
|
||||
return ConvolutionMatrix.computeConvolution3x3(src, convMatrix);
|
||||
}
|
||||
|
||||
public static Bitmap applyEngraveEffect(Bitmap src) {
|
||||
public static Bitmap applyEngraveEffect(Bitmap src){
|
||||
ConvolutionMatrix convMatrix = new ConvolutionMatrix(3);
|
||||
convMatrix.setAll(0);
|
||||
convMatrix.Matrix[0][0] = -2;
|
||||
@@ -235,7 +293,7 @@ public class ImageFilters {
|
||||
return ConvolutionMatrix.computeConvolution3x3(src, convMatrix);
|
||||
}
|
||||
|
||||
public static Bitmap applyFleaEffect(Bitmap source) {
|
||||
public static Bitmap applyFleaEffect(Bitmap source){
|
||||
// get image size
|
||||
int width = source.getWidth();
|
||||
int height = source.getHeight();
|
||||
@@ -264,7 +322,7 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public static Bitmap applySnowEffect(Bitmap source) {
|
||||
public static Bitmap applySnowEffect(Bitmap source){
|
||||
// get image size
|
||||
int width = source.getWidth();
|
||||
int height = source.getHeight();
|
||||
@@ -297,7 +355,7 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public Bitmap applyDecreaseColorDepthEffect(Bitmap src, int bitOffset) {
|
||||
public Bitmap applyDecreaseColorDepthEffect(Bitmap src, int bitOffset){
|
||||
// get image size
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
@@ -340,7 +398,7 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public Bitmap applyContrastEffect(Bitmap src, double value) {
|
||||
public Bitmap applyContrastEffect(Bitmap src, double value){
|
||||
// image size
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
@@ -392,7 +450,7 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public Bitmap applyBrightnessEffect(Bitmap src, int value) {
|
||||
public Bitmap applyBrightnessEffect(Bitmap src, int value){
|
||||
// image size
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
@@ -443,8 +501,8 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public Bitmap applyGaussianBlurEffect(Bitmap src) {
|
||||
double[][] GaussianBlurConfig = new double[][]{
|
||||
public Bitmap applyGaussianBlurEffect(Bitmap src){
|
||||
double[][] GaussianBlurConfig = new double[][] {
|
||||
{1, 2, 1},
|
||||
{2, 4, 2},
|
||||
{1, 2, 1}
|
||||
@@ -456,8 +514,8 @@ public class ImageFilters {
|
||||
return ConvolutionMatrix.computeConvolution3x3(src, convMatrix);
|
||||
}
|
||||
|
||||
public Bitmap applySharpenEffect(Bitmap src, double weight) {
|
||||
double[][] SharpConfig = new double[][]{
|
||||
public Bitmap applySharpenEffect(Bitmap src, double weight){
|
||||
double[][] SharpConfig = new double[][] {
|
||||
{0, -2, 0},
|
||||
{-2, weight, -2},
|
||||
{0, -2, 0}
|
||||
@@ -468,8 +526,8 @@ public class ImageFilters {
|
||||
return ConvolutionMatrix.computeConvolution3x3(src, convMatrix);
|
||||
}
|
||||
|
||||
public Bitmap applyMeanRemovalEffect(Bitmap src) {
|
||||
double[][] MeanRemovalConfig = new double[][]{
|
||||
public Bitmap applyMeanRemovalEffect(Bitmap src){
|
||||
double[][] MeanRemovalConfig = new double[][] {
|
||||
{-1, -1, -1},
|
||||
{-1, 9, -1},
|
||||
{-1, -1, -1}
|
||||
@@ -481,7 +539,7 @@ public class ImageFilters {
|
||||
return ConvolutionMatrix.computeConvolution3x3(src, convMatrix);
|
||||
}
|
||||
|
||||
public Bitmap applySmoothEffect(Bitmap src, double value) {
|
||||
public Bitmap applySmoothEffect(Bitmap src, double value){
|
||||
ConvolutionMatrix convMatrix = new ConvolutionMatrix(3);
|
||||
convMatrix.setAll(1);
|
||||
convMatrix.Matrix[1][1] = value;
|
||||
@@ -490,7 +548,7 @@ public class ImageFilters {
|
||||
return ConvolutionMatrix.computeConvolution3x3(src, convMatrix);
|
||||
}
|
||||
|
||||
public Bitmap applyBoostEffect(Bitmap src, int type, float percent) {
|
||||
public Bitmap applyBoostEffect(Bitmap src, int type, float percent){
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig());
|
||||
@@ -521,7 +579,7 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public Bitmap applyTintEffect(Bitmap src, int degree) {
|
||||
public Bitmap applyTintEffect(Bitmap src, int degree){
|
||||
|
||||
int width = src.getWidth();
|
||||
int height = src.getHeight();
|
||||
@@ -565,7 +623,7 @@ public class ImageFilters {
|
||||
return outBitmap;
|
||||
}
|
||||
|
||||
public Bitmap applyBlackFilter(Bitmap source) {
|
||||
public Bitmap applyBlackFilter(Bitmap source){
|
||||
// get image size
|
||||
int width = source.getWidth();
|
||||
int height = source.getHeight();
|
||||
@@ -598,7 +656,7 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public Bitmap applyShadingFilter(Bitmap source, int shadingColor) {
|
||||
public Bitmap applyShadingFilter(Bitmap source, int shadingColor){
|
||||
// get image size
|
||||
int width = source.getWidth();
|
||||
int height = source.getHeight();
|
||||
@@ -622,7 +680,7 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public Bitmap applySaturationFilter(Bitmap source, int level) {
|
||||
public Bitmap applySaturationFilter(Bitmap source, int level){
|
||||
// get image size
|
||||
int width = source.getWidth();
|
||||
int height = source.getHeight();
|
||||
@@ -652,7 +710,7 @@ public class ImageFilters {
|
||||
return bmOut;
|
||||
}
|
||||
|
||||
public Bitmap applyHueFilter(Bitmap source, int level) {
|
||||
public Bitmap applyHueFilter(Bitmap source, int level){
|
||||
// get image size
|
||||
int width = source.getWidth();
|
||||
int height = source.getHeight();
|
||||
|
||||
@@ -8,7 +8,6 @@ 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.CacheUtils.deleteCache;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
|
||||
@@ -33,15 +32,15 @@ import java.io.OutputStream;
|
||||
import ru.vtosters.lite.ui.PreferencesUtil;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment{
|
||||
|
||||
private WallpaperPreferences mWPPreviewPref;
|
||||
|
||||
public static void copyStream(InputStream copyFrom, OutputStream copyTo) throws IOException {
|
||||
public static void copyStream(InputStream copyFrom, OutputStream copyTo) throws IOException{
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
while ((length = copyFrom.read(buffer)) > 0) {
|
||||
while((length = copyFrom.read(buffer)) > 0) {
|
||||
copyTo.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
@@ -51,7 +50,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
public void onCreate(Bundle bundle){
|
||||
super.onCreate(bundle);
|
||||
|
||||
int vtosterXml = getIdentifier("empty", "xml");
|
||||
@@ -87,16 +86,16 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
}
|
||||
|
||||
PreferencesUtil.addListPreference(this, "msg_blur_radius", "disabled", AndroidUtils.getString("filter_blur"), AndroidUtils.getArray("filter_types"), new String[]{
|
||||
PreferencesUtil.addListPreference(this, "msg_blur_radius", "disabled", AndroidUtils.getString("filter_blur"), AndroidUtils.getArray("filter_types"), new String[] {
|
||||
"disabled", "low", "med", "high"
|
||||
});
|
||||
|
||||
PreferencesUtil.addListPreference(this, "msg_dim", "off", AndroidUtils.getString("filter_dim"), AndroidUtils.getArray("filter_dim_types"), new String[]{
|
||||
PreferencesUtil.addListPreference(this, "msg_dim", "off", AndroidUtils.getString("filter_dim"), AndroidUtils.getArray("filter_dim_types"), new String[] {
|
||||
"off", "dim_black", "dim_white"
|
||||
});
|
||||
|
||||
|
||||
PreferencesUtil.addListPreference(this, "msg_mosaic", "disabled", AndroidUtils.getString("filter_mosaic"), AndroidUtils.getArray("filter_types"), new String[]{
|
||||
PreferencesUtil.addListPreference(this, "msg_mosaic", "disabled", AndroidUtils.getString("filter_mosaic"), AndroidUtils.getArray("filter_types"), new String[] {
|
||||
"disabled", "low", "med", "high"
|
||||
});
|
||||
|
||||
@@ -158,6 +157,14 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
}
|
||||
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "compresswp", "Сжимать обои", "Значительно ускоряет открытие чатов", null, true, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
edit().putBoolean("compresswp", value).commit();
|
||||
requestUpdateWallpaper();
|
||||
mWPPreviewPref.redraw();
|
||||
return true;
|
||||
});
|
||||
|
||||
ListPreference blur = (ListPreference) findPreference("msg_blur_radius");
|
||||
ListPreference dim = (ListPreference) findPreference("msg_dim");
|
||||
ListPreference mosaic = (ListPreference) findPreference("msg_mosaic");
|
||||
@@ -192,13 +199,14 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int i, int i1, @Nullable Intent intent) {
|
||||
public void onActivityResult(int i, int i1, @Nullable Intent intent){
|
||||
super.onActivityResult(i, i1, intent);
|
||||
|
||||
if (intent == null || intent.getData() == null)
|
||||
return;
|
||||
|
||||
try {
|
||||
removeWallpaper();
|
||||
InputStream fileInputStream = requireActivity().getContentResolver().openInputStream(intent.getData());
|
||||
OutputStream outputStream = new FileOutputStream(getWallpaperFile());
|
||||
|
||||
@@ -209,20 +217,21 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
if (i == 1488) {
|
||||
mWPPreviewPref.redraw();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(requireActivity(), e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void removeStickCache() {
|
||||
private void removeStickCache(){
|
||||
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||
prefs2.edit().clear().apply();
|
||||
ImEngineProvider.b().a();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
public int T4(){
|
||||
return getIdentifier("wallpapers", "string");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package ru.vtosters.lite.ui.wallpapers;
|
||||
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaper;
|
||||
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;
|
||||
@@ -18,31 +18,31 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import ru.vtosters.lite.ui.adapters.MessagesPreviewAdapter;
|
||||
|
||||
public class WallpaperPreferences extends Preference {
|
||||
public class WallpaperPreferences extends Preference{
|
||||
|
||||
private MessagesPreviewAdapter mAdapter;
|
||||
RecyclerView mRecyclerView;
|
||||
ImageView mChatBackground;
|
||||
private MessagesPreviewAdapter mAdapter;
|
||||
|
||||
public WallpaperPreferences(Context context) {
|
||||
public WallpaperPreferences(Context context){
|
||||
this(context, null, -1, -1);
|
||||
}
|
||||
|
||||
public WallpaperPreferences(Context context, AttributeSet attributeSet) {
|
||||
public WallpaperPreferences(Context context, AttributeSet attributeSet){
|
||||
this(context, attributeSet, -1, -1);
|
||||
}
|
||||
|
||||
public WallpaperPreferences(Context context, AttributeSet attributeSet, int defStyleAttr) {
|
||||
public WallpaperPreferences(Context context, AttributeSet attributeSet, int defStyleAttr){
|
||||
this(context, attributeSet, defStyleAttr, -1);
|
||||
}
|
||||
|
||||
public WallpaperPreferences(Context context, AttributeSet attributeSet, int defStyleAttr, int i1) {
|
||||
public WallpaperPreferences(Context context, AttributeSet attributeSet, int defStyleAttr, int i1){
|
||||
super(context, attributeSet, defStyleAttr, i1);
|
||||
setLayoutResource(getIdentifier("wppreview", "layout"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PreferenceViewHolder preferenceViewHolder) {
|
||||
public void onBindViewHolder(PreferenceViewHolder preferenceViewHolder){
|
||||
super.onBindViewHolder(preferenceViewHolder);
|
||||
|
||||
mRecyclerView = (RecyclerView) preferenceViewHolder.findViewById(getIdentifier("install_btn_container", "id"));
|
||||
@@ -56,17 +56,17 @@ public class WallpaperPreferences extends Preference {
|
||||
requestBg();
|
||||
}
|
||||
|
||||
private void requestBg() {
|
||||
final Drawable drawable = getWallpaper();
|
||||
private void requestBg(){
|
||||
final Drawable drawable = getFilteredFile();
|
||||
|
||||
if (drawable != null && getWallpaperFile().exists())
|
||||
if (drawable != null && getWallpaperFile() != null)
|
||||
mChatBackground.setImageDrawable(drawable);
|
||||
else
|
||||
mChatBackground.setImageDrawable(null);
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
void redraw() {
|
||||
void redraw(){
|
||||
mAdapter.notifyDataSetChanged();
|
||||
requestBg();
|
||||
}
|
||||
|
||||
@@ -1,97 +1,120 @@
|
||||
package ru.vtosters.lite.ui.wallpapers;
|
||||
|
||||
import static com.vk.im.engine.h.im_bg_chat;
|
||||
import static ru.vtosters.lite.ui.wallpapers.ImageFilters.getBlurredWallpaper;
|
||||
import static ru.vtosters.lite.ui.wallpapers.ImageFilters.getDimmed;
|
||||
import static ru.vtosters.lite.ui.wallpapers.ImageFilters.getFilteredDrawable;
|
||||
import static ru.vtosters.lite.ui.wallpapers.ImageFilters.getMonochrome;
|
||||
import static ru.vtosters.lite.ui.wallpapers.ImageFilters.getMosaic;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
import vigo.sdk.Log;
|
||||
|
||||
public class WallpapersHooks {
|
||||
public class WallpapersHooks{
|
||||
private static final boolean compress = getBoolValue("compresswp", true);
|
||||
private static File mWallpaperFile;
|
||||
|
||||
private static Drawable mWallpaper;
|
||||
private static boolean mUpdateWallpaperRequested = true;
|
||||
private static boolean mUpdateWallpaperFileRequested = true;
|
||||
|
||||
public static File getWallpaperFile() {
|
||||
return mWallpaperFile == null ? mWallpaperFile = compressFile(new File(getGlobalContext().getFilesDir(), "wallpaper.png")) : mWallpaperFile;
|
||||
}
|
||||
|
||||
public static File compressFile(File file) {
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
|
||||
File compressedFile = new File(file.getParent(), file.getName());
|
||||
OutputStream out = null;
|
||||
try {
|
||||
out = new FileOutputStream(compressedFile);
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 95, out);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
public static File getWallpaperFile(){
|
||||
if (mWallpaperFile == null) {
|
||||
mWallpaperFile = new File(getGlobalContext().getFilesDir(), "wallpaper.webp");
|
||||
}
|
||||
return compressedFile;
|
||||
|
||||
return mWallpaperFile;
|
||||
}
|
||||
|
||||
public static void setBg(View view) {
|
||||
public static Drawable getFilteredFile(){
|
||||
File file = null;
|
||||
File wp = mWallpaperFile;
|
||||
String temp = getGlobalContext().getFilesDir() + File.separator + "filteredwp.webp";
|
||||
|
||||
if (wp != null && mUpdateWallpaperFileRequested) {
|
||||
try {
|
||||
file = new File(temp);
|
||||
file.createNewFile();
|
||||
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
((BitmapDrawable) getFilteredDrawable(Drawable.createFromPath(wp.getAbsolutePath()))).getBitmap().compress(Bitmap.CompressFormat.WEBP, (compress ? 80 : 95), bos);
|
||||
byte[] bitmapdata = bos.toByteArray();
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
fos.write(bitmapdata);
|
||||
fos.flush();
|
||||
fos.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.d("Wallpapers", e.getMessage());
|
||||
}
|
||||
|
||||
mUpdateWallpaperFileRequested = false;
|
||||
}
|
||||
|
||||
try {
|
||||
return Drawable.createFromPath(temp);
|
||||
} catch (Exception e) {
|
||||
return Drawable.createFromPath(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
private static Boolean eligibleWallpaperFile(File file){
|
||||
if (file.length() >= 6291456) {
|
||||
sendToast("Размер файла превышает лимит 6 MB");
|
||||
removeWallpaper();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setBg(View view){
|
||||
if (getWallpaper() != null) {
|
||||
((ImageView) view).setImageDrawable(getWallpaper()); // set picture to background
|
||||
((ImageView) view).setImageDrawable(getFilteredFile()); // set picture to background
|
||||
return;
|
||||
}
|
||||
|
||||
((ImageView) view).setColorFilter(im_bg_chat); // set default bg color
|
||||
view.setBackgroundColor(ThemesUtils.getColorFromAttr(im_bg_chat)); // set default bg color
|
||||
}
|
||||
|
||||
public static String getWallpaperUrl() {
|
||||
if (getWallpaperFile().exists())
|
||||
return getWallpaperFile().getAbsolutePath();
|
||||
else
|
||||
return "default";
|
||||
public static String getWallpaperUrl(){
|
||||
var file = getWallpaperFile();
|
||||
|
||||
if (file.exists() && eligibleWallpaperFile(file)) {
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
|
||||
return "default";
|
||||
}
|
||||
|
||||
public static Drawable getWallpaper() {
|
||||
public static Drawable getWallpaper(){
|
||||
if (mWallpaper == null || mUpdateWallpaperRequested) {
|
||||
if (!getPreferences().getString("msg_blur_radius", "disabled").equals("disabled")) {
|
||||
mWallpaper = getBlurredWallpaper(Drawable.createFromPath(getWallpaperUrl()), getRadius());
|
||||
} else {
|
||||
mWallpaper = Drawable.createFromPath(getWallpaperUrl());
|
||||
}
|
||||
if (!getPreferences().getString("msg_dim", "off").equals("off")) {
|
||||
mWallpaper = getDimmed(mWallpaper);
|
||||
String url = getWallpaperUrl();
|
||||
|
||||
if (url.equals("default") || url.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!getPreferences().getString("msg_mosaic", "disabled").equals("disabled")) {
|
||||
mWallpaper = getMosaic(mWallpaper);
|
||||
Drawable drawable = Drawable.createFromPath(getWallpaperUrl());
|
||||
|
||||
if (drawable == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (hasVerification()) {
|
||||
if (getPreferences().getBoolean("msg_monochrome", false)) {
|
||||
mWallpaper = getMonochrome(mWallpaper);
|
||||
}
|
||||
mWallpaper = drawable;
|
||||
|
||||
mWallpaper = getFilteredDrawable(mWallpaper);
|
||||
}
|
||||
mWallpaper = getFilteredDrawable(mWallpaper);
|
||||
|
||||
mUpdateWallpaperRequested = false;
|
||||
}
|
||||
@@ -99,25 +122,14 @@ public class WallpapersHooks {
|
||||
return mWallpaper;
|
||||
}
|
||||
|
||||
public static void requestUpdateWallpaper() {
|
||||
public static void requestUpdateWallpaper(){
|
||||
mUpdateWallpaperRequested = true;
|
||||
mUpdateWallpaperFileRequested = true;
|
||||
}
|
||||
|
||||
private static int getRadius() {
|
||||
public static String getRadiusSummary(){
|
||||
String radius = getPreferences().getString("msg_blur_radius", "disabled");
|
||||
switch (radius) {
|
||||
case "low":
|
||||
return 8;
|
||||
case "med":
|
||||
return 14;
|
||||
default:
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getRadiusSummary() {
|
||||
String radius = getPreferences().getString("msg_blur_radius", "disabled");
|
||||
switch (radius) {
|
||||
switch(radius) {
|
||||
case "low":
|
||||
return AndroidUtils.getString("wallpapers_low");
|
||||
case "med":
|
||||
@@ -129,21 +141,21 @@ public class WallpapersHooks {
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDimmingSummary() {
|
||||
public static String getDimmingSummary(){
|
||||
String radius = getPreferences().getString("msg_dim", "disabled");
|
||||
switch (radius) {
|
||||
switch(radius) {
|
||||
case "dim_black":
|
||||
return AndroidUtils.getString("wallpapers_dim_black");
|
||||
case "dim_white":
|
||||
return AndroidUtils.getString("wallpapers_dim_white");
|
||||
return AndroidUtils.getString("wallpapers_dim_white");
|
||||
default:
|
||||
return AndroidUtils.getString("wallpapers_disabled");
|
||||
}
|
||||
}
|
||||
|
||||
public static String getMosaicSummary() {
|
||||
public static String getMosaicSummary(){
|
||||
String radius = getPreferences().getString("msg_mosaic", "disabled");
|
||||
switch (radius) {
|
||||
switch(radius) {
|
||||
case "low":
|
||||
return AndroidUtils.getString("wallpapers_low");
|
||||
case "med":
|
||||
@@ -156,7 +168,13 @@ public class WallpapersHooks {
|
||||
}
|
||||
|
||||
|
||||
public static void removeWallpaper() {
|
||||
getWallpaperFile().delete();
|
||||
public static void removeWallpaper(){
|
||||
try {
|
||||
new File(getGlobalContext().getFilesDir(), "wallpaper.webp").delete();
|
||||
new File(getGlobalContext().getFilesDir(), "filteredwp.webp").delete();
|
||||
mWallpaperFile = null;
|
||||
} catch (Exception e) {
|
||||
Log.d("Wallpapers", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,10 @@ import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.vk.core.util.Screen;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Locale;
|
||||
@@ -31,6 +32,10 @@ public class AndroidUtils {
|
||||
return PreferenceManager.getDefaultSharedPreferences(getGlobalContext());
|
||||
}
|
||||
|
||||
public static boolean isTablet() {
|
||||
return Screen.l(getGlobalContext());
|
||||
}
|
||||
|
||||
public static String getPrefsValue(String pref) {
|
||||
return getPreferences().getString(pref, "");
|
||||
} // Get pref value as string
|
||||
@@ -39,14 +44,13 @@ public class AndroidUtils {
|
||||
return PreferenceManager.getDefaultSharedPreferences(getGlobalContext()).edit();
|
||||
} // Edit SharedPreferences
|
||||
|
||||
@NonNull
|
||||
public static Context getGlobalContext() {
|
||||
try {
|
||||
return ReflectionUtils.invokeStaticMethod("android.app.AppGlobals", "getInitialApplication");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.d("GlobalContext", "Error while fetching context via refl");
|
||||
}
|
||||
return null;
|
||||
return null; // need fix for a13+ cuz google shit disabled global context via refl
|
||||
} // Getting the global context through reflection to use context on application initialization
|
||||
|
||||
public static Resources getResources() {
|
||||
|
||||
@@ -13,15 +13,11 @@ import com.vk.im.ui.providers.audiomsg.ImAudioMsgPlayerProvider;
|
||||
import com.vk.im.ui.providers.audiomsg.PlayerActionSources;
|
||||
import com.vk.imageloader.VKImageLoader;
|
||||
import com.vk.media.player.cache.AutoPlayCacheHolder;
|
||||
import com.vk.mediastore.MediaStorage;
|
||||
import com.vk.stickers.Stickers;
|
||||
import com.vtosters.lite.im.ImEngineProvider;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
import java.text.StringCharacterIterator;
|
||||
|
||||
import b.h.g.m.FileUtils;
|
||||
|
||||
public class CacheUtils {
|
||||
private static CacheUtils sInstance = new CacheUtils();
|
||||
public long size = 0;
|
||||
@@ -32,10 +28,6 @@ public class CacheUtils {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public static void deleteCache() {
|
||||
IOUtils.deleteRecursive(getGlobalContext().getCacheDir());
|
||||
}
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public static String humanReadableByteCountBin(long bytes) {
|
||||
long absB = bytes == Long.MIN_VALUE ? Long.MAX_VALUE : Math.abs(bytes);
|
||||
@@ -60,7 +52,6 @@ public class CacheUtils {
|
||||
VKImageLoader.e();
|
||||
ImAudioMsgPlayerProvider.b().e(PlayerActionSources.a);
|
||||
ImAudioMsgPlayerProvider.b().d(PlayerActionSources.a);
|
||||
FileUtils.l();
|
||||
Stickers.l.c();
|
||||
ImEngineExt.a(ImEngine1.a());
|
||||
AutoPlayCacheHolder.d.a();
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
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.sendToast;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.SyncResult;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
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.auth.VKAccountManager;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class ContactsUtils{
|
||||
public static void setContactsSync(boolean enabled){
|
||||
makeRequest("https://" + getApi() + "/method/account.setInfo?" + "name=im_user_name_type&value=" + (enabled ? "contact" : "vk") + "&https=1&v=5.153&access_token=" + getUserToken(),
|
||||
response -> {
|
||||
try {
|
||||
JSONObject mainJson = new JSONObject(response);
|
||||
Log.d("ContactsUtils", "Result: " + mainJson + ", enabled sync: " + enabled);
|
||||
} catch (JSONException e) {
|
||||
Log.d("ContactsUtils", e.getMessage());
|
||||
sendToast("Ошибка установки контактов");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void uploadContacts(Context ctx){
|
||||
try {
|
||||
if (ContextCompat.checkSelfPermission(ctx, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
|
||||
sendToast("Для работы данной функции необходимо выдать право на чтение контактов");
|
||||
requestPermissions(LifecycleUtils.getCurrentActivity(), new String[] {Manifest.permission.READ_CONTACTS}, 11111);
|
||||
} else {
|
||||
var account = VKAuthUtils.a.a(VKAccountManager.d().Z());
|
||||
ContactsSyncAdapterService.c(ctx, account, new Bundle(), new SyncResult());
|
||||
}
|
||||
} catch (Exception e){
|
||||
Log.d("ContactsUtils", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void getContactsStatus(Context ctx){
|
||||
final ProgressDialog progressDialog = new ProgressDialog(ctx);
|
||||
progressDialog.setMessage("Загрузка данных о контактах...");
|
||||
progressDialog.show();
|
||||
|
||||
var request = new okhttp3.Request.a()
|
||||
.b("https://" + getApi() + "/method/execute?https=1&v=5.153&code=return%20API.account.getInfo().settings%5B44%5D.value%3B&access_token=" + getUserToken())
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"))
|
||||
.a();
|
||||
|
||||
try {
|
||||
var response = new OkHttpClient().a(request).execute().a().g();
|
||||
progressDialog.cancel();
|
||||
|
||||
try {
|
||||
String resp = new JSONObject(response).optString("response");
|
||||
|
||||
Log.d("ContactsUtils", new JSONObject(response).toString());
|
||||
|
||||
boolean enabledsync = resp.equals("contact");
|
||||
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(ctx);
|
||||
builder.setTitle("Синхронизация контактов");
|
||||
builder.setMessage("Статус синхронизации: " + (enabledsync ? "Включена" : "Отключена"));
|
||||
builder.setCancelable(true);
|
||||
builder.setPositiveButton((!enabledsync ? "Включить" : "Отключить"), (dialog, which) -> {
|
||||
setContactsSync(!enabledsync);
|
||||
});
|
||||
// builder.setNegativeButton("Импортировать контакты", (dialog, which) -> {
|
||||
// uploadContacts(ctx);
|
||||
// });
|
||||
|
||||
builder.show();
|
||||
|
||||
} catch (JSONException e) {
|
||||
Log.d("ContactsUtils", e.getMessage());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.d("ContactsUtils", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.os.storage.StorageVolume;
|
||||
import android.provider.DocumentsContract;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
// https://stackoverflow.com/questions/34927748/android-5-0-documentfile-from-tree-uri/36162691#36162691
|
||||
|
||||
public final class FileUriUtils {
|
||||
|
||||
private static final String PRIMARY_VOLUME_NAME = "primary";
|
||||
|
||||
@Nullable
|
||||
public static String getFullPathFromTreeUri(@Nullable final Uri treeUri, Context con) {
|
||||
if (treeUri == null) return null;
|
||||
String volumePath = getVolumePath(getVolumeIdFromTreeUri(treeUri),con);
|
||||
if (volumePath == null) return File.separator;
|
||||
if (volumePath.endsWith(File.separator))
|
||||
volumePath = volumePath.substring(0, volumePath.length() - 1);
|
||||
|
||||
String documentPath = getDocumentPathFromTreeUri(treeUri);
|
||||
if (documentPath.endsWith(File.separator))
|
||||
documentPath = documentPath.substring(0, documentPath.length() - 1);
|
||||
|
||||
if (documentPath.length() > 0) {
|
||||
if (documentPath.startsWith(File.separator))
|
||||
return volumePath + documentPath;
|
||||
else
|
||||
return volumePath + File.separator + documentPath;
|
||||
}
|
||||
else return volumePath;
|
||||
}
|
||||
|
||||
|
||||
private static String getVolumePath(final String volumeId, Context context) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
|
||||
return getVolumePathForAndroid11AndAbove(volumeId, context);
|
||||
else
|
||||
return getVolumePathBeforeAndroid11(volumeId, context);
|
||||
}
|
||||
|
||||
|
||||
private static String getVolumePathBeforeAndroid11(final String volumeId, Context context){
|
||||
try {
|
||||
StorageManager mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
|
||||
Class<?> storageVolumeClazz = Class.forName("android.os.storage.StorageVolume");
|
||||
Method getVolumeList = mStorageManager.getClass().getMethod("getVolumeList");
|
||||
Method getUuid = storageVolumeClazz.getMethod("getUuid");
|
||||
Method getPath = storageVolumeClazz.getMethod("getPath");
|
||||
Method isPrimary = storageVolumeClazz.getMethod("isPrimary");
|
||||
Object result = getVolumeList.invoke(mStorageManager);
|
||||
|
||||
final int length = Array.getLength(result);
|
||||
for (int i = 0; i < length; i++) {
|
||||
Object storageVolumeElement = Array.get(result, i);
|
||||
String uuid = (String) getUuid.invoke(storageVolumeElement);
|
||||
Boolean primary = (Boolean) isPrimary.invoke(storageVolumeElement);
|
||||
|
||||
if (primary && PRIMARY_VOLUME_NAME.equals(volumeId)) // primary volume?
|
||||
return (String) getPath.invoke(storageVolumeElement);
|
||||
|
||||
if (uuid != null && uuid.equals(volumeId)) // other volumes?
|
||||
return (String) getPath.invoke(storageVolumeElement);
|
||||
}
|
||||
// not found.
|
||||
return null;
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.R)
|
||||
private static String getVolumePathForAndroid11AndAbove(final String volumeId, Context context) {
|
||||
try {
|
||||
StorageManager mStorageManager = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE);
|
||||
List<StorageVolume> storageVolumes = mStorageManager.getStorageVolumes();
|
||||
for (StorageVolume storageVolume : storageVolumes) {
|
||||
// primary volume?
|
||||
if (storageVolume.isPrimary() && PRIMARY_VOLUME_NAME.equals(volumeId))
|
||||
return storageVolume.getDirectory().getPath();
|
||||
|
||||
// other volumes?
|
||||
String uuid = storageVolume.getUuid();
|
||||
if (uuid != null && uuid.equals(volumeId))
|
||||
return storageVolume.getDirectory().getPath();
|
||||
|
||||
}
|
||||
// not found.
|
||||
return null;
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getVolumeIdFromTreeUri(final Uri treeUri) {
|
||||
final String docId = DocumentsContract.getTreeDocumentId(treeUri);
|
||||
final String[] split = docId.split(":");
|
||||
if (split.length > 0) return split[0];
|
||||
else return null;
|
||||
}
|
||||
|
||||
private static String getDocumentPathFromTreeUri(final Uri treeUri) {
|
||||
final String docId = DocumentsContract.getTreeDocumentId(treeUri);
|
||||
final String[] split = docId.split(":");
|
||||
if ((split.length >= 2) && (split[1] != null)) return split[1];
|
||||
else return File.separator;
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.RectF;
|
||||
|
||||
@@ -23,14 +23,14 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
import ru.vtosters.lite.hooks.JsonInjectors;
|
||||
import ru.vtosters.lite.hooks.AdBlockHook;
|
||||
|
||||
public class NewsFeedFiltersUtils {
|
||||
public class NewsFeedFiltersUtils{
|
||||
public static List<String> mFilters;
|
||||
public static List<String> mFiltersNames;
|
||||
public static List<String> mFiltersLinks;
|
||||
|
||||
public static void setupFilters() {
|
||||
public static void setupFilters(){
|
||||
mFilters = new ArrayList<>();
|
||||
mFiltersNames = new ArrayList<>();
|
||||
mFiltersLinks = new ArrayList<>();
|
||||
@@ -57,43 +57,53 @@ public class NewsFeedFiltersUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void getFilter(String boolname, String filename, List<String> list) {
|
||||
if (getBoolValue(boolname, true)) {
|
||||
public static void getFilter(String boolname, String filename, List<String> list){
|
||||
var ctx = getGlobalContext();
|
||||
|
||||
if (getBoolValue(boolname, false)) {
|
||||
try {
|
||||
var scanner = new Scanner(getGlobalContext().getAssets().open(filename));
|
||||
while (scanner.hasNextLine()) {
|
||||
var line = scanner.nextLine();
|
||||
if (!line.isEmpty())
|
||||
list.add(line.toLowerCase());
|
||||
Scanner scanner;
|
||||
if (ctx != null) {
|
||||
scanner = new Scanner(ctx.getAssets().open(filename));
|
||||
|
||||
while(scanner.hasNextLine()) {
|
||||
var line = scanner.nextLine();
|
||||
if (!line.isEmpty())
|
||||
list.add(line.toLowerCase());
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Log.d("NewsFeedFiltersUtils", e.getMessage());
|
||||
}
|
||||
}
|
||||
} // Get needed filter list from assets
|
||||
|
||||
public static boolean injectFiltersReposts(JSONObject obj) throws JSONException {
|
||||
public static boolean injectFiltersReposts(JSONObject obj) throws JSONException{
|
||||
if (getBoolValue("cringerepost", false) && obj.has("copy_history")) {
|
||||
var copyHistoryNode = obj.optJSONArray("copy_history");
|
||||
for (int i = 0; i < copyHistoryNode.length(); i++) {
|
||||
var item = copyHistoryNode.optJSONObject(i);
|
||||
var text = item.optString("text");
|
||||
if (copyHistoryNode != null && copyHistoryNode.length() != 0) {
|
||||
for (int i = 0; i < copyHistoryNode.length(); i++) {
|
||||
var item = copyHistoryNode.optJSONObject(i);
|
||||
var text = item.optString("text");
|
||||
|
||||
if (isBadNews(text)) {
|
||||
if (dev())
|
||||
Log.d("RepostFilter", "Fetched repost ad (isBadNews), owner id " + item.optString("owner_id") + ", text: " + text);
|
||||
return true;
|
||||
} else if (JsonInjectors.isAds(item, item.optString("post_type"))) {
|
||||
if (dev())
|
||||
Log.d("RepostFilter", "Fetched repost ad (ads), owner id " + item.optString("owner_id") + ", text: " + text);
|
||||
return true;
|
||||
}
|
||||
|
||||
for (String filter : mFiltersLinks) {
|
||||
if (text.contains(filter)) {
|
||||
if (isBadNews(text)) {
|
||||
if (dev())
|
||||
Log.d("RepostFilter", "Fetched repost ad, owner id " + item.optString("owner_id") + ", text: " + text);
|
||||
Log.d("RepostFilter", "Fetched repost ad (isBadNews), owner id " + item.optString("owner_id") + ", text: " + text);
|
||||
return true;
|
||||
} else if (AdBlockHook.isAds(item, item.optString("post_type"))) {
|
||||
if (dev())
|
||||
Log.d("RepostFilter", "Fetched repost ad (ads), owner id " + item.optString("owner_id") + ", text: " + text);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mFiltersLinks != null) {
|
||||
for (String filter : mFiltersLinks) {
|
||||
if (text.contains(filter)) {
|
||||
if (dev())
|
||||
Log.d("RepostFilter", "Fetched repost ad, owner id " + item.optString("owner_id") + ", text: " + text);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,65 +111,89 @@ public class NewsFeedFiltersUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkCopyright(JSONObject json) throws JSONException {
|
||||
public static boolean checkCopyright(JSONObject json) throws JSONException{
|
||||
if (json.has("copyright")) {
|
||||
if (copyright_post()) return true;
|
||||
|
||||
var copyright = json.optJSONObject("copyright");
|
||||
var copyrightName = copyright.getString("name").toLowerCase();
|
||||
var copyrightLink = copyright.getString("link").toLowerCase();
|
||||
|
||||
for (String filter : mFiltersNames) {
|
||||
if (copyrightName.contains(filter)) return true;
|
||||
|
||||
String copyrightName = null;
|
||||
|
||||
if (copyright != null) {
|
||||
copyrightName = copyright.getString("name").toLowerCase();
|
||||
}
|
||||
|
||||
for (String filter : mFiltersLinks) {
|
||||
if (copyrightLink.contains(filter)) return true;
|
||||
String copyrightLink = null;
|
||||
|
||||
if (copyright != null) {
|
||||
copyrightLink = copyright.getString("link").toLowerCase();
|
||||
}
|
||||
|
||||
if (mFiltersNames != null) {
|
||||
for (String filter : mFiltersNames) {
|
||||
if (copyrightName != null && copyrightName.contains(filter)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mFiltersLinks != null) {
|
||||
for (String filter : mFiltersLinks) {
|
||||
if (copyrightLink != null && copyrightLink.contains(filter)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isRecomsGroup(String src) {
|
||||
public static boolean isRecomsGroup(String src){
|
||||
return authorsrecomm() && src.equals("recommended_groups");
|
||||
}
|
||||
|
||||
public static boolean isMusicBlock(String src) {
|
||||
public static boolean isMusicBlock(String src){
|
||||
return authorsrecomm() && (src.equals("recommended_audios") || src.equals("recommended_artists") || src.equals("recommended_playlists"));
|
||||
}
|
||||
|
||||
public static boolean isNewsBlock(String src) {
|
||||
public static boolean isNewsBlock(String src){
|
||||
return ads() && src.equals("tags_suggestions");
|
||||
}
|
||||
|
||||
public static String getAllFilters() {
|
||||
public static String getAllFilters(){
|
||||
return getPrefsValue("spamfilters");
|
||||
}
|
||||
|
||||
public static boolean isBadNews(String text) {
|
||||
public static boolean isBadNews(String text){
|
||||
var textInLowerCase = text.toLowerCase();
|
||||
for (String filter : mFilters) {
|
||||
if (textInLowerCase.contains(filter)) {
|
||||
if (dev())
|
||||
Log.d("VTLite", text);
|
||||
return true;
|
||||
|
||||
if (mFilters != null) {
|
||||
for (String filter : mFilters) {
|
||||
if (textInLowerCase.contains(filter)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", text);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkCaption(JSONObject postJson) {
|
||||
public static boolean checkCaption(JSONObject postJson){
|
||||
if (postJson.has("caption")) {
|
||||
if (captions()) return true;
|
||||
var caption = postJson.optJSONObject("caption");
|
||||
if (postsrecomm()) {
|
||||
try {
|
||||
var type = caption.getString("type");
|
||||
return type.equals("explorebait") || // Может быть интересно
|
||||
type.equals("shared") || // Поделился записью
|
||||
type.equals("digest") || // Рекомедации
|
||||
type.equals("commented") || // Комментирует
|
||||
type.equals("voted"); // Проголосовал в опросе
|
||||
String type;
|
||||
if (caption != null) {
|
||||
type = caption.getString("type");
|
||||
return type.equals("explorebait") || // Может быть интересно
|
||||
type.equals("shared") || // Поделился записью
|
||||
type.equals("digest") || // Рекомедации
|
||||
type.equals("commented") || // Комментирует
|
||||
type.equals("voted"); // Проголосовал в опросе
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Log.d("checkCaption", "Caption error");
|
||||
}
|
||||
@@ -169,29 +203,29 @@ public class NewsFeedFiltersUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isAds(String optString) {
|
||||
public static boolean isAds(String optString){
|
||||
return ads() && (optString.equals("ads_easy_promote") ||
|
||||
optString.equals("promo_button") ||
|
||||
optString.equals("app_widget") ||
|
||||
optString.equals("ads"));
|
||||
}
|
||||
|
||||
public static boolean isAuthorRecommendations(String optString) {
|
||||
public static boolean isAuthorRecommendations(String optString){
|
||||
return authorsrecomm() && optString.equals("authors_rec");
|
||||
}
|
||||
|
||||
public static boolean isPostRecommendations(String optString) {
|
||||
public static boolean isPostRecommendations(String optString){
|
||||
return postsrecomm() && (optString.equals("live_recommended") ||
|
||||
optString.equals("inline_user_rec"));
|
||||
}
|
||||
|
||||
public static boolean isFriendsRecommendations(String optString) {
|
||||
public static boolean isFriendsRecommendations(String optString){
|
||||
return friendsrecomm() && (optString.equals("user_rec") ||
|
||||
optString.equals("friends_recommendations") ||
|
||||
optString.equals("friends_recomm"));
|
||||
}
|
||||
|
||||
public static boolean isGroupAds(JSONObject obj) {
|
||||
public static boolean isGroupAds(JSONObject obj){
|
||||
return adsgroup() && obj.optInt("marked_as_ads", 0) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static java.lang.Long.MAX_VALUE;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.setProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.getInstance;
|
||||
import static ru.vtosters.lite.utils.DeletedMessagesHandler.reloadMessagesList;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.setProxy;
|
||||
import static ru.vtosters.lite.utils.SignatureChecker.validateAppSignature;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.isDarkTheme;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.isPrometheus;
|
||||
@@ -18,13 +15,12 @@ import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Environment;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.vtosters.lite.data.Users;
|
||||
import com.vtosters.lite.fragments.SettingsListFragment;
|
||||
|
||||
import java.io.File;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.VTSettings;
|
||||
@@ -34,19 +30,16 @@ public class Preferences {
|
||||
public static String VERSIONNAME = "Beta";
|
||||
|
||||
public static void init(Application application) throws Exception {
|
||||
setupFilters();
|
||||
GmsUtils.fixGapps();
|
||||
setProxy();
|
||||
reloadMessagesList();
|
||||
LifecycleUtils.registerActivities(application);
|
||||
getInstance().autoCleaningCache();
|
||||
} // VK Init
|
||||
|
||||
public static void forceOffline() {
|
||||
setupFilters();
|
||||
getInstance().autoCleaningCache();
|
||||
edit().putBoolean("isdark", isDarkTheme()).commit();
|
||||
|
||||
setupFilters();
|
||||
|
||||
if (setoffline() && offline()) {
|
||||
Users.a();
|
||||
}
|
||||
@@ -68,7 +61,7 @@ public class Preferences {
|
||||
}
|
||||
|
||||
public static boolean systemtheme() {
|
||||
return false; //getBoolValue("systemtheme", true) && VERSION.SDK_INT >= 28;
|
||||
return Build.VERSION.SDK_INT >= 28 && getBoolValue("systemtheme", true);
|
||||
}
|
||||
|
||||
public static boolean authorsrecomm() {
|
||||
@@ -204,14 +197,6 @@ public class Preferences {
|
||||
return getBoolValue("milkshake", true);
|
||||
}
|
||||
|
||||
public static boolean musicnewcatalog() {
|
||||
return getBoolValue("musicnewcatalog", true);
|
||||
}
|
||||
|
||||
public static boolean videonewcatalog() {
|
||||
return getBoolValue("videonewcatalog", true);
|
||||
}
|
||||
|
||||
public static boolean postsredesign() {
|
||||
return getBoolValue("postsredesign", true);
|
||||
}
|
||||
@@ -331,7 +316,7 @@ public class Preferences {
|
||||
}
|
||||
|
||||
public static boolean checkupdates() {
|
||||
return getBoolValue("checkupdates", true) && isValidSignature();
|
||||
return !getBoolValue("isRoamingState", false) && isValidSignature();
|
||||
}
|
||||
|
||||
public static boolean isValidSignature() {
|
||||
@@ -382,28 +367,4 @@ public class Preferences {
|
||||
}
|
||||
return origquality;
|
||||
}
|
||||
|
||||
public static File getDownloadsDir() {
|
||||
return new File(getPreferences().getString(
|
||||
"downloads_directory",
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath()));
|
||||
}
|
||||
|
||||
public static File getPhotosDir() {
|
||||
return new File(getPreferences().getString(
|
||||
"photos_directory",
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath()));
|
||||
}
|
||||
|
||||
public static File getVideosDir() {
|
||||
return new File(getPreferences().getString(
|
||||
"videos_directory",
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath()));
|
||||
}
|
||||
|
||||
public static File getMusicDir() {
|
||||
return new File(getPreferences().getString(
|
||||
"music_directory",
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.hooks.DateHook.getLocale;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.About.getBuildNumber;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.vksans;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isApiProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.isDarkTheme;
|
||||
|
||||
public class SSFSUtils {
|
||||
@@ -39,7 +39,7 @@ public class SSFSUtils {
|
||||
}
|
||||
|
||||
public static String getUserProxy() {
|
||||
return isApiProxyEnabled() ? "1" : "0";
|
||||
return isAnyProxyEnabled() ? "1" : "0";
|
||||
}
|
||||
|
||||
public static String isVKSansEnabled() {
|
||||
|
||||
@@ -3,7 +3,6 @@ package ru.vtosters.lite.utils;
|
||||
import static android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
import static ru.vtosters.lite.hooks.VKUIHook.isLoaded;
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaper;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getCenterScreenCoords;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
@@ -12,14 +11,12 @@ import static ru.vtosters.lite.utils.Preferences.color_grishka;
|
||||
import static ru.vtosters.lite.utils.Preferences.dockbar_accent;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.navbar;
|
||||
import static ru.vtosters.lite.utils.Preferences.systemtheme;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
@@ -384,34 +381,6 @@ public class ThemesUtils {
|
||||
);
|
||||
}
|
||||
|
||||
public static void systemThemeChanger(Activity activity) { // ded
|
||||
boolean isDarkTheme = isDarkTheme();
|
||||
|
||||
if (!isDarkTheme) {
|
||||
applyTheme(getDarkTheme());
|
||||
} else {
|
||||
applyTheme(getLightTheme());
|
||||
}
|
||||
|
||||
if (!systemtheme()) {
|
||||
edit().putBoolean("isdark", isDarkTheme).commit();
|
||||
return;
|
||||
}
|
||||
|
||||
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
switch (currentNightMode) {
|
||||
case Configuration.UI_MODE_NIGHT_UNDEFINED:
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
edit().putBoolean("isdark", false).commit();
|
||||
setTheme(getLightTheme(), activity);
|
||||
break;
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
edit().putBoolean("isdark", true).commit();
|
||||
setTheme(getDarkTheme(), activity);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void getCurrentThemeID(VKTheme paramVKTheme) {
|
||||
Preference.b("vk_theme_helper", "current_theme", paramVKTheme.getId());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getOauth;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class VKMeHandler{
|
||||
public static void getVkMeToken(String username, String password){
|
||||
makeRequest("https://" +
|
||||
getOauth() +
|
||||
"/token?" +
|
||||
"grant_type=password&client_id=6146827&client_secret=qVxWRF1CwHERuIrKBnqe&username=" +
|
||||
username +
|
||||
"&password=" +
|
||||
password +
|
||||
"&v=5.131&2fa_supported=1",
|
||||
response -> {
|
||||
try {
|
||||
JSONObject mainJson = new JSONObject(response);
|
||||
|
||||
if (mainJson.has("redirect_uri")){
|
||||
String redirect_uri = mainJson.getString("redirect_uri");
|
||||
// TODO open redirect_uri and get token
|
||||
} else if (mainJson.has("access_token")){
|
||||
setToken(mainJson.getString("access_token"));
|
||||
} else if (mainJson.has("error_description")){
|
||||
Log.d("VKMeHandler", mainJson.getString("error_description"));
|
||||
sendToast("Ошибка входа: " + mainJson.getString("error_description"));
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
Log.d("VKMeHandler", e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void setToken(String token){
|
||||
edit().putString("vkmetoken", token).commit();
|
||||
}
|
||||
|
||||
public static void removeToken(){
|
||||
edit().remove("vkmetoken").commit();
|
||||
}
|
||||
|
||||
public static String getToken(){
|
||||
return getPrefsValue("vkmetoken");
|
||||
}
|
||||
|
||||
public static void setPrivacyStatus(String status){
|
||||
// all, friends_and_contacts, only_me
|
||||
makeRequest("https://" + getApi() + "/method/account.setPrivacy?" + "v=5.140&key=online&value=" + status + "&https=1&access_token=" + getToken(),
|
||||
response -> {
|
||||
try {
|
||||
JSONObject mainJson = new JSONObject(response);
|
||||
} catch (JSONException e) {
|
||||
Log.d("VKMeHandler", e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void getPrivacyStatus(){
|
||||
makeRequest("https://" + getApi() + "/method/execute?v=5.140&code=return API.account.getPrivacySettings().settings[22].value.category;&access_token=" + getToken(),
|
||||
response -> {
|
||||
try {
|
||||
String resp = new JSONObject(response).optString("response");
|
||||
|
||||
switch (resp){ // TODO make support for privacy
|
||||
case "all":
|
||||
case "friends_and_contacts":
|
||||
case "friends":
|
||||
case "only_me":
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
Log.d("VKMeHandler", e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class VTVerifications {
|
||||
public static void load(Context context) {
|
||||
var prefs = context.getSharedPreferences("vt_another_data", 0);
|
||||
|
||||
if (!NetworkUtils.isNetworkConnected() && prefs.contains("ids")) {
|
||||
if ((!NetworkUtils.isNetworkConnected() || getBoolValue("isRoamingState", false)) && prefs.contains("ids")) {
|
||||
parseJson(prefs.getString("ids", "[]"));
|
||||
return;
|
||||
}
|
||||
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
RED='\033[31m'
|
||||
GREEN='\033[92m'
|
||||
NC='\033[0m'
|
||||
BOLD='\033[1m'
|
||||
UNDERLINE='\033[4m'
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Сборка apk..${NC}"
|
||||
cd ../smali/
|
||||
java -jar ../scripts/apktool.jar b . -o VTLite.apk --use-aapt2 -p ../scripts/framework/
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}Успех!${NC}\n"
|
||||
else
|
||||
echo -e "${RED}Провал.${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Распаковка dex'ов..${NC}"
|
||||
unzip -j VTLite.apk classes.dex classes2.dex classes3.dex classes4.dex classes5.dex -d ../app/libs
|
||||
|
||||
cd ../app/libs
|
||||
echo -e "${BOLD}${UNDERLINE}Удаление старых библиотек..${NC}"
|
||||
rm -r *.jar
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Сборка новых библиотек..${NC}"
|
||||
d2j-dex2jar classes*
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Удаляем говно..${NC}"
|
||||
rm -r *.dex
|
||||
+72
-26
@@ -194,7 +194,7 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.vtosters.lite.MainActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
|
||||
android:finishOnTaskLaunch="true"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
@@ -960,6 +960,17 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="vk.ru"
|
||||
android:pathPattern="/.*"
|
||||
android:scheme="http" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="vk.com"
|
||||
android:pathPattern="/.*"
|
||||
@@ -971,28 +982,6 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="vkontakte.ru"
|
||||
android:pathPattern="/.*"
|
||||
android:scheme="http" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="new.vk.com"
|
||||
android:pathPattern="/.*"
|
||||
android:scheme="http" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="vk.com"
|
||||
android:pathPattern="/.*"
|
||||
@@ -1007,6 +996,28 @@
|
||||
<data
|
||||
android:host="vkontakte.ru"
|
||||
android:pathPattern="/.*"
|
||||
android:scheme="http" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="new.vk.ru"
|
||||
android:pathPattern="/.*"
|
||||
android:scheme="http" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="vk.ru"
|
||||
android:pathPattern="/.*"
|
||||
android:scheme="https" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
@@ -1016,7 +1027,18 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="new.vk.com"
|
||||
android:host="vkontakte.ru"
|
||||
android:pathPattern="/.*"
|
||||
android:scheme="https" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="new.vk.ru"
|
||||
android:pathPattern="/.*"
|
||||
android:scheme="https" />
|
||||
</intent-filter>
|
||||
@@ -1107,6 +1129,30 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
||||
<data
|
||||
android:host="m.vk.ru"
|
||||
android:pathPattern="/.*"
|
||||
android:scheme="http" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
||||
<data
|
||||
android:host="m.vk.ru"
|
||||
android:pathPattern="/.*"
|
||||
android:scheme="https" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
|
||||
<data
|
||||
android:host="m.vk.com"
|
||||
@@ -1132,7 +1178,7 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="m.vk.com"
|
||||
android:host="m.vk.ru"
|
||||
android:pathPattern="/restore"
|
||||
android:scheme="http" />
|
||||
</intent-filter>
|
||||
@@ -1143,7 +1189,7 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="m.vk.com"
|
||||
android:host="m.vk.ru"
|
||||
android:pathPattern="/restore"
|
||||
android:scheme="https" />
|
||||
</intent-filter>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
appscent
|
||||
//t.me/
|
||||
vk.com
|
||||
vk.ru
|
||||
apps-cent
|
||||
app-cent
|
||||
appcent
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:opacity="opaque">
|
||||
<item android:drawable="@color/iclauncher" />
|
||||
<item>
|
||||
<nine-patch android:src="@drawable/bg_splash_screen_tablet" />
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/vtlogo" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -24,10 +24,6 @@
|
||||
android:id="@id/menu_stickers"
|
||||
android:icon="@drawable/ic_smile_outline_28"
|
||||
android:title="@string/stickers" />
|
||||
<item
|
||||
android:id="@id/menu_shopping"
|
||||
android:icon="@drawable/ic_market_24_white"
|
||||
android:title="@string/sc_catalog_title" />
|
||||
<item
|
||||
android:id="@id/menu_lives"
|
||||
android:icon="@drawable/ic_live_24"
|
||||
|
||||
@@ -40,10 +40,6 @@
|
||||
android:id="@id/menu_stickers"
|
||||
android:icon="@drawable/ic_smile_outline_28"
|
||||
android:title="@string/stickers" />
|
||||
<item
|
||||
android:id="@id/menu_shopping"
|
||||
android:icon="@drawable/ic_market_24_white"
|
||||
android:title="@string/sc_catalog_title" />
|
||||
<item
|
||||
android:id="@id/menu_lives"
|
||||
android:icon="@drawable/ic_live_filter_24dp"
|
||||
|
||||
@@ -40,10 +40,6 @@
|
||||
android:id="@id/menu_stickers"
|
||||
android:icon="@drawable/ic_smile_outline_28"
|
||||
android:title="@string/stickers" />
|
||||
<item
|
||||
android:id="@id/menu_shopping"
|
||||
android:icon="@drawable/ic_market_outline_28"
|
||||
android:title="@string/sc_catalog_title" />
|
||||
<item
|
||||
android:id="@id/menu_lives"
|
||||
android:icon="@drawable/ic_live_outline_28"
|
||||
|
||||
@@ -552,8 +552,6 @@
|
||||
<item>Fade</item>
|
||||
<item>AndroidX</item>
|
||||
<item>Слайд</item>
|
||||
<item>Системный</item>
|
||||
<item>Системный (task)</item>
|
||||
</string-array>
|
||||
<string-array name="animations">
|
||||
<item>Без анимации</item>
|
||||
|
||||
@@ -5414,7 +5414,7 @@
|
||||
<string name="gms_download_microg">Скачать MicroG</string>
|
||||
<string name="gms_what_to_do_next">Что делать дальше?</string>
|
||||
<string name="gms_what_to_do_after_microg_title">Что делать после установки MicroG?</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">Обновите регистрацию Firebase в настройках в разделе "Другое"</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">1. Войдите в свой Google аккаунт \n2. Разрешите VTLite получать уведомления\n3. Обновите регистрацию Firebase в настройках в разделе "Другое"</string>
|
||||
<string name="donate">Помочь проекту</string>
|
||||
<string name="fulltime">dd MMMM yyyy в HH:mm:ss</string>
|
||||
<string name="fulltime2">dd MMMM в HH:mm:ss</string>
|
||||
@@ -5433,7 +5433,7 @@
|
||||
<string name="vtlfeedwork">Прочее</string>
|
||||
<string name="vtlfeedreload">Автоматическое обновление ленты</string>
|
||||
<string name="vtlfeedcache">Кешировать посты в ленте</string>
|
||||
<string name="vtlrecommendmark">Отключить посты с пометкой рекомендовано</string>
|
||||
<string name="vtlrecommendmark">Отключить посты с пометкой</string>
|
||||
<string name="vtlmsgtails">Хвосты сообщений</string>
|
||||
<string name="vtlmsgflat">Плоские сообщения</string>
|
||||
<string name="vtlupdmsg">Обновить</string>
|
||||
@@ -5525,8 +5525,6 @@
|
||||
<string name="lastfm_enabled_summ">Полезный сервис по учету прослушивания песен</string>
|
||||
<string name="lastfm_credentials_empty">Логин или пароль не заданы</string>
|
||||
<string name="vtl_music_settings">Музыка</string>
|
||||
<string name="musicnewcatalog_title">Новый раздел музыки</string>
|
||||
<string name="musicnewcatalog_summ">Новый каталог музыкального раздела с динамическим контентом</string>
|
||||
<string name="musicdefcatalog_dialogTitle">Выберите раздел по умолчанию</string>
|
||||
<string name="musicdefcatalog_title">Раздел музыки по умолчанию</string>
|
||||
<string name="vtl_video_settings">Видео</string>
|
||||
@@ -5591,8 +5589,6 @@
|
||||
<string name="otaupd">Обновить</string>
|
||||
<string name="otaupdavalible">Доступно обновление!</string>
|
||||
<string name="otaupdchanges">Список изменений</string>
|
||||
<string name="otawarning">Внимание!</string>
|
||||
<string name="otawarnwait">Пожалуйста, не закрывайте приложение до окончания загрузки обновления</string>
|
||||
<string name="privacy_vtl">Приватность</string>
|
||||
<string name="proxyadvsettings">Расширенные настройки прокси</string>
|
||||
<string name="proxyapi">API Домен</string>
|
||||
@@ -5600,7 +5596,6 @@
|
||||
<string name="proxydonate">Донат</string>
|
||||
<string name="proxyhttp">HTTP Прокси</string>
|
||||
<string name="proxyhttps">HTTPS Прокси</string>
|
||||
<string name="proxyimpinfo">Внимание!</string>
|
||||
<string name="proxyimpinfosum">"Не используйте прокси если ВК не заблокирован в вашей стране
|
||||
|
||||
Для применения изменений необходимо перезапустить приложение"</string>
|
||||
@@ -5654,7 +5649,6 @@
|
||||
<string name="screenshotdetect_summ">Отключить уведомление о том, что вы сделали скриншот</string>
|
||||
<string name="hideDeviceInfo_title">Отключить отправку метрики</string>
|
||||
<string name="hideDeviceInfo_summ">Отключить отправку информации об устройстве пользователя и вашем местоположении</string>
|
||||
<string name="newadblock_title">Использовать новый AdBlock (Beta)</string>
|
||||
<string name="podcastcatalog_title">Добавить каталог подкастов</string>
|
||||
<string name="useNewSettings_title">Использовать новые настройки</string>
|
||||
<string name="musicFixNew_title">Фикс музыки v2</string>
|
||||
@@ -5749,7 +5743,6 @@
|
||||
<string name="activity_dnw_summary">Функция позволяет вам не отправлять статус вашего набора/написания сообщения</string>
|
||||
<string name="activity_dns_summary">Функция позволяет вам не отправлять статус просмотра вами историй</string>
|
||||
|
||||
<string name="activity_dnr_warn">Внимание!</string>
|
||||
<string name="activity_dnr_visual">Визуально может работать некорректно (сообщение прочиталось локально), но у собеседника оно прочитано не будет</string>
|
||||
|
||||
<string name="activity_undel">Анти-удаление сообщений</string>
|
||||
@@ -5793,7 +5786,7 @@
|
||||
|
||||
<string name="debug_no_toggles">Значения toggles не были получены с сервера</string>
|
||||
|
||||
<string name="debug_warning">Внимание!</string>
|
||||
<string name="warning">Внимание!</string>
|
||||
<string name="debug_warning_summary">Данное меню предназначено только для тестирования работоспособности приложения. Если вы являетесь рядовым юзером, то вам не следует ничего не трогать в данных настройках (пожалуйста)</string>
|
||||
<string name="debug_show_settings_item">Показывать пункт дебага в настройках</string>
|
||||
|
||||
@@ -5891,7 +5884,7 @@
|
||||
<string name="DNR_ON">Включить нечиталку</string>
|
||||
<string name="DNR_OFF">Отключить нечиталку</string>
|
||||
|
||||
<string name="vtl_crashed">Произошла ошибка в работе Vtosters!</string>
|
||||
<string name="vtl_crashed">Произошла ошибка в работе VTLite!</string>
|
||||
<string name="vtl_crash_upload">Загрузить логи</string>
|
||||
<string name="vtl_crash_save">Сохранить в файл</string>
|
||||
|
||||
@@ -5960,6 +5953,8 @@
|
||||
|
||||
<string name="download_mp3">Скачать как mp3</string>
|
||||
<string name="remove_from_cache">Удалить из кеша</string>
|
||||
<string name="play_in_vkx">Воспроизвести в VK X</string>
|
||||
|
||||
|
||||
<string name="thanksfordonate">Спасибо тебе за поддержку проекта!</string>
|
||||
<string name="getdonate">Поддержи проект донатом и получи бонусы</string>
|
||||
@@ -6169,4 +6164,25 @@
|
||||
<string name="denial_of_responsibility_proxy_summ">Разработчики клиента VTLite не несут никакой ответственности за работу и безопасность использования сторонних прокси-серверов \n\nИспользуйте на свой страх и риск</string>
|
||||
|
||||
<string name="altervika_title">Альтернативный домен VikaMobile</string>
|
||||
|
||||
<string name="proxy_setup_title">Установить прокси</string>
|
||||
<string name="proxy_setup_summ">Получение стороннего прокси из поддерживаемых списков прокси</string>
|
||||
<string name="proxy_setup_success">Прокси установлен, хост:</string>
|
||||
|
||||
<string name="delete_elements_confirm">Вы действительно хотите удалить все элементы из списка?</string>
|
||||
<string name="elements_deleted_success">Список элементов успешно очищен</string>
|
||||
<string name="get_proxy_error">Ошибка при получении прокси</string>
|
||||
|
||||
<string name="add_to_filter_whitelist">Добавить в вайтлист фильтров</string>
|
||||
<string name="remove_from_filter_whitelist">Удалить из вайтлиста фильтров</string>
|
||||
<string name="add_to_ads_whitelist">Добавить в вайтлист рекламы</string>
|
||||
<string name="remove_from_ads_whitelist">Удалить из вайтлиста рекламы</string>
|
||||
<string name="removed_from_whitelist_success">Группа удалена из вайтлиста</string>
|
||||
<string name="added_to_whitelist_success">Группа добавлена в вайтлист</string>
|
||||
|
||||
<string name="whitelisted_ad_groups_title">Вайтлист рекламы</string>
|
||||
<string name="whitelisted_filters_groups_title">Вайтлист фильтров</string>
|
||||
|
||||
<string name="download_dl">Скачать диалог</string>
|
||||
<string name="download_dl_error">Произошла ошибка при попытке скачать диалог</string>
|
||||
</resources>
|
||||
@@ -27,7 +27,6 @@
|
||||
<item name="android:windowBackground">@drawable/bg_splash</item>
|
||||
<item name="android:navigationBarColor">@color/gray_20</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
</style>
|
||||
|
||||
<style name="StoryDialog" parent="@style/Theme.AppCompat.Light.Dialog">
|
||||
@@ -43,7 +42,6 @@
|
||||
<item name="android:navigationBarColor">@android:color/black</item>
|
||||
<item name="android:windowElevation">0.0px</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="android:windowLightNavigationBar">false</item>
|
||||
</style>
|
||||
|
||||
<style name="VkLightStyle.WhiteToolbar" parent="@style/VkLightStyle">
|
||||
@@ -64,7 +62,6 @@
|
||||
<item name="android:windowBackground">@drawable/bg_splash_screen_me</item>
|
||||
<item name="android:navigationBarColor">@color/black</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="android:windowLightNavigationBar">false</item>
|
||||
<item name="im_bg_modal_dialog">@drawable/bg_modal_dialog</item>
|
||||
<item name="im_btn_accept_background">@color/azure_300_alpha10</item>
|
||||
<item name="im_btn_accept_background_dark">@color/azure_300_alpha15</item>
|
||||
@@ -91,7 +88,6 @@
|
||||
<item name="android:windowBackground">@drawable/bg_splash_screen_me</item>
|
||||
<item name="android:navigationBarColor">@color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
<item name="im_bg_modal_dialog">@drawable/list_dialog_bg</item>
|
||||
<item name="im_btn_accept_background">@color/azure_300_alpha10</item>
|
||||
<item name="im_btn_accept_background_dark">@color/azure_300_alpha15</item>
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<item name="im_ic_voip_call_video">@drawable/vkui_ic_voip_call_video_24</item>
|
||||
<item name="im_ic_write_msg">@drawable/ic_add_24</item>
|
||||
<item name="im_ic_msgreload">@drawable/ic_camera_switch_48</item>
|
||||
<item name="im_ic_msgdl">@drawable/ic_download_24</item>
|
||||
<item name="im_msg_avatar_margin_top">1.0dip</item>
|
||||
<item name="im_msg_box_margin_start_no_avatar">6.0dip</item>
|
||||
<item name="im_msg_box_margin_start_with_avatar">6.0dip</item>
|
||||
@@ -234,6 +235,7 @@
|
||||
<item name="im_ic_voip_call_video">@drawable/ic_videocam_28_outline</item>
|
||||
<item name="im_ic_write_msg">@drawable/ic_add_24</item>
|
||||
<item name="im_ic_msgreload">@drawable/ic_camera_switch_48</item>
|
||||
<item name="im_ic_msgdl">@drawable/ic_download_24</item>
|
||||
<item name="im_msg_avatar_margin_top">3.0dip</item>
|
||||
<item name="im_msg_box_margin_start_no_avatar">0.0dip</item>
|
||||
<item name="im_msg_box_margin_start_with_avatar">8.0dip</item>
|
||||
|
||||
@@ -673,16 +673,12 @@
|
||||
<item>Fade</item>
|
||||
<item>AndroidX</item>
|
||||
<item>Slide</item>
|
||||
<item>System</item>
|
||||
<item>System task</item>
|
||||
</string-array>
|
||||
<string-array name="animations_values2">
|
||||
<item>noanim</item>
|
||||
<item>frag_fade</item>
|
||||
<item>frag_enter</item>
|
||||
<item>slide</item>
|
||||
<item>system</item>
|
||||
<item>system_task</item>
|
||||
</string-array>
|
||||
<string-array name="language">
|
||||
<item>System</item>
|
||||
@@ -741,7 +737,7 @@
|
||||
<item>liked</item>
|
||||
</string-array>
|
||||
<string-array name="proxy">
|
||||
<item>No Proxy</item>
|
||||
<item>No proxy</item>
|
||||
<item>zaborona.help</item>
|
||||
<item>VikaMobile</item>
|
||||
<item>Random proxy</item>
|
||||
|
||||
@@ -2509,4 +2509,5 @@
|
||||
<attr name="yesNoPreferenceStyle" format="reference" />
|
||||
<attr name="zOrderOnTop" format="boolean" />
|
||||
<attr name="im_ic_msgreload" format="reference" />
|
||||
<attr name="im_ic_msgdl" format="reference" />
|
||||
</resources>
|
||||
|
||||
@@ -3914,4 +3914,5 @@
|
||||
<item name="btncopyid" type="id" />
|
||||
<item name="download_video" type="id" />
|
||||
<item name="savedmsg" type="id" />
|
||||
<item name="play_in_vkx" type="id" />
|
||||
</resources>
|
||||
|
||||
@@ -5548,7 +5548,7 @@ Filters are not case-sensitive!"</string>
|
||||
<string name="gms_download_microg">Download MicroG</string>
|
||||
<string name="gms_what_to_do_next">What to do next?</string>
|
||||
<string name="gms_what_to_do_after_microg_title">What to do after installing MicroG?</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">Update Firebase registration in Other settings</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">1. Log in to your Google account \n2. Allow VTLite to receive notifications\n3. Update Firebase registration in Other settings</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="fulltime">dd MMMM yyyy HH:mm:ss</string>
|
||||
<string name="fulltime2">dd MMMM HH:mm:ss</string>
|
||||
@@ -5567,7 +5567,7 @@ Does not affect vk.cc links"</string>
|
||||
<string name="vtlfeedwork">Other</string>
|
||||
<string name="vtlfeedreload">Automatic feed update</string>
|
||||
<string name="vtlfeedcache">Cache feed posts</string>
|
||||
<string name="vtlrecommendmark">Disable posts with recommended mark</string>
|
||||
<string name="vtlrecommendmark">Disable posts with mark</string>
|
||||
<string name="vtlmsgtails">Message tails</string>
|
||||
<string name="vtlmsgflat">Flat Messages</string>
|
||||
<string name="vtlupdmsg">Update</string>
|
||||
@@ -5659,8 +5659,6 @@ Expand text..."</string>
|
||||
<string name="lastfm_enabled_summ">Useful song tracking service</string>
|
||||
<string name="lastfm_credentials_empty">Username or password not set</string>
|
||||
<string name="vtl_music_settings">Music</string>
|
||||
<string name="musicnewcatalog_title">New music catalog</string>
|
||||
<string name="musicnewcatalog_summ">New music catalog with dynamic content</string>
|
||||
<string name="musicdefcatalog_dialogTitle">Select default section</string>
|
||||
<string name="musicdefcatalog_title">Default music section</string>
|
||||
<string name="vtl_video_settings">Video</string>
|
||||
@@ -5725,8 +5723,6 @@ Expand text..."</string>
|
||||
<string name="otaupd">Update</string>
|
||||
<string name="otaupdavalible">Update available!</string>
|
||||
<string name="otaupdchanges">Changelog</string>
|
||||
<string name="otawarning">Warning!</string>
|
||||
<string name="otawarnwait">"Please don't close the app until the end of the update download"</string>
|
||||
<string name="privacy_vtl">Privacy</string>
|
||||
<string name="proxyadvsettings">Advanced proxy settings</string>
|
||||
<string name="proxyapi">API Domain</string>
|
||||
@@ -5734,7 +5730,6 @@ Expand text..."</string>
|
||||
<string name="proxydonate">Donate</string>
|
||||
<string name="proxyhttp">HTTP Proxy</string>
|
||||
<string name="proxyhttps">HTTPS Proxy</string>
|
||||
<string name="proxyimpinfo">Warning!</string>
|
||||
<string name="proxyimpinfosum">"Don't use proxy if VK is available in your country
|
||||
|
||||
You need to restart the application to apply proxy settings"</string>
|
||||
@@ -5788,7 +5783,6 @@ You need to restart the application to apply proxy settings"</string>
|
||||
<string name="screenshotdetect_summ">Turn off the notification that you took a screenshot</string>
|
||||
<string name="hideDeviceInfo_title">Disable sending metric</string>
|
||||
<string name="hideDeviceInfo_summ">Disable sending information about the user\'s device and your location</string>
|
||||
<string name="newadblock_title">Use new AdBlock (Beta)</string>
|
||||
<string name="podcastcatalog_title">Add podcast catalog</string>
|
||||
<string name="useNewSettings_title">Use new settings</string>
|
||||
<string name="musicFixNew_title">Music fix v2</string>
|
||||
@@ -5882,7 +5876,6 @@ May look like a fake leaving the online"</string>
|
||||
<string name="activity_dnw_summary">Function lets you don\'t send write message status</string>
|
||||
<string name="activity_dns_summary">Function lets you don\'t send read stories status</string>
|
||||
|
||||
<string name="activity_dnr_warn">Warning!</string>
|
||||
<string name="activity_dnr_visual">Visually may not work correctly (locally read), but companion will see that it wasn\'t read.</string>
|
||||
|
||||
<string name="activity_undel">Anti-delete messages</string>
|
||||
@@ -5925,7 +5918,7 @@ May look like a fake leaving the online"</string>
|
||||
|
||||
<string name="checkforupdates">Check for updates</string>
|
||||
|
||||
<string name="debug_warning">Warning!</string>
|
||||
<string name="warning">Warning!</string>
|
||||
<string name="debug_warning_summary">These options are for testing this app only. If you are a regular user, please, don\'t use them</string>
|
||||
<string name="debug_show_settings_item">Show debug category in settings</string>
|
||||
|
||||
@@ -6029,7 +6022,7 @@ May look like a fake leaving the online"</string>
|
||||
<string name="DNR_ON">Enable Do Not Read</string>
|
||||
<string name="DNR_OFF">Disable Do Not Read</string>
|
||||
|
||||
<string name="vtl_crashed">An error has occurred in VTL!</string>
|
||||
<string name="vtl_crashed">An error has occurred in VTLite!</string>
|
||||
<string name="vtl_crash_upload">Upload logs</string>
|
||||
<string name="vtl_crash_save">Save to local file</string>
|
||||
|
||||
@@ -6096,6 +6089,8 @@ May look like a fake leaving the online"</string>
|
||||
<string name="download_mp3">Download as mp3</string>
|
||||
<string name="remove_from_cache">Delete from cache</string>
|
||||
|
||||
<string name="play_in_vkx">Play the track in VK X</string>
|
||||
|
||||
<string name="thanksfordonate">Thank you for supporting the project!</string>
|
||||
<string name="getdonate">Support the project with a donation and get rewards</string>
|
||||
|
||||
@@ -6307,4 +6302,25 @@ May look like a fake leaving the online"</string>
|
||||
<string name="denial_of_responsibility_proxy_summ">The developers of the VTLite client assume no responsibility for the safety of using third-party proxies \n\nUse at your own risk</string>
|
||||
|
||||
<string name="altervika_title">Alternative VikaMobile domain</string>
|
||||
|
||||
<string name="proxy_setup_title">Set proxy</string>
|
||||
<string name="proxy_setup_summ">Getting a third party proxy from supported proxy lists</string>
|
||||
<string name="proxy_setup_success">Proxy set up, host:</string>
|
||||
|
||||
<string name="delete_elements_confirm">Are you sure you want to delete all elements from the list?</string>
|
||||
<string name="elements_deleted_success">Element list cleared successfully</string>
|
||||
<string name="get_proxy_error">An error occurred while getting the proxy</string>
|
||||
|
||||
<string name="add_to_filter_whitelist">Add to filters whitelist</string>
|
||||
<string name="remove_from_filter_whitelist">Remove from filters whitelist</string>
|
||||
<string name="add_to_ads_whitelist">Add to ads whitelist</string>
|
||||
<string name="remove_from_ads_whitelist">Remove from ads whitelist</string>
|
||||
<string name="removed_from_whitelist_success">Group removed from whitelist</string>
|
||||
<string name="added_to_whitelist_success">Group added to whitelist</string>
|
||||
|
||||
<string name="whitelisted_ad_groups_title">Ads whitelist</string>
|
||||
<string name="whitelisted_filters_groups_title">Filters whitelist</string>
|
||||
|
||||
<string name="download_dl">Download dialog</string>
|
||||
<string name="download_dl_error">An error occurred while trying to download the dialog</string>
|
||||
</resources>
|
||||
|
||||
@@ -5176,6 +5176,7 @@
|
||||
<item name="im_ic_voip_call_video">@drawable/vkui_ic_voip_call_video_24</item>
|
||||
<item name="im_ic_write_msg">@drawable/ic_add_24</item>
|
||||
<item name="im_ic_msgreload">@drawable/ic_camera_switch_48</item>
|
||||
<item name="im_ic_msgdl">@drawable/ic_download_24</item>
|
||||
<item name="im_msg_avatar_margin_top">1.0dip</item>
|
||||
<item name="im_msg_box_margin_start_no_avatar">6.0dip</item>
|
||||
<item name="im_msg_box_margin_start_with_avatar">6.0dip</item>
|
||||
@@ -6809,6 +6810,7 @@
|
||||
<item name="im_ic_voip_call_video">@drawable/ic_videocam_28_outline</item>
|
||||
<item name="im_ic_write_msg">@drawable/ic_add_24</item>
|
||||
<item name="im_ic_msgreload">@drawable/ic_camera_switch_48</item>
|
||||
<item name="im_ic_msgdl">@drawable/ic_download_24</item>
|
||||
<item name="im_msg_avatar_margin_top">3.0dip</item>
|
||||
<item name="im_msg_box_margin_start_no_avatar">0.0dip</item>
|
||||
<item name="im_msg_box_margin_start_with_avatar">8.0dip</item>
|
||||
@@ -9166,6 +9168,7 @@
|
||||
<item name="im_ic_voip_call_video">@drawable/ic_videocam_28_outline</item>
|
||||
<item name="im_ic_write_msg">@drawable/ic_write_outline_28_new</item>
|
||||
<item name="im_ic_msgreload">@drawable/ic_camera_switch_outline_24</item>
|
||||
<item name="im_ic_msgdl">@drawable/ic_download_outline_28</item>
|
||||
<item name="im_msg_avatar_margin_top">3.0dip</item>
|
||||
<item name="im_msg_box_margin_start_no_avatar">0.0dip</item>
|
||||
<item name="im_msg_box_margin_start_with_avatar">8.0dip</item>
|
||||
@@ -9324,6 +9327,7 @@
|
||||
<item name="im_ic_voip_call_video">@drawable/ic_videocam_28_outline</item>
|
||||
<item name="im_ic_write_msg">@drawable/ic_write_outline_28_new</item>
|
||||
<item name="im_ic_msgreload">@drawable/ic_camera_switch_outline_24</item>
|
||||
<item name="im_ic_msgdl">@drawable/ic_download_outline_28</item>
|
||||
<item name="im_msg_avatar_margin_top">3.0dip</item>
|
||||
<item name="im_msg_box_margin_start_no_avatar">0.0dip</item>
|
||||
<item name="im_msg_box_margin_start_with_avatar">8.0dip</item>
|
||||
@@ -9483,6 +9487,7 @@
|
||||
<item name="im_ic_voip_call_video">@drawable/ic_videocam_28_outline</item>
|
||||
<item name="im_ic_write_msg">@drawable/ic_write_outline_28_new</item>
|
||||
<item name="im_ic_msgreload">@drawable/ic_camera_switch_outline_24</item>
|
||||
<item name="im_ic_msgdl">@drawable/ic_download_outline_28</item>
|
||||
<item name="im_msg_avatar_margin_top">3.0dip</item>
|
||||
<item name="im_msg_box_margin_start_no_avatar">0.0dip</item>
|
||||
<item name="im_msg_box_margin_start_with_avatar">8.0dip</item>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<Preference
|
||||
android:enabled="false"
|
||||
android:summary="@string/activity_dnr_visual"
|
||||
android:title="@string/activity_dnr_warn" />
|
||||
android:title="@string/warning" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="read_pm"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<Preference
|
||||
android:enabled="false"
|
||||
android:summary="@string/debug_warning_summary"
|
||||
android:title="@string/debug_warning" />
|
||||
android:title="@string/warning" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="devmenu"
|
||||
@@ -22,10 +22,6 @@
|
||||
android:key="calls"
|
||||
android:summary="@string/messages_interface_calls_summary"
|
||||
android:title="@string/vtlcalls" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="newadblock"
|
||||
android:title="@string/newadblock_title" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="podcastcatalog"
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
android:key="adsstories"
|
||||
android:summary="@string/feed_ads_stories_summary"
|
||||
android:title="@string/vtldas" />
|
||||
<Preference
|
||||
android:key="whitelisted_ad_groups"
|
||||
android:title="@string/whitelisted_ad_groups_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vtlfilters">
|
||||
<Preference
|
||||
@@ -74,6 +77,9 @@
|
||||
android:key="copyright_post"
|
||||
android:summary="@string/feed_ads_sources_summary"
|
||||
android:title="@string/feed_ads_sources" />
|
||||
<Preference
|
||||
android:key="whitelisted_filters_groups"
|
||||
android:title="@string/whitelisted_filters_groups_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vtlrecommend">
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
@@ -125,5 +131,15 @@
|
||||
<Preference
|
||||
android:key="newsfeedlistmanager_reset"
|
||||
android:title="@string/newsfeedlistmanager_reset_title" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="donotgetads"
|
||||
android:summary="Не запрашивать рекламу и рекомендации\n\nМогуть быть проблемы"
|
||||
android:title="Не пытаться получать рекламу" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="force_disable_psm"
|
||||
android:summary="Включение этой функции скроет информацию о состоянии вашего устройства в режиме экономии батареи и ВКонтакте будет отправлять вам медиаконтент без сильного сжатия и блюра"
|
||||
android:title="Не отправлять информацию о батарее" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user