Compare commits

..
Author SHA1 Message Date
gdlbo 00c1e926e6 Fixed store stickers colors 2022-05-02 12:54:58 +03:00
gdlbo ef8109e2e8 Reworked some about menu 2022-05-02 12:40:57 +03:00
gdlbo 732ee76957 Disabled anim stickers 2022-05-02 12:31:30 +03:00
gdlbo b97d2261de Fixed bug with new feed design 2022-05-02 11:03:39 +03:00
gdlbo c362bfc8da Fixes + new update feed logic 2022-05-02 10:44:57 +03:00
gdlbo cc445e4aea Oh sh*t I am sorry (for refactoring) 2022-05-02 09:44:30 +03:00
gdlbo 4ac83d59b5 Color fixes 2022-04-30 14:25:40 +03:00
gdlbo 5025a5fa94 Refactoring + renaming 2022-04-30 13:48:04 +03:00
gdlbo b8cb19c8db Refactoring + renaming 2022-04-30 13:17:32 +03:00
gdlbo 593153de8f Updated README.md + version null fix 2022-04-29 22:22:07 +03:00
gdlbo 6c36b83d64 Github Actions test 2022-04-29 21:51:56 +03:00
gdlbo 1381fdd3bb Github Actions test 2022-04-29 21:48:08 +03:00
gdlbo f680a37eb1 gh actions test 3 2022-04-29 21:42:51 +03:00
gdlbo 4531b7af52 gh actions test 2 2022-04-29 21:38:24 +03:00
gdlbo 0c4d1af2dc fix 2022-04-29 21:29:20 +03:00
gdlbo d6a18ecca6 gh actions test 2022-04-29 21:27:25 +03:00
gdlbo dc768952c3 Updated README.md 2022-04-29 20:56:14 +03:00
gdlbo 57cdcfcbd1 color fixes 2022-04-29 16:49:30 +03:00
gdlbo fb4837ce40 color fixes 2022-04-28 22:02:35 +03:00
gdlbo b85e1e6937 color fixes 2022-04-28 21:56:54 +03:00
208 changed files with 1728 additions and 1624 deletions
+46
View File
@@ -0,0 +1,46 @@
name: Build VTosters Lite
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: actions/checkout@v2
- name: Download tools
run: |
sudo apt update
sudo apt install default-jre
sudo apt install python3
chmod +x scripts/apktool.jar
chmod +x scripts/apksigner.jar
- name: Build VTLite
run: |
git checkout master
bash scripts/buildworkflow.sh
- name: Sign and verify the apk
run: |
java -jar scripts/apksigner.jar sign --ks scripts/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android smali/VTLite.apk
java -jar scripts/apksigner.jar verify smali/VTLite.apk
- name: Upload apk to artifact
uses: actions/upload-artifact@v2
with:
name: VTLite.apk
path: smali/VTLite.apk
+66 -13
View File
@@ -1,18 +1,78 @@
# VTosters Lite # VTosters Lite
VTosters Lite - это модифицированный клиент ВКонтакте, основанный на версии 5.29 VTosters Lite - это модифицированный клиент (декомпиляция) официального ВКонтакте основанный на версии 5.29
О найденных багах сообщать в [issues](https://github.com/vtosters/lite/issues), просьба не плодить дубликаты, воспользуйтесь поиском перед созданием нового issue О найденных багах сообщать в [issues](https://github.com/vtosters/lite/issues), просьба не плодить дубликаты, воспользуйтесь поиском перед созданием нового issue
Скачивать самые актуальные версии можно с [Actions](https://github.com/vtosters/lite/actions)
Стабильные сборки находятся в [Releases](https://github.com/vtosters/lite/releases)
## Откладка
Для откладки с помощью Android Studio необходимо пройти в `/smali/AndroidManifest.xml`
```
android:debuggable="false" -> android:debuggable="true"
```
Для дополнительной откладки ответов, доп логов и подмены данных для дебаг приложения необходимо включить **Режим разработчика**
```
Настройки -> Для разработчиков -> Режим разработчика
```
Для просмотра трафика необходимо отключить функцию **SSL Pinning**
```
Настройки -> Для разработчиков -> SSL Pinning
```
Для логгирования внутренних запросов к API необходимо включить функции **Логгирование API**
(Работает только при использовании внутреннего логгера!)
```
Настройки -> Для разработчиков -> Логгирование API
```
Для использования внутреннего логгера необходимо включить функции **Запись логов в файл**
```
Настройки -> Для разработчиков -> Запись логов в файл
```
Сразу после нажатия на запись аппа начнет записывать **все действия** в файлы по пути
```
/VK/logs/com.vtosters.lite
```
При следующем открытии аппы она автоматически запакует эти файлы и отправит вам в **Документы** ВК
Позже архив можно будет скачать и работать с файлами логов которые находятся в нем
## Разработка ## Разработка
Мы всегда готовы к новым предложениям в [Pull Requests](https://github.com/vtosters/lite/pulls)
Для понимания декомпилированного кода требуется использовать **Dex to Java** декомпилятор [jadx](https://github.com/skylot/jadx) или же сторонние варианты как [Fernflower](https://github.com/fesh0r/fernflower)
Рекомендуется установка **Android Debug Bridge** в систему ([Гайд как это сделать](https://technastic.com/system-wide-adb-fastboot-windows-10))
Для индексации декомпилированного кода в Studio используется [dex2jar](https://github.com/pxb1988/dex2jar)
Сгенерированные библиотеки из дексов находятся в `/app/libs`
При чистой перекомпиляции дексов в jar может сломаться некоторая индексация файлов, исправляйте ручками что попадется (К примеру какие-то функции в дексах изменены с **private** на **public**)
Для сборки декомпилированного кода и ресурсов используется [Apktool](https://github.com/iBotPeaches/Apktool)
А при нахождении решения каких-либо проблем ждем вас в [Pull Requests](https://github.com/vtosters/lite/pulls)
### Всё необходимое для сборки и компиляции
`Не меняйте packagename во избе­жа­ние проблем с приложением`
`Некоторые функции связанные с музыкой не будут работать в пересобранном приложении`
## Компиляция
Весь декомпилированный код клиента находится в `/smali` Весь декомпилированный код клиента находится в `/smali`
Весь исходный код написанный на Java находится в `/app` Весь исходный код модификации находится в `/app`
Все необходимые скрипты для компиляции APK, его подписывании и не только находятся в `/scripts` Все необходимые скрипты/жарники для компиляции APK, его подписывании и не только находятся в `/scripts`
### Необходимые зависимости ### Необходимые зависимости
Требуется установленная **Java** >11 версии Требуется установленная **Java** >11 версии
@@ -32,11 +92,4 @@ VTosters Lite - это модифицированный клиент ВКонт
build.bat build.bat
``` ```
![](https://cdn.discordapp.com/attachments/762063967979175946/961682299366309928/unknown.png) ![](https://cdn.discordapp.com/attachments/762063967979175946/961682299366309928/unknown.png)
## Проверка версии коммита
С версии 0.0.4 доступна прямая проверка версии коммита внутри приложения.
![](https://media.discordapp.net/attachments/762063967979175946/957344234640408606/Screenshot_20220326-212257_VTLite__01.png)
+1
View File
@@ -4,6 +4,7 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<application <application
@@ -1,6 +1,7 @@
package bruhcollective.itaysonlab.libvkx.client; package bruhcollective.itaysonlab.libvkx.client;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Preferences.BooleanFalse;
import android.content.Context; import android.content.Context;
import android.os.RemoteException; import android.os.RemoteException;
@@ -14,8 +15,6 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import bruhcollective.itaysonlab.libvkx.ILibVkxService; import bruhcollective.itaysonlab.libvkx.ILibVkxService;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.Prefs;
public class LibVKXClient { public class LibVKXClient {
private static LibVKXClientImpl impl; private static LibVKXClientImpl impl;
@@ -29,7 +28,7 @@ public class LibVKXClient {
public static LibVKXClientImpl getInstance() { public static LibVKXClientImpl getInstance() {
LibVKXClientImpl libVKXClientImpl = impl; LibVKXClientImpl libVKXClientImpl = impl;
return libVKXClientImpl == null ? getInstance(GetContext()) : libVKXClientImpl; return libVKXClientImpl == null ? getInstance(getContext()) : libVKXClientImpl;
} }
public static boolean isVkxInstalled() { public static boolean isVkxInstalled() {
@@ -37,7 +36,7 @@ public class LibVKXClient {
} }
public static boolean isIntegrationEnabled() { public static boolean isIntegrationEnabled() {
return Prefs.BooleanFalse("libvkx_integration") && isVkxInstalled(); return BooleanFalse("libvkx_integration") && isVkxInstalled();
} }
public static boolean play(MusicTrack musicTrack, List<MusicTrack> list, PlayerRefer playerRefer) { public static boolean play(MusicTrack musicTrack, List<MusicTrack> list, PlayerRefer playerRefer) {
@@ -1,6 +1,6 @@
package bruhcollective.itaysonlab.libvkx.client; package bruhcollective.itaysonlab.libvkx.client;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getUserId;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
@@ -14,7 +14,6 @@ import android.os.RemoteException;
import java.util.List; import java.util.List;
import bruhcollective.itaysonlab.libvkx.ILibVkxService; import bruhcollective.itaysonlab.libvkx.ILibVkxService;
import ru.vtosters.lite.utils.Helper;
public class LibVKXClientImpl { public class LibVKXClientImpl {
private ILibVkxService serviceInstance; private ILibVkxService serviceInstance;
@@ -53,7 +52,7 @@ public class LibVKXClientImpl {
public boolean runOnService(LibVKXAction action) { public boolean runOnService(LibVKXAction action) {
if (serviceInstance != null) { if (serviceInstance != null) {
try { try {
if (serviceInstance.getUserId() != GetUserId()) return false; if (serviceInstance.getUserId() != getUserId()) return false;
action.run(serviceInstance); action.run(serviceInstance);
return true; return true;
} catch (RemoteException e) { } catch (RemoteException e) {
@@ -77,7 +76,7 @@ public class LibVKXClientImpl {
isBindFailed = true; isBindFailed = true;
} else { } else {
try { try {
if (serviceInstance.getUserId() != GetUserId()) return; if (serviceInstance.getUserId() != getUserId()) return;
runAfterBind.run(serviceInstance); runAfterBind.run(serviceInstance);
} catch (RemoteException e) { } catch (RemoteException e) {
e.printStackTrace(); e.printStackTrace();
@@ -1,6 +1,6 @@
package com.aefyr.tsg.g2; package com.aefyr.tsg.g2;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getContext;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@@ -20,7 +20,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment; import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
import ru.vtosters.lite.utils.Helper;
/** /**
* Created by Aefyr on 19.05.2018. * Created by Aefyr on 19.05.2018.
@@ -116,7 +115,7 @@ public class TelegramStickersService {
} }
private void notifyPackAdded(TelegramStickersPack pack, int atIndex) { private void notifyPackAdded(TelegramStickersPack pack, int atIndex) {
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD)); getContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
if (listeners.isEmpty()) if (listeners.isEmpty())
return; return;
@@ -126,7 +125,7 @@ public class TelegramStickersService {
} }
private void notifyPackChanged(TelegramStickersPack pack, int atIndex) { private void notifyPackChanged(TelegramStickersPack pack, int atIndex) {
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD)); getContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
if (listeners.isEmpty()) if (listeners.isEmpty())
return; return;
@@ -136,7 +135,7 @@ public class TelegramStickersService {
} }
private void notifyPackRemoved(TelegramStickersPack pack, int atIndex) { private void notifyPackRemoved(TelegramStickersPack pack, int atIndex) {
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD)); getContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
if (listeners.isEmpty()) if (listeners.isEmpty())
return; return;
@@ -146,7 +145,7 @@ public class TelegramStickersService {
} }
private void notifyPackDownloadError(TelegramStickersPack pack, Exception error) { private void notifyPackDownloadError(TelegramStickersPack pack, Exception error) {
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD)); getContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
if (listeners.isEmpty()) if (listeners.isEmpty())
return; return;
@@ -156,7 +155,7 @@ public class TelegramStickersService {
} }
private void notifyActivePacksListChanged() { private void notifyActivePacksListChanged() {
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD)); getContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
if (listeners.isEmpty()) if (listeners.isEmpty())
return; return;
@@ -166,7 +165,7 @@ public class TelegramStickersService {
} }
private void notifyInactivePacksListChanged() { private void notifyInactivePacksListChanged() {
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD)); getContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
if (listeners.isEmpty()) if (listeners.isEmpty())
return; return;
@@ -1,6 +1,6 @@
package ru.f0x1d.net; package ru.f0x1d.net;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getUserToken;
import android.os.AsyncTask; import android.os.AsyncTask;
@@ -11,8 +11,6 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import ru.vtosters.lite.utils.Helper;
public class F0x1dRequest { public class F0x1dRequest {
public static void makeRequest(byte[] bArr, F0x1dRequestCallback f0x1dRequestCallback) { public static void makeRequest(byte[] bArr, F0x1dRequestCallback f0x1dRequestCallback) {
@@ -58,7 +56,7 @@ public class F0x1dRequest {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(new String(this.url)).openConnection(); HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(new String(this.url)).openConnection();
httpURLConnection.setRequestMethod(this.mIsPut ? "PUT" : "GET"); httpURLConnection.setRequestMethod(this.mIsPut ? "PUT" : "GET");
if (this.mIsVkToasterRequest) { if (this.mIsVkToasterRequest) {
httpURLConnection.setRequestProperty("Token", GetUserToken()); httpURLConnection.setRequestProperty("Token", getUserToken());
} }
if (!this.mIsVkToasterRequest) { if (!this.mIsVkToasterRequest) {
httpURLConnection.setRequestProperty("User-Agent", Network.a.a().a()); httpURLConnection.setRequestProperty("User-Agent", Network.a.a().a());
@@ -1,7 +1,10 @@
package ru.vtosters.lite.dnr; package ru.vtosters.lite.dnr;
import static ru.vtosters.lite.dnr.DNRModule.*; import static ru.vtosters.lite.dnr.DNRModule.hookDNR;
import static ru.vtosters.lite.utils.Helper.*; 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.utils.Globals.getIdentifier;
import com.vk.im.engine.models.dialogs.Dialog; import com.vk.im.engine.models.dialogs.Dialog;
import com.vk.im.ui.components.common.DialogAction; import com.vk.im.ui.components.common.DialogAction;
@@ -9,8 +12,6 @@ import com.vk.im.ui.components.common.DialogAction;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import ru.vtosters.lite.utils.Helper;
public class DNRInjector { public class DNRInjector {
public static void inject(Dialog dialog, List<DialogAction> list) { public static void inject(Dialog dialog, List<DialogAction> list) {
int peerId = dialog.a(); int peerId = dialog.a();
@@ -1,8 +1,8 @@
package ru.vtosters.lite.dnr; package ru.vtosters.lite.dnr;
import static ru.f0x1d.net.F0x1dRequest.*; import static ru.f0x1d.net.F0x1dRequest.makeRequest;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getUserToken;
import static ru.vtosters.lite.utils.Proxy.*; import static ru.vtosters.lite.utils.Proxy.getApiCom;
import com.vk.core.util.ToastUtils; import com.vk.core.util.ToastUtils;
import com.vk.im.engine.commands.messages.SetUserActivityCmd; import com.vk.im.engine.commands.messages.SetUserActivityCmd;
@@ -10,11 +10,8 @@ import com.vk.im.engine.models.dialogs.Dialog;
import java.util.List; import java.util.List;
import ru.f0x1d.net.F0x1dRequest;
import ru.vtosters.lite.dnr.helpers.DoNotReadDBHelper; import ru.vtosters.lite.dnr.helpers.DoNotReadDBHelper;
import ru.vtosters.lite.dnr.helpers.DoNotTypeDBHelper; import ru.vtosters.lite.dnr.helpers.DoNotTypeDBHelper;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.Proxy;
public class DNRModule { public class DNRModule {
public static DoNotReadDBHelper mDoNotReadDBHelper = new DoNotReadDBHelper(); public static DoNotReadDBHelper mDoNotReadDBHelper = new DoNotReadDBHelper();
@@ -54,7 +51,7 @@ public class DNRModule {
} }
public static void hookRead(Dialog dialog) { public static void hookRead(Dialog dialog) {
makeRequest("https://" + getApiCom() + "/method/messages.markAsRead?start_message_id=" + dialog.lastMsgVkId + "&peer_id=" + dialog.a() + "&v=5.91&access_token=" + GetUserToken(), response -> { makeRequest("https://" + getApiCom() + "/method/messages.markAsRead?start_message_id=" + dialog.lastMsgVkId + "&peer_id=" + dialog.a() + "&v=5.91&access_token=" + getUserToken(), response -> {
ToastUtils.a("Чат помечен как прочитанный!"); ToastUtils.a("Чат помечен как прочитанный!");
}); });
} }
@@ -1,10 +1,10 @@
package ru.vtosters.lite.dnr; package ru.vtosters.lite.dnr;
import ru.vtosters.lite.utils.Prefs; import static ru.vtosters.lite.utils.Preferences.BooleanFalse;
public class DNRPrefs { public class DNRPrefs {
public static boolean getStoriesRead() { public static boolean getStoriesRead() {
return Prefs.BooleanFalse("read_s"); return BooleanFalse("read_s");
} }
public static boolean getMarkAsReadWithoutExceptions(int peerId) { public static boolean getMarkAsReadWithoutExceptions(int peerId) {
@@ -28,27 +28,27 @@ public class DNRPrefs {
} }
public static boolean readPM(int peer) { public static boolean readPM(int peer) {
return (peer > 0 && peer < 2000000000) && Prefs.BooleanFalse("read_pm"); return (peer > 0 && peer < 2000000000) && BooleanFalse("read_pm");
} }
public static boolean readConversations(int peer) { public static boolean readConversations(int peer) {
return (peer > 2000000000) && Prefs.BooleanFalse("read_conversations"); return (peer > 2000000000) && BooleanFalse("read_conversations");
} }
public static boolean readBots(int peer) { public static boolean readBots(int peer) {
return (peer < 0) && Prefs.BooleanFalse("read_bot"); return (peer < 0) && BooleanFalse("read_bot");
} }
public static boolean writePM(int peer) { public static boolean writePM(int peer) {
return (peer > 0 && peer < 2000000000) && Prefs.BooleanFalse("write_pm"); return (peer > 0 && peer < 2000000000) && BooleanFalse("write_pm");
} }
public static boolean writeConversations(int peer) { public static boolean writeConversations(int peer) {
return (peer > 2000000000) && Prefs.BooleanFalse("write_conversations"); return (peer > 2000000000) && BooleanFalse("write_conversations");
} }
public static boolean writeBots(int peer) { public static boolean writeBots(int peer) {
return (peer < 0) && Prefs.BooleanFalse("write_bot"); return (peer < 0) && BooleanFalse("write_bot");
} }
public static boolean getActivityWithoutExceptions(int peerId) { public static boolean getActivityWithoutExceptions(int peerId) {
@@ -1,6 +1,6 @@
package ru.vtosters.lite.dnr.helpers; package ru.vtosters.lite.dnr.helpers;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getContext;
import android.content.ContentValues; import android.content.ContentValues;
import android.database.Cursor; import android.database.Cursor;
@@ -11,11 +11,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import ru.vtosters.lite.dnr.DNRPrefs; import ru.vtosters.lite.dnr.DNRPrefs;
import ru.vtosters.lite.utils.Helper;
public class DoNotReadDBHelper extends SQLiteOpenHelper { public class DoNotReadDBHelper extends SQLiteOpenHelper {
public DoNotReadDBHelper() { public DoNotReadDBHelper() {
super(GetContext(), "dnr", null, 1); super(getContext(), "dnr", null, 1);
} }
@Override @Override
@@ -1,5 +1,7 @@
package ru.vtosters.lite.dnr.helpers; package ru.vtosters.lite.dnr.helpers;
import static ru.vtosters.lite.utils.Globals.getContext;
import android.content.ContentValues; import android.content.ContentValues;
import android.database.Cursor; import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
@@ -9,11 +11,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import ru.vtosters.lite.dnr.DNRPrefs; import ru.vtosters.lite.dnr.DNRPrefs;
import ru.vtosters.lite.utils.Helper;
public class DoNotTypeDBHelper extends SQLiteOpenHelper { public class DoNotTypeDBHelper extends SQLiteOpenHelper {
public DoNotTypeDBHelper() { public DoNotTypeDBHelper() {
super(Helper.GetContext(), "dnt", null, 1); super(getContext(), "dnt", null, 1);
} }
@Override @Override
@@ -1,6 +1,8 @@
package ru.vtosters.lite.f0x1d; package ru.vtosters.lite.f0x1d;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.About.*;
import static ru.vtosters.lite.utils.Globals.*;
import static ru.vtosters.lite.utils.Preferences.*;
import android.app.Activity; import android.app.Activity;
import android.app.Notification; import android.app.Notification;
@@ -19,8 +21,6 @@ import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import ru.vtosters.lite.badmanners.DeviceInfoCollector; import ru.vtosters.lite.badmanners.DeviceInfoCollector;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.Prefs;
public class Crashreporter { public class Crashreporter {
protected static String logString; protected static String logString;
@@ -37,12 +37,12 @@ public class Crashreporter {
} }
static void start(Thread.UncaughtExceptionHandler uncaughtExceptionHandler, Thread thread, Throwable th, Activity activity) { static void start(Thread.UncaughtExceptionHandler uncaughtExceptionHandler, Thread thread, Throwable th, Activity activity) {
logString = getStackTrace(th) + "\n\n" + new DeviceInfoCollector().collect(GetContext()).toDeviceName() + "\n VTL Version: " + Prefs.VERSIONNAME + ", build: " + Prefs.getBuildNumber(); logString = getStackTrace(th) + "\n\n" + new DeviceInfoCollector().collect(getContext()).toDeviceName() + "\n VTL Version: " + VERSIONNAME + ", build: " + getBuildNumber();
if (Build.VERSION.SDK_INT >= 26) { if (Build.VERSION.SDK_INT >= 26) {
var notificationChannel = new NotificationChannel("crashes", "crash", NotificationManager.IMPORTANCE_DEFAULT); var notificationChannel = new NotificationChannel("crashes", "crash", NotificationManager.IMPORTANCE_DEFAULT);
notificationChannel.enableVibration(true); notificationChannel.enableVibration(true);
notificationChannel.enableLights(true); notificationChannel.enableLights(true);
((NotificationManager) GetContext().getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(notificationChannel); ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(notificationChannel);
} }
var foxbinIntent = new Intent("com.f0x1d.dogbin.ACTION_UPLOAD_TO_FOXBIN"); var foxbinIntent = new Intent("com.f0x1d.dogbin.ACTION_UPLOAD_TO_FOXBIN");
@@ -54,19 +54,19 @@ public class Crashreporter {
foxbinIntent.addFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION); foxbinIntent.addFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION);
} }
var saveLogIntent = new Intent(GetContext(), LogWriterService.class); var saveLogIntent = new Intent(getContext(), LogWriterService.class);
saveLogIntent.putExtra("log", logString); saveLogIntent.putExtra("log", logString);
saveLogIntent.putExtra("notificationId", 1); saveLogIntent.putExtra("notificationId", 1);
var psaveLogIntent = PendingIntent.getService(GetContext(), 0, saveLogIntent, PendingIntent.FLAG_CANCEL_CURRENT); var psaveLogIntent = PendingIntent.getService(getContext(), 0, saveLogIntent, PendingIntent.FLAG_CANCEL_CURRENT);
var builder = new Notification.Builder(GetContext()); var builder = new Notification.Builder(getContext());
builder.setSmallIcon(R.drawable.ic_bug_24); builder.setSmallIcon(R.drawable.ic_bug_24);
builder.setContentTitle("VTL Крашнулся!"); builder.setContentTitle("VTL Крашнулся!");
builder.setContentText(logString); builder.setContentText(logString);
builder.setStyle(new Notification.BigTextStyle().bigText(logString)); builder.setStyle(new Notification.BigTextStyle().bigText(logString));
builder.setAutoCancel(true); builder.setAutoCancel(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
builder.addAction(new Notification.Action(0, "Загрузить логи", PendingIntent.getActivity(GetContext(), (int) (Math.random() * 100.0d), foxbinIntent, PendingIntent.FLAG_CANCEL_CURRENT))); builder.addAction(new Notification.Action(0, "Загрузить логи", PendingIntent.getActivity(getContext(), (int) (Math.random() * 100.0d), foxbinIntent, PendingIntent.FLAG_CANCEL_CURRENT)));
builder.addAction(new Notification.Action(0, "Сохранить в файл", psaveLogIntent)); builder.addAction(new Notification.Action(0, "Сохранить в файл", psaveLogIntent));
} else { } else {
builder.setContentIntent(PendingIntent.getActivity(activity, 0, foxbinIntent, PendingIntent.FLAG_ONE_SHOT)); builder.setContentIntent(PendingIntent.getActivity(activity, 0, foxbinIntent, PendingIntent.FLAG_ONE_SHOT));
@@ -77,13 +77,13 @@ public class Crashreporter {
} }
((NotificationManager) GetContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(-2147483548, builder.build()); ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(-2147483548, builder.build());
Log.e("VTosters Lite", "crashed: " + th.getLocalizedMessage()); Log.e("VTosters Lite", "crashed: " + th.getLocalizedMessage());
uncaughtExceptionHandler.uncaughtException(thread, th); uncaughtExceptionHandler.uncaughtException(thread, th);
} }
private static boolean isFoxbinInstalled() { private static boolean isFoxbinInstalled() {
var pm = GetContext().getPackageManager(); var pm = getContext().getPackageManager();
try { try {
pm.getPackageInfo("com.f0x1d.dogbin", 0); pm.getPackageInfo("com.f0x1d.dogbin", 0);
return true; return true;
@@ -1,7 +1,8 @@
package ru.vtosters.lite.f0x1d; package ru.vtosters.lite.f0x1d;
import static android.widget.Toast.*; import static android.widget.Toast.LENGTH_SHORT;
import static ru.vtosters.lite.utils.Helper.*; import static android.widget.Toast.makeText;
import static ru.vtosters.lite.utils.Globals.getContext;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.Service; import android.app.Service;
@@ -10,7 +11,6 @@ import android.content.Intent;
import android.os.Environment; import android.os.Environment;
import android.os.IBinder; import android.os.IBinder;
import android.util.Log; import android.util.Log;
import android.widget.Toast;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@@ -19,8 +19,6 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import ru.vtosters.lite.utils.Helper;
public class LogWriterService extends Service { public class LogWriterService extends Service {
public LogWriterService() { public LogWriterService() {
} }
@@ -41,12 +39,12 @@ public class LogWriterService extends Service {
writeLog(intent, file); writeLog(intent, file);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
makeText(GetContext(), "Не удалось сохранить лог-файл", LENGTH_SHORT).show(); makeText(getContext(), "Не удалось сохранить лог-файл", LENGTH_SHORT).show();
} }
var notificationId = intent.getIntExtra("notificationId", 1); var notificationId = intent.getIntExtra("notificationId", 1);
var manager = (NotificationManager) GetContext().getSystemService(Context.NOTIFICATION_SERVICE); var manager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE);
manager.cancel(notificationId); manager.cancel(notificationId);
makeText(GetContext(), "Лог-файл был сохранен", LENGTH_SHORT).show(); makeText(getContext(), "Лог-файл был сохранен", LENGTH_SHORT).show();
stopSelf(); stopSelf();
return START_NOT_STICKY; return START_NOT_STICKY;
@@ -1,5 +1,7 @@
package ru.vtosters.lite.f0x1d; package ru.vtosters.lite.f0x1d;
import static ru.vtosters.lite.utils.Preferences.BooleanTrue;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.util.Base64; import android.util.Base64;
@@ -24,7 +26,6 @@ import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.Response; import okhttp3.Response;
import ru.vtosters.lite.utils.Prefs;
public class VTVerifications { public class VTVerifications {
public static final HashMap<Integer, Boolean> sServiceAccountsMap = new HashMap<>(); public static final HashMap<Integer, Boolean> sServiceAccountsMap = new HashMap<>();
@@ -135,7 +136,7 @@ public class VTVerifications {
if (jSONObject.optInt("verified", 0) == 1) { if (jSONObject.optInt("verified", 0) == 1) {
return true; return true;
} }
if (!Prefs.BooleanTrue("VT_Verification")) { if (!BooleanTrue("VT_Verification")) {
return false; return false;
} }
return isVerified((jSONObject.optString(NavigatorKeys.j) == null || (!jSONObject.optString(NavigatorKeys.j).equals("group") && !jSONObject.optString(NavigatorKeys.j).equals("page"))) ? jSONObject.optInt("id", 0) : -jSONObject.optInt("id", 0)); return isVerified((jSONObject.optString(NavigatorKeys.j) == null || (!jSONObject.optString(NavigatorKeys.j).equals("group") && !jSONObject.optString(NavigatorKeys.j).equals("page"))) ? jSONObject.optInt("id", 0) : -jSONObject.optInt("id", 0));
@@ -145,14 +146,14 @@ public class VTVerifications {
if (jSONObject.optInt("trending", 0) == 1) { if (jSONObject.optInt("trending", 0) == 1) {
return true; return true;
} }
if (!Prefs.BooleanTrue("VT_Fire")) { if (!BooleanTrue("VT_Fire")) {
return false; return false;
} }
return hasPrometheus((jSONObject.optString(NavigatorKeys.j) == null || (!jSONObject.optString(NavigatorKeys.j).equals("group") && !jSONObject.optString(NavigatorKeys.j).equals("page"))) ? jSONObject.optInt("id", 0) : -jSONObject.optInt("id", 0)); return hasPrometheus((jSONObject.optString(NavigatorKeys.j) == null || (!jSONObject.optString(NavigatorKeys.j).equals("group") && !jSONObject.optString(NavigatorKeys.j).equals("page"))) ? jSONObject.optInt("id", 0) : -jSONObject.optInt("id", 0));
} }
public static boolean hasDeveloper(JSONObject jSONObject) { public static boolean hasDeveloper(JSONObject jSONObject) {
if (!Prefs.BooleanTrue("VT_Dev")) { if (!BooleanTrue("VT_Dev")) {
return false; return false;
} }
return isDeveloper((jSONObject.optString(NavigatorKeys.j) == null || (!jSONObject.optString(NavigatorKeys.j).equals("group") && !jSONObject.optString(NavigatorKeys.j).equals("page"))) ? jSONObject.optInt("id", 0) : -jSONObject.optInt("id", 0)); return isDeveloper((jSONObject.optString(NavigatorKeys.j) == null || (!jSONObject.optString(NavigatorKeys.j).equals("group") && !jSONObject.optString(NavigatorKeys.j).equals("page"))) ? jSONObject.optInt("id", 0) : -jSONObject.optInt("id", 0));
@@ -1,14 +1,14 @@
package ru.vtosters.lite.foaf; package ru.vtosters.lite.foaf;
import static android.widget.Toast.*; import static android.widget.Toast.LENGTH_SHORT;
import static ru.vtosters.lite.utils.Helper.*; import static android.widget.Toast.makeText;
import static ru.vtosters.lite.utils.Globals.getString;
import static ru.vtosters.lite.utils.Proxy.getApiCom; import static ru.vtosters.lite.utils.Proxy.getApiCom;
import static ru.vtosters.lite.utils.Proxy.proxy;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.widget.Toast;
import androidx.exifinterface.media.ExifInterface; import androidx.exifinterface.media.ExifInterface;
@@ -27,8 +27,7 @@ import java.util.regex.Pattern;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
import ru.f0x1d.net.F0x1dRequest; import ru.f0x1d.net.F0x1dRequest;
import ru.vtosters.lite.utils.Helper; import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.Prefs;
public class FoafBase { public class FoafBase {
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>"); private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
@@ -51,7 +50,7 @@ public class FoafBase {
private static String getLink(int i) { private static String getLink(int i) {
String str; String str;
StringBuilder sb; StringBuilder sb;
if (Prefs.proxy()) { if (proxy()) {
sb = new StringBuilder(); sb = new StringBuilder();
str = "https://" + getApiCom() + "/_/vk.com/foaf.php?id="; str = "https://" + getApiCom() + "/_/vk.com/foaf.php?id=";
} else { } else {
@@ -1,12 +1,12 @@
package ru.vtosters.lite.tgs; package ru.vtosters.lite.tgs;
import static ru.vtosters.lite.utils.Globals.getContext;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import ru.vtosters.lite.utils.Helper;
public class TGPref { public class TGPref {
private static final SharedPreferences Prefs = PreferenceManager.getDefaultSharedPreferences(Helper.GetContext()); private static final SharedPreferences Prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
private static final String CNCT_METHOD = "VTGS:CM"; private static final String CNCT_METHOD = "VTGS:CM";
private static final String TG_BOTKEY = "VTGS:BKey"; private static final String TG_BOTKEY = "VTGS:BKey";
@@ -57,8 +57,7 @@ public class TGPref {
} }
public static void setTGProxyUserPass(String user, String pass) { public static void setTGProxyUserPass(String user, String pass) {
Prefs.edit().putString(TG_PROXYUSER, user).putString(TG_PROXYPASS, pass) Prefs.edit().putString(TG_PROXYUSER, user).putString(TG_PROXYPASS, pass).apply();
.apply();
} }
public static boolean isTGProxyPassEnabled() { public static boolean isTGProxyPassEnabled() {
@@ -1,6 +1,7 @@
package ru.vtosters.lite.tgs; package ru.vtosters.lite.tgs;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getString;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
@@ -22,8 +23,6 @@ import org.json.JSONObject;
import java.util.List; import java.util.List;
import java.util.Stack; import java.util.Stack;
import ru.vtosters.lite.utils.Helper;
public class TGRoot { public class TGRoot {
public static final int N = 76820000; public static final int N = 76820000;
public static final int X = 976820000; public static final int X = 976820000;
@@ -49,7 +48,7 @@ public class TGRoot {
int stickerId = (id - N) % 120; int stickerId = (id - N) % 120;
TelegramStickersPack pack = null; TelegramStickersPack pack = null;
for (TelegramStickersPack p : TelegramStickersService.getInstance(GetContext()).getActivePacksListReference()) { for (TelegramStickersPack p : TelegramStickersService.getInstance(getContext()).getActivePacksListReference()) {
if (p.index == index) { if (p.index == index) {
pack = p; pack = p;
break; break;
@@ -70,7 +69,7 @@ public class TGRoot {
public static void injectStickers(List<StickerStockItem> list) { public static void injectStickers(List<StickerStockItem> list) {
try { try {
List<TelegramStickersPack> packs = TelegramStickersService.getInstance(GetContext()).getActivePacksListReference(); List<TelegramStickersPack> packs = TelegramStickersService.getInstance(getContext()).getActivePacksListReference();
for (int i = packs.size() - 1; i >= 0; i--) for (int i = packs.size() - 1; i >= 0; i--)
list.add(0, toStickerPack(packs.get(i))); list.add(0, toStickerPack(packs.get(i)));
} catch (Exception e) { } catch (Exception e) {
@@ -83,7 +82,7 @@ public class TGRoot {
int index = (stickerId - N) / 120; int index = (stickerId - N) / 120;
TelegramStickersPack p = null; TelegramStickersPack p = null;
for (TelegramStickersPack p_ : TelegramStickersService.getInstance(GetContext()) for (TelegramStickersPack p_ : TelegramStickersService.getInstance(getContext())
.getActivePacksListReference()) { .getActivePacksListReference()) {
if (p_.index == index) { if (p_.index == index) {
p = p_; p = p_;
@@ -1,6 +1,7 @@
package ru.vtosters.lite.ui; package ru.vtosters.lite.ui;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.getContext;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
@@ -24,7 +25,6 @@ import androidx.core.view.ViewCompat;
import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment; import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
import com.vtosters.lite.ui.MaterialSwitchPreference; import com.vtosters.lite.ui.MaterialSwitchPreference;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.Themes; import ru.vtosters.lite.utils.Themes;
public class PreferencesUtil { public class PreferencesUtil {
@@ -35,7 +35,7 @@ public class PreferencesUtil {
} }
public static void addListPreference(MaterialPreferenceToolbarFragment fragment, String key, String def, CharSequence title, CharSequence[] entries, CharSequence[] entriesValue) { public static void addListPreference(MaterialPreferenceToolbarFragment fragment, String key, String def, CharSequence title, CharSequence[] entries, CharSequence[] entriesValue) {
ListPreference preference = new ListPreference(GetContext()); ListPreference preference = new ListPreference(getContext());
preference.a(entries); preference.a(entries);
preference.b(entriesValue); preference.b(entriesValue);
preference.c(title); // setTitle preference.c(title); // setTitle
@@ -46,7 +46,7 @@ public class PreferencesUtil {
} }
public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment materialPreferenceToolbarFragment, String key, CharSequence title, CharSequence summary, boolean defValue) { public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment materialPreferenceToolbarFragment, String key, CharSequence title, CharSequence summary, boolean defValue) {
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(GetContext()); MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(getContext());
materialSwitchPreference.c(title); // setTitle materialSwitchPreference.c(title); // setTitle
materialSwitchPreference.b(summary); // setSummary materialSwitchPreference.b(summary); // setSummary
materialSwitchPreference.d(key); // setKey materialSwitchPreference.d(key); // setKey
@@ -56,7 +56,7 @@ public class PreferencesUtil {
} }
public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, int icon, boolean defValue, Preference.b listener) { public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, int icon, boolean defValue, Preference.b listener) {
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(GetContext()); MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(getContext());
materialSwitchPreference.c(title); // setTitle materialSwitchPreference.c(title); // setTitle
materialSwitchPreference.b(summary); // setSummary materialSwitchPreference.b(summary); // setSummary
materialSwitchPreference.d(key); // setKey materialSwitchPreference.d(key); // setKey
@@ -64,13 +64,13 @@ public class PreferencesUtil {
materialSwitchPreference.a(listener); // setOnPreferenceClickListener materialSwitchPreference.a(listener); // setOnPreferenceClickListener
if (icon != 1) if (icon != 1)
materialSwitchPreference.a(setTint(GetContext(), ContextCompat.getDrawable(GetContext(), icon))); // preference.setIcon materialSwitchPreference.a(setTint(getContext(), ContextCompat.getDrawable(getContext(), icon))); // preference.setIcon
fragment.ay().d(materialSwitchPreference); // fragment.getPreferenceScreen().addPreference(preference) fragment.ay().d(materialSwitchPreference); // fragment.getPreferenceScreen().addPreference(preference)
} }
public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, String icon, boolean defValue, Preference.b listener) { public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, String icon, boolean defValue, Preference.b listener) {
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(GetContext()); MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(getContext());
materialSwitchPreference.c(title); // setTitle materialSwitchPreference.c(title); // setTitle
materialSwitchPreference.b(summary); // setSummary materialSwitchPreference.b(summary); // setSummary
materialSwitchPreference.d(key); // setKey materialSwitchPreference.d(key); // setKey
@@ -78,14 +78,14 @@ public class PreferencesUtil {
fragment.ay().d(materialSwitchPreference); // materialPreferenceToolbarFragment.getPreferenceScreen().addPreference(preference) fragment.ay().d(materialSwitchPreference); // materialPreferenceToolbarFragment.getPreferenceScreen().addPreference(preference)
if (icon != null) if (icon != null)
materialSwitchPreference.a(setTint(GetContext(), getDrawable(GetContext(), icon))); // preference.setIcon materialSwitchPreference.a(setTint(getContext(), getDrawable(getContext(), icon))); // preference.setIcon
materialSwitchPreference.a(listener); // setOnPreferenceClickListener(listener) materialSwitchPreference.a(listener); // setOnPreferenceClickListener(listener)
fragment.ay().d(materialSwitchPreference); // fragment.getPreferenceScreen().addPreference(preference) fragment.ay().d(materialSwitchPreference); // fragment.getPreferenceScreen().addPreference(preference)
} }
public static void addPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary) { public static void addPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary) {
Preference preference = new Preference(GetContext()); Preference preference = new Preference(getContext());
preference.b(summary); // setSummary preference.b(summary); // setSummary
preference.c(title); // setTitle preference.c(title); // setTitle
preference.d(key); // setKey preference.d(key); // setKey
@@ -94,59 +94,59 @@ public class PreferencesUtil {
} }
public static void addPreference(MaterialPreferenceToolbarFragment fragment, CharSequence title, CharSequence summary, @Nullable String icon, Preference.c listener) { public static void addPreference(MaterialPreferenceToolbarFragment fragment, CharSequence title, CharSequence summary, @Nullable String icon, Preference.c listener) {
Preference preference = new Preference(GetContext()); Preference preference = new Preference(getContext());
preference.b(summary); // setSummary preference.b(summary); // setSummary
preference.c(title); // setTitle preference.c(title); // setTitle
if (icon != null) if (icon != null)
preference.a(setTint(GetContext(), getDrawable(GetContext(), icon))); // preference.setIcon preference.a(setTint(getContext(), getDrawable(getContext(), icon))); // preference.setIcon
preference.a(listener); // preference.setOnPreferenceClickListener(listener) preference.a(listener); // preference.setOnPreferenceClickListener(listener)
fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference) fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference)
} }
public static void addPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, @Nullable String icon, Preference.c listener) { public static void addPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, @Nullable String icon, Preference.c listener) {
Preference preference = new Preference(GetContext()); Preference preference = new Preference(getContext());
preference.b(summary); // setSummary preference.b(summary); // setSummary
preference.c(title); // setTitle preference.c(title); // setTitle
preference.d(key); // setKey preference.d(key); // setKey
if (icon != null) if (icon != null)
preference.a(setTint(GetContext(), getDrawable(GetContext(), icon))); // preference.setIcon preference.a(setTint(getContext(), getDrawable(getContext(), icon))); // preference.setIcon
preference.a(listener); // preference.setOnPreferenceClickListener(listener) preference.a(listener); // preference.setOnPreferenceClickListener(listener)
fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference) fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference)
} }
public static void addPreferenceCategory(MaterialPreferenceToolbarFragment fragment, CharSequence title) { public static void addPreferenceCategory(MaterialPreferenceToolbarFragment fragment, CharSequence title) {
PreferenceCategory preference = new PreferenceCategory(GetContext(), null); PreferenceCategory preference = new PreferenceCategory(getContext(), null);
preference.c(title); // setTitle preference.c(title); // setTitle
fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference) fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference)
} }
public static void addPreferenceCategory(MaterialPreferenceToolbarFragment fragment, CharSequence title, int collapsedSize) { public static void addPreferenceCategory(MaterialPreferenceToolbarFragment fragment, CharSequence title, int collapsedSize) {
PreferenceCategory preference = new PreferenceCategory(GetContext(), null); PreferenceCategory preference = new PreferenceCategory(getContext(), null);
preference.c(title); // setTitle preference.c(title); // setTitle
fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference) fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference)
} }
public static void addEditTextPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, EditTextPrefChangeListener editTextPrefChangeListener) { public static void addEditTextPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, EditTextPrefChangeListener editTextPrefChangeListener) {
Preference preference = new Preference(GetContext()); Preference preference = new Preference(getContext());
preference.c(title); // setTitle preference.c(title); // setTitle
preference.d(key); // setKey preference.d(key); // setKey
preference.a(preference1 -> { preference.a(preference1 -> {
LinearLayout linearLayout = new LinearLayout(GetContext()); LinearLayout linearLayout = new LinearLayout(getContext());
final EditText editText = new EditText(GetContext()); final EditText editText = new EditText(getContext());
editText.setText(PreferenceManager.getDefaultSharedPreferences(GetContext()).getString(key, "")); editText.setText(PreferenceManager.getDefaultSharedPreferences(getContext()).getString(key, ""));
editText.setHint(title); editText.setHint(title);
editText.setHintTextColor(PreferencesUtil.getSTextColor(GetContext())); editText.setHintTextColor(PreferencesUtil.getSTextColor(getContext()));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
editText.setBackgroundTintList(ColorStateList.valueOf(PreferencesUtil.getTextColor(GetContext()))); editText.setBackgroundTintList(ColorStateList.valueOf(PreferencesUtil.getTextColor(getContext())));
} else { } else {
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(GetContext()))); ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(getContext())));
} }
linearLayout.addView(editText); linearLayout.addView(editText);
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
@@ -162,7 +162,7 @@ public class PreferencesUtil {
if (!change) if (!change)
return; return;
PreferenceManager.getDefaultSharedPreferences(GetContext()) PreferenceManager.getDefaultSharedPreferences(getContext())
.edit() .edit()
.putString(key, editText.getText().toString()) .putString(key, editText.getText().toString())
.apply(); .apply();
@@ -1,6 +1,8 @@
package ru.vtosters.lite.ui.dialogs; package ru.vtosters.lite.ui.dialogs;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Preferences.BooleanTrue;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@@ -11,14 +13,12 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.PowerManager; import android.os.PowerManager;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.OEMDetector; import ru.vtosters.lite.utils.OEMDetector;
import ru.vtosters.lite.utils.Prefs;
public class DisableBattery { public class DisableBattery {
public static void alert(Activity activity) { public static void alert(Activity activity) {
if (OEMDetector.isOEM() && Build.VERSION.SDK_INT >= 23 && Prefs.BooleanTrue("showDoze")) { if (OEMDetector.isOEM() && Build.VERSION.SDK_INT >= 23 && BooleanTrue("showDoze")) {
final Context context = GetContext(); final Context context = getContext();
if (!((PowerManager) context.getSystemService(Context.POWER_SERVICE)).isIgnoringBatteryOptimizations(context.getPackageName())) { if (!((PowerManager) context.getSystemService(Context.POWER_SERVICE)).isIgnoringBatteryOptimizations(context.getPackageName())) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity); AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("Выключите оптимизацию батареи!"); builder.setTitle("Выключите оптимизацию батареи!");
@@ -1,6 +1,9 @@
package ru.vtosters.lite.ui.dialogs; package ru.vtosters.lite.ui.dialogs;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.isGmsInstalled;
import static ru.vtosters.lite.utils.Preferences.BooleanTrue;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@@ -11,12 +14,10 @@ import android.content.Intent;
import com.vk.navigation.Navigator; import com.vk.navigation.Navigator;
import ru.vtosters.lite.ui.fragments.InstallGMSFragment; import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.Prefs;
public class InstallGMS { public class InstallGMS {
public static void alert(final Activity activity) { public static void alert(final Activity activity) {
if (!IsGmsInstalled()) { if (!isGmsInstalled()) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity); AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("Внимание!"); builder.setTitle("Внимание!");
builder.setMessage(Text()); builder.setMessage(Text());
@@ -33,12 +34,12 @@ public class InstallGMS {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
edit().putBoolean("showAlertGms", false).apply(); edit().putBoolean("showAlertGms", false).apply();
Context context = GetContext(); Context context = getContext();
Intent a2 = new Navigator(InstallGMSFragment.class).a(context); Intent a2 = new Navigator(InstallGMSFragment.class).a(context);
context.startActivity(a2); context.startActivity(a2);
} }
}); });
if (Prefs.BooleanTrue("showAlertGms")) { if (BooleanTrue("showAlertGms")) {
builder.show(); builder.show();
} }
} }
@@ -1,6 +1,7 @@
package ru.vtosters.lite.ui.dialogs; package ru.vtosters.lite.ui.dialogs;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Preferences.BooleanTrue;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
@@ -9,9 +10,7 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.OEMDetector; import ru.vtosters.lite.utils.OEMDetector;
import ru.vtosters.lite.utils.Prefs;
public class Start { public class Start {
public static void alert(final Activity activity) { public static void alert(final Activity activity) {
@@ -37,7 +36,7 @@ public class Start {
activity.startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/vtosters"))); activity.startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/vtosters")));
} }
}); });
if (Prefs.BooleanTrue("showAlert")) { if (BooleanTrue("showAlert")) {
builder.show(); builder.show();
} }
} }
@@ -1,5 +1,7 @@
package ru.vtosters.lite.ui.fragments; package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.Globals.getString;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
@@ -7,8 +9,6 @@ import com.vk.core.util.ToastUtils;
import com.vtosters.lite.R; import com.vtosters.lite.R;
import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment; import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.utils.Helper;
public class InterfaceFragment extends MaterialPreferenceToolbarFragment { public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
@Override @Override
public void b(Bundle bundle) { public void b(Bundle bundle) {
@@ -22,7 +22,7 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
} }
public boolean restart(Preference preference, Object obj) { public boolean restart(Preference preference, Object obj) {
ToastUtils.a(Helper.getString("restartapp")); ToastUtils.a(getString("restartapp"));
return true; return true;
} }
@@ -1,7 +1,11 @@
package ru.vtosters.lite.ui.fragments; package ru.vtosters.lite.ui.fragments;
import static android.widget.Toast.*; import static android.widget.Toast.LENGTH_SHORT;
import static ru.vtosters.lite.utils.Helper.*; import static android.widget.Toast.makeText;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getString;
import static ru.vtosters.lite.utils.Globals.getUserToken;
import static ru.vtosters.lite.utils.Globals.restartApplication;
import static ru.vtosters.lite.utils.SettBackup.backupSettings; import static ru.vtosters.lite.utils.SettBackup.backupSettings;
import static ru.vtosters.lite.utils.SettBackup.deletePrefs; import static ru.vtosters.lite.utils.SettBackup.deletePrefs;
import static ru.vtosters.lite.utils.SettBackup.restoreBackup; import static ru.vtosters.lite.utils.SettBackup.restoreBackup;
@@ -12,7 +16,6 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
import android.widget.Toast;
import com.vk.audio.AudioMessageUtils; import com.vk.audio.AudioMessageUtils;
import com.vk.auth.api.VKAccount; import com.vk.auth.api.VKAccount;
@@ -26,8 +29,6 @@ import com.vtosters.lite.auth.VKAccountManager;
import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment; import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
import com.vtosters.lite.im.ImEngineProvider; import com.vtosters.lite.im.ImEngineProvider;
import ru.vtosters.lite.utils.Helper;
public class OtherFragment extends MaterialPreferenceToolbarFragment { public class OtherFragment extends MaterialPreferenceToolbarFragment {
@Override @Override
@@ -62,7 +63,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
@Override // android.support.v7.preference.Preference.c @Override // android.support.v7.preference.Preference.c
public boolean a(Preference preference) { public boolean a(Preference preference) {
copy(GetContext(), GetUserToken()); copy(getContext(), getUserToken());
return true; return true;
} }
} }
@@ -99,7 +100,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
@Override // android.support.v7.preference.Preference.c @Override // android.support.v7.preference.Preference.c
public boolean a(Preference preference) { public boolean a(Preference preference) {
restarting(); restartApplication();
return true; return true;
} }
} }
@@ -129,9 +130,9 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
@Override // android.support.v7.preference.Preference.c @Override // android.support.v7.preference.Preference.c
public boolean a(Preference preference) { public boolean a(Preference preference) {
SharedPreferences prefs = GetContext().getSharedPreferences("stickers", Context.MODE_PRIVATE); SharedPreferences prefs = getContext().getSharedPreferences("stickers", Context.MODE_PRIVATE);
prefs.edit().clear().commit(); prefs.edit().clear().commit();
restarting(); restartApplication();
return true; return true;
} }
} }
@@ -143,7 +144,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
@Override // android.support.v7.preference.Preference.c @Override // android.support.v7.preference.Preference.c
public boolean a(Preference preference) { public boolean a(Preference preference) {
deletePrefs(); deletePrefs();
restarting(); restartApplication();
return true; return true;
} }
} }
@@ -1,5 +1,9 @@
package ru.vtosters.lite.ui.fragments; package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.Globals.getString;
import static ru.vtosters.lite.utils.IconHelper.switchToDefault;
import static ru.vtosters.lite.utils.IconHelper.switchToVK;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
@@ -7,9 +11,6 @@ import com.vk.core.util.ToastUtils;
import com.vtosters.lite.R; import com.vtosters.lite.R;
import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment; import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.IconHelper;
public class ThemesFragment extends MaterialPreferenceToolbarFragment { public class ThemesFragment extends MaterialPreferenceToolbarFragment {
@Override @Override
@@ -21,11 +22,11 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
public boolean apply(Preference preference, Object obj) { public boolean apply(Preference preference, Object obj) {
if (((Boolean) obj).booleanValue()) { if (((Boolean) obj).booleanValue()) {
IconHelper.switchToVK(); switchToVK();
} else { } else {
IconHelper.switchToDefault(); switchToDefault();
} }
ToastUtils.a(Helper.getString("iconapplying")); ToastUtils.a(getString("iconapplying"));
return true; return true;
} }
@@ -38,7 +39,7 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
public static class b implements Preference.b { public static class b implements Preference.b {
@Override // android.support.v7.preference.Preference.b @Override // android.support.v7.preference.Preference.b
public boolean a(Preference preference, Object obj) { public boolean a(Preference preference, Object obj) {
ToastUtils.a(Helper.getString("restartapp")); ToastUtils.a(getString("restartapp"));
return true; return true;
} }
} }
@@ -1,6 +1,7 @@
package ru.vtosters.lite.ui.fragments.dockbar; package ru.vtosters.lite.ui.fragments.dockbar;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.getContext;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.Typeface; import android.graphics.Typeface;
@@ -14,7 +15,6 @@ import android.widget.TextView;
import java.util.List; import java.util.List;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.Themes; import ru.vtosters.lite.utils.Themes;
public class DockBarAdapter extends RecyclerView.a public class DockBarAdapter extends RecyclerView.a
@@ -42,7 +42,7 @@ public class DockBarAdapter extends RecyclerView.a
} }
private View createTabItem() { private View createTabItem() {
LinearLayout container = new LinearLayout(GetContext()); LinearLayout container = new LinearLayout(getContext());
container.setTag("tab_item_container"); container.setTag("tab_item_container");
container.setGravity(Gravity.CENTER_VERTICAL); container.setGravity(Gravity.CENTER_VERTICAL);
container.setOrientation(LinearLayout.HORIZONTAL); container.setOrientation(LinearLayout.HORIZONTAL);
@@ -54,7 +54,7 @@ public class DockBarAdapter extends RecyclerView.a
); );
container.setLayoutParams(new LinearLayout.LayoutParams(-1, convertDpToPixel(48))); container.setLayoutParams(new LinearLayout.LayoutParams(-1, convertDpToPixel(48)));
ImageView icon = new ImageView(GetContext()); ImageView icon = new ImageView(getContext());
icon.setTag("icon"); icon.setTag("icon");
icon.setImageTintList(ColorStateList.valueOf(Themes.getAccentColor())); icon.setImageTintList(ColorStateList.valueOf(Themes.getAccentColor()));
icon.setLayoutParams(new LinearLayout.LayoutParams( icon.setLayoutParams(new LinearLayout.LayoutParams(
@@ -62,7 +62,7 @@ public class DockBarAdapter extends RecyclerView.a
convertDpToPixel(24))); convertDpToPixel(24)));
container.addView(icon); container.addView(icon);
TextView title = new TextView(GetContext()); TextView title = new TextView(getContext());
title.setTag("title"); title.setTag("title");
title.setTextSize(16.0f); title.setTextSize(16.0f);
title.setTypeface(Typeface.DEFAULT_BOLD); title.setTypeface(Typeface.DEFAULT_BOLD);
@@ -76,10 +76,10 @@ public class DockBarAdapter extends RecyclerView.a
} }
private View createGroupTitle() { private View createGroupTitle() {
LinearLayout layout = new LinearLayout(GetContext()); LinearLayout layout = new LinearLayout(getContext());
layout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2)); layout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
TextView title = new TextView(GetContext()); TextView title = new TextView(getContext());
title.setTag("group_title"); title.setTag("group_title");
title.setTextSize(13.0f); title.setTextSize(13.0f);
title.setPadding( title.setPadding(
@@ -1,6 +1,7 @@
package ru.vtosters.lite.ui.fragments.dockbar; package ru.vtosters.lite.ui.fragments.dockbar;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.restartApplication;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
@@ -14,7 +15,6 @@ import android.widget.FrameLayout;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import me.grishka.appkit.fragments.ToolbarFragment; import me.grishka.appkit.fragments.ToolbarFragment;
import ru.vtosters.lite.utils.Helper;
public class DockBarFragment extends ToolbarFragment { public class DockBarFragment extends ToolbarFragment {
@@ -43,7 +43,7 @@ public class DockBarFragment extends ToolbarFragment {
save.setText("Сохранить"); save.setText("Сохранить");
save.setOnClickListener(v -> { save.setOnClickListener(v -> {
DockBarManager.getInstance().save(); DockBarManager.getInstance().save();
restarting(); restartApplication();
}); });
LinearLayout.LayoutParams saveParams = new LinearLayout.LayoutParams(0, -2); LinearLayout.LayoutParams saveParams = new LinearLayout.LayoutParams(0, -2);
@@ -57,7 +57,7 @@ public class DockBarFragment extends ToolbarFragment {
reset.setText("Сбросить"); reset.setText("Сбросить");
reset.setOnClickListener(v -> { reset.setOnClickListener(v -> {
DockBarManager.getInstance().delete(); DockBarManager.getInstance().delete();
restarting(); restartApplication();
}); });
LinearLayout.LayoutParams resetParams = new LinearLayout.LayoutParams(0, -2); LinearLayout.LayoutParams resetParams = new LinearLayout.LayoutParams(0, -2);
@@ -1,6 +1,6 @@
package ru.vtosters.lite.ui.fragments.dockbar; package ru.vtosters.lite.ui.fragments.dockbar;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getContext;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@@ -26,8 +26,6 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import ru.vtosters.lite.utils.Helper;
public class DockBarInjector { public class DockBarInjector {
private static final DockBarManager sManager = DockBarManager.getInstance(); private static final DockBarManager sManager = DockBarManager.getInstance();
@@ -63,8 +61,8 @@ public class DockBarInjector {
for (DockBarTab tab : sManager.getSelectedTabs()) { for (DockBarTab tab : sManager.getSelectedTabs()) {
MenuItem add = menu.add(0, tab.id, 0, tab.titleID); MenuItem add = menu.add(0, tab.id, 0, tab.titleID);
Drawable drawable = GetContext().getResources().getDrawable(tab.iconID); Drawable drawable = getContext().getResources().getDrawable(tab.iconID);
ColorStateList colorStateList = GetContext().getResources().getColorStateList(com.vtosters.lite.R.color.bottom_navigation_item); ColorStateList colorStateList = getContext().getResources().getColorStateList(com.vtosters.lite.R.color.bottom_navigation_item);
// if (isAndroidMonet()) { // if (isAndroidMonet()) {
// colorStateList = ColorStateList.valueOf(Themes.getAccentColor()); // colorStateList = ColorStateList.valueOf(Themes.getAccentColor());
// } // }
@@ -1,5 +1,9 @@
package ru.vtosters.lite.ui.fragments.dockbar; package ru.vtosters.lite.ui.fragments.dockbar;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Preferences.newfeed;
import static ru.vtosters.lite.utils.Preferences.olddock;
import com.vk.apps.AppsFragment; import com.vk.apps.AppsFragment;
import com.vk.discover.DiscoverFeedFragment; import com.vk.discover.DiscoverFeedFragment;
import com.vk.discover.DiscoverFragment; import com.vk.discover.DiscoverFragment;
@@ -7,7 +11,7 @@ import com.vk.fave.fragments.FaveTabFragment;
import com.vk.feedlikes.fragments.FeedLikesFragment; import com.vk.feedlikes.fragments.FeedLikesFragment;
import com.vk.menu.MenuFragment; import com.vk.menu.MenuFragment;
import com.vk.music.fragment.MusicFragment; import com.vk.music.fragment.MusicFragment;
import com.vk.newsfeed.Feed2049; import com.vk.newsfeed.HomeFragment;
import com.vk.newsfeed.NewsfeedFragment; import com.vk.newsfeed.NewsfeedFragment;
import com.vk.notifications.NotificationsContainerFragment; import com.vk.notifications.NotificationsContainerFragment;
import com.vtosters.lite.R; import com.vtosters.lite.R;
@@ -40,9 +44,6 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.Prefs;
public class DockBarManager { public class DockBarManager {
public static final int MIN_SELECTED_TABS_LIMIT = 3; public static final int MIN_SELECTED_TABS_LIMIT = 3;
public static final int MAX_SELECTED_TABS_LIMIT = 9; public static final int MAX_SELECTED_TABS_LIMIT = 9;
@@ -75,14 +76,14 @@ public class DockBarManager {
} }
private void load() { private void load() {
File dockbar = new File(Helper.GetContext().getFilesDir(), "dockbar.json"); File dockbar = new File(getContext().getFilesDir(), "dockbar.json");
if (!dockbar.exists()) { if (!dockbar.exists()) {
mSelectedTabs.add(new DockBarTab("tab_news", Prefs.olddock() ? R.drawable.ic_newsfeed_28 : R.drawable.ic_menu_newsfeed_outline_28, R.string.newsfeed, R.id.tab_news, Prefs.isUseAlternativeFragments() ? Feed2049.b.c() : NewsfeedFragment.class)); mSelectedTabs.add(new DockBarTab("tab_news", olddock() ? R.drawable.ic_newsfeed_28 : R.drawable.ic_menu_newsfeed_outline_28, R.string.newsfeed, R.id.tab_news, newfeed() ? HomeFragment.class : NewsfeedFragment.class));
mSelectedTabs.add(new DockBarTab("tab_discover", Prefs.olddock() ? R.drawable.ic_search_28 : R.drawable.ic_menu_search_outline_28, R.string.search, R.id.tab_discover, Prefs.isUseAlternativeFragments() ? DiscoverFragment.class : DiscoverFeedFragment.class)); mSelectedTabs.add(new DockBarTab("tab_discover", olddock() ? R.drawable.ic_search_28 : R.drawable.ic_menu_search_outline_28, R.string.search, R.id.tab_discover, newfeed() ? DiscoverFragment.class : DiscoverFeedFragment.class));
mSelectedTabs.add(new DockBarTab("tab_messages", Prefs.olddock() ? R.drawable.ic_menu_messages_28 : R.drawable.ic_message_28_outline, R.string.messages, R.id.tab_messages, DialogsFragment.class)); mSelectedTabs.add(new DockBarTab("tab_messages", olddock() ? R.drawable.ic_menu_messages_28 : R.drawable.ic_message_28_outline, R.string.messages, R.id.tab_messages, DialogsFragment.class));
mSelectedTabs.add(new DockBarTab("tab_feedback", Prefs.olddock() ? R.drawable.ic_menu_notifications_28 : R.drawable.ic_menu_notification_outline_28, R.string.feedback, R.id.tab_feedback, NotificationsContainerFragment.class)); mSelectedTabs.add(new DockBarTab("tab_feedback", olddock() ? R.drawable.ic_menu_notifications_28 : R.drawable.ic_menu_notification_outline_28, R.string.feedback, R.id.tab_feedback, NotificationsContainerFragment.class));
mSelectedTabs.add(new DockBarTab("tab_menu", Prefs.olddock() ? R.drawable.ic_menu_more_28 : R.drawable.ic_menu_more_outline_28, R.string.menu, R.id.tab_menu, MenuFragment.class)); mSelectedTabs.add(new DockBarTab("tab_menu", olddock() ? R.drawable.ic_menu_more_28 : R.drawable.ic_menu_more_outline_28, R.string.menu, R.id.tab_menu, MenuFragment.class));
mDisabledTabs.add(new DockBarTab("tab_friends", R.drawable.ic_user_24, R.string.friends, R.id.menu_friends, FriendsFragment.class)); mDisabledTabs.add(new DockBarTab("tab_friends", R.drawable.ic_user_24, R.string.friends, R.id.menu_friends, FriendsFragment.class));
mDisabledTabs.add(new DockBarTab("tab_groups", R.drawable.ic_users_24, R.string.groups, R.id.menu_groups, GroupsFragment.class)); mDisabledTabs.add(new DockBarTab("tab_groups", R.drawable.ic_users_24, R.string.groups, R.id.menu_groups, GroupsFragment.class));
@@ -114,14 +115,14 @@ public class DockBarManager {
item.getInt("id"), item.getInt("id"),
Class.forName(item.getString("fragmentClass")) Class.forName(item.getString("fragmentClass"))
); );
if (Prefs.isUseAlternativeFragments()) { if (newfeed()) {
if (tab.fragmentClass == NewsfeedFragment.class) { if (tab.fragmentClass == NewsfeedFragment.class) {
tab.fragmentClass = Feed2049.b.c(); tab.fragmentClass = HomeFragment.class;
} else if (tab.fragmentClass == DiscoverFeedFragment.class) { } else if (tab.fragmentClass == DiscoverFeedFragment.class) {
tab.fragmentClass = DiscoverFragment.class; tab.fragmentClass = DiscoverFragment.class;
} }
} else { } else {
if (tab.fragmentClass == Feed2049.b.c()) { if (tab.fragmentClass == HomeFragment.class) {
tab.fragmentClass = NewsfeedFragment.class; tab.fragmentClass = NewsfeedFragment.class;
} else if (tab.fragmentClass == DiscoverFragment.class) { } else if (tab.fragmentClass == DiscoverFragment.class) {
tab.fragmentClass = DiscoverFeedFragment.class; tab.fragmentClass = DiscoverFeedFragment.class;
@@ -140,14 +141,14 @@ public class DockBarManager {
item.getInt("id"), item.getInt("id"),
Class.forName(item.getString("fragmentClass")) Class.forName(item.getString("fragmentClass"))
); );
if (Prefs.isUseAlternativeFragments()) { if (newfeed()) {
if (tab.fragmentClass == NewsfeedFragment.class) { if (tab.fragmentClass == NewsfeedFragment.class) {
tab.fragmentClass = Feed2049.b.c(); tab.fragmentClass = HomeFragment.class;
} else if (tab.fragmentClass == DiscoverFeedFragment.class) { } else if (tab.fragmentClass == DiscoverFeedFragment.class) {
tab.fragmentClass = DiscoverFragment.class; tab.fragmentClass = DiscoverFragment.class;
} }
} else { } else {
if (tab.fragmentClass == Feed2049.b.c()) { if (tab.fragmentClass == HomeFragment.class) {
tab.fragmentClass = NewsfeedFragment.class; tab.fragmentClass = NewsfeedFragment.class;
} else if (tab.fragmentClass == DiscoverFragment.class) { } else if (tab.fragmentClass == DiscoverFragment.class) {
tab.fragmentClass = DiscoverFeedFragment.class; tab.fragmentClass = DiscoverFeedFragment.class;
@@ -163,13 +164,13 @@ public class DockBarManager {
} }
public void delete() { public void delete() {
File dockbar = new File(Helper.GetContext().getFilesDir(), "dockbar.json"); File dockbar = new File(getContext().getFilesDir(), "dockbar.json");
if (dockbar.exists()) dockbar.delete(); if (dockbar.exists()) dockbar.delete();
} }
public void save() { public void save() {
try { try {
File dockbar = new File(Helper.GetContext().getFilesDir(), "dockbar.json"); File dockbar = new File(getContext().getFilesDir(), "dockbar.json");
JSONArray selected = new JSONArray(); JSONArray selected = new JSONArray();
for (DockBarTab tab : mSelectedTabs) { for (DockBarTab tab : mSelectedTabs) {
@@ -1,7 +1,11 @@
package ru.vtosters.lite.ui.fragments.multiaccount; package ru.vtosters.lite.ui.fragments.multiaccount;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Themes.*; import static ru.vtosters.lite.utils.Globals.getResources;
import static ru.vtosters.lite.utils.Globals.isNetworkConnected;
import static ru.vtosters.lite.utils.Globals.restartApplication;
import static ru.vtosters.lite.utils.Themes.getTextAttr;
import static ru.vtosters.lite.utils.Themes.recolorDrawable;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
@@ -26,9 +30,6 @@ import com.vtosters.lite.im.ImEngineProvider;
import java.util.List; import java.util.List;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.Themes;
public class MultiAccountAdapter extends RecyclerView.a<MultiAccountAdapter.MultiAccountViewHolder> { public class MultiAccountAdapter extends RecyclerView.a<MultiAccountAdapter.MultiAccountViewHolder> {
private final List<MultiAccountItem> mAccounts = MultiAccountManager.buildList(); private final List<MultiAccountItem> mAccounts = MultiAccountManager.buildList();
@@ -126,7 +127,7 @@ public class MultiAccountAdapter extends RecyclerView.a<MultiAccountAdapter.Mult
VKAccount b = VKAccountManager.b(); VKAccount b = VKAccountManager.b();
PushSubscriber.a.a(b.b(), b.c()); PushSubscriber.a.a(b.b(), b.c());
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply(); AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
restarting(); restartApplication();
}); });
Drawable drawable = recolorDrawable(getResources().getDrawable(R.drawable.ic_list_add)); Drawable drawable = recolorDrawable(getResources().getDrawable(R.drawable.ic_list_add));
mAction.setImageDrawable(drawable); mAction.setImageDrawable(drawable);
@@ -142,7 +143,7 @@ public class MultiAccountAdapter extends RecyclerView.a<MultiAccountAdapter.Mult
VKAccount b = VKAccountManager.b(); VKAccount b = VKAccountManager.b();
PushSubscriber.a.a(b.b(), b.c()); PushSubscriber.a.a(b.b(), b.c());
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply(); AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
restarting(); restartApplication();
}); });
@@ -163,7 +164,7 @@ public class MultiAccountAdapter extends RecyclerView.a<MultiAccountAdapter.Mult
VKAccount b = VKAccountManager.b(); VKAccount b = VKAccountManager.b();
PushSubscriber.a.a(b.b(), b.c()); PushSubscriber.a.a(b.b(), b.c());
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply(); AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
restarting(); restartApplication();
}); });
} }
} }
@@ -1,5 +1,7 @@
package ru.vtosters.lite.ui.fragments.multiaccount; package ru.vtosters.lite.ui.fragments.multiaccount;
import static ru.vtosters.lite.utils.Globals.getString;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
@@ -9,7 +11,6 @@ import android.view.ViewGroup;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import me.grishka.appkit.fragments.ToolbarFragment; import me.grishka.appkit.fragments.ToolbarFragment;
import ru.vtosters.lite.utils.Helper;
public class MultiAccountFragment extends ToolbarFragment { public class MultiAccountFragment extends ToolbarFragment {
@@ -36,6 +37,6 @@ public class MultiAccountFragment extends ToolbarFragment {
super.a(arg0, arg1); super.a(arg0, arg1);
a(Helper.getString("accounts")); a(getString("accounts"));
} }
} }
@@ -1,7 +1,7 @@
package ru.vtosters.lite.ui.fragments.multiaccount; package ru.vtosters.lite.ui.fragments.multiaccount;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Helper.GetContext; import static ru.vtosters.lite.utils.Globals.getPreferences;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@@ -12,26 +12,24 @@ import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import ru.vtosters.lite.utils.Helper;
public class MultiAccountManager { public class MultiAccountManager {
public static void migrate() { public static void migrate() {
SharedPreferences OldPrefs = GetContext().getSharedPreferences("pref_account_manager", Context.MODE_PRIVATE); SharedPreferences OldPrefs = getContext().getSharedPreferences("pref_account_manager", Context.MODE_PRIVATE);
String OldPrefsValue = OldPrefs.getString("key_vk_account", ""); String OldPrefsValue = OldPrefs.getString("key_vk_account", "");
SharedPreferences NewPrefs = GetContext().getSharedPreferences("pref_account_manager0", Context.MODE_PRIVATE); SharedPreferences NewPrefs = getContext().getSharedPreferences("pref_account_manager0", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = NewPrefs.edit(); SharedPreferences.Editor editor = NewPrefs.edit();
editor.putString("key_vk_account", OldPrefsValue); editor.putString("key_vk_account", OldPrefsValue);
editor.apply(); editor.apply();
} }
public static SharedPreferences getCurrentAccount() { public static SharedPreferences getCurrentAccount() {
int account = GetPreferences().getInt("account", 0); int account = getPreferences().getInt("account", 0);
return GetContext().getSharedPreferences("pref_account_manager" + (account != 0 ? account : ""), Context.MODE_PRIVATE); return getContext().getSharedPreferences("pref_account_manager" + (account != 0 ? account : ""), Context.MODE_PRIVATE);
} }
private static int getAccountPrefsCount() { private static int getAccountPrefsCount() {
File[] prefs = new File(GetContext().getFilesDir().getParent(), "shared_prefs") File[] prefs = new File(getContext().getFilesDir().getParent(), "shared_prefs")
.listFiles((dir, name) -> { .listFiles((dir, name) -> {
return name.matches("pref_account_manager\\d+\\.xml"); return name.matches("pref_account_manager\\d+\\.xml");
}); });
@@ -50,7 +48,7 @@ public class MultiAccountManager {
public static List<MultiAccountItem> buildList() { public static List<MultiAccountItem> buildList() {
List<MultiAccountItem> list = new ArrayList<>(); List<MultiAccountItem> list = new ArrayList<>();
for (int i = 0; i <= getAccountPrefsCount(); i++) { for (int i = 0; i <= getAccountPrefsCount(); i++) {
SharedPreferences prefs = GetContext().getSharedPreferences("pref_account_manager" + i, Context.MODE_PRIVATE); SharedPreferences prefs = getContext().getSharedPreferences("pref_account_manager" + i, Context.MODE_PRIVATE);
String keyVKAccount = prefs.getString("key_vk_account", ""); String keyVKAccount = prefs.getString("key_vk_account", "");
if (!keyVKAccount.isEmpty()) { if (!keyVKAccount.isEmpty()) {
String name = withRegex(keyVKAccount, ".*\"name\":\\{.*?:\"(.*?)\"\\}.*", ""); String name = withRegex(keyVKAccount, ".*\"name\":\\{.*?:\"(.*?)\"\\}.*", "");
@@ -65,22 +63,22 @@ public class MultiAccountManager {
} }
public static boolean switchAccount(int i) { public static boolean switchAccount(int i) {
int account = GetPreferences().getInt("account", 0); int account = getPreferences().getInt("account", 0);
if (account == i) return false; if (account == i) return false;
GetPreferences().edit().putInt("account", i).commit(); getPreferences().edit().putInt("account", i).commit();
return true; return true;
} }
public static void addAccount() { public static void addAccount() {
GetPreferences().edit().putInt("account", getAccountPrefsCount()).commit(); getPreferences().edit().putInt("account", getAccountPrefsCount()).commit();
} }
public static void deleteAccount(int i) { public static void deleteAccount(int i) {
int account = GetPreferences().getInt("account", 0); int account = getPreferences().getInt("account", 0);
SharedPreferences prefs = GetContext().getSharedPreferences("pref_account_manager" + i, Context.MODE_PRIVATE); SharedPreferences prefs = getContext().getSharedPreferences("pref_account_manager" + i, Context.MODE_PRIVATE);
prefs.edit().clear().commit(); prefs.edit().clear().commit();
File file = new File(new File(GetContext().getFilesDir().getParent(), "shared_prefs"), "pref_account_manager" + i); File file = new File(new File(getContext().getFilesDir().getParent(), "shared_prefs"), "pref_account_manager" + i);
if (file.exists()) file.delete(); if (file.exists()) file.delete();
if (account == i && getAccountPrefsCount() > 0) if (account == i && getAccountPrefsCount() > 0)
switchAccount(buildList().get(0).index); switchAccount(buildList().get(0).index);
@@ -1,8 +1,17 @@
package ru.vtosters.lite.ui.fragments.tgstickers; package ru.vtosters.lite.ui.fragments.tgstickers;
import static android.widget.Toast.*; import static android.widget.Toast.LENGTH_SHORT;
import static ru.vtosters.lite.utils.Helper.*; import static android.widget.Toast.makeText;
import static ru.vtosters.lite.utils.Themes.*; import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getResources;
import static ru.vtosters.lite.utils.Globals.getString;
import static ru.vtosters.lite.utils.Themes.getAccentColor;
import static ru.vtosters.lite.utils.Themes.getNavbarColor;
import static ru.vtosters.lite.utils.Themes.getSTextAttr;
import static ru.vtosters.lite.utils.Themes.getTextAttr;
import static ru.vtosters.lite.utils.Themes.recolorDrawable;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
@@ -28,7 +37,6 @@ import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@@ -47,9 +55,6 @@ import java.io.File;
import me.grishka.appkit.fragments.ToolbarFragment; import me.grishka.appkit.fragments.ToolbarFragment;
import ru.vtosters.lite.tgs.TGPref; import ru.vtosters.lite.tgs.TGPref;
import ru.vtosters.lite.ui.PreferencesUtil; import ru.vtosters.lite.ui.PreferencesUtil;
import ru.vtosters.lite.utils.Helper;
import ru.vtosters.lite.utils.Prefs;
import ru.vtosters.lite.utils.Themes;
public class StickersFragment extends ToolbarFragment { public class StickersFragment extends ToolbarFragment {
@@ -209,7 +214,7 @@ public class StickersFragment extends ToolbarFragment {
@Override @Override
public View d(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View d(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
grabber = new TelegramStickersGrabber(TGPref.getTGBotKey()); grabber = new TelegramStickersGrabber(TGPref.getTGBotKey());
stickersService = TelegramStickersService.getInstance(GetContext()); stickersService = TelegramStickersService.getInstance(getContext());
editPadding = convertDpToPixel(24f); editPadding = convertDpToPixel(24f);
@@ -252,13 +257,13 @@ public class StickersFragment extends ToolbarFragment {
LinearLayout linearLayout = new LinearLayout(super.n()); LinearLayout linearLayout = new LinearLayout(super.n());
final EditText editText = new EditText(super.n()); final EditText editText = new EditText(super.n());
editText.setHintTextColor(PreferencesUtil.getSTextColor(GetContext())); editText.setHintTextColor(PreferencesUtil.getSTextColor(getContext()));
// Костыль для китката // Костыль для китката
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
editText.setBackgroundTintList(ColorStateList.valueOf(PreferencesUtil.getTextColor(GetContext()))); editText.setBackgroundTintList(ColorStateList.valueOf(PreferencesUtil.getTextColor(getContext())));
} else { } else {
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(GetContext()))); ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(getContext())));
} }
linearLayout.addView(editText); linearLayout.addView(editText);
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT; editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
@@ -272,7 +277,7 @@ public class StickersFragment extends ToolbarFragment {
.setPositiveButton(android.R.string.ok, (dialog, which) -> { .setPositiveButton(android.R.string.ok, (dialog, which) -> {
String pack = editText.getText().toString(); String pack = editText.getText().toString();
pack = parsePack(pack); pack = parsePack(pack);
stickersService.requestPackDownload(pack, new File(GetContext().getFilesDir(), new File("VT-Stickers", pack).getAbsolutePath())); stickersService.requestPackDownload(pack, new File(getContext().getFilesDir(), new File("VT-Stickers", pack).getAbsolutePath()));
}).setNeutralButton(android.R.string.cancel, null).create().show(); }).setNeutralButton(android.R.string.cancel, null).create().show();
}; };
if (TGPref.getTGBotKey() == null) enterBotKey(() -> checkApiKey(work)); if (TGPref.getTGBotKey() == null) enterBotKey(() -> checkApiKey(work));
@@ -291,7 +296,7 @@ public class StickersFragment extends ToolbarFragment {
@Override @Override
public void b(@Nullable Bundle savedInstanceState) { public void b(@Nullable Bundle savedInstanceState) {
super.b(savedInstanceState); super.b(savedInstanceState);
GetContext().registerReceiver(receiver, new IntentFilter(ACTION_RELOAD)); getContext().registerReceiver(receiver, new IntentFilter(ACTION_RELOAD));
} }
@Override @Override
@@ -306,7 +311,7 @@ public class StickersFragment extends ToolbarFragment {
@Override @Override
public void A_() { public void A_() {
super.A_(); super.A_();
GetContext().unregisterReceiver(receiver); getContext().unregisterReceiver(receiver);
} }
private String parsePack(String pack) { private String parsePack(String pack) {
@@ -353,7 +358,7 @@ public class StickersFragment extends ToolbarFragment {
holder.updateButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.ic_camera_switch_48))); holder.updateButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.ic_camera_switch_48)));
holder.updateButton.setOnClickListener(listener -> { holder.updateButton.setOnClickListener(listener -> {
stickersService.setBotKey(TGPref.getTGBotKey()); stickersService.setBotKey(TGPref.getTGBotKey());
stickersService.requestPackDownload(pack.id, new File(GetContext().getFilesDir(), new File("VT-Stickers", pack.id).getAbsolutePath())); stickersService.requestPackDownload(pack.id, new File(getContext().getFilesDir(), new File("VT-Stickers", pack.id).getAbsolutePath()));
}); });
holder.deleteButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.vkim_ic_msg_delete))); holder.deleteButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.vkim_ic_msg_delete)));
@@ -367,7 +372,7 @@ public class StickersFragment extends ToolbarFragment {
holder.switchCompat.setOnCheckedChangeListener((buttonView, isChecked) -> stickersService.setPackEnabled(pack, isChecked, false)); holder.switchCompat.setOnCheckedChangeListener((buttonView, isChecked) -> stickersService.setPackEnabled(pack, isChecked, false));
holder.count.setText(pack.stickersCount + " " + getString("stickerscount")); holder.count.setText(pack.stickersCount + " " + getString("stickerscount"));
holder.layout.setBackgroundColor(Prefs.getNavbarColor()); holder.layout.setBackgroundColor(getNavbarColor());
// Color костыль // Color костыль
int color = getTextAttr(); int color = getTextAttr();
@@ -1,6 +1,7 @@
package ru.vtosters.lite.ui.fragments.tgstickers; package ru.vtosters.lite.ui.fragments.tgstickers;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getString;
import android.os.Bundle; import android.os.Bundle;
@@ -11,7 +12,6 @@ import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.tgs.TGPref; import ru.vtosters.lite.tgs.TGPref;
import ru.vtosters.lite.tgs.TGRoot; import ru.vtosters.lite.tgs.TGRoot;
import ru.vtosters.lite.ui.PreferencesUtil; import ru.vtosters.lite.ui.PreferencesUtil;
import ru.vtosters.lite.utils.Helper;
public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragment { public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragment {
@@ -19,7 +19,7 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
public void b(Bundle bundle) { public void b(Bundle bundle) {
super.b(bundle); super.b(bundle);
int vtosterXml = GetContext().getResources().getIdentifier("empty", "xml", GetContext().getPackageName()); int vtosterXml = getContext().getResources().getIdentifier("empty", "xml", getContext().getPackageName());
this.a(vtosterXml); this.a(vtosterXml);
PreferencesUtil.addPreferenceCategory(this, getString("sprefsstickers")); PreferencesUtil.addPreferenceCategory(this, getString("sprefsstickers"));
@@ -85,7 +85,7 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
@Override @Override
public int aq() { public int aq() {
return GetContext().getResources().getIdentifier("vtltgs", "string", GetContext().getPackageName()); return getContext().getResources().getIdentifier("vtltgs", "string", getContext().getPackageName());
} }
} }
@@ -0,0 +1,66 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Globals.*;
import static ru.vtosters.lite.utils.Preferences.*;
import android.content.Context;
import com.vk.about.Items;
import com.vk.about.Items1;
import com.vk.about.Items2;
import java.io.IOException;
import java.util.List;
import java.util.Scanner;
public class About {
public static void injectAbout(List<Items2> list) {
list.clear();
list.add(new Items1());
if (!oldabout()) {
list.add(new Items(21, com.vtosters.lite.R.string.opencommit));
list.add(new Items(8, com.vtosters.lite.R.string.tgchannel));
list.add(new Items(9, com.vtosters.lite.R.string.tgchat));
list.add(new Items(16, com.vtosters.lite.R.string.vtfaq));
list.add(new Items(19, com.vtosters.lite.R.string.vtsite));
list.add(new Items(20, com.vtosters.lite.R.string.donate));
list.add(new Items(17, com.vtosters.lite.R.string.vkgroup));
list.add(new Items(18, com.vtosters.lite.R.string.sett_debug));
return;
}
list.add(new Items(0, com.vtosters.lite.R.string.about_app_feedback));
list.add(new Items(1, com.vtosters.lite.R.string.about_app_estimate));
list.add(new Items(2, com.vtosters.lite.R.string.about_app_privacy));
list.add(new Items(5, com.vtosters.lite.R.string.about_app_cookie));
list.add(new Items(3, com.vtosters.lite.R.string.about_app_terms_to_use));
list.add(new Items(4, com.vtosters.lite.R.string.about_app_license));
list.add(new Items(6, com.vtosters.lite.R.string.about_app_data_protect));
list.add(new Items(8, com.vtosters.lite.R.string.sett_debug));
}
public static String getBuildNumber() {
return getBuild(getContext(), "version.properties");
}
public static String getCommitLink() {
return "https://github.com/vtosters/lite/commit/" + getBuild(getContext(), "version.properties");
}
public static String getBuild(Context context, String name) {
try {
Scanner scanner = new Scanner(context.getAssets().open(name));
while (scanner.hasNextLine()) {
String line = scanner.findInLine("VERSION_BUILD=.+");
if (line != null)
return line.replace("VERSION_BUILD=", "");
return "0000000";
}
} catch (IOException e) {
e.printStackTrace();
}
return "0000000";
}
public static String getAppVersion() throws IOException {
return getApplicationName() + " " + VERSIONNAME + " | " + getBuildNumber();
}
}
@@ -1,6 +1,8 @@
package ru.vtosters.lite.utils; package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.isEmpty;
import static ru.vtosters.lite.utils.Preferences.*;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
@@ -39,7 +41,7 @@ public class ExternalLinkHandler {
} }
} }
if (!Prefs.isEnableExternalOpening()) return false; if (!isEnableExternalOpening()) return false;
if (checkVkVideo(file)) { if (checkVkVideo(file)) {
if (qualities.size() == 1) { if (qualities.size() == 1) {
@@ -120,7 +122,7 @@ public class ExternalLinkHandler {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
} }
GetContext().startActivity(intent); getContext().startActivity(intent);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@@ -129,7 +131,7 @@ public class ExternalLinkHandler {
} }
private static String getMXPlayerPackageName() { private static String getMXPlayerPackageName() {
for (ApplicationInfo info : GetContext().getPackageManager().getInstalledApplications(0)) { for (ApplicationInfo info : getContext().getPackageManager().getInstalledApplications(0)) {
String packName = info.packageName; String packName = info.packageName;
if (packName.equals("com.mxtech.videoplayer.ad") || packName.equals("com.mxtech.videoplayer.pro")) if (packName.equals("com.mxtech.videoplayer.ad") || packName.equals("com.mxtech.videoplayer.pro"))
return packName; return packName;
@@ -0,0 +1,230 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Preferences.getLocale;
import android.app.Activity;
import android.app.Application;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.annotation.NonNull;
import com.vk.core.util.ToastUtils;
import com.vtosters.lite.UserProfile;
import com.vtosters.lite.VKActivity;
import com.vtosters.lite.api.ExtendedUserProfile;
import com.vtosters.lite.auth.VKAccountManager;
import com.vtosters.lite.im.ImEngineProvider;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class Globals {
private static final List<Activity> activities = new ArrayList<>();
// Current UserId
public static int getUserId() {
return VKAccountManager.b().a();
}
public static String getUserSecret() {
return VKAccountManager.b().c();
}
public static String getUserToken() {
return VKAccountManager.b().b();
}
public static SharedPreferences.Editor edit() {
return PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
}
// Delete and reload msg cache
public static void reloadMSG() {
ImEngineProvider.a().h();
}
// UserId Profile via userProfile
public static int getUserID(UserProfile userProfile) {
return userProfile.n;
}
public static String getUserFirstName(UserProfile userProfile) {
return userProfile.p;
}
public static String getUserLastName(UserProfile userProfile) {
return userProfile.o;
}
// UserId Profile via extendedUserProfile
public static int getUserID(ExtendedUserProfile extendedUserProfile) {
return getUserID(fromEup(extendedUserProfile));
}
public static UserProfile fromEup(ExtendedUserProfile extendedUserProfile) {
return extendedUserProfile.a;
}
// Application restart (works on sdk 29+ too)
public static void restartApplication() {
Context ctx = getContext();
PackageManager pm = ctx.getPackageManager();
Intent intent = pm.getLaunchIntentForPackage(ctx.getPackageName());
Intent mainIntent = Intent.makeRestartActivityTask(intent.getComponent());
ctx.startActivity(mainIntent);
Runtime.getRuntime().exit(0);
}
// Global Context
@NonNull
public static Context getContext() {
try {
Class<?> appGlobalsClazz = Class.forName("android.app.AppGlobals");
Method getInitialApplication = appGlobalsClazz.getDeclaredMethod("getInitialApplication");
getInitialApplication.setAccessible(true);
return (Context) getInitialApplication.invoke(null);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
// Google Market Services check
public static boolean isGmsInstalled() {
try {
getContext().getPackageManager().getPackageInfo("com.google.android.gms", 0);
return true;
} catch (Exception unused) {
return false;
}
}
public static Resources getResources() {
return getContext().getResources();
}
public static int getIdentifier(String str, String str2) {
return getResources().getIdentifier(str, str2, getContext().getPackageName());
}
public static String getString(String str) {
return getContext().getString(Integer.parseInt(String.valueOf(getContext().getResources().getIdentifier(str, "string", getContext().getPackageName()))));
}
public static String getPackageName() {
return getContext().getPackageName();
}
public static int convertDpToPixel(float f) {
return (int) (f * ((float) getContext().getResources().getDisplayMetrics().densityDpi / 160.0f));
}
public static SharedPreferences getPreferences() {
return PreferenceManager.getDefaultSharedPreferences(getContext());
}
public static void sendToast(String text) {
ToastUtils.a(text);
}
public static boolean isEmpty(String str) {
return str == null || str.isEmpty();
}
public static boolean isNetworkConnected() {
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
}
// Music channels fix
public static void fixGapps() {
try {
if (Build.VERSION.SDK_INT >= 26) {
NotificationManager notificationManager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE);
boolean z = false;
try {
if (notificationManager.getNotificationChannel("audio_playback_channel") != null) {
z = true;
}
} catch (Exception ignored) {
}
if (!z) {
notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", getResources().getString(com.vtosters.lite.R.string.audio_message_play_error), NotificationManager.IMPORTANCE_LOW));
}
}
} catch (Exception ignored) {
}
}
public static void registerActivities(Application application) {
application.registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() {
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
if (activity instanceof VKActivity) {
activities.add(activity);
}
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
activities.remove(activity);
}
});
}
public static String getApplicationName() {
return getContext().getApplicationInfo().loadLabel(getContext().getPackageManager()).toString();
}
// Language changer and BaseContext inject
public static Context BaseContextLocale(Context context) {
Locale locale = new Locale(getLocale());
Locale.setDefault(locale);
var resources = context.getResources();
var configuration = resources.getConfiguration();
if (Build.VERSION.SDK_INT >= 24) {
configuration.setLocale(locale);
configuration.setLayoutDirection(locale);
return context.createConfigurationContext(configuration);
}
configuration.locale = locale;
configuration.setLayoutDirection(locale);
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return context;
}
}
@@ -1,148 +0,0 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Proxy.*;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.preference.PreferenceManager;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import com.vk.core.util.ToastUtils;
import com.vtosters.lite.UserProfile;
import com.vtosters.lite.api.ExtendedUserProfile;
import com.vtosters.lite.auth.VKAccountManager;
import com.vtosters.lite.im.ImEngineProvider;
import java.lang.reflect.Method;
public class Helper {
public static int GetUserId() {
return VKAccountManager.b().a();
}
public static String GetUserSecret() {
return VKAccountManager.b().c();
}
public static String GetUserToken() {
return VKAccountManager.b().b();
}
public static SharedPreferences.Editor edit() {
return PreferenceManager.getDefaultSharedPreferences(GetContext()).edit();
}
public static String getConnectorDomain(String str) {
return GetConnector(str);
}
public static void reloadMSG() {
ImEngineProvider.a().h();
}
public static int getUserID(UserProfile userProfile) {
return userProfile.n;
}
public static String getUserFirstName(UserProfile userProfile) {
return userProfile.p;
}
public static String getUserLastName(UserProfile userProfile) {
return userProfile.o;
}
public static int getUserID(ExtendedUserProfile extendedUserProfile) {
return getUserID(fromEup(extendedUserProfile));
}
public static UserProfile fromEup(ExtendedUserProfile extendedUserProfile) {
return extendedUserProfile.a;
}
public static void restarting() {
Context ctx = GetContext();
PackageManager pm = ctx.getPackageManager();
Intent intent = pm.getLaunchIntentForPackage(ctx.getPackageName());
Intent mainIntent = Intent.makeRestartActivityTask(intent.getComponent());
ctx.startActivity(mainIntent);
Runtime.getRuntime().exit(0);
}
@NonNull
public static Context GetContext() {
try {
Class<?> appGlobalsClazz = Class.forName("android.app.AppGlobals");
Method getInitialApplication = appGlobalsClazz.getDeclaredMethod("getInitialApplication");
getInitialApplication.setAccessible(true);
return (Context) getInitialApplication.invoke(null);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static boolean IsGmsInstalled() {
try {
GetContext().getPackageManager().getPackageInfo("com.google.android.gms", 0);
return true;
} catch (Exception unused) {
return false;
}
}
public static Resources getResources() {
return GetContext().getResources();
}
public static int getIdentifier(String str, String str2) {
return getResources().getIdentifier(str, str2, GetContext().getPackageName());
}
public static String getString(String str) {
return GetContext().getString(Integer.parseInt(String.valueOf(GetContext().getResources().getIdentifier(str, "string", GetContext().getPackageName()))));
}
public static String getPackageName() {
return GetContext().getPackageName();
}
public static int convertDpToPixel(float f) {
return (int) (f * (((float) GetContext().getResources().getDisplayMetrics().densityDpi) / 160.0f));
}
public static String GetString(@StringRes int res, Object... args) {
return GetContext().getString(res, args);
}
public static SharedPreferences GetPrefs() {
return PreferenceManager.getDefaultSharedPreferences(GetContext());
}
public static SharedPreferences GetPreferences() {
return PreferenceManager.getDefaultSharedPreferences(GetContext());
}
public static void SendToast(String text) {
ToastUtils.a(text);
}
public static boolean isEmpty(String str) {
return str == null || str.isEmpty();
}
public static boolean isNetworkConnected() {
ConnectivityManager cm = (ConnectivityManager) GetContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
}
}
@@ -1,20 +1,21 @@
package ru.vtosters.lite.utils; package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getPackageName;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
public class IconHelper { public class IconHelper {
public static void switchToVK() { public static void switchToVK() {
var packageManager = GetContext().getPackageManager(); var packageManager = getContext().getPackageManager();
var packageName = getPackageName(); var packageName = getPackageName();
packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconDefault"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconDefault"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconVK"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconVK"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
} }
public static void switchToDefault() { public static void switchToDefault() {
var packageManager = GetContext().getPackageManager(); var packageManager = getContext().getPackageManager();
var packageName = getPackageName(); var packageName = getPackageName();
packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconDefault"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconDefault"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconVK"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconVK"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
@@ -0,0 +1,265 @@
package ru.vtosters.lite.utils;
import static java.lang.Long.MAX_VALUE;
import static ru.vtosters.lite.ui.fragments.dockbar.DockBarManager.getInstance;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getPreferences;
import static ru.vtosters.lite.utils.Preferences.BooleanTrue;
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.copyright_post;
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
import static ru.vtosters.lite.utils.Preferences.newfeed;
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
import com.vk.apps.AppsFragment;
import com.vk.core.preference.Preference;
import com.vk.discover.DiscoverFeedFragment;
import com.vk.discover.DiscoverFragment;
import com.vk.fave.fragments.FaveTabFragment;
import com.vk.menu.MenuFragment;
import com.vk.music.fragment.MusicFragment;
import com.vk.navigation.NavigatorKeys;
import com.vk.newsfeed.HomeFragment;
import com.vk.newsfeed.NewsfeedFragment;
import com.vk.notifications.NotificationsContainerFragment;
import com.vtosters.lite.fragments.GamesFragment;
import com.vtosters.lite.fragments.PhotosFragment;
import com.vtosters.lite.fragments.ProfileFragment;
import com.vtosters.lite.fragments.SettingsListFragment;
import com.vtosters.lite.fragments.d.DocumentsViewFragment;
import com.vtosters.lite.fragments.f.FriendsFragment;
import com.vtosters.lite.fragments.g.BirthdaysFragment;
import com.vtosters.lite.fragments.h.GroupsFragment;
import com.vtosters.lite.fragments.lives.LivesTabsFragment;
import com.vtosters.lite.fragments.m.VideosFragment;
import com.vtosters.lite.fragments.messages.dialogs.DialogsFragment;
import com.vtosters.lite.fragments.money.MoneyTransfersFragment;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Newsfeed {
public static List<String> mFilters;
public static boolean isBlockedByFilter(String str) {
for (String str2 : mFilters) {
if (str.toLowerCase().contains(str2.toLowerCase())) {
return true;
}
}
return false;
}
public static void setupFilters() {
mFilters = new ArrayList();
getFilter("refsfilter", "Referals.txt");
getFilter("shortlinkfilter", "LinkShorter.txt");
getFilter("default_ad_list", "StandartFilter.txt");
getFilter("shitposting", "IDontWantToReadIt.txt");
String string = getPreferences().getString("spamfilters", "");
if (!string.isEmpty()) {
mFilters.addAll(Arrays.asList(string.split(", ")));
}
}
public static void getFilter(String boolname, String filename) {
if (BooleanTrue(boolname)) {
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(getContext().getAssets().open(filename)));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
mFilters.add(readLine);
} else {
bufferedReader.close();
return;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static boolean injectFilters(JSONObject jSONObject) {
String optString = jSONObject.optString(NavigatorKeys.j, "");
if (!ads(optString) && !authors_rec(optString) && !recomm(optString) && !friendrecomm(optString)) {
String optString2 = jSONObject.optString("post_type", "");
if (!ads(optString2) && !authors_rec(optString2) && !recomm(optString2) && !friendrecomm(optString2)) {
String optString3 = jSONObject.optString("filters", "");
if (ads(optString3) || authors_rec(optString3) || recomm(optString3) || friendrecomm(optString3) || isBlockedByFilter(jSONObject.optString(NavigatorKeys.x, "")) || checkCopyright(jSONObject) || captions(jSONObject)) {
return false;
}
return !AD(jSONObject);
}
}
return false;
}
public static boolean authors_rec(String str) {
return str.equals("authors_rec") && !authorsrecomm();
}
public static boolean captions(JSONObject jSONObject) {
try {
JSONObject jSONObject2 = jSONObject.getJSONObject("caption");
if (!Preferences.captions()) {
return true;
}
boolean postsrecomm = postsrecomm();
return (jSONObject2.getString(NavigatorKeys.j).equals("explorebait") && !postsrecomm) || ((jSONObject2.getString(NavigatorKeys.j).equals("shared") && postsrecomm) || ((jSONObject.getString(NavigatorKeys.j).equals("digest") && postsrecomm) || ((jSONObject2.getString(NavigatorKeys.j).equals("commented") && postsrecomm) || (jSONObject2.getString(NavigatorKeys.j).equals("voted") && postsrecomm))));
} catch (JSONException unused) {
return false;
}
}
public static boolean ads(String str) {
if ((str.equals("ads_easy_promote") || str.equals("promo_button") || str.equals("app_widget") || str.equals("ads")) && Preferences.ads()) {
return true;
}
return false;
}
public static boolean recomm(String str) {
return (str.equals("user_rec") || str.equals("live_recommended") || str.equals("inline_user_rec")) && !postsrecomm();
}
public static boolean friendrecomm(String str) {
return str.equals("friends_recommendations") && !friendsrecomm();
}
public static boolean AD(JSONObject jSONObject) {
return jSONObject.optInt("marked_as_ads", 0) == 1 && adsgroup();
}
public static boolean checkCopyright(JSONObject jSONObject) {
return jSONObject.optInt("copyright", 0) == 1 && copyright_post();
}
public static String friendsads() {
return postsrecomm() ? "user_rec" : "null";
}
public static String getFriendRecomm() {
return friendsrecomm() ? "friends_recommendations" : "null";
}
public static String authorsads() {
return authorsrecomm() ? "authors_rec" : "null";
}
public static String widgetads() {
return Preferences.ads() ? "null" : "app_widget";
}
public static String promoads() {
return Preferences.ads() ? "null" : "promo_button";
}
public static String storyads() {
return adsstories() ? "null" : "ads";
}
public static String getCommentsSort(String def) {
String string = getPreferences().getString("commentssort", "");
if (string.isEmpty()) {
return def;
}
if (string.equals("new")) {
return "desc";
}
if (string.equals("old")) {
return "asc";
}
return def;
}
public static long getUpdateNewsfeed(boolean refresh_timeout) {
String string = getPreferences().getString("newsupdate", "");
if (string.isEmpty()) {
return Preference.b().getLong(refresh_timeout ? "refresh_timeout_top" : "refresh_timeout_recent", 600000L);
}
if (string.equals("no_update")) {
return MAX_VALUE;
}
if (string.equals("imd_update")) {
return 10000L;
}
return Preference.b().getLong(refresh_timeout ? "refresh_timeout_top" : "refresh_timeout_recent", 600000L);
}
public static Class getStartFragment() {
String string = getPreferences().getString("start_values", "");
if (string.equals("default")) {
return getInstance().getSelectedTabs().get(0).fragmentClass;
}
if (string.equals("newsfeed")) {
return newfeed() ? HomeFragment.class : NewsfeedFragment.class;
}
if (string.equals("messenger")) {
return DialogsFragment.class;
}
if (string.equals("groups")) {
return GroupsFragment.class;
}
if (string.equals("music")) {
return MusicFragment.class;
}
if (string.equals("friends")) {
return FriendsFragment.class;
}
if (string.equals("photos")) {
return PhotosFragment.class;
}
if (string.equals("videos")) {
return VideosFragment.class;
}
if (string.equals("settings")) {
return SettingsListFragment.class;
}
if (string.equals("apps")) {
return AppsFragment.class;
}
if (string.equals("discover")) {
return newfeed() ? DiscoverFragment.class : DiscoverFeedFragment.class;
}
if (string.equals("notifications")) {
return NotificationsContainerFragment.class;
}
if (string.equals("money")) {
return MoneyTransfersFragment.class;
}
if (string.equals("games")) {
return GamesFragment.class;
}
if (string.equals("liked")) {
return FaveTabFragment.class;
}
if (string.equals("menu")) {
return MenuFragment.class;
}
if (string.equals("profile")) {
return ProfileFragment.class;
}
if (string.equals("lives")) {
return LivesTabsFragment.class;
}
if (string.equals("docs")) {
return DocumentsViewFragment.class;
}
return string.equals("brtd") ? BirthdaysFragment.class : getInstance().getSelectedTabs().get(0).fragmentClass;
}
}
@@ -0,0 +1,319 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.ui.fragments.multiaccount.MultiAccountManager.migrate;
import static ru.vtosters.lite.utils.Globals.*;
import static ru.vtosters.lite.utils.Newsfeed.*;
import static ru.vtosters.lite.utils.Proxy.*;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.preference.PreferenceManager;
import com.vk.core.util.Screen;
import com.vtosters.lite.data.Users;
import java.util.Locale;
public class Preferences {
public static String VERSIONNAME = "Beta";
public static void init(Application application) {
setupFilters();
fixGapps();
setProxy();
migrate();
registerActivities(application);
}
public static boolean BooleanFalse(String key) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
return prefs.getBoolean(key, false);
}
public static boolean BooleanTrue(String key) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
return prefs.getBoolean(key, true);
}
public static boolean authorsrecomm() {
return BooleanTrue("authorsrecomm");
}
public static boolean captions() {
return BooleanTrue("captions");
}
public static boolean copyright_post() {
return BooleanFalse("copyright_post");
}
public static boolean default_ad_list() {
return BooleanFalse("default_ad_list");
}
public static boolean shitposting() {
return BooleanFalse("shitposting");
}
public static boolean friendsrecomm() {
return BooleanTrue("friendsrecomm");
}
public static boolean isBGStickersEnabled() {
return BooleanTrue("isBGStickersEnabled");
}
public static boolean ads() {
return BooleanFalse("__dbg_no_ads");
}
public static boolean adsgroup() {
return BooleanFalse("adsgroup");
}
public static boolean olddock() {
return BooleanFalse("olddock");
}
public static boolean adsslider() {
return BooleanFalse("__dbg_no_slider_ads");
}
public static boolean adsstories() {
return BooleanFalse("adsstories");
}
public static boolean alteremoji(Context context) {
return alteremojipref() ? alteremojipref() : Screen.a(context);
}
public static boolean alteremojipref() {
return BooleanFalse("alteremoji");
}
public static boolean awayphp() {
return BooleanTrue("awayphp");
}
public static boolean VKUI_INJ() {
return BooleanTrue("VKUI_INJ");
}
public static boolean benchmark() {
return BooleanFalse("benchmark");
}
public static boolean calls() {
return BooleanTrue("calls");
}
public static boolean convUsersOnline() {
return BooleanFalse("convUsersOnline");
}
public static boolean darkmode() {
return BooleanTrue("darkmode");
}
public static boolean dev() {
return BooleanFalse("dev");
}
public static boolean devmenu() {
return BooleanFalse("devmenu");
}
public static boolean dnr() {
return BooleanTrue("dnr");
}
public static boolean dns() {
return BooleanTrue("dns");
}
public static boolean libverify() {
return BooleanFalse("libverify");
}
public static boolean dnt() {
return BooleanTrue("dnt");
}
public static boolean dockcounter() {
return BooleanTrue("dockcounter");
}
public static boolean feedcache() {
return BooleanTrue("feedcache");
}
public static void forceOffline() {
if (setoffline()) {
Users.b();
}
setupFilters();
}
public static boolean fulltime() {
return BooleanTrue("fulltime");
}
public static boolean gcmfix() {
return BooleanTrue("gcmfix");
}
public static boolean hasMusicSubscription() {
return BooleanTrue("hasMusicSubscription");
}
public static boolean isEnableExternalOpening() {
return BooleanFalse("isEnableExternalOpening");
}
public static boolean iconvk() {
return BooleanFalse("iconvk");
}
public static boolean iconvkru() {
return BooleanFalse("iconvkru");
}
public static boolean isMusicRestricted() {
return BooleanTrue("isMusicRestricted");
}
public static boolean msgflat() {
return BooleanFalse("msgflat");
}
public static boolean msgtails() {
return BooleanTrue("msgtails");
}
public static boolean navbar() {
return BooleanTrue("navbar");
}
public static boolean newfeed() {
return BooleanTrue("newfeed");
}
public static boolean offline() {
return BooleanTrue("offline");
}
public static boolean oldabout() {
return BooleanFalse("oldabout");
}
public static boolean postsrecomm() {
return BooleanTrue("postsrecomm");
}
public static String readstatus() {
return dnr() ? "messages.markAsRead" : "null";
}
public static boolean refsfilter() {
return BooleanFalse("refsfilter");
}
public static boolean setoffline() {
return BooleanFalse("setoffline");
}
public static boolean shortinfo() {
return BooleanTrue("shortinfo");
}
public static boolean shortlinkfilter() {
return BooleanFalse("shortlinkfilter");
}
public static boolean shortpost() {
return BooleanTrue("shortpost");
}
public static boolean showmenu() {
return BooleanFalse("showmenu");
}
public static boolean ssl() {
return BooleanTrue("ssl");
}
public static boolean stories() {
return BooleanTrue("stories");
}
public static boolean swipe() {
return BooleanTrue("swipe");
}
public static boolean systememoji() {
return BooleanFalse("systememoji");
}
public static boolean unlockstats() {
return BooleanFalse("unlockstats");
}
public static boolean usevkui() {
return BooleanTrue("usevkui");
}
public static boolean vksans() {
return BooleanFalse("vksans");
}
public static boolean voice() {
return BooleanTrue("voice");
}
public static boolean newvideo() {
return false;
}
public static int getMsgCount() {
String customvalue = getPreferences().getString("msgcount", "");
return customvalue.isEmpty() ? 30 : Integer.parseInt(customvalue);
}
public static String MediacontentFix() {
return Build.VERSION.SDK_INT >= 29 ? "date_modified DESC" : "datetaken DESC";
}
public static String MediacontentFix2() {
return Build.VERSION.SDK_INT >= 29 ? "date_modified" : "datetaken";
}
public static String MediacontentFix3() {
return Build.VERSION.SDK_INT >= 29 ? ", date_modified=" : ", dateTaken=";
}
public static boolean color_grishka() {
return BooleanTrue("color_grishka");
}
public static boolean vkme_msg() {
return BooleanFalse("vkme_msg");
}
public static String VKVersion() {
String string = getPreferences().getString("vkversion", "");
if (!string.isEmpty()) {
return string;
}
return "5.29";
}
public static String getLocale() {
String string = getPreferences().getString("lang_value", "");
if (string.equals("system")) {
return Locale.getDefault().getLanguage();
}
return string.isEmpty() ? Locale.getDefault().getLanguage() : string;
}
}
@@ -1,900 +0,0 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Helper.*;
import static ru.vtosters.lite.utils.Proxy.setProxy;
import android.app.Activity;
import android.app.Application;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Window;
import com.vk.about.Items;
import com.vk.about.Items1;
import com.vk.about.Items2;
import com.vk.apps.AppsFragment;
import com.vk.core.ui.themes.VKThemeHelper;
import com.vk.core.util.Screen;
import com.vk.fave.fragments.FaveTabFragment;
import com.vk.menu.MenuFragment;
import com.vk.music.fragment.MusicFragment;
import com.vk.navigation.NavigatorKeys;
import com.vk.newsfeed.Feed2049;
import com.vk.notifications.NotificationsContainerFragment;
import com.vtosters.lite.R;
import com.vtosters.lite.VKActivity;
import com.vtosters.lite.data.Users;
import com.vtosters.lite.fragments.GamesFragment;
import com.vtosters.lite.fragments.PhotosFragment;
import com.vtosters.lite.fragments.ProfileFragment;
import com.vtosters.lite.fragments.SettingsListFragment;
import com.vtosters.lite.fragments.d.DocumentsViewFragment;
import com.vtosters.lite.fragments.f.FriendsFragment;
import com.vtosters.lite.fragments.g.BirthdaysFragment;
import com.vtosters.lite.fragments.h.GroupsFragment;
import com.vtosters.lite.fragments.lives.LivesTabsFragment;
import com.vtosters.lite.fragments.m.VideosFragment;
import com.vtosters.lite.fragments.messages.dialogs.DialogsFragment;
import com.vtosters.lite.fragments.money.MoneyTransfersFragment;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Scanner;
import ru.vtosters.lite.ui.fragments.dockbar.DockBarManager;
import ru.vtosters.lite.ui.fragments.multiaccount.MultiAccountManager;
public class Prefs {
private static final List<Activity> activities = new ArrayList<>();
public static String VERSIONNAME = "2.0 Beta";
private static List<String> mFilters;
public static boolean BooleanFalse(String key) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(GetContext());
return prefs.getBoolean(key, false);
}
public static boolean BooleanTrue(String key) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(GetContext());
return prefs.getBoolean(key, true);
}
public static void ClearCache() {
}
public static String GetBackgroundStickers() {
if (isBGStickersEnabled()) {
return "images_with_background";
}
return "images";
}
public static boolean isBGStickersEnabled() {
return BooleanTrue("isBGStickersEnabled");
}
public static String GetCopyright() {
return copyright_post() ? "null" : "copyright";
}
public static String GetFriendRecomm() {
return friendsrecomm() ? "friends_recommendations" : "null";
}
public static String GetStories() {
return stories() ? "stories" : "null";
}
public static boolean ads() {
return BooleanFalse("__dbg_no_ads");
}
public static boolean adsgroup() {
return BooleanFalse("adsgroup");
}
public static boolean olddock() {
return BooleanFalse("olddock");
}
public static boolean adsslider() {
return BooleanFalse("__dbg_no_slider_ads");
}
public static boolean adsstories() {
return BooleanFalse("adsstories");
}
public static boolean alteremoji(Context context) {
return alteremojipref() ? alteremojipref() : Screen.a(context);
}
public static boolean alteremojipref() {
return BooleanFalse("alteremoji");
}
public static String authorsads() {
return authorsrecomm() ? "authors_rec" : "null";
}
public static boolean authorsrecomm() {
return BooleanTrue("authorsrecomm");
}
public static boolean awayphp() {
return BooleanTrue("awayphp");
}
public static boolean VKUI_INJ() {
return BooleanTrue("VKUI_INJ");
}
public static boolean benchmark() {
return BooleanFalse("benchmark");
}
public static boolean calls() {
return BooleanTrue("calls");
}
public static boolean captions() {
return BooleanTrue("captions");
}
public static boolean convUsersOnline() {
return BooleanFalse("convUsersOnline");
}
public static boolean copyright_post() {
return BooleanTrue("copyright_post");
}
public static boolean darkmode() {
return BooleanTrue("darkmode");
}
public static boolean default_ad_list() {
return BooleanFalse("default_ad_list");
}
public static boolean shitposting() {
return BooleanFalse("shitposting");
}
public static boolean dev() {
return BooleanFalse("dev");
}
public static boolean devmenu() {
return BooleanFalse("devmenu");
}
public static boolean dnr() {
return BooleanTrue("dnr");
}
public static boolean dns() {
return BooleanTrue("dns");
}
public static boolean libverify() {
return BooleanFalse("libverify");
}
public static boolean dnt() {
return BooleanTrue("dnt");
}
public static boolean dockcounter() {
return BooleanTrue("dockcounter");
}
public static boolean feedautoupdate() {
return BooleanTrue("feedautoupdate");
}
public static boolean feedcache() {
return BooleanTrue("feedcache");
}
public static void forceOffline() {
if (setoffline()) {
Users.b();
}
setupFilters();
}
public static boolean forcenogms() {
return BooleanTrue("forcenogms");
}
public static String friendsads() {
return postsrecomm() ? "user_rec" : "null";
}
public static boolean friendsrecomm() {
return BooleanTrue("friendsrecomm");
}
public static boolean fulltime() {
return BooleanTrue("fulltime");
}
public static boolean gcmfix() {
return BooleanTrue("gcmfix");
}
public static String getAppVersion() throws IOException {
return "VTLite | " + VERSIONNAME + " | " + getBuildNumber();
}
public static String getBuildNumber() {
return Prefs.getBuild(GetContext(), "version.properties");
}
public static String getCommitLink() {
return "https://github.com/vtosters/lite/commit/" + Prefs.getBuild(GetContext(), "version.properties");
}
public static String getBuild(Context context, String name) {
try {
Scanner scanner = new Scanner(context.getAssets().open(name));
while (scanner.hasNextLine()) {
String line = scanner.findInLine("VERSION_BUILD=.+");
if (line != null)
return line.replace("VERSION_BUILD=", "");
return "0000000";
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static String getBranch() {
return GetPreferences().getString("ota_branches", "Stable");
}
public static String getDarkVKUI() {
return !VKThemeHelper.d() ? "1" : "0";
}
public static String getAmoledVKUI() {
String string = GetPreferences().getString("darktheme", "");
return string.equals("amoled") ? "1" : "0";
}
public static String getCommentsSort(String def) {
String string = GetPreferences().getString("commentssort", "");
if (string.isEmpty()) {
return def;
}
if (string.equals("new")) {
return "desc";
}
if (string.equals("old")) {
return "asc";
}
return def;
}
public static String getMeToken() {
return GetPreferences().getString("me_token", "");
}
public static void setMeToken(String str) {
GetPreferences().edit().putString("me_token", str).apply();
}
public static int getNavbarColor() {
return VKThemeHelper.a(R.attr.tabbar_background);
}
public static String getSSFSLink() {
return SSFSDomain() + "?token=" + GetUserToken() + "&vt_dark=" + getDarkVKUI() + "&vt_amoled=" + getAmoledVKUI() + "&secret=" + GetUserSecret() + "&proxy=" + getUserProxy() + "&lang=" + getLocale() + "&vt=1&vtl=1&vksans=" + isVKSansEnabled() + "&vt_version=" + getBuildNumber() + "&vt_debug=" + isDEVModEnabled();
}
public static String getString(String key, String defValue) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(GetContext());
return prefs.getString(key, defValue);
}
public static String getUserProxy() {
return proxy() ? "1" : "0";
}
public static boolean hasMusicSubscription() {
return BooleanTrue("hasMusicSubscription");
}
public static boolean isEnableExternalOpening() {
return BooleanFalse("isEnableExternalOpening");
}
public static boolean iconvk() {
return BooleanFalse("iconvk");
}
public static boolean iconvkru() {
return BooleanFalse("iconvkru");
}
public static String isDEVModEnabled() {
return dev() ? "1" : "0";
}
public static boolean isOtaEnabled() {
return BooleanTrue("ota_enabled");
}
public static boolean isMusicRestricted() {
return BooleanTrue("isMusicRestricted");
}
public static String isVKSansEnabled() {
return vksans() ? "1" : "0";
}
public static boolean msgflat() {
return BooleanFalse("msgflat");
}
public static boolean msgtails() {
return BooleanTrue("msgtails");
}
public static boolean navbar() {
return BooleanTrue("navbar");
}
public static boolean newfeed() {
return BooleanTrue("newfeed");
}
public static boolean offline() {
return BooleanTrue("offline");
}
public static boolean oldabout() {
return BooleanFalse("oldabout");
}
public static boolean postsrecomm() {
return BooleanTrue("postsrecomm");
}
public static String promoads() {
return ads() ? "null" : "promo_button";
}
public static String proxyHostHTTP() {
String string = GetPreferences().getString("proxyHostHTTP", "");
return string.isEmpty() ? "192.168.0.1" : string;
}
public static String proxyHostHTTPS() {
String string = GetPreferences().getString("proxyHostHTTPS", "");
return string.isEmpty() ? "192.168.0.1" : string;
}
public static String proxyHostSocks() {
String string = GetPreferences().getString("proxyHostSocks", "");
return string.isEmpty() ? "192.168.0.1" : string;
}
public static String proxyPortHTTP() {
String string = GetPreferences().getString("proxyPortHTTP", "");
return string.isEmpty() ? "8888" : string;
}
public static String proxyPortHTTPS() {
String string = GetPreferences().getString("proxyPortHTTPS", "");
return string.isEmpty() ? "8888" : string;
}
public static String proxyPortSocks() {
String string = GetPreferences().getString("proxyPortSocks", "");
return string.isEmpty() ? "8888" : string;
}
public static boolean proxyvk() {
return BooleanFalse("proxyvk");
}
public static String readstatus() {
return dnr() ? "messages.markAsRead" : "null";
}
public static boolean refsfilter() {
return BooleanFalse("refsfilter");
}
public static boolean rightLikes() {
return BooleanFalse("rightLikes");
}
public static boolean setoffline() {
return BooleanFalse("setoffline");
}
public static boolean shortinfo() {
return BooleanTrue("shortinfo");
}
public static boolean shortlinkfilter() {
return BooleanFalse("shortlinkfilter");
}
public static boolean shortpost() {
return BooleanTrue("shortpost");
}
public static boolean showmenu() {
return BooleanFalse("showmenu");
}
public static boolean ssl() {
return BooleanTrue("ssl");
}
public static boolean stories() {
return BooleanTrue("stories");
}
public static String storyads() {
return adsstories() ? "null" : "ads";
}
public static boolean swipe() {
return BooleanTrue("swipe");
}
public static boolean systememoji() {
return BooleanFalse("systememoji");
}
public static boolean unlockstats() {
return BooleanFalse("unlockstats");
}
public static boolean usevkui() {
return BooleanTrue("usevkui");
}
public static boolean vksans() {
return BooleanFalse("vksans");
}
public static boolean voice() {
return BooleanTrue("voice");
}
public static boolean newvideo() {
return false;
}
public static String widgetads() {
return ads() ? "null" : "app_widget";
}
public static int getMsgCount() {
String customvalue = GetPreferences().getString("msgcount", "");
return customvalue.isEmpty() ? 30 : Integer.parseInt(customvalue);
}
public static void setNavbarColor(Window window, int i) {
if (navbar() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setNavigationBarColor(getNavbarColor());
}
}
public static String MediacontentFix() {
return Build.VERSION.SDK_INT >= 29 ? "date_modified DESC" : "datetaken DESC";
}
public static String MediacontentFix2() {
return Build.VERSION.SDK_INT >= 29 ? "date_modified" : "datetaken";
}
public static String MediacontentFix3() {
return Build.VERSION.SDK_INT >= 29 ? ", date_modified=" : ", dateTaken=";
}
public static boolean inject(JSONObject jSONObject) {
String optString = jSONObject.optString(NavigatorKeys.j, "");
if (!ads(optString) && !authors_rec(optString) && !recomm(optString) && !friendrecomm(optString)) {
String optString2 = jSONObject.optString("post_type", "");
if (!ads(optString2) && !authors_rec(optString2) && !recomm(optString2) && !friendrecomm(optString2)) {
String optString3 = jSONObject.optString("filters", "");
if (ads(optString3) || authors_rec(optString3) || recomm(optString3) || friendrecomm(optString3) || isBlockedByFilter(jSONObject.optString(NavigatorKeys.x, "")) || checkCopyright(jSONObject) || captions(jSONObject)) {
return false;
}
return !AD(jSONObject);
}
}
return false;
}
public static void setupFilters() {
mFilters = new ArrayList();
ReferalsPut();
StandardFilterPut();
ShortLinkPut();
IDontWantToReadIt();
String string = GetPreferences().getString("spamfilters", "");
if (!string.isEmpty()) {
mFilters.addAll(Arrays.asList(string.split(", ")));
}
}
public static void ReferalsPut() {
if (BooleanTrue("refsfilter")) {
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(GetContext().getAssets().open("Referals.txt")));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
mFilters.add(readLine);
} else {
bufferedReader.close();
return;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void ShortLinkPut() {
if (BooleanTrue("shortlinkfilter")) {
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(GetContext().getAssets().open("LinkShorter.txt")));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
mFilters.add(readLine);
} else {
bufferedReader.close();
return;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void StandardFilterPut() {
if (BooleanTrue("default_ad_list")) {
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(GetContext().getAssets().open("StandartFilter.txt")));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
mFilters.add(readLine);
} else {
bufferedReader.close();
return;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void IDontWantToReadIt() {
if (BooleanTrue("shitposting")) {
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(GetContext().getAssets().open("IDontWantToReadIt.txt")));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
mFilters.add(readLine);
} else {
bufferedReader.close();
return;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static String SSFSDomain() {
String string = GetPreferences().getString("ssfscustom", "");
if (!string.isEmpty()) {
return string;
}
return "https://vtsf.vknext.net";
}
public static String VKVersion() {
String string = GetPreferences().getString("vkversion", "");
if (!string.isEmpty()) {
return string;
}
return "5.29";
}
public static boolean isBlockedByFilter(String str) {
for (String str2 : mFilters) {
if (str.toLowerCase().contains(str2.toLowerCase())) {
return true;
}
}
return false;
}
public static void injectAbout(List<Items2> list) {
list.clear();
list.add(new Items1());
if (!oldabout()) {
list.add(new Items(21, R.string.opencommit));
list.add(new Items(8, R.string.tgchannel));
list.add(new Items(9, R.string.tgchat));
list.add(new Items(16, R.string.vtfaq));
list.add(new Items(19, R.string.vtsite));
list.add(new Items(20, R.string.donate));
list.add(new Items(17, R.string.vkgroup));
list.add(new Items(18, R.string.sett_debug));
return;
}
list.add(new Items(0, R.string.about_app_feedback));
list.add(new Items(1, R.string.about_app_estimate));
list.add(new Items(2, R.string.about_app_privacy));
list.add(new Items(5, R.string.about_app_cookie));
list.add(new Items(3, R.string.about_app_terms_to_use));
list.add(new Items(4, R.string.about_app_license));
list.add(new Items(6, R.string.about_app_data_protect));
list.add(new Items(8, R.string.sett_debug));
}
public static boolean ads(String str) {
if ((str.equals("ads_easy_promote") || str.equals("promo_button") || str.equals("app_widget") || str.equals("ads")) && ads()) {
return false;
}
return false;
}
public static String getLocale() {
String string = GetPreferences().getString("lang_value", "");
if (string.equals("system")) {
return Locale.getDefault().getLanguage();
}
return string.isEmpty() ? Locale.getDefault().getLanguage() : string;
}
public static boolean proxy() {
return GetPreferences().getString("proxy", "").equals("apiproxy");
}
public static boolean authors_rec(String str) {
return str.equals("authors_rec") && !authorsrecomm();
}
public static boolean captions(JSONObject jSONObject) {
try {
JSONObject jSONObject2 = jSONObject.getJSONObject("caption");
if (!captions()) {
return true;
}
boolean postsrecomm = postsrecomm();
return (jSONObject2.getString(NavigatorKeys.j).equals("explorebait") && !postsrecomm) || ((jSONObject2.getString(NavigatorKeys.j).equals("shared") && postsrecomm) || ((jSONObject.getString(NavigatorKeys.j).equals("digest") && postsrecomm) || ((jSONObject2.getString(NavigatorKeys.j).equals("commented") && postsrecomm) || (jSONObject2.getString(NavigatorKeys.j).equals("voted") && postsrecomm))));
} catch (JSONException unused) {
return false;
}
}
public static boolean recomm(String str) {
return (str.equals("user_rec") || str.equals("live_recommended") || str.equals("inline_user_rec")) && !postsrecomm();
}
public static boolean friendrecomm(String str) {
return str.equals("friends_recommendations") && !friendsrecomm();
}
public static boolean AD(JSONObject jSONObject) {
return jSONObject.optInt("marked_as_ads", 0) == 1 && adsgroup();
}
public static boolean checkCopyright(JSONObject jSONObject) {
return jSONObject.optInt("copyright", 0) == 1 && copyright_post();
}
public static Activity getCurrentActivity() {
if (activities.size() == 0) {
return null;
}
return activities.get(0);
}
public static void init(Application application) {
setupFilters();
fixGapps();
setProxy();
MultiAccountManager.migrate();
registerActivities(application);
}
private static void registerActivities(Application application) {
application.registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() { // from class: ru.vtoster2.VTCore.1
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
if (activity instanceof VKActivity) {
Prefs.activities.add(activity);
}
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
Prefs.activities.remove(activity);
}
});
}
public static boolean isUseAlternativeFragments() {
return true;
}
public static Class getStartFragment() {
String string = GetPreferences().getString("start_values", "");
if (string.equals("default")) {
return DockBarManager.getInstance().getSelectedTabs().get(0).fragmentClass;
}
if (string.equals("newsfeed")) {
return Feed2049.b.c();
}
if (string.equals("messenger")) {
return DialogsFragment.class;
}
if (string.equals("groups")) {
return GroupsFragment.class;
}
if (string.equals("music")) {
return MusicFragment.class;
}
if (string.equals("friends")) {
return FriendsFragment.class;
}
if (string.equals("photos")) {
return PhotosFragment.class;
}
if (string.equals("videos")) {
return VideosFragment.class;
}
if (string.equals("settings")) {
return SettingsListFragment.class;
}
if (string.equals("apps")) {
return AppsFragment.class;
}
if (string.equals("discover")) {
return Feed2049.b.e();
}
if (string.equals("notifications")) {
return NotificationsContainerFragment.class;
}
if (string.equals("money")) {
return MoneyTransfersFragment.class;
}
if (string.equals("games")) {
return GamesFragment.class;
}
if (string.equals("liked")) {
return FaveTabFragment.class;
}
if (string.equals("menu")) {
return MenuFragment.class;
}
if (string.equals("profile")) {
return ProfileFragment.class;
}
if (string.equals("lives")) {
return LivesTabsFragment.class;
}
if (string.equals("docs")) {
return DocumentsViewFragment.class;
}
return string.equals("brtd") ? BirthdaysFragment.class : DockBarManager.getInstance().getSelectedTabs().get(0).fragmentClass;
}
public static Context BaseContextLocale(Context context) {
Locale locale = new Locale(getLocale());
Locale.setDefault(locale);
var resources = context.getResources();
var configuration = resources.getConfiguration();
if (Build.VERSION.SDK_INT >= 24) {
configuration.setLocale(locale);
configuration.setLayoutDirection(locale);
return context.createConfigurationContext(configuration);
}
configuration.locale = locale;
configuration.setLayoutDirection(locale);
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
return context;
}
public static int vk_sans_display_demibold() {
return vksans() ? R.font.tt_commons_demi_bold : R.font.vk_sans_display_demibold;
}
public static int vk_sans_text_black() {
return vksans() ? R.font.vk_sans_display_bold : R.font.roboto_black;
}
public static int vk_sans_text_bold() {
return vksans() ? R.font.vk_sans_text_bold : R.font.roboto_bold;
}
public static int vk_sans_text_demibold() {
return vksans() ? R.font.vk_sans_text_demibold : R.font.roboto_bold_italic;
}
public static int vk_sans_text_light() {
return vksans() ? R.font.vk_sans_text_light : R.font.roboto_light;
}
public static int vk_sans_text_medium() {
return vksans() ? R.font.vk_sans_text_medium : R.font.roboto_medium;
}
public static int vk_sans_text_regular() {
return vksans() ? R.font.vk_sans_text_regular : R.font.roboto_regular;
}
public static void fixGapps() {
try {
if (Build.VERSION.SDK_INT >= 26) {
NotificationManager notificationManager = (NotificationManager) GetContext().getSystemService(Context.NOTIFICATION_SERVICE);
boolean z = false;
try {
if (notificationManager.getNotificationChannel("audio_playback_channel") != null) {
z = true;
}
} catch (Exception ignored) {
}
if (!z) {
notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", getResources().getString(R.string.audio_message_play_error), NotificationManager.IMPORTANCE_LOW));
}
}
} catch (Exception ignored) {
}
}
}
@@ -1,12 +1,7 @@
package ru.vtosters.lite.utils; package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.*;
import static ru.vtosters.lite.utils.Prefs.proxyHostHTTP; import static ru.vtosters.lite.utils.Preferences.*;
import static ru.vtosters.lite.utils.Prefs.proxyHostHTTPS;
import static ru.vtosters.lite.utils.Prefs.proxyHostSocks;
import static ru.vtosters.lite.utils.Prefs.proxyPortHTTP;
import static ru.vtosters.lite.utils.Prefs.proxyPortHTTPS;
import static ru.vtosters.lite.utils.Prefs.proxyPortSocks;
import java.util.Properties; import java.util.Properties;
@@ -44,32 +39,32 @@ public class Proxy {
} }
public static String getApiCom() { public static String getApiCom() {
String string = GetPreferences().getString("proxyapi", ""); String string = getPreferences().getString("proxyapi", "");
if (!Prefs.proxy() & string.isEmpty()) { if (!proxy() & string.isEmpty()) {
return "api.vk.com"; return "api.vk.com";
} }
return string; return string;
} }
public static String getAwayPhpCom() { public static String getAwayPhpCom() {
String string = GetPreferences().getString("proxyapi", ""); String string = getPreferences().getString("proxyapi", "");
if (!Prefs.proxy() & string.isEmpty()) { if (!proxy() & string.isEmpty()) {
return "m.vk.com"; return "m.vk.com";
} }
return string; return string;
} }
public static String getOauthCom() { public static String getOauthCom() {
String string = GetPreferences().getString("proxyoauth", ""); String string = getPreferences().getString("proxyoauth", "");
if (!Prefs.proxy() & string.isEmpty()) { if (!proxy() & string.isEmpty()) {
return "oauth.vk.com"; return "oauth.vk.com";
} }
return string; return string;
} }
public static String getStaticCom() { public static String getStaticCom() {
String string = GetPreferences().getString("proxystatic", ""); String string = getPreferences().getString("proxystatic", "");
if (!Prefs.proxy() & string.isEmpty()) { if (!proxy() & string.isEmpty()) {
return "static.vk.com"; return "static.vk.com";
} }
return string; return string;
@@ -77,31 +72,16 @@ public class Proxy {
public static String staticFix(String str) { public static String staticFix(String str) {
String str2; String str2;
String string = GetPreferences().getString("proxystatic", ""); String string = getPreferences().getString("proxystatic", "");
if (!Prefs.proxy() & string.isEmpty()) { if (!proxy() & string.isEmpty()) {
return str; return str;
} }
str2 = string; str2 = string;
return str.replace(str2, "static.vk.com"); return str.replace(str2, "static.vk.com");
} }
public static String GetConnector(String str) {
if (!Prefs.proxy()) {
return str;
}
if (str.startsWith("https://")) {
String replace = str.replace("https://", "");
return "https://" + getApiCom() + "/_/" + replace;
} else if (str.startsWith("http://")) {
String replace2 = str.replace("http://", "");
return "http://" + getApiCom() + "/_/" + replace2;
} else {
return getApiCom() + "/_/" + str;
}
}
public static void setProxy() { public static void setProxy() {
switch (GetPreferences().getString("proxy", "")) { switch (getPreferences().getString("proxy", "")) {
case "zaborona": case "zaborona":
Properties properties = System.getProperties(); Properties properties = System.getProperties();
properties.setProperty("socksProxyHost", "socks.zaboronahelp.pp.ua"); properties.setProperty("socksProxyHost", "socks.zaboronahelp.pp.ua");
@@ -148,4 +128,43 @@ public class Proxy {
break; break;
} }
} }
public static String proxyHostHTTP() {
String string = getPreferences().getString("proxyHostHTTP", "");
return string.isEmpty() ? "192.168.0.1" : string;
}
public static String proxyHostHTTPS() {
String string = getPreferences().getString("proxyHostHTTPS", "");
return string.isEmpty() ? "192.168.0.1" : string;
}
public static String proxyHostSocks() {
String string = getPreferences().getString("proxyHostSocks", "");
return string.isEmpty() ? "192.168.0.1" : string;
}
public static String proxyPortHTTP() {
String string = getPreferences().getString("proxyPortHTTP", "");
return string.isEmpty() ? "8888" : string;
}
public static String proxyPortHTTPS() {
String string = getPreferences().getString("proxyPortHTTPS", "");
return string.isEmpty() ? "8888" : string;
}
public static String proxyPortSocks() {
String string = getPreferences().getString("proxyPortSocks", "");
return string.isEmpty() ? "8888" : string;
}
public static boolean proxy() {
return getPreferences().getString("proxy", "").equals("apiproxy");
}
// Official vk proxy enforcer
public static boolean proxyvk() {
return BooleanFalse("proxyvk");
}
} }
@@ -0,0 +1,43 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.About.*;
import static ru.vtosters.lite.utils.Globals.*;
import static ru.vtosters.lite.utils.Preferences.*;
import static ru.vtosters.lite.utils.Proxy.*;
import com.vk.core.ui.themes.VKThemeHelper;
public class SSFS {
public static String getSSFSLink() {
return SSFSDomain() + "?token=" + getUserToken() + "&vt_dark=" + getDarkVKUI() + "&vt_amoled=" + getAmoledVKUI() + "&secret=" + getUserSecret() + "&proxy=" + getUserProxy() + "&lang=" + getLocale() + "&vt=1&vtl=1&vksans=" + isVKSansEnabled() + "&vt_version=" + getBuildNumber() + "&vt_debug=" + isDEVModEnabled();
}
public static String SSFSDomain() {
String string = getPreferences().getString("ssfscustom", "");
if (!string.isEmpty()) {
return string;
}
return "https://vtsf.vknext.net";
}
public static String getDarkVKUI() {
return !VKThemeHelper.d() ? "1" : "0";
}
public static String getAmoledVKUI() {
String string = getPreferences().getString("darktheme", "");
return string.equals("amoled") ? "1" : "0";
}
public static String getUserProxy() {
return proxy() ? "1" : "0";
}
public static String isVKSansEnabled() {
return vksans() ? "1" : "0";
}
public static String isDEVModEnabled() {
return dev() ? "1" : "0";
}
}
@@ -5,7 +5,7 @@ import static android.os.Environment.getExternalStoragePublicDirectory;
import static android.widget.Toast.LENGTH_LONG; import static android.widget.Toast.LENGTH_LONG;
import static android.widget.Toast.LENGTH_SHORT; import static android.widget.Toast.LENGTH_SHORT;
import static android.widget.Toast.makeText; import static android.widget.Toast.makeText;
import static ru.vtosters.lite.utils.Helper.GetContext; import static ru.vtosters.lite.utils.Globals.getContext;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@@ -21,11 +21,11 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
public class SettBackup { public class SettBackup {
static SharedPreferences prefs = GetContext().getSharedPreferences("com.vtosters.lite_preferences", Context.MODE_PRIVATE); static SharedPreferences prefs = getContext().getSharedPreferences("com.vtosters.lite_preferences", Context.MODE_PRIVATE);
public static void deletePrefs() { public static void deletePrefs() {
prefs.edit().clear().commit(); prefs.edit().clear().commit();
File file = new File(new File(GetContext().getFilesDir().getParent(), "shared_prefs"), "com.vtosters.lite_preferences"); File file = new File(new File(getContext().getFilesDir().getParent(), "shared_prefs"), "com.vtosters.lite_preferences");
if (file.exists()) file.delete(); if (file.exists()) file.delete();
} }
@@ -45,15 +45,15 @@ public class SettBackup {
FileWriter out = new FileWriter(file); FileWriter out = new FileWriter(file);
out.write(getAllPrefs()); out.write(getAllPrefs());
out.close(); out.close();
makeText(GetContext(), "Сохранено в файл " + directory, LENGTH_LONG).show(); makeText(getContext(), "Сохранено в файл " + directory, LENGTH_LONG).show();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
makeText(GetContext(), "Не удалось сохранить файл", LENGTH_SHORT).show(); makeText(getContext(), "Не удалось сохранить файл", LENGTH_SHORT).show();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
makeText(GetContext(), "Не удалось сохранить файл", LENGTH_SHORT).show(); makeText(getContext(), "Не удалось сохранить файл", LENGTH_SHORT).show();
} }
} }
@@ -66,6 +66,6 @@ public class SettBackup {
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(Intent.ACTION_GET_CONTENT); intent.setAction(Intent.ACTION_GET_CONTENT);
intent.setType("text/plain"); intent.setType("text/plain");
GetContext().startActivity(intent); getContext().startActivity(intent);
} }
} }
@@ -1,12 +1,14 @@
package ru.vtosters.lite.utils; package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.*;
import static ru.vtosters.lite.utils.Preferences.*;
import android.content.Context; import android.content.Context;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.Window;
import android.widget.ImageButton; import android.widget.ImageButton;
import com.vk.core.d.RecoloredDrawable; import com.vk.core.d.RecoloredDrawable;
@@ -37,19 +39,19 @@ public class Themes {
} }
public static int getAmoledTheme() { public static int getAmoledTheme() {
return GetContext().getResources().getIdentifier("BaseAmoledStyle", "style", GetContext().getPackageName()); return getContext().getResources().getIdentifier("BaseAmoledStyle", "style", getContext().getPackageName());
} }
public static int picFix() { public static int picFix() {
return GetContext().getResources().getIdentifier("ActionBarThemeFix", "style", GetContext().getPackageName()); return getContext().getResources().getIdentifier("ActionBarThemeFix", "style", getContext().getPackageName());
} }
public static int getAmoledImTheme() { public static int getAmoledImTheme() {
return GetContext().getResources().getIdentifier("VkIm.Theme.VkApp.Amoled", "style", GetContext().getPackageName()); return getContext().getResources().getIdentifier("VkIm.Theme.VkApp.Amoled", "style", getContext().getPackageName());
} }
public static VKTheme getDarkTheme() { public static VKTheme getDarkTheme() {
String string = GetPreferences().getString("darktheme", ""); String string = getPreferences().getString("darktheme", "");
if (string.isEmpty()) { if (string.isEmpty()) {
return VKTheme.DARK; return VKTheme.DARK;
} }
@@ -60,7 +62,7 @@ public class Themes {
} }
public static ImTheme getImDarkTheme() { public static ImTheme getImDarkTheme() {
String string = GetPreferences().getString("darktheme", ""); String string = getPreferences().getString("darktheme", "");
if (string.isEmpty()) { if (string.isEmpty()) {
return ImTheme.VKAPP_DARK; return ImTheme.VKAPP_DARK;
} }
@@ -71,7 +73,7 @@ public class Themes {
} }
public static VKTheme getLightTheme() { public static VKTheme getLightTheme() {
String string = GetPreferences().getString("lighttheme", ""); String string = getPreferences().getString("lighttheme", "");
if (string.isEmpty()) { if (string.isEmpty()) {
return VKTheme.DEFAULT_LIGHT; return VKTheme.DEFAULT_LIGHT;
} }
@@ -79,7 +81,7 @@ public class Themes {
} }
public static ImTheme getImLightTheme() { public static ImTheme getImLightTheme() {
String string = GetPreferences().getString("lighttheme", ""); String string = getPreferences().getString("lighttheme", "");
if (string.isEmpty()) { if (string.isEmpty()) {
return ImTheme.VKAPP_LIGHT; return ImTheme.VKAPP_LIGHT;
} }
@@ -102,10 +104,6 @@ public class Themes {
} }
} }
public static boolean color_grishka() {
return ru.vtosters.lite.utils.Prefs.BooleanTrue("color_grishka");
}
public static boolean isColorRefAccented(int i) { public static boolean isColorRefAccented(int i) {
return i == R.color.cornflower_blue || i == R.color.cornflower_blue_two || i == R.color.dot_unread || i == R.color.fave_promo_btn_pressed || i == R.color.im_back_to_vk_gradient_start || i == R.color.live_emoji_butt_hide || i == R.color.picker_tab_bg_selected || i == R.color.sky_300 || i == R.color.text_blue || i == R.color.tw__blue_default || i == R.color.tw__blue_pressed || i == R.color.white_blue32 || i == R.color.name || i == R.color.picker_blue || i == R.color.picker_blue_pressed || i == R.color.picker_tab_text_selected || i == R.color.sharing_blue_btn_pressed || i == R.color.sharing_blue_btn_normal || i == R.color.tip_background || i == R.color.vkim_msg_sending_ic || i == R.color.vkim_playing_drawable_rect || i == R.color.accent_blue || i == R.color.light_blue_gray || i == R.color.light_blue || i == R.color.blue_200 || i == R.color.header_blue || i == R.color.blue_200_muted || i == R.color.im_old_accent || i == R.color.im_old_accent_muted || i == R.color.im_dark_accent || i == R.color.im_dark_accent_muted || i == R.color.azure_A400 || i == R.color.blue || i == R.color.blue_400 || i == R.color.blue_300 || i == R.color.cool_blue; return i == R.color.cornflower_blue || i == R.color.cornflower_blue_two || i == R.color.dot_unread || i == R.color.fave_promo_btn_pressed || i == R.color.im_back_to_vk_gradient_start || i == R.color.live_emoji_butt_hide || i == R.color.picker_tab_bg_selected || i == R.color.sky_300 || i == R.color.text_blue || i == R.color.tw__blue_default || i == R.color.tw__blue_pressed || i == R.color.white_blue32 || i == R.color.name || i == R.color.picker_blue || i == R.color.picker_blue_pressed || i == R.color.picker_tab_text_selected || i == R.color.sharing_blue_btn_pressed || i == R.color.sharing_blue_btn_normal || i == R.color.tip_background || i == R.color.vkim_msg_sending_ic || i == R.color.vkim_playing_drawable_rect || i == R.color.accent_blue || i == R.color.light_blue_gray || i == R.color.light_blue || i == R.color.blue_200 || i == R.color.header_blue || i == R.color.blue_200_muted || i == R.color.im_old_accent || i == R.color.im_old_accent_muted || i == R.color.im_dark_accent || i == R.color.im_dark_accent_muted || i == R.color.azure_A400 || i == R.color.blue || i == R.color.blue_400 || i == R.color.blue_300 || i == R.color.cool_blue;
} }
@@ -117,18 +115,6 @@ public class Themes {
} }
} }
public static boolean vkim_msg() {
return ru.vtosters.lite.utils.Prefs.BooleanFalse("vkim_msg");
}
public static boolean amoled() {
return ru.vtosters.lite.utils.Prefs.BooleanFalse("amoled");
}
public static boolean vkme_msg() {
return ru.vtosters.lite.utils.Prefs.BooleanFalse("vkme_msg");
}
public static Drawable recolorDrawable(Drawable drawable) { public static Drawable recolorDrawable(Drawable drawable) {
if (drawable == null) { if (drawable == null) {
return null; return null;
@@ -164,10 +150,54 @@ public class Themes {
if (isColorRefAccented(i) && isAndroidMonet()) { if (isColorRefAccented(i) && isAndroidMonet()) {
return getAccentColor(); return getAccentColor();
} }
return GetContext().getResources().getColor(i); return getContext().getResources().getColor(i);
}
public static void setNavbarColor(Window window, int i) {
if (navbar() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.setNavigationBarColor(getNavbarColor());
}
} }
public static String hex(int i) { public static String hex(int i) {
return String.format("#%06X", Integer.valueOf(i & 16777215)); return String.format("#%06X", Integer.valueOf(i & 16777215));
} }
public static int vk_sans_display_demibold() {
return vksans() ? R.font.vk_sans_display_demibold : R.font.tt_commons_demi_bold;
}
public static int vk_sans_text_black() {
return vksans() ? R.font.vk_sans_display_bold : R.font.roboto_black;
}
public static int vk_sans_text_bold() {
return vksans() ? R.font.vk_sans_text_bold : R.font.roboto_bold;
}
public static int vk_sans_text_demibold() {
return vksans() ? R.font.vk_sans_text_demibold : R.font.roboto_bold_italic;
}
public static int vk_sans_text_light() {
return vksans() ? R.font.vk_sans_text_light : R.font.roboto_light;
}
public static int vk_sans_text_medium() {
return vksans() ? R.font.vk_sans_text_medium : R.font.roboto_medium;
}
public static int vk_sans_text_regular() {
return vksans() ? R.font.vk_sans_text_regular : R.font.roboto_regular;
}
public static int getNavbarColor() {
return VKThemeHelper.a(R.attr.tabbar_background);
}
public static String getBackgroundStickers() {
if (isBGStickersEnabled()) {
return "images_with_background";
}
return "images";
}
} }
@@ -1,7 +1,9 @@
package ru.vtosters.lite.utils; package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Helper.*; import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Themes.*; import static ru.vtosters.lite.utils.Globals.getPreferences;
import static ru.vtosters.lite.utils.Themes.getColorFromAttr;
import static ru.vtosters.lite.utils.Themes.hex;
import android.util.Base64; import android.util.Base64;
import android.webkit.WebView; import android.webkit.WebView;
@@ -27,7 +29,7 @@ public class VKUIInjector {
private static String load(String str) { private static String load(String str) {
try { try {
InputStream open = GetContext().getAssets().open(str); InputStream open = getContext().getAssets().open(str);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(open, StandardCharsets.UTF_8)); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(open, StandardCharsets.UTF_8));
while (true) { while (true) {
@@ -64,8 +66,8 @@ public class VKUIInjector {
} }
public static void inject(WebView webView) { public static void inject(WebView webView) {
String string = GetPreferences().getString("darktheme", ""); String string = getPreferences().getString("darktheme", "");
if (Prefs.BooleanTrue("VKUI_INJ")) { if (Preferences.BooleanTrue("VKUI_INJ")) {
if (!isLoaded) { if (!isLoaded) {
load(); load();
} }
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
echo -e "${BOLD}${UNDERLINE}Сборка dex..${NC}\n"
gradle versionFile
gradle assembleDebug
if [ $? -eq 0 ]; then
echo -e "${GREEN}Успех!${NC}\n"
else
echo -e "${RED}Провал.${NC}\n"
exit 1
fi
echo -e "${BOLD}${UNDERLINE}Экспорт dex..${NC}"
gradle exportDex
if [ $? -eq 0 ]; then
echo -e "${GREEN}Успех!${NC}\n"
else
echo -e "${RED}Провал.${NC}\n"
exit 1
fi
echo -e "${BOLD}${UNDERLINE}Перенос dex6 в папку с исходным кодом..${NC}"
mv app/classes6.dex smali/
if [ $? -eq 0 ]; then
echo -e "${GREEN}Успех!${NC}\n"
else
echo -e "${RED}Провал.${NC}\n"
exit 1
fi
echo -e "${BOLD}${UNDERLINE}Перенос dex8 в папку с исходным кодом..${NC}"
mv app/classes8.dex smali/
if [ $? -eq 0 ]; then
echo -e "${GREEN}Успех!${NC}\n"
else
echo -e "${RED}Провал.${NC}\n"
exit 1
fi
echo -e "${BOLD}${UNDERLINE}Перенос version.properties в папку с исходным кодом..${NC}"
mv app/version.properties smali/assets/
if [ $? -eq 0 ]; then
echo -e "${GREEN}Успех!${NC}\n"
else
echo -e "${RED}Провал.${NC}\n"
fi
echo -e "${BOLD}${UNDERLINE}Сборка apk..${NC}"
java -jar scripts/apktool.jar b smali -o smali/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
@@ -4,7 +4,7 @@
<FrameLayout <FrameLayout
android:orientation="horizontal" android:orientation="horizontal"
android:id="@id/toolbar" android:id="@id/toolbar"
android:background="?tabbar_background" android:background="?header_background"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?actionBarSize" android:minHeight="?actionBarSize"
@@ -18,7 +18,7 @@
android:layout_height="48.0dip" android:layout_height="48.0dip"
android:layout_marginLeft="4.0dip" android:layout_marginLeft="4.0dip"
android:src="@drawable/ic_back_24" android:src="@drawable/ic_back_24"
android:tint="?accent" android:tint="?header_text"
android:contentDescription="@string/music_talkback_go_back" android:contentDescription="@string/music_talkback_go_back"
style="@style/ActionButton.White" /> style="@style/ActionButton.White" />
@@ -30,7 +30,7 @@
android:layout_height="48.0dip" android:layout_height="48.0dip"
android:layout_marginRight="4.0dip" android:layout_marginRight="4.0dip"
android:src="@drawable/ic_menu_search" android:src="@drawable/ic_menu_search"
android:tint="?accent" android:tint="?header_text"
style="@style/ActionButton.White" /> style="@style/ActionButton.White" />
<LinearLayout <LinearLayout
@@ -44,7 +44,7 @@
<TextView <TextView
android:textSize="16.0dip" android:textSize="16.0dip"
android:textColor="?text_primary" android:textColor="?header_text"
android:ellipsize="end" android:ellipsize="end"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:id="@id/title" android:id="@id/title"
@@ -55,7 +55,7 @@
<TextView <TextView
android:textSize="14.0dip" android:textSize="14.0dip"
android:textColor="?text_secondary" android:textColor="?header_text_secondary"
android:ellipsize="end" android:ellipsize="end"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:id="@id/subtitle" android:id="@id/subtitle"
+2 -1
View File
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:gravity="center" <LinearLayout android:gravity="center"
android:orientation="vertical" android:orientation="vertical"
android:background="?background_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
<com.vtosters.lite.ui.LinkedTextView <com.vtosters.lite.ui.LinkedTextView
android:textSize="16.0dip" android:textSize="16.0dip"
android:textColor="#ff999999" android:textColor="?text_primary"
android:gravity="center" android:gravity="center"
android:id="@id/empty_text" android:id="@id/empty_text"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@@ -12,6 +12,7 @@
<me.grishka.appkit.views.UsableRecyclerView <me.grishka.appkit.views.UsableRecyclerView
android:id="@id/list" android:id="@id/list"
android:background="?background_content"
android:scrollbars="vertical" android:scrollbars="vertical"
android:clipToPadding="false" android:clipToPadding="false"
android:layout_width="fill_parent" android:layout_width="fill_parent"
+2 -1
View File
@@ -6,12 +6,13 @@
<FrameLayout <FrameLayout
android:id="@id/content_wrap" android:id="@id/content_wrap"
android:background="?tabbar_background" android:background="?background_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
<me.grishka.appkit.views.UsableRecyclerView <me.grishka.appkit.views.UsableRecyclerView
android:id="@id/list" android:id="@id/list"
android:background="?background_content"
android:paddingTop="219.0dip" android:paddingTop="219.0dip"
android:scrollbars="vertical" android:scrollbars="vertical"
android:clipToPadding="false" android:clipToPadding="false"
+2 -1
View File
@@ -7,12 +7,13 @@
<FrameLayout <FrameLayout
android:id="@id/content_wrap" android:id="@id/content_wrap"
android:background="?tabbar_background" android:background="?background_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
<me.grishka.appkit.views.UsableRecyclerView <me.grishka.appkit.views.UsableRecyclerView
android:id="@id/list" android:id="@id/list"
android:background="?background_content"
android:scrollbars="vertical" android:scrollbars="vertical"
android:clipToPadding="false" android:clipToPadding="false"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@@ -19,6 +19,7 @@
<me.grishka.appkit.views.UsableRecyclerView <me.grishka.appkit.views.UsableRecyclerView
android:id="@id/list" android:id="@id/list"
android:background="?background_content"
android:scrollbars="vertical" android:scrollbars="vertical"
android:clipToPadding="false" android:clipToPadding="false"
android:layout_width="fill_parent" android:layout_width="fill_parent"
+5 -5
View File
@@ -4,7 +4,7 @@
<FrameLayout <FrameLayout
android:orientation="horizontal" android:orientation="horizontal"
android:id="@id/toolbar" android:id="@id/toolbar"
android:background="?tabbar_background" android:background="?header_background"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?actionBarSize" android:minHeight="?actionBarSize"
@@ -17,7 +17,7 @@
android:layout_height="48.0dip" android:layout_height="48.0dip"
android:layout_marginLeft="4.0dip" android:layout_marginLeft="4.0dip"
android:src="@drawable/ic_back_24" android:src="@drawable/ic_back_24"
android:tint="?accent" android:tint="?header_text"
android:contentDescription="@string/music_talkback_go_back" android:contentDescription="@string/music_talkback_go_back"
style="@style/ActionButton.White" /> style="@style/ActionButton.White" />
@@ -29,7 +29,7 @@
android:layout_height="48.0dip" android:layout_height="48.0dip"
android:layout_marginRight="4.0dip" android:layout_marginRight="4.0dip"
android:src="@drawable/ic_menu_search" android:src="@drawable/ic_menu_search"
android:tint="?accent" android:tint="?header_text"
style="@style/ActionButton.White" /> style="@style/ActionButton.White" />
<LinearLayout <LinearLayout
@@ -43,7 +43,7 @@
<TextView <TextView
android:textSize="16.0dip" android:textSize="16.0dip"
android:textColor="?text_primary" android:textColor="?header_text"
android:ellipsize="end" android:ellipsize="end"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:id="@id/title" android:id="@id/title"
@@ -54,7 +54,7 @@
<TextView <TextView
android:textSize="14.0dip" android:textSize="14.0dip"
android:textColor="?text_secondary" android:textColor="?header_text_secondary"
android:ellipsize="end" android:ellipsize="end"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:id="@id/subtitle" android:id="@id/subtitle"
+5 -5
View File
@@ -5,7 +5,7 @@
<FrameLayout <FrameLayout
android:orientation="horizontal" android:orientation="horizontal"
android:id="@id/toolbar" android:id="@id/toolbar"
android:background="?tabbar_background" android:background="?header_background"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="?actionBarSize" android:minHeight="?actionBarSize"
@@ -18,7 +18,7 @@
android:layout_height="48.0dip" android:layout_height="48.0dip"
android:layout_marginLeft="4.0dip" android:layout_marginLeft="4.0dip"
android:src="@drawable/ic_back_24" android:src="@drawable/ic_back_24"
android:tint="?accent" android:tint="?header_text"
android:contentDescription="@string/music_talkback_go_back" android:contentDescription="@string/music_talkback_go_back"
style="@style/ActionButton.White" /> style="@style/ActionButton.White" />
@@ -30,7 +30,7 @@
android:layout_height="48.0dip" android:layout_height="48.0dip"
android:layout_marginRight="4.0dip" android:layout_marginRight="4.0dip"
android:src="@drawable/ic_menu_search" android:src="@drawable/ic_menu_search"
android:tint="?accent" android:tint="?header_text"
style="@style/ActionButton.White" /> style="@style/ActionButton.White" />
<com.vk.imageloader.view.VKCircleImageView <com.vk.imageloader.view.VKCircleImageView
@@ -53,7 +53,7 @@
<TextView <TextView
android:textSize="16.0dip" android:textSize="16.0dip"
android:textColor="?text_primary" android:textColor="?header_text"
android:ellipsize="end" android:ellipsize="end"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:id="@id/title" android:id="@id/title"
@@ -64,7 +64,7 @@
<TextView <TextView
android:textSize="14.0dip" android:textSize="14.0dip"
android:textColor="?text_secondary" android:textColor="?header_text_secondary"
android:ellipsize="end" android:ellipsize="end"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:id="@id/subtitle" android:id="@id/subtitle"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.vk.attachpicker.widget.TopShadowLinearLayout android:orientation="vertical" <com.vk.attachpicker.widget.TopShadowLinearLayout android:orientation="vertical"
android:background="?tabbar_background" android:background="#ffffffff"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
@@ -43,7 +43,7 @@
android:gravity="center" android:gravity="center"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:id="@id/tv_bottom_panel_cancel" android:id="@id/tv_bottom_panel_cancel"
android:background="?tabbar_background" android:background="@drawable/picker_btn_white"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="@dimen/picker_viewer_bottom_padding" android:layout_height="@dimen/picker_viewer_bottom_padding"
android:text="@string/picker_cancel" android:text="@string/picker_cancel"
@@ -6,11 +6,13 @@
<FrameLayout <FrameLayout
android:id="@id/content_wrap" android:id="@id/content_wrap"
android:background="?background_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
<com.vk.attachpicker.widget.GraffitiRecyclerView <com.vk.attachpicker.widget.GraffitiRecyclerView
android:id="@id/list" android:id="@id/list"
android:background="?background_content"
android:scrollbars="vertical" android:scrollbars="vertical"
android:clipToPadding="false" android:clipToPadding="false"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@@ -23,6 +23,7 @@
<com.vk.imageloader.view.VKImageView <com.vk.imageloader.view.VKImageView
android:id="@id/iv_preview" android:id="@id/iv_preview"
android:background="@drawable/picker_bg_graffiti_preview_top" android:background="@drawable/picker_bg_graffiti_preview_top"
android:backgroundTint="?background_content"
android:paddingLeft="32.0dip" android:paddingLeft="32.0dip"
android:paddingTop="32.0dip" android:paddingTop="32.0dip"
android:paddingRight="32.0dip" android:paddingRight="32.0dip"
@@ -34,10 +35,11 @@
<TextView <TextView
android:textSize="14.0sp" android:textSize="14.0sp"
android:textColor="#ffffffff" android:textColor="?header_text"
android:gravity="center" android:gravity="center"
android:id="@id/tv_send_button" android:id="@id/tv_send_button"
android:background="@drawable/picker_bg_graffiti_preview_bottom" android:background="@drawable/picker_bg_graffiti_preview_bottom"
android:backgroundTint="?accent"
android:paddingLeft="24.0dip" android:paddingLeft="24.0dip"
android:paddingRight="24.0dip" android:paddingRight="24.0dip"
android:paddingBottom="24.0dip" android:paddingBottom="24.0dip"
@@ -6,12 +6,13 @@
<FrameLayout <FrameLayout
android:id="@id/content_wrap" android:id="@id/content_wrap"
android:background="?tabbar_background" android:background="?background_content"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent"> android:layout_height="fill_parent">
<me.grishka.appkit.views.UsableRecyclerView <me.grishka.appkit.views.UsableRecyclerView
android:id="@id/list" android:id="@id/list"
android:background="?background_content"
android:scrollbars="vertical" android:scrollbars="vertical"
android:clipToPadding="false" android:clipToPadding="false"
android:layout_width="fill_parent" android:layout_width="fill_parent"
+1 -1
View File
@@ -58,7 +58,7 @@
app:tabBackground="@drawable/highlight" app:tabBackground="@drawable/highlight"
app:tabPaddingLeftRight="12.0dip" app:tabPaddingLeftRight="12.0dip"
app:textAllCaps="true" app:textAllCaps="true"
app:underlineColor="#ffd8d8d8" app:underlineColor="?background_content"
app:underlineHeight="0.5dip" /> app:underlineHeight="0.5dip" />
</FrameLayout> </FrameLayout>
+5
View File
@@ -495,4 +495,9 @@
<item>От Новых к Старым</item> <item>От Новых к Старым</item>
<item>От Старых к Новым</item> <item>От Старых к Новым</item>
</string-array> </string-array>
<string-array name="newsupdate_value">
<item>По умолчанию</item>
<item>Не обновлять</item>
<item>Обновлять мгновенно</item>
</string-array>
</resources> </resources>
+10
View File
@@ -686,4 +686,14 @@
<item>new</item> <item>new</item>
<item>old</item> <item>old</item>
</string-array> </string-array>
<string-array name="newsupdate_value">
<item>Default</item>
<item>Do not update</item>
<item>Immediately update</item>
</string-array>
<string-array name="newsupdate">
<item>default</item>
<item>no_update</item>
<item>imd_update</item>
</string-array>
</resources> </resources>
+7 -4
View File
@@ -79,10 +79,13 @@
android:entryValues="@array/commentssort" android:entryValues="@array/commentssort"
android:key="commentssort" android:key="commentssort"
android:title="Сортировка комментариев" /> android:title="Сортировка комментариев" />
<com.vtosters.lite.ui.MaterialSwitchPreference <com.vtosters.lite.ui.SummaryListPreference
android:defaultValue="true" android:defaultValue="default"
android:key="feedautoupdate" android:dialogTitle="Выберите значение"
android:title="@string/vtlfeedreload" /> android:entries="@array/newsupdate_value"
android:entryValues="@array/newsupdate"
android:key="newsupdate"
android:title="Обновление новостей" />
<com.vtosters.lite.ui.MaterialSwitchPreference <com.vtosters.lite.ui.MaterialSwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="feedcache" android:key="feedcache"
@@ -273,7 +273,7 @@
check-cast v2, Landroid/content/Context; check-cast v2, Landroid/content/Context;
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->getCommitLink()Ljava/lang/String; invoke-static {}, Lru/vtosters/lite/utils/About;->getCommitLink()Ljava/lang/String;
move-result-object v3 move-result-object v3
@@ -304,7 +304,7 @@
if-eqz v0, :cond_8 if-eqz v0, :cond_8
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object p1 move-result-object p1
@@ -632,7 +632,7 @@
invoke-interface {p1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z invoke-interface {p1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
invoke-static {p1}, Lru/vtosters/lite/utils/Prefs;->injectAbout(Ljava/util/List;)V invoke-static {p1}, Lru/vtosters/lite/utils/About;->injectAbout(Ljava/util/List;)V
return-void return-void
.end method .end method
@@ -4040,7 +4040,7 @@
if-eqz v2, :cond_51 if-eqz v2, :cond_51
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4091,7 +4091,7 @@
if-eqz v2, :cond_52 if-eqz v2, :cond_52
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4144,7 +4144,7 @@
if-eqz v2, :cond_130 if-eqz v2, :cond_130
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4197,7 +4197,7 @@
if-eqz v2, :cond_131 if-eqz v2, :cond_131
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4250,7 +4250,7 @@
if-eqz v2, :cond_132 if-eqz v2, :cond_132
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4304,7 +4304,7 @@
if-eqz v2, :cond_53 if-eqz v2, :cond_53
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4355,7 +4355,7 @@
if-eqz v2, :cond_54 if-eqz v2, :cond_54
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4406,7 +4406,7 @@
if-eqz v2, :cond_55 if-eqz v2, :cond_55
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4457,7 +4457,7 @@
if-eqz v2, :cond_56 if-eqz v2, :cond_56
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4508,7 +4508,7 @@
if-eqz v2, :cond_57 if-eqz v2, :cond_57
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4559,7 +4559,7 @@
if-eqz v2, :cond_58 if-eqz v2, :cond_58
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4610,7 +4610,7 @@
if-eqz v2, :cond_59 if-eqz v2, :cond_59
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -4661,7 +4661,7 @@
if-eqz v2, :cond_5a if-eqz v2, :cond_5a
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v1 move-result-object v1
@@ -5758,7 +5758,7 @@
move-result v0 move-result v0
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->newvideo()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->newvideo()Z
move-result v0 move-result v0
+2 -2
View File
@@ -109,7 +109,7 @@
move-result v0 move-result v0
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->dev()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->dev()Z
move-result v0 move-result v0
@@ -151,7 +151,7 @@
move-result v0 move-result v0
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->dev()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->dev()Z
move-result v0 move-result v0
@@ -927,7 +927,7 @@
invoke-virtual {p1, v0}, Landroid/view/Window;->setBackgroundDrawableResource(I)V invoke-virtual {p1, v0}, Landroid/view/Window;->setBackgroundDrawableResource(I)V
invoke-static {p1, v0}, Lru/vtosters/lite/utils/Prefs;->setNavbarColor(Landroid/view/Window;I)V invoke-static {p1, v0}, Lru/vtosters/lite/utils/Themes;->setNavbarColor(Landroid/view/Window;I)V
return-void return-void
.end method .end method
@@ -1062,7 +1062,7 @@
if-eqz v0, :cond_0 if-eqz v0, :cond_0
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->darkmode()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->darkmode()Z
move-result v0 move-result v0
@@ -566,7 +566,7 @@
invoke-interface {v2, p0, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; invoke-interface {v2, p0, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
:cond_f :cond_f
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->forceOffline()V invoke-static {}, Lru/vtosters/lite/utils/Preferences;->forceOffline()V
return-object v2 return-object v2
.end method .end method
@@ -775,7 +775,7 @@
check-cast p1, Ljava/lang/Integer; check-cast p1, Ljava/lang/Integer;
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->forceOffline()V invoke-static {}, Lru/vtosters/lite/utils/Preferences;->forceOffline()V
return-object p1 return-object p1
.end method .end method
@@ -124,7 +124,7 @@
move-result v1 move-result v1
invoke-static {}, Lru/vtosters/lite/utils/Themes;->vkme_msg()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->vkme_msg()Z
move-result v1 move-result v1
@@ -1327,7 +1327,7 @@
const-string p2, "VT_Verification" const-string p2, "VT_Verification"
.line 181 .line 181
invoke-static {p2}, Lru/vtosters/lite/utils/Prefs;->BooleanTrue(Ljava/lang/String;)Z invoke-static {p2}, Lru/vtosters/lite/utils/Preferences;->BooleanTrue(Ljava/lang/String;)Z
move-result p2 move-result p2
@@ -1357,7 +1357,7 @@
const-string p2, "VT_Verification" const-string p2, "VT_Verification"
.line 181 .line 181
invoke-static {p2}, Lru/vtosters/lite/utils/Prefs;->BooleanTrue(Ljava/lang/String;)Z invoke-static {p2}, Lru/vtosters/lite/utils/Preferences;->BooleanTrue(Ljava/lang/String;)Z
move-result p2 move-result p2
@@ -112,7 +112,7 @@
move-result p1 move-result p1
invoke-static {}, Lru/vtosters/lite/utils/Themes;->vkme_msg()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->vkme_msg()Z
move-result p1 move-result p1
@@ -76,7 +76,7 @@
const-string p2, "VT_Verification" const-string p2, "VT_Verification"
.line 181 .line 181
invoke-static {p2}, Lru/vtosters/lite/utils/Prefs;->BooleanTrue(Ljava/lang/String;)Z invoke-static {p2}, Lru/vtosters/lite/utils/Preferences;->BooleanTrue(Ljava/lang/String;)Z
move-result p2 move-result p2
@@ -107,7 +107,7 @@
const-string p2, "VT_Verification" const-string p2, "VT_Verification"
.line 181 .line 181
invoke-static {p2}, Lru/vtosters/lite/utils/Prefs;->BooleanTrue(Ljava/lang/String;)Z invoke-static {p2}, Lru/vtosters/lite/utils/Preferences;->BooleanTrue(Ljava/lang/String;)Z
move-result p2 move-result p2
@@ -231,7 +231,7 @@
move-result v1 move-result v1
invoke-static {}, Lru/vtosters/lite/utils/Themes;->vkme_msg()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->vkme_msg()Z
move-result v1 move-result v1
@@ -343,7 +343,7 @@
move-result v0 move-result v0
invoke-static {}, Lru/vtosters/lite/utils/Themes;->vkme_msg()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->vkme_msg()Z
move-result v0 move-result v0
@@ -57,7 +57,7 @@
move-result v0 move-result v0
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->proxyvk()Z invoke-static {}, Lru/vtosters/lite/utils/Proxy;->proxyvk()Z
move-result v0 move-result v0
@@ -255,7 +255,7 @@
move-result v0 move-result v0
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->proxyvk()Z invoke-static {}, Lru/vtosters/lite/utils/Proxy;->proxyvk()Z
move-result v0 move-result v0
@@ -105,7 +105,7 @@
const v1, 0x7f090007 const v1, 0x7f090007
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->vk_sans_text_medium()I invoke-static {}, Lru/vtosters/lite/utils/Themes;->vk_sans_text_medium()I
move-result v1 move-result v1
@@ -138,7 +138,7 @@
.locals 6 .locals 6
.line 165 .line 165
invoke-static {p1}, Lru/vtosters/lite/utils/Prefs;->alteremoji(Landroid/content/Context;)Z invoke-static {p1}, Lru/vtosters/lite/utils/Preferences;->alteremoji(Landroid/content/Context;)Z
move-result v4 move-result v4
@@ -161,7 +161,7 @@
.locals 7 .locals 7
.line 154 .line 154
invoke-static {p1}, Lru/vtosters/lite/utils/Prefs;->alteremoji(Landroid/content/Context;)Z invoke-static {p1}, Lru/vtosters/lite/utils/Preferences;->alteremoji(Landroid/content/Context;)Z
move-result v5 move-result v5
@@ -339,7 +339,7 @@
.locals 7 .locals 7
.line 172 .line 172
invoke-static {p1}, Lru/vtosters/lite/utils/Prefs;->alteremoji(Landroid/content/Context;)Z invoke-static {p1}, Lru/vtosters/lite/utils/Preferences;->alteremoji(Landroid/content/Context;)Z
move-result v4 move-result v4
@@ -520,13 +520,13 @@
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->a(Ljava/lang/Object;Ljava/lang/String;)V invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->a(Ljava/lang/Object;Ljava/lang/String;)V
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->dev()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->dev()Z
move-result v1 move-result v1
if-eqz v1, :cond_3 if-eqz v1, :cond_3
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v3 move-result-object v3
+1 -1
View File
@@ -29,7 +29,7 @@
.line 18 .line 18
invoke-super {p0, p1}, Lcom/vk/webapp/VkUiFragment;->b(Landroid/os/Bundle;)V invoke-super {p0, p1}, Lcom/vk/webapp/VkUiFragment;->b(Landroid/os/Bundle;)V
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->getSSFSLink()Ljava/lang/String; invoke-static {}, Lru/vtosters/lite/utils/SSFS;->getSSFSLink()Ljava/lang/String;
move-result-object v0 move-result-object v0
@@ -59,7 +59,7 @@
const-string v1, "arm" const-string v1, "arm"
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->VKVersion()Ljava/lang/String; invoke-static {}, Lru/vtosters/lite/utils/Preferences;->VKVersion()Ljava/lang/String;
move-result-object v2 move-result-object v2
@@ -727,7 +727,7 @@
.param p0, "s" # I .param p0, "s" # I
.line 17 .line 17
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->fulltime()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->fulltime()Z
move-result v0 move-result v0
@@ -1071,7 +1071,7 @@
.method private setLang()V .method private setLang()V
.locals 6 .locals 6
invoke-static {}, Lru/vtosters/lite/utils/Helper;->GetContext()Landroid/content/Context; invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
move-result-object v0 move-result-object v0
@@ -1089,7 +1089,7 @@
new-instance v3, Ljava/util/Locale; new-instance v3, Ljava/util/Locale;
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->getLocale()Ljava/lang/String; invoke-static {}, Lru/vtosters/lite/utils/Preferences;->getLocale()Ljava/lang/String;
move-result-object v4 move-result-object v4
@@ -1321,7 +1321,7 @@
.method public onCreate()V .method public onCreate()V
.locals 4 .locals 4
invoke-static {p0}, Lru/vtosters/lite/utils/Prefs;->init(Landroid/app/Application;)V invoke-static {p0}, Lru/vtosters/lite/utils/Preferences;->init(Landroid/app/Application;)V
invoke-direct {p0}, Lcom/vtosters/lite/VKApplication;->setLang()V invoke-direct {p0}, Lcom/vtosters/lite/VKApplication;->setLang()V
@@ -114,7 +114,7 @@
.prologue .prologue
.line 41 .line 41
invoke-static {p1}, Lru/vtosters/lite/utils/Prefs;->BaseContextLocale(Landroid/content/Context;)Landroid/content/Context; invoke-static {p1}, Lru/vtosters/lite/utils/Globals;->BaseContextLocale(Landroid/content/Context;)Landroid/content/Context;
move-result-object v0 move-result-object v0
@@ -195,7 +195,7 @@
invoke-virtual {p1, v0}, Landroid/view/Window;->setBackgroundDrawableResource(I)V invoke-virtual {p1, v0}, Landroid/view/Window;->setBackgroundDrawableResource(I)V
invoke-static {p1}, Lru/vtosters/lite/utils/Prefs;->setNavbarColor(Landroid/view/Window;I)V invoke-static {p1}, Lru/vtosters/lite/utils/Themes;->setNavbarColor(Landroid/view/Window;I)V
.line 42 .line 42
invoke-virtual {p0}, Lcom/vtosters/lite/VKFragmentActivity;->isTaskRoot()Z invoke-virtual {p0}, Lcom/vtosters/lite/VKFragmentActivity;->isTaskRoot()Z
@@ -2582,7 +2582,7 @@
iput-boolean v2, v0, Lcom/vtosters/lite/api/ExtendedUserProfile;->bp:Z iput-boolean v2, v0, Lcom/vtosters/lite/api/ExtendedUserProfile;->bp:Z
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->GetFriendRecomm()Ljava/lang/String; invoke-static {}, Lru/vtosters/lite/utils/Newsfeed;->getFriendRecomm()Ljava/lang/String;
move-result-object v2 move-result-object v2
@@ -51,13 +51,13 @@
.method public a(Lcom/vk/api/sdk/exceptions/VKApiExecutionException;)V .method public a(Lcom/vk/api/sdk/exceptions/VKApiExecutionException;)V
.locals 5 .locals 5
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->offline()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->offline()Z
move-result v2 move-result v2
if-nez v2, :cond_0 if-nez v2, :cond_0
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->forceOffline()V invoke-static {}, Lru/vtosters/lite/utils/Preferences;->forceOffline()V
return-void return-void
@@ -1031,7 +1031,7 @@
if-eqz v0, :cond_0 if-eqz v0, :cond_0
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->voice()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->voice()Z
move-result v0 move-result v0
@@ -1080,7 +1080,7 @@
if-eqz v0, :cond_2 if-eqz v0, :cond_2
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->voice()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->voice()Z
move-result v6 move-result v6
@@ -4835,7 +4835,7 @@
return-void return-void
:cond_0 :cond_0
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->voice()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->voice()Z
move-result v2 move-result v2
@@ -27,7 +27,7 @@
.prologue .prologue
.line 41 .line 41
invoke-static {p1}, Lru/vtosters/lite/utils/Prefs;->BaseContextLocale(Landroid/content/Context;)Landroid/content/Context; invoke-static {p1}, Lru/vtosters/lite/utils/Globals;->BaseContextLocale(Landroid/content/Context;)Landroid/content/Context;
move-result-object v0 move-result-object v0
@@ -234,7 +234,7 @@
.prologue .prologue
.line 41 .line 41
invoke-static {p1}, Lru/vtosters/lite/utils/Prefs;->BaseContextLocale(Landroid/content/Context;)Landroid/content/Context; invoke-static {p1}, Lru/vtosters/lite/utils/Globals;->BaseContextLocale(Landroid/content/Context;)Landroid/content/Context;
move-result-object v0 move-result-object v0
@@ -359,7 +359,7 @@
.prologue .prologue
.line 41 .line 41
invoke-static {p1}, Lru/vtosters/lite/utils/Prefs;->BaseContextLocale(Landroid/content/Context;)Landroid/content/Context; invoke-static {p1}, Lru/vtosters/lite/utils/Globals;->BaseContextLocale(Landroid/content/Context;)Landroid/content/Context;
move-result-object v0 move-result-object v0
@@ -129,7 +129,7 @@
const v3, 0x7f090007 const v3, 0x7f090007
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->vk_sans_text_medium()I invoke-static {}, Lru/vtosters/lite/utils/Themes;->vk_sans_text_medium()I
move-result v3 move-result v3
@@ -549,7 +549,7 @@
.prologue .prologue
.line 41 .line 41
invoke-static {p1}, Lru/vtosters/lite/utils/Prefs;->BaseContextLocale(Landroid/content/Context;)Landroid/content/Context; invoke-static {p1}, Lru/vtosters/lite/utils/Globals;->BaseContextLocale(Landroid/content/Context;)Landroid/content/Context;
move-result-object v0 move-result-object v0
@@ -648,7 +648,7 @@
invoke-virtual {v0, v9}, Landroid/view/Window;->setStatusBarColor(I)V invoke-virtual {v0, v9}, Landroid/view/Window;->setStatusBarColor(I)V
invoke-static {v0, v9}, Lru/vtosters/lite/utils/Prefs;->setNavbarColor(Landroid/view/Window;I)V invoke-static {v0, v9}, Lru/vtosters/lite/utils/Themes;->setNavbarColor(Landroid/view/Window;I)V
.line 97 .line 97
:cond_10 :cond_10
@@ -36,7 +36,7 @@
.line 28 .line 28
invoke-virtual {p0, p1}, Landroid/view/Window;->setStatusBarColor(I)V invoke-virtual {p0, p1}, Landroid/view/Window;->setStatusBarColor(I)V
invoke-static {p0, p1}, Lru/vtosters/lite/utils/Prefs;->setNavbarColor(Landroid/view/Window;I)V invoke-static {p0, p1}, Lru/vtosters/lite/utils/Themes;->setNavbarColor(Landroid/view/Window;I)V
:cond_1 :cond_1
return-void return-void
@@ -42,7 +42,7 @@
.method private a(Landroid/content/Context;Z)V .method private a(Landroid/content/Context;Z)V
.locals 5 .locals 5
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->ssl()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->ssl()Z
move-result v0 move-result v0
@@ -129,7 +129,7 @@
.line 61 .line 61
sget p3, Lcom/vk/s/R$d;->roboto_regular:I sget p3, Lcom/vk/s/R$d;->roboto_regular:I
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->vk_sans_text_regular()I invoke-static {}, Lru/vtosters/lite/utils/Themes;->vk_sans_text_regular()I
move-result p3 move-result p3
@@ -186,7 +186,7 @@
.line 71 .line 71
sget v0, Lcom/vk/s/R$d;->roboto_regular:I sget v0, Lcom/vk/s/R$d;->roboto_regular:I
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->vk_sans_text_regular()I invoke-static {}, Lru/vtosters/lite/utils/Themes;->vk_sans_text_regular()I
move-result v0 move-result v0
@@ -746,7 +746,7 @@
.method public a(Ljava/lang/CharSequence;II)Ljava/lang/CharSequence; .method public a(Ljava/lang/CharSequence;II)Ljava/lang/CharSequence;
.locals 8 .locals 8
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->systememoji()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->systememoji()Z
move-result v0 move-result v0
@@ -182,7 +182,7 @@
move-result-object p1 move-result-object p1
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->forceOffline()V invoke-static {}, Lru/vtosters/lite/utils/Preferences;->forceOffline()V
return-object p1 return-object p1
.end method .end method
@@ -151,7 +151,7 @@
check-cast p1, Lcom/vk/im/engine/internal/api_commands/messages/MessagesGetConversationsByIdApiCmd$b; check-cast p1, Lcom/vk/im/engine/internal/api_commands/messages/MessagesGetConversationsByIdApiCmd$b;
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->forceOffline()V invoke-static {}, Lru/vtosters/lite/utils/Preferences;->forceOffline()V
return-object p1 return-object p1
.end method .end method
@@ -2213,7 +2213,7 @@
.line 183 .line 183
sget-object v3, Lcom/vk/im/engine/internal/api_parsers/ImageSizesParser;->a:Lcom/vk/im/engine/internal/api_parsers/ImageSizesParser; sget-object v3, Lcom/vk/im/engine/internal/api_parsers/ImageSizesParser;->a:Lcom/vk/im/engine/internal/api_parsers/ImageSizesParser;
invoke-static {}, Lru/vtosters/lite/utils/Prefs;->GetBackgroundStickers()Ljava/lang/String; invoke-static {}, Lru/vtosters/lite/utils/Themes;->getBackgroundStickers()Ljava/lang/String;
move-result-object v4 move-result-object v4
@@ -370,7 +370,7 @@
move-result v0 move-result v0
invoke-static {}, Lru/vtosters/lite/utils/Themes;->vkme_msg()Z invoke-static {}, Lru/vtosters/lite/utils/Preferences;->vkme_msg()Z
move-result v0 move-result v0

Some files were not shown because too many files have changed in this diff Show More