Compare commits
2
Commits
v0.2.4-beta
..
alpha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6930acd826 | ||
|
|
c21e04528b |
@@ -1,46 +0,0 @@
|
|||||||
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
|
|
||||||
+8
-2
@@ -21,7 +21,13 @@ local.properties
|
|||||||
/smali/VTLite.apk.idsig
|
/smali/VTLite.apk.idsig
|
||||||
.idea/gradle.xml
|
.idea/gradle.xml
|
||||||
.idea/compiler.xml
|
.idea/compiler.xml
|
||||||
|
apksigner.jar
|
||||||
|
apktool_2.6.0.jar
|
||||||
|
debug.jks
|
||||||
|
smali/VTLite_signed.apk.idsig
|
||||||
|
local.properties
|
||||||
|
gradle.properties
|
||||||
|
smali/lib/armeabi-v7a/liblite.so
|
||||||
smali/assets/version.properties
|
smali/assets/version.properties
|
||||||
app/src/main/assets/version.properties
|
app/src/main/assets/version.properties
|
||||||
smali/build/resources.zip
|
smali/build/resources.zip
|
||||||
*.idsig
|
|
||||||
@@ -1,95 +1,9 @@
|
|||||||
# VTosters Lite
|
# VTosters Lite
|
||||||
|
О багах сообщать в issues, **просьба не создавать дубликаты и воспользоваться поиском**
|
||||||
VTosters Lite - это модифицированный клиент (декомпиляция) официального ВКонтакте основанный на версии 5.29
|
### Компиляция
|
||||||
|
|
||||||
О найденных багах сообщать в [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
|
|
||||||
```
|
|
||||||
При следующем открытии аппы она автоматически запакует эти файлы и отправит вам в **Документы** ВК
|
|
||||||
|
|
||||||
Позже архив можно будет скачать и работать с файлами логов которые находятся в нем
|
|
||||||
|
|
||||||
## Разработка
|
|
||||||
|
|
||||||
Для понимания декомпилированного кода требуется использовать **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`
|
|
||||||
|
|
||||||
Весь исходный код модификации находится в `/app`
|
|
||||||
|
|
||||||
Все необходимые скрипты/жарники для компиляции APK, его подписывании и не только находятся в `/scripts`
|
|
||||||
|
|
||||||
### Необходимые зависимости
|
|
||||||
Требуется установленная **Java** >11 версии
|
Требуется установленная **Java** >11 версии
|
||||||
|
Скрипты для сборки лежат в папке **scripts**
|
||||||
|
|
||||||
Требуется установленная **Android Studio**
|
Linux/Unix: ```./build.sh```
|
||||||
|
|
||||||
### Linux/macOS
|
Windows: ```./build.bat```
|
||||||
```
|
|
||||||
./build.sh
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
### Windows
|
|
||||||
```
|
|
||||||
build.bat
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ android {
|
|||||||
sourceCompatibility JavaVersion.VERSION_11
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
targetCompatibility JavaVersion.VERSION_11
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
}
|
}
|
||||||
namespace 'ru.vtosters.lite'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="ru.vtosters.lite">
|
||||||
|
|
||||||
<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
|
||||||
|
|||||||
@@ -3,28 +3,11 @@
|
|||||||
*/
|
*/
|
||||||
package bruhcollective.itaysonlab.libvkx;
|
package bruhcollective.itaysonlab.libvkx;
|
||||||
|
|
||||||
// Works only with original signature of VT
|
|
||||||
|
|
||||||
public interface ILibVkxService extends android.os.IInterface {
|
public interface ILibVkxService extends android.os.IInterface {
|
||||||
void play(java.util.List<String> audio_ids, int index, String playbackContext) throws android.os.RemoteException;
|
|
||||||
|
|
||||||
int getUserId() throws android.os.RemoteException;
|
|
||||||
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
|
||||||
|
|
||||||
void addTrackToCache(int track_id, int owner_id, String access_key) throws android.os.RemoteException;
|
|
||||||
// A UserID. CHECK FOR THIS TO BE EQUAL BEFORE SENDING ANYTHING TO SERVICE!
|
|
||||||
|
|
||||||
void deleteTrackFromCache(int track_id, int owner_id) throws android.os.RemoteException;
|
|
||||||
// Cache add/remove
|
|
||||||
|
|
||||||
boolean isTrackCached(int track_id, int owner_id) throws android.os.RemoteException;
|
|
||||||
|
|
||||||
java.util.List<String> getCache() throws android.os.RemoteException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default implementation for ILibVkxService.
|
* Default implementation for ILibVkxService.
|
||||||
*/
|
*/
|
||||||
class Default implements ILibVkxService {
|
public static class Default implements ILibVkxService {
|
||||||
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -63,20 +46,13 @@ public interface ILibVkxService extends android.os.IInterface {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Get a list of cached tracks. The response is close to VK's original response (an audio list)
|
|
||||||
// Also, the items in the list are JSON ones.
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Local-side IPC implementation stub class.
|
* Local-side IPC implementation stub class.
|
||||||
*/
|
*/
|
||||||
abstract class Stub extends android.os.Binder implements ILibVkxService {
|
public static abstract class Stub extends android.os.Binder implements ILibVkxService {
|
||||||
static final int TRANSACTION_play = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
|
|
||||||
static final int TRANSACTION_getUserId = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
|
|
||||||
static final int TRANSACTION_addTrackToCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
|
|
||||||
static final int TRANSACTION_deleteTrackFromCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
|
|
||||||
static final int TRANSACTION_isTrackCached = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
|
|
||||||
static final int TRANSACTION_getCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
|
|
||||||
private static final String DESCRIPTOR = "bruhcollective.itaysonlab.libvkx.ILibVkxService";
|
private static final String DESCRIPTOR = "bruhcollective.itaysonlab.libvkx.ILibVkxService";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct the stub at attach it to the interface.
|
* Construct the stub at attach it to the interface.
|
||||||
*/
|
*/
|
||||||
@@ -99,18 +75,6 @@ public interface ILibVkxService extends android.os.IInterface {
|
|||||||
return new Proxy(obj);
|
return new Proxy(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean setDefaultImpl(ILibVkxService impl) {
|
|
||||||
if (Proxy.sDefaultImpl == null && impl != null) {
|
|
||||||
Proxy.sDefaultImpl = impl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ILibVkxService getDefaultImpl() {
|
|
||||||
return Proxy.sDefaultImpl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public android.os.IBinder asBinder() {
|
public android.os.IBinder asBinder() {
|
||||||
return this;
|
return this;
|
||||||
@@ -190,8 +154,7 @@ public interface ILibVkxService extends android.os.IInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class Proxy implements ILibVkxService {
|
private static class Proxy implements ILibVkxService {
|
||||||
public static ILibVkxService sDefaultImpl;
|
private android.os.IBinder mRemote;
|
||||||
private final android.os.IBinder mRemote;
|
|
||||||
|
|
||||||
Proxy(android.os.IBinder remote) {
|
Proxy(android.os.IBinder remote) {
|
||||||
mRemote = remote;
|
mRemote = remote;
|
||||||
@@ -201,12 +164,11 @@ public interface ILibVkxService extends android.os.IInterface {
|
|||||||
public android.os.IBinder asBinder() {
|
public android.os.IBinder asBinder() {
|
||||||
return mRemote;
|
return mRemote;
|
||||||
}
|
}
|
||||||
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
|
||||||
|
|
||||||
public String getInterfaceDescriptor() {
|
public String getInterfaceDescriptor() {
|
||||||
return DESCRIPTOR;
|
return DESCRIPTOR;
|
||||||
}
|
}
|
||||||
// A UserID. CHECK FOR THIS TO BE EQUAL BEFORE SENDING ANYTHING TO SERVICE!
|
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void play(java.util.List<String> audio_ids, int index, String playbackContext) throws android.os.RemoteException {
|
public void play(java.util.List<String> audio_ids, int index, String playbackContext) throws android.os.RemoteException {
|
||||||
@@ -228,7 +190,7 @@ public interface ILibVkxService extends android.os.IInterface {
|
|||||||
_data.recycle();
|
_data.recycle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cache add/remove
|
// A UserID. CHECK FOR THIS TO BE EQUAL BEFORE SENDING ANYTHING TO SERVICE!
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getUserId() throws android.os.RemoteException {
|
public int getUserId() throws android.os.RemoteException {
|
||||||
@@ -249,6 +211,7 @@ public interface ILibVkxService extends android.os.IInterface {
|
|||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
}
|
}
|
||||||
|
// Cache add/remove
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTrackToCache(int track_id, int owner_id, String access_key) throws android.os.RemoteException {
|
public void addTrackToCache(int track_id, int owner_id, String access_key) throws android.os.RemoteException {
|
||||||
@@ -290,8 +253,6 @@ public interface ILibVkxService extends android.os.IInterface {
|
|||||||
_data.recycle();
|
_data.recycle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Get a list of cached tracks. The response is close to VK's original response (an audio list)
|
|
||||||
// Also, the items in the list are JSON ones.
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTrackCached(int track_id, int owner_id) throws android.os.RemoteException {
|
public boolean isTrackCached(int track_id, int owner_id) throws android.os.RemoteException {
|
||||||
@@ -314,6 +275,8 @@ public interface ILibVkxService extends android.os.IInterface {
|
|||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
}
|
}
|
||||||
|
// Get a list of cached tracks. The response is close to VK's original response (an audio list)
|
||||||
|
// Also, the items in the list are JSON ones.
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public java.util.List<String> getCache() throws android.os.RemoteException {
|
public java.util.List<String> getCache() throws android.os.RemoteException {
|
||||||
@@ -334,6 +297,44 @@ public interface ILibVkxService extends android.os.IInterface {
|
|||||||
}
|
}
|
||||||
return _result;
|
return _result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ILibVkxService sDefaultImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
static final int TRANSACTION_play = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
|
||||||
|
static final int TRANSACTION_getUserId = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
|
||||||
|
static final int TRANSACTION_addTrackToCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
|
||||||
|
static final int TRANSACTION_deleteTrackFromCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
|
||||||
|
static final int TRANSACTION_isTrackCached = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
|
||||||
|
static final int TRANSACTION_getCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
|
||||||
|
|
||||||
|
public static boolean setDefaultImpl(ILibVkxService impl) {
|
||||||
|
if (Proxy.sDefaultImpl == null && impl != null) {
|
||||||
|
Proxy.sDefaultImpl = impl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ILibVkxService getDefaultImpl() {
|
||||||
|
return Proxy.sDefaultImpl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
||||||
|
|
||||||
|
public void play(java.util.List<String> audio_ids, int index, String playbackContext) throws android.os.RemoteException;
|
||||||
|
// A UserID. CHECK FOR THIS TO BE EQUAL BEFORE SENDING ANYTHING TO SERVICE!
|
||||||
|
|
||||||
|
public int getUserId() throws android.os.RemoteException;
|
||||||
|
// Cache add/remove
|
||||||
|
|
||||||
|
public void addTrackToCache(int track_id, int owner_id, String access_key) throws android.os.RemoteException;
|
||||||
|
|
||||||
|
public void deleteTrackFromCache(int track_id, int owner_id) throws android.os.RemoteException;
|
||||||
|
|
||||||
|
public boolean isTrackCached(int track_id, int owner_id) throws android.os.RemoteException;
|
||||||
|
// Get a list of cached tracks. The response is close to VK's original response (an audio list)
|
||||||
|
// Also, the items in the list are JSON ones.
|
||||||
|
|
||||||
|
public java.util.List<String> getCache() throws android.os.RemoteException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
package bruhcollective.itaysonlab.libvkx.client;
|
package bruhcollective.itaysonlab.libvkx.client;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
import bruhcollective.itaysonlab.libvkx.ILibVkxService;
|
||||||
|
|
||||||
import com.vk.core.b.PackageManagerHelper;
|
import com.vk.core.b.PackageManagerHelper;
|
||||||
import com.vk.dto.music.MusicTrack;
|
import com.vk.dto.music.MusicTrack;
|
||||||
import com.vk.music.PlayerRefer;
|
import com.vk.music.PlayerRefer;
|
||||||
@@ -14,8 +13,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import bruhcollective.itaysonlab.libvkx.ILibVkxService;
|
import ru.vtosters.lite.utils.Helper;
|
||||||
|
import ru.vtosters.lite.utils.Prefs;
|
||||||
|
import ru.vtosters.lite.utils.Helper;
|
||||||
|
import ru.vtosters.lite.utils.Prefs;
|
||||||
|
|
||||||
|
/* loaded from: classes6.dex */
|
||||||
public class LibVKXClient {
|
public class LibVKXClient {
|
||||||
private static LibVKXClientImpl impl;
|
private static LibVKXClientImpl impl;
|
||||||
|
|
||||||
@@ -28,7 +31,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(Helper.GetContext()) : libVKXClientImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isVkxInstalled() {
|
public static boolean isVkxInstalled() {
|
||||||
@@ -36,7 +39,7 @@ public class LibVKXClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isIntegrationEnabled() {
|
public static boolean isIntegrationEnabled() {
|
||||||
return BooleanFalse("libvkx_integration") && isVkxInstalled();
|
return Prefs.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) {
|
||||||
@@ -49,7 +52,8 @@ public class LibVKXClient {
|
|||||||
return getInstance().runOnService(action);
|
return getInstance().runOnService(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void lambdaplay(List list, MusicTrack musicTrack, PlayerRefer playerRefer, ILibVkxService iLibVkxService) {
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||||||
|
public static /* synthetic */ void lambdaplay(List list, MusicTrack musicTrack, PlayerRefer playerRefer, ILibVkxService iLibVkxService) {
|
||||||
int indexOf = list.indexOf(musicTrack);
|
int indexOf = list.indexOf(musicTrack);
|
||||||
ArrayList arrayList = new ArrayList();
|
ArrayList arrayList = new ArrayList();
|
||||||
Iterator it = list.iterator();
|
Iterator it = list.iterator();
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package bruhcollective.itaysonlab.libvkx.client;
|
package bruhcollective.itaysonlab.libvkx.client;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getUserId;
|
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -14,6 +12,7 @@ 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;
|
||||||
@@ -52,7 +51,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() != Helper.GetUserId()) return false;
|
||||||
action.run(serviceInstance);
|
action.run(serviceInstance);
|
||||||
return true;
|
return true;
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -76,7 +75,7 @@ public class LibVKXClientImpl {
|
|||||||
isBindFailed = true;
|
isBindFailed = true;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if (serviceInstance.getUserId() != getUserId()) return;
|
if (serviceInstance.getUserId() != Helper.GetUserId()) return;
|
||||||
runAfterBind.run(serviceInstance);
|
runAfterBind.run(serviceInstance);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -96,7 +95,8 @@ public class LibVKXClientImpl {
|
|||||||
|
|
||||||
private boolean verifyBindActuality() {
|
private boolean verifyBindActuality() {
|
||||||
if (!checkIfAppExists()) return false; // no need
|
if (!checkIfAppExists()) return false; // no need
|
||||||
return !isBindFailed;
|
if (isBindFailed) return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Intent getIntent() {
|
private Intent getIntent() {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.aefyr.tsg.g2;
|
package com.aefyr.tsg.g2;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
@@ -7,13 +10,11 @@ import android.content.Context;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.core.app.NotificationCompat;
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
|
|
||||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Aefyr on 20.05.2018.
|
* Created by Aefyr on 20.05.2018.
|
||||||
@@ -21,13 +22,17 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||||||
public class NotificationsHelper {
|
public class NotificationsHelper {
|
||||||
private static final int NOTIFICATION_ID_BASE = 3921337;
|
private static final int NOTIFICATION_ID_BASE = 3921337;
|
||||||
private static final String NOTIFICATION_CHANNEL_ID = "tgss_chan_v5";
|
private static final String NOTIFICATION_CHANNEL_ID = "tgss_chan_v5";
|
||||||
|
|
||||||
|
private HashMap<TelegramStickersPack, Integer> downloadingPacksNotificationsIds;
|
||||||
|
|
||||||
|
private Context c;
|
||||||
|
private NotificationManagerCompat manager;
|
||||||
|
private int currentNotificationN = 0;
|
||||||
|
|
||||||
private static final int MAX_UPDATE_NOTIFICATIONS_PER_SECOND = 3;
|
private static final int MAX_UPDATE_NOTIFICATIONS_PER_SECOND = 3;
|
||||||
private static final int MIN_TIME_BETWEEN_UPDATE_NOTIFICATIONS = 1000 / MAX_UPDATE_NOTIFICATIONS_PER_SECOND;
|
private static final int MIN_TIME_BETWEEN_UPDATE_NOTIFICATIONS = 1000 / MAX_UPDATE_NOTIFICATIONS_PER_SECOND;
|
||||||
private final HashMap<TelegramStickersPack, Integer> downloadingPacksNotificationsIds;
|
|
||||||
private final Context c;
|
private AtomicLong lastNotificationTime = new AtomicLong(0);
|
||||||
private final NotificationManagerCompat manager;
|
|
||||||
private int currentNotificationN = 0;
|
|
||||||
private final AtomicLong lastNotificationTime = new AtomicLong(0);
|
|
||||||
|
|
||||||
public NotificationsHelper(Context c) {
|
public NotificationsHelper(Context c) {
|
||||||
this.c = c;
|
this.c = c;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.io.File;
|
|||||||
class PackDeletionTask extends AsyncTask<Void, Void, Boolean> {
|
class PackDeletionTask extends AsyncTask<Void, Void, Boolean> {
|
||||||
private static final String TAG = "TGSSAnnihilator";
|
private static final String TAG = "TGSSAnnihilator";
|
||||||
|
|
||||||
private final TelegramStickersPack pack;
|
private TelegramStickersPack pack;
|
||||||
|
|
||||||
PackDeletionTask(TelegramStickersPack pack) {
|
PackDeletionTask(TelegramStickersPack pack) {
|
||||||
this.pack = pack;
|
this.pack = pack;
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
package com.aefyr.tsg.g2;
|
package com.aefyr.tsg.g2;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Aefyr on 18.05.2018.
|
* Created by Aefyr on 18.05.2018.
|
||||||
*/
|
*/
|
||||||
@@ -101,7 +101,7 @@ public class TelegramStickersPack extends CustomStickersPack {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return obj instanceof TelegramStickersPack && ((TelegramStickersPack) obj).id.equalsIgnoreCase(id);
|
return obj instanceof TelegramStickersPack && ((TelegramStickersPack) obj).id.toLowerCase().equals(id.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,17 +1,5 @@
|
|||||||
package com.aefyr.tsg.g2;
|
package com.aefyr.tsg.g2;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.aefyr.tsg.g2.sql.TelegramStickersDbHelper;
|
|
||||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
|
||||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersPackInfo;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -19,6 +7,17 @@ import java.util.List;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
|
import com.aefyr.tsg.g2.sql.TelegramStickersDbHelper;
|
||||||
|
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||||
|
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersPackInfo;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import ru.vtosters.lite.utils.Helper;
|
||||||
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
|
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,25 +27,29 @@ public class TelegramStickersService {
|
|||||||
private static final String TAG = "TGStickersService";
|
private static final String TAG = "TGStickersService";
|
||||||
private static TelegramStickersService instance;
|
private static TelegramStickersService instance;
|
||||||
|
|
||||||
private final Context c;
|
private Context c;
|
||||||
|
|
||||||
private final ArrayList<TelegramStickersPack> packs;
|
private ArrayList<TelegramStickersPack> packs;
|
||||||
private final ArrayList<TelegramStickersPack> activePacks;
|
private ArrayList<TelegramStickersPack> activePacks;
|
||||||
private final ArrayList<TelegramStickersPack> inactivePacks;
|
private ArrayList<TelegramStickersPack> inactivePacks;
|
||||||
private final ArrayList<StickersEventsListener> listeners;
|
private ArrayList<StickersEventsListener> listeners;
|
||||||
private final HashSet<String> currentlyDownloading;
|
private HashSet<String> currentlyDownloading;
|
||||||
|
|
||||||
private final Handler uiThreadHandler;
|
private Handler uiThreadHandler;
|
||||||
|
|
||||||
private final TelegramStickersGrabber grabber;
|
private TelegramStickersGrabber grabber;
|
||||||
|
|
||||||
private final TelegramStickersDbHelper dbHelper;
|
private TelegramStickersDbHelper dbHelper;
|
||||||
private boolean ready = false;
|
private boolean ready = false;
|
||||||
private final ArrayList<Runnable> queuedTasks;
|
private ArrayList<Runnable> queuedTasks;
|
||||||
|
|
||||||
private final ThreadPoolExecutor executor;
|
private ThreadPoolExecutor executor;
|
||||||
|
|
||||||
private final NotificationsHelper notificationsHelper;
|
private NotificationsHelper notificationsHelper;
|
||||||
|
|
||||||
|
public static TelegramStickersService getInstance(Context c) {
|
||||||
|
return instance == null ? new TelegramStickersService(c) : instance;
|
||||||
|
}
|
||||||
|
|
||||||
private TelegramStickersService(Context context) {
|
private TelegramStickersService(Context context) {
|
||||||
instance = this;
|
instance = this;
|
||||||
@@ -69,10 +72,6 @@ public class TelegramStickersService {
|
|||||||
updatePacks(true);
|
updatePacks(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TelegramStickersService getInstance(Context c) {
|
|
||||||
return instance == null ? new TelegramStickersService(c) : instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePacks(final boolean notify) {
|
private void updatePacks(final boolean notify) {
|
||||||
packs.clear();
|
packs.clear();
|
||||||
dbHelper.getAllPacks(new TelegramStickersDbHelper.PacksLoadingListener() {
|
dbHelper.getAllPacks(new TelegramStickersDbHelper.PacksLoadingListener() {
|
||||||
@@ -106,6 +105,20 @@ public class TelegramStickersService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface StickersEventsListener {
|
||||||
|
void onPackAdded(TelegramStickersPack pack, int atIndex);
|
||||||
|
|
||||||
|
void onPackRemoved(TelegramStickersPack pack, int atIndex);
|
||||||
|
|
||||||
|
void onPackChanged(TelegramStickersPack pack, int atIndex);
|
||||||
|
|
||||||
|
void onPackDownloadError(TelegramStickersPack pack, Exception error);
|
||||||
|
|
||||||
|
void onActivePacksListChanged();
|
||||||
|
|
||||||
|
void onInactivePacksListChanged();
|
||||||
|
}
|
||||||
|
|
||||||
public void addStickersEventsListener(StickersEventsListener listener) {
|
public void addStickersEventsListener(StickersEventsListener listener) {
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
@@ -115,7 +128,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));
|
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||||
if (listeners.isEmpty())
|
if (listeners.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -125,7 +138,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));
|
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||||
if (listeners.isEmpty())
|
if (listeners.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -135,7 +148,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));
|
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||||
if (listeners.isEmpty())
|
if (listeners.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -145,7 +158,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));
|
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||||
if (listeners.isEmpty())
|
if (listeners.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -155,7 +168,7 @@ public class TelegramStickersService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void notifyActivePacksListChanged() {
|
private void notifyActivePacksListChanged() {
|
||||||
getContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||||
if (listeners.isEmpty())
|
if (listeners.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -165,7 +178,7 @@ public class TelegramStickersService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void notifyInactivePacksListChanged() {
|
private void notifyInactivePacksListChanged() {
|
||||||
getContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||||
if (listeners.isEmpty())
|
if (listeners.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -385,19 +398,5 @@ public class TelegramStickersService {
|
|||||||
getPacksListReference().set(li1, p2);
|
getPacksListReference().set(li1, p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface StickersEventsListener {
|
|
||||||
void onPackAdded(TelegramStickersPack pack, int atIndex);
|
|
||||||
|
|
||||||
void onPackRemoved(TelegramStickersPack pack, int atIndex);
|
|
||||||
|
|
||||||
void onPackChanged(TelegramStickersPack pack, int atIndex);
|
|
||||||
|
|
||||||
void onPackDownloadError(TelegramStickersPack pack, Exception error);
|
|
||||||
|
|
||||||
void onActivePacksListChanged();
|
|
||||||
|
|
||||||
void onInactivePacksListChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,6 @@ import android.provider.BaseColumns;
|
|||||||
*/
|
*/
|
||||||
public final class TelegramStickersContract {
|
public final class TelegramStickersContract {
|
||||||
|
|
||||||
public static final String SQL_CREATE_ENTRIES = String.format("CREATE TABLE %s (%s INTEGER PRIMARY KEY, %s INTEGER AUTO_INCREMENT, %s TEXT, %s TEXT, %s TEXT, %s INTEGER, %s INTEGER, %s TEXT, %s TEXT)",
|
|
||||||
StickersTableEntry.TABLE_NAME, StickersTableEntry._ID, StickersTableEntry.COLUMN_NAME_INDEX, StickersTableEntry.COLUMN_NAME_ID, StickersTableEntry.COLUMN_NAME_NAME,
|
|
||||||
StickersTableEntry.COLUMN_NAME_FOLDER, StickersTableEntry.COLUMN_NAME_STICKERS_COUNT, StickersTableEntry.COLUMN_NAME_ENABLED, StickersTableEntry.COLUMN_NAME_VERSION, StickersTableEntry.COLUMN_NAME_EMOJIS);
|
|
||||||
|
|
||||||
private TelegramStickersContract() {
|
private TelegramStickersContract() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,5 +23,9 @@ public final class TelegramStickersContract {
|
|||||||
public static final String COLUMN_NAME_EMOJIS = "emojis";
|
public static final String COLUMN_NAME_EMOJIS = "emojis";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String SQL_CREATE_ENTRIES = String.format("CREATE TABLE %s (%s INTEGER PRIMARY KEY, %s INTEGER AUTO_INCREMENT, %s TEXT, %s TEXT, %s TEXT, %s INTEGER, %s INTEGER, %s TEXT, %s TEXT)",
|
||||||
|
StickersTableEntry.TABLE_NAME, StickersTableEntry._ID, StickersTableEntry.COLUMN_NAME_INDEX, StickersTableEntry.COLUMN_NAME_ID, StickersTableEntry.COLUMN_NAME_NAME,
|
||||||
|
StickersTableEntry.COLUMN_NAME_FOLDER, StickersTableEntry.COLUMN_NAME_STICKERS_COUNT, StickersTableEntry.COLUMN_NAME_ENABLED, StickersTableEntry.COLUMN_NAME_VERSION, StickersTableEntry.COLUMN_NAME_EMOJIS);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.aefyr.tsg.g2.TelegramStickersPack;
|
import com.aefyr.tsg.g2.TelegramStickersPack;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Aefyr on 19.05.2018.
|
* Created by Aefyr on 19.05.2018.
|
||||||
*/
|
*/
|
||||||
@@ -27,6 +27,12 @@ public class TelegramStickersDbHelper extends SQLiteOpenHelper {
|
|||||||
private SQLiteDatabase writableDb;
|
private SQLiteDatabase writableDb;
|
||||||
private SQLiteDatabase readableDb;
|
private SQLiteDatabase readableDb;
|
||||||
|
|
||||||
|
public interface PacksLoadingListener {
|
||||||
|
void onPackLoaded(TelegramStickersPack pack);
|
||||||
|
|
||||||
|
void onAllPacksLoaded(ArrayList<TelegramStickersPack> packs);
|
||||||
|
}
|
||||||
|
|
||||||
public TelegramStickersDbHelper(Context context) {
|
public TelegramStickersDbHelper(Context context) {
|
||||||
super(context, DB_NAME, null, DB_VERSION);
|
super(context, DB_NAME, null, DB_VERSION);
|
||||||
}
|
}
|
||||||
@@ -88,6 +94,7 @@ public class TelegramStickersDbHelper extends SQLiteOpenHelper {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
max = 0;
|
max = 0;
|
||||||
}
|
}
|
||||||
|
Log.d("sova", "Found last index: " + max);
|
||||||
return max + 1;
|
return max + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,12 +106,6 @@ public class TelegramStickersDbHelper extends SQLiteOpenHelper {
|
|||||||
new PacksLoadingTask(listener).execute();
|
new PacksLoadingTask(listener).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface PacksLoadingListener {
|
|
||||||
void onPackLoaded(TelegramStickersPack pack);
|
|
||||||
|
|
||||||
void onAllPacksLoaded(ArrayList<TelegramStickersPack> packs);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class PacksLoadingTask extends AsyncTask<Void, Void, ArrayList<TelegramStickersPack>> {
|
private class PacksLoadingTask extends AsyncTask<Void, Void, ArrayList<TelegramStickersPack>> {
|
||||||
|
|
||||||
PacksLoadingListener listener;
|
PacksLoadingListener listener;
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ import android.util.Log;
|
|||||||
import com.aefyr.tsg.g2.stickersgrabber.util.Flag;
|
import com.aefyr.tsg.g2.stickersgrabber.util.Flag;
|
||||||
import com.aefyr.tsg.g2.stickersgrabber.util.GoalCounter;
|
import com.aefyr.tsg.g2.stickersgrabber.util.GoalCounter;
|
||||||
|
|
||||||
|
import ru.f0x1d.net.NetCall;
|
||||||
|
import ru.f0x1d.net.NetCallback;
|
||||||
|
import ru.f0x1d.net.NetClient;
|
||||||
|
import ru.f0x1d.net.NetRequest;
|
||||||
|
import ru.f0x1d.net.NetResponse;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
@@ -27,17 +33,17 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import ru.f0x1d.net.NetCall;
|
|
||||||
import ru.f0x1d.net.NetCallback;
|
|
||||||
import ru.f0x1d.net.NetClient;
|
|
||||||
import ru.f0x1d.net.NetRequest;
|
|
||||||
import ru.f0x1d.net.NetResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Aefyr on 11.05.2018.
|
* Created by Aefyr on 11.05.2018.
|
||||||
*/
|
*/
|
||||||
public class TelegramStickersGrabber {
|
public class TelegramStickersGrabber {
|
||||||
private static final String TAG = "TSG";
|
private static final String TAG = "TSG";
|
||||||
|
|
||||||
|
private static String BOT_API_BASE_URL;
|
||||||
|
private static String GET_STICKER_SET_URL;
|
||||||
|
private static String GET_FILE_URL;
|
||||||
|
private static String BOT_API_BASE_FILE_URL;
|
||||||
|
|
||||||
public static String REAL_TG_IP = null;
|
public static String REAL_TG_IP = null;
|
||||||
public static String PROXY_IP = null;
|
public static String PROXY_IP = null;
|
||||||
public static int PROXY_PORT = -1;
|
public static int PROXY_PORT = -1;
|
||||||
@@ -46,32 +52,11 @@ public class TelegramStickersGrabber {
|
|||||||
public static boolean PROXY_SOCKS = true;
|
public static boolean PROXY_SOCKS = true;
|
||||||
public static boolean HAS_PASS = false;
|
public static boolean HAS_PASS = false;
|
||||||
public static boolean USE_PROXY = false;
|
public static boolean USE_PROXY = false;
|
||||||
private static String BOT_API_BASE_URL;
|
|
||||||
private static String GET_STICKER_SET_URL;
|
|
||||||
private static String GET_FILE_URL;
|
|
||||||
private static String BOT_API_BASE_FILE_URL;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
updateURLs();
|
updateURLs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final MessageDigest sha256;
|
|
||||||
private final Handler uiThreadHandler;
|
|
||||||
private String botApiKey = "";
|
|
||||||
private NetClient httpClient;
|
|
||||||
public TelegramStickersGrabber(String botApiKey) {
|
|
||||||
this.botApiKey = botApiKey;
|
|
||||||
httpClient = new NetClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build();
|
|
||||||
uiThreadHandler = new Handler(Looper.getMainLooper());
|
|
||||||
try {
|
|
||||||
sha256 = MessageDigest.getInstance("SHA-256");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
Log.wtf(TAG, "No support for SHA-256");
|
|
||||||
e.printStackTrace();
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void updateURLs() {
|
public static void updateURLs() {
|
||||||
BOT_API_BASE_FILE_URL = "https://api.telegram.org/file/bot%s/%s";
|
BOT_API_BASE_FILE_URL = "https://api.telegram.org/file/bot%s/%s";
|
||||||
|
|
||||||
@@ -81,6 +66,11 @@ public class TelegramStickersGrabber {
|
|||||||
GET_FILE_URL = BOT_API_BASE_URL + "getFile?file_id=%s";
|
GET_FILE_URL = BOT_API_BASE_URL + "getFile?file_id=%s";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String botApiKey = "";
|
||||||
|
private NetClient httpClient;
|
||||||
|
private final MessageDigest sha256;
|
||||||
|
private final Handler uiThreadHandler;
|
||||||
|
|
||||||
public static boolean isTelegramBlocked() {
|
public static boolean isTelegramBlocked() {
|
||||||
NetClient client = new NetClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build();
|
NetClient client = new NetClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build();
|
||||||
try {
|
try {
|
||||||
@@ -111,6 +101,43 @@ public class TelegramStickersGrabber {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface PackDownloadListener {
|
||||||
|
void onPackDownloaded(TelegramStickersPackInfo pack, boolean newVersionFound);
|
||||||
|
|
||||||
|
void onPackDownloadError(Exception e);
|
||||||
|
|
||||||
|
void onGotPackInfo(TelegramStickersPackInfo packInfo);
|
||||||
|
|
||||||
|
void onStickerDownloaded(String pack, File sticker, String boundEmoji, int stickerIndex, int downloadedStickersCount, int totalStickerCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface KeyCheckListener {
|
||||||
|
void onKeyChecked(boolean ok);
|
||||||
|
|
||||||
|
void onNetError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TSGException extends Exception {
|
||||||
|
private static final long serialVersionUID = 7866915509988422944L;
|
||||||
|
|
||||||
|
private TSGException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TelegramStickersGrabber(String botApiKey) {
|
||||||
|
this.botApiKey = botApiKey;
|
||||||
|
httpClient = new NetClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build();
|
||||||
|
uiThreadHandler = new Handler(Looper.getMainLooper());
|
||||||
|
try {
|
||||||
|
sha256 = MessageDigest.getInstance("SHA-256");
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
Log.wtf(TAG, "No support for SHA-256");
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void resetProxy() {
|
public void resetProxy() {
|
||||||
httpClient = new NetClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build();
|
httpClient = new NetClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build();
|
||||||
}
|
}
|
||||||
@@ -174,6 +201,40 @@ public class TelegramStickersGrabber {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class StickerSet {
|
||||||
|
String id;
|
||||||
|
String name;
|
||||||
|
String version;
|
||||||
|
ArrayList<Sticker> stickers;
|
||||||
|
|
||||||
|
StickerSet(String id, String name, String version, ArrayList<Sticker> stickers) {
|
||||||
|
this.name = name;
|
||||||
|
this.stickers = stickers;
|
||||||
|
this.id = id;
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class Sticker {
|
||||||
|
String emoji;
|
||||||
|
String fileId;
|
||||||
|
|
||||||
|
Sticker(String fileId, String emoji) {
|
||||||
|
this.fileId = fileId;
|
||||||
|
this.emoji = emoji;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
return obj instanceof Sticker && ((Sticker) obj).fileId.equals(fileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return (17 * emoji.hashCode()) << 32 + fileId.hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void getPackInfo(final String packName, final File packFolder, final String installedVersion, final PackDownloadListener listener) {
|
private void getPackInfo(final String packName, final File packFolder, final String installedVersion, final PackDownloadListener listener) {
|
||||||
NetRequest packInfoRequest = new NetRequest.Builder().get().url(String.format(GET_STICKER_SET_URL, botApiKey, packName)).build();
|
NetRequest packInfoRequest = new NetRequest.Builder().get().url(String.format(GET_STICKER_SET_URL, botApiKey, packName)).build();
|
||||||
httpClient.newCall(packInfoRequest).enqueue(new NetCallback() {
|
httpClient.newCall(packInfoRequest).enqueue(new NetCallback() {
|
||||||
@@ -417,62 +478,4 @@ public class TelegramStickersGrabber {
|
|||||||
private void runOnUiThread(Runnable r) {
|
private void runOnUiThread(Runnable r) {
|
||||||
uiThreadHandler.post(r);
|
uiThreadHandler.post(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface PackDownloadListener {
|
|
||||||
void onPackDownloaded(TelegramStickersPackInfo pack, boolean newVersionFound);
|
|
||||||
|
|
||||||
void onPackDownloadError(Exception e);
|
|
||||||
|
|
||||||
void onGotPackInfo(TelegramStickersPackInfo packInfo);
|
|
||||||
|
|
||||||
void onStickerDownloaded(String pack, File sticker, String boundEmoji, int stickerIndex, int downloadedStickersCount, int totalStickerCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface KeyCheckListener {
|
|
||||||
void onKeyChecked(boolean ok);
|
|
||||||
|
|
||||||
void onNetError();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TSGException extends Exception {
|
|
||||||
private static final long serialVersionUID = 7866915509988422944L;
|
|
||||||
|
|
||||||
private TSGException(String message) {
|
|
||||||
super(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class StickerSet {
|
|
||||||
String id;
|
|
||||||
String name;
|
|
||||||
String version;
|
|
||||||
ArrayList<Sticker> stickers;
|
|
||||||
|
|
||||||
StickerSet(String id, String name, String version, ArrayList<Sticker> stickers) {
|
|
||||||
this.name = name;
|
|
||||||
this.stickers = stickers;
|
|
||||||
this.id = id;
|
|
||||||
this.version = version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class Sticker {
|
|
||||||
String emoji;
|
|
||||||
String fileId;
|
|
||||||
|
|
||||||
Sticker(String fileId, String emoji) {
|
|
||||||
this.fileId = fileId;
|
|
||||||
this.emoji = emoji;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
return obj instanceof Sticker && ((Sticker) obj).fileId.equals(fileId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return (17 * emoji.hashCode()) << 32 + fileId.hashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,14 @@ import android.util.Log;
|
|||||||
*/
|
*/
|
||||||
public class GoalCounter {
|
public class GoalCounter {
|
||||||
|
|
||||||
private final int goal;
|
public interface OnGoalReachListener {
|
||||||
|
void onGoalReached();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int goal;
|
||||||
private int i = 0;
|
private int i = 0;
|
||||||
private final OnGoalReachListener listener;
|
|
||||||
|
private OnGoalReachListener listener;
|
||||||
|
|
||||||
public GoalCounter(int goal, OnGoalReachListener listener) {
|
public GoalCounter(int goal, OnGoalReachListener listener) {
|
||||||
this.goal = goal;
|
this.goal = goal;
|
||||||
@@ -31,8 +36,4 @@ public class GoalCounter {
|
|||||||
public synchronized int value() {
|
public synchronized int value() {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnGoalReachListener {
|
|
||||||
void onGoalReached();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -7,17 +7,20 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import okhttp3.Headers;
|
||||||
import okhttp3.internal.Util;
|
import okhttp3.internal.Util;
|
||||||
import okhttp3.internal.b.HttpMethod;
|
import okhttp3.internal.b.HttpMethod;
|
||||||
|
import okhttp3.Request;
|
||||||
|
|
||||||
public final class Request {
|
public final class Request {
|
||||||
|
/* renamed from: a reason: collision with root package name */
|
||||||
final HttpUrl a;
|
final HttpUrl a;
|
||||||
final String b;
|
final String b;
|
||||||
final Headers c;
|
final Headers c;
|
||||||
final Map<Class<?>, Object> e;
|
final Map<Class<?>, Object> e;
|
||||||
|
private volatile CacheControl f;
|
||||||
@Nullable
|
@Nullable
|
||||||
final RequestBody requestBody;
|
final RequestBody requestBody;
|
||||||
private volatile CacheControl f;
|
|
||||||
|
|
||||||
Request(Builder builder) {
|
Request(Builder builder) {
|
||||||
this.a = builder.a;
|
this.a = builder.a;
|
||||||
@@ -55,7 +58,7 @@ public final class Request {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public <T> T a(Class<? extends T> cls) {
|
public <T> T a(Class<? extends T> cls) {
|
||||||
return cls.cast(this.e.get(cls));
|
return (T) cls.cast(this.e.get(cls));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder e() {
|
public Builder e() {
|
||||||
@@ -82,6 +85,7 @@ public final class Request {
|
|||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
|
/* renamed from: a reason: collision with root package name */
|
||||||
HttpUrl a;
|
HttpUrl a;
|
||||||
String b;
|
String b;
|
||||||
Headers.a c;
|
Headers.a c;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package ru.f0x1d.net;
|
package ru.f0x1d.net;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
|
||||||
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
import com.vk.core.network.Network;
|
import com.vk.core.network.Network;
|
||||||
@@ -11,8 +9,14 @@ 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 interface F0x1dRequestCallback {
|
||||||
|
void onResponse(String str);
|
||||||
|
}
|
||||||
|
|
||||||
public static void makeRequest(byte[] bArr, F0x1dRequestCallback f0x1dRequestCallback) {
|
public static void makeRequest(byte[] bArr, F0x1dRequestCallback f0x1dRequestCallback) {
|
||||||
new MakeRequestTask(bArr, f0x1dRequestCallback).execute();
|
new MakeRequestTask(bArr, f0x1dRequestCallback).execute();
|
||||||
}
|
}
|
||||||
@@ -25,15 +29,11 @@ public class F0x1dRequest {
|
|||||||
new MakeRequestTask(str.getBytes(), f0x1dRequestCallback, true, !z).execute();
|
new MakeRequestTask(str.getBytes(), f0x1dRequestCallback, true, !z).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface F0x1dRequestCallback {
|
|
||||||
void onResponse(String str);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class MakeRequestTask extends AsyncTask<Void, Void, String> {
|
private static class MakeRequestTask extends AsyncTask<Void, Void, String> {
|
||||||
private final F0x1dRequestCallback callback;
|
private F0x1dRequestCallback callback;
|
||||||
private boolean mIsPut;
|
private boolean mIsPut;
|
||||||
private boolean mIsVkToasterRequest;
|
private boolean mIsVkToasterRequest;
|
||||||
private final byte[] url;
|
private byte[] url;
|
||||||
|
|
||||||
public MakeRequestTask(byte[] bArr, F0x1dRequestCallback f0x1dRequestCallback) {
|
public MakeRequestTask(byte[] bArr, F0x1dRequestCallback f0x1dRequestCallback) {
|
||||||
this.mIsVkToasterRequest = false;
|
this.mIsVkToasterRequest = false;
|
||||||
@@ -51,12 +51,13 @@ public class F0x1dRequest {
|
|||||||
this.mIsPut = z2;
|
this.mIsPut = z2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||||||
public String doInBackground(Void... voidArr) {
|
public String doInBackground(Void... voidArr) {
|
||||||
try {
|
try {
|
||||||
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", Helper.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,5 @@
|
|||||||
package ru.f0x1d.net;
|
package ru.f0x1d.net;
|
||||||
|
|
||||||
import android.util.Base64;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -15,25 +13,17 @@ import java.nio.charset.StandardCharsets;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
import android.util.Base64;
|
||||||
|
|
||||||
public final class NetCall {
|
public final class NetCall {
|
||||||
private final NetRequest req;
|
private NetRequest req;
|
||||||
private final NetClient cl;
|
private NetClient cl;
|
||||||
|
|
||||||
protected NetCall(NetClient cl, NetRequest req) {
|
protected NetCall(NetClient cl, NetRequest req) {
|
||||||
this.req = req;
|
this.req = req;
|
||||||
this.cl = cl;
|
this.cl = cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String constructArgs(Map<String, String> args) throws UnsupportedEncodingException {
|
|
||||||
args = new TreeMap<>(args);
|
|
||||||
String str = "";
|
|
||||||
for (Map.Entry<String, String> en : args.entrySet()) {
|
|
||||||
if (!str.isEmpty()) str += "&";
|
|
||||||
str += URLEncoder.encode(en.getKey(), "UTF-8") + "=" + URLEncoder.encode(en.getValue(), "UTF-8");
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NetRequest request() {
|
public NetRequest request() {
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
@@ -75,6 +65,16 @@ public final class NetCall {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String constructArgs(Map<String, String> args) throws UnsupportedEncodingException {
|
||||||
|
args = new TreeMap<>(args);
|
||||||
|
String str = "";
|
||||||
|
for (Map.Entry<String, String> en : args.entrySet()) {
|
||||||
|
if (!str.isEmpty()) str += "&";
|
||||||
|
str += URLEncoder.encode(en.getKey(), "UTF-8") + "=" + URLEncoder.encode(en.getValue(), "UTF-8");
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
public void enqueue(NetCallback cb) {
|
public void enqueue(NetCallback cb) {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,39 +5,9 @@ import java.net.Proxy;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class NetClient {
|
public class NetClient {
|
||||||
private final long timeout;
|
private long timeout;
|
||||||
private final Proxy proxy;
|
private Proxy proxy;
|
||||||
private final PasswordAuthentication authenticator;
|
private PasswordAuthentication authenticator;
|
||||||
|
|
||||||
protected NetClient(Builder b) {
|
|
||||||
timeout = b.timeout;
|
|
||||||
proxy = b.proxy;
|
|
||||||
authenticator = b.auth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Builder newBuilder() {
|
|
||||||
Builder b = new Builder();
|
|
||||||
b.timeout = timeout;
|
|
||||||
b.proxy = proxy;
|
|
||||||
b.auth = authenticator;
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NetCall newCall(NetRequest req) {
|
|
||||||
return new NetCall(this, req);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PasswordAuthentication getAuthenticator() {
|
|
||||||
return authenticator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Proxy getProxy() {
|
|
||||||
return proxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTimeout() {
|
|
||||||
return timeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private long timeout;
|
private long timeout;
|
||||||
@@ -84,4 +54,34 @@ public class NetClient {
|
|||||||
return new NetClient(this);
|
return new NetClient(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder newBuilder() {
|
||||||
|
Builder b = new Builder();
|
||||||
|
b.timeout = timeout;
|
||||||
|
b.proxy = proxy;
|
||||||
|
b.auth = authenticator;
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected NetClient(Builder b) {
|
||||||
|
timeout = b.timeout;
|
||||||
|
proxy = b.proxy;
|
||||||
|
authenticator = b.auth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NetCall newCall(NetRequest req) {
|
||||||
|
return new NetCall(this, req);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PasswordAuthentication getAuthenticator() {
|
||||||
|
return authenticator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Proxy getProxy() {
|
||||||
|
return proxy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimeout() {
|
||||||
|
return timeout;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,27 +4,9 @@ import java.util.Map;
|
|||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public class NetRequest {
|
public class NetRequest {
|
||||||
private final String url;
|
private String url;
|
||||||
private final String requestMethod;
|
private String requestMethod;
|
||||||
private final Map<String, String> params;
|
private Map<String, String> params;
|
||||||
|
|
||||||
protected NetRequest(Builder b) {
|
|
||||||
url = b.url;
|
|
||||||
requestMethod = b.req;
|
|
||||||
params = b.params;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getRequestParams() {
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String url() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRequestMethod() {
|
|
||||||
return requestMethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private String url;
|
private String url;
|
||||||
@@ -61,4 +43,22 @@ public class NetRequest {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected NetRequest(Builder b) {
|
||||||
|
url = b.url;
|
||||||
|
requestMethod = b.req;
|
||||||
|
params = b.params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getRequestParams() {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String url() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRequestMethod() {
|
||||||
|
return requestMethod;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.io.InputStream;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
public final class NetResponse {
|
public final class NetResponse {
|
||||||
private final byte[] data;
|
private byte[] data;
|
||||||
private int code;
|
private int code;
|
||||||
|
|
||||||
protected NetResponse(byte[] data) {
|
protected NetResponse(byte[] data) {
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package ru.vtosters.lite.audio.gcm;
|
package ru.vtosters.lite.audio.gcm;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.VKVersion;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.VKVersionBuild;
|
|
||||||
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
|
|
||||||
@@ -29,11 +26,16 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
import javax.net.ssl.HttpsURLConnection;
|
import javax.net.ssl.HttpsURLConnection;
|
||||||
|
|
||||||
public class GCMFix {
|
public class GCMFix {
|
||||||
|
private static String agent = String.format("Android-GCM/1.5 (%s %s)", Build.MODEL, Build.MODEL);
|
||||||
public static ArrayList<String> langs = new ArrayList<>();
|
public static ArrayList<String> langs = new ArrayList<>();
|
||||||
private static final String agent = String.format("Android-GCM/1.5 (%s %s)", Build.MODEL, Build.MODEL);
|
|
||||||
private static KeyPair pair;
|
private static KeyPair pair;
|
||||||
private static int rid = 0;
|
private static int rid = 0;
|
||||||
|
|
||||||
|
/* access modifiers changed from: private */
|
||||||
|
public interface Callback {
|
||||||
|
void doCallback(String str);
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
genNewKey();
|
genNewKey();
|
||||||
}
|
}
|
||||||
@@ -93,12 +95,12 @@ public class GCMFix {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lambdaRequestToken(StringBuilder sb, AtomicBoolean wait, String s) {
|
static /* synthetic */ void lambdaRequestToken(StringBuilder sb, AtomicBoolean wait, String s) {
|
||||||
sb.append(s.substring(20));
|
sb.append(s.substring(20));
|
||||||
wait.set(true);
|
wait.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lambda$requestToken$1(String str) {
|
static /* synthetic */ void lambda$requestToken$1(String str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fillParams(List<String> params, String sig, String pub2, String xappid, long androidId, boolean del) {
|
private static void fillParams(List<String> params, String sig, String pub2, String xappid, long androidId, boolean del) {
|
||||||
@@ -111,7 +113,7 @@ public class GCMFix {
|
|||||||
params.add("X-X-subscription=841415684880");
|
params.add("X-X-subscription=841415684880");
|
||||||
}
|
}
|
||||||
params.add("X-X-subtype=841415684880");
|
params.add("X-X-subtype=841415684880");
|
||||||
params.add("X-app_ver=" + VKVersionBuild());
|
params.add("X-app_ver=3439");
|
||||||
params.add("X-kid=|ID|" + rid + "|");
|
params.add("X-kid=|ID|" + rid + "|");
|
||||||
params.add("X-osv=30");
|
params.add("X-osv=30");
|
||||||
params.add("X-sig=" + sig);
|
params.add("X-sig=" + sig);
|
||||||
@@ -132,12 +134,12 @@ public class GCMFix {
|
|||||||
if (!del) {
|
if (!del) {
|
||||||
params.add("X-gmp_app_id=1:841415684880:android:632f429381141121");
|
params.add("X-gmp_app_id=1:841415684880:android:632f429381141121");
|
||||||
}
|
}
|
||||||
params.add("X-app_ver_name=" + VKVersion());
|
params.add("X-app_ver_name=5.29");
|
||||||
params.add("app=com.vkontakte.android");
|
params.add("app=com.vkontakte.android");
|
||||||
params.add("sender=841415684880");
|
params.add("sender=841415684880");
|
||||||
params.add("device=" + androidId);
|
params.add("device=" + androidId);
|
||||||
params.add("cert=48761eef50ee53afc4cc9c5f10e6bde7f8f5b82f");
|
params.add("cert=48761eef50ee53afc4cc9c5f10e6bde7f8f5b82f");
|
||||||
params.add("app_ver=" + VKVersionBuild());
|
params.add("app_ver=3439");
|
||||||
params.add("gcm_ver=11949470");
|
params.add("gcm_ver=11949470");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,8 +196,4 @@ public class GCMFix {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Callback {
|
|
||||||
void doCallback(String str);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package ru.vtosters.lite.deviceinfo;
|
package ru.vtosters.lite.badmanners;
|
||||||
|
|
||||||
public class Device {
|
public class Device {
|
||||||
private String androidId;
|
private String androidId;
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
package ru.vtosters.lite.deviceinfo;
|
package ru.vtosters.lite.badmanners;
|
||||||
|
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -164,7 +164,7 @@ public class DeviceInfoCollector {
|
|||||||
declaredField.setAccessible(true);
|
declaredField.setAccessible(true);
|
||||||
Object obj = declaredField.get(defaultAdapter);
|
Object obj = declaredField.get(defaultAdapter);
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
return (String) obj.getClass().getMethod("getAddress").invoke(obj, new Object[0]);
|
return (String) obj.getClass().getMethod("getAddress", new Class[0]).invoke(obj, new Object[0]);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -1,10 +1,6 @@
|
|||||||
package ru.vtosters.lite.dnr;
|
package ru.vtosters.lite.dnr;
|
||||||
|
|
||||||
import static ru.vtosters.lite.dnr.DNRModule.hookDNR;
|
import android.util.Log;
|
||||||
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;
|
||||||
@@ -12,17 +8,19 @@ 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();
|
||||||
|
|
||||||
if (isDnrEnabledFor(peerId)) {
|
if (DNRModule.isDnrEnabledFor(peerId)) {
|
||||||
list.add(DialogAction.valueOf("DNR_OFF"));
|
list.add(DialogAction.valueOf("DNR_OFF"));
|
||||||
} else {
|
} else {
|
||||||
list.add(DialogAction.valueOf("DNR_ON"));
|
list.add(DialogAction.valueOf("DNR_ON"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDntEnabledFor(peerId)) {
|
if (DNRModule.isDntEnabledFor(peerId)) {
|
||||||
list.add(DialogAction.valueOf("DNT_OFF"));
|
list.add(DialogAction.valueOf("DNT_OFF"));
|
||||||
} else {
|
} else {
|
||||||
list.add(DialogAction.valueOf("DNT_ON"));
|
list.add(DialogAction.valueOf("DNT_ON"));
|
||||||
@@ -30,10 +28,10 @@ public class DNRInjector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static LinkedHashMap<DialogAction, Integer> injectToHashMap(LinkedHashMap<DialogAction, Integer> hashMap) {
|
public static LinkedHashMap<DialogAction, Integer> injectToHashMap(LinkedHashMap<DialogAction, Integer> hashMap) {
|
||||||
hashMap.put(DialogAction.valueOf("DNR_ON"), getIdentifier("DNR_ON", "string"));
|
hashMap.put(DialogAction.valueOf("DNR_ON"), Helper.getIdentifier("DNR_ON", "string"));
|
||||||
hashMap.put(DialogAction.valueOf("DNR_OFF"), getIdentifier("DNR_OFF", "string"));
|
hashMap.put(DialogAction.valueOf("DNR_OFF"), Helper.getIdentifier("DNR_OFF", "string"));
|
||||||
hashMap.put(DialogAction.valueOf("DNT_ON"), getIdentifier("DNT_ON", "string"));
|
hashMap.put(DialogAction.valueOf("DNT_ON"), Helper.getIdentifier("DNT_ON", "string"));
|
||||||
hashMap.put(DialogAction.valueOf("DNT_OFF"), getIdentifier("DNT_OFF", "string"));
|
hashMap.put(DialogAction.valueOf("DNT_OFF"), Helper.getIdentifier("DNT_OFF", "string"));
|
||||||
return hashMap;
|
return hashMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,11 +58,11 @@ public class DNRInjector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setDnr(Dialog dialog, boolean value) {
|
public static void setDnr(Dialog dialog, boolean value) {
|
||||||
hookDNR(dialog.a());
|
DNRModule.hookDNR(dialog.a());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setDnt(Dialog dialog, boolean value) {
|
public static void setDnt(Dialog dialog, boolean value) {
|
||||||
hookDNT(dialog.a());
|
DNRModule.hookDNT(dialog.a());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package ru.vtosters.lite.dnr;
|
package ru.vtosters.lite.dnr;
|
||||||
|
|
||||||
import static ru.f0x1d.net.F0x1dRequest.makeRequest;
|
import android.util.Log;
|
||||||
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
|
||||||
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,13 +8,15 @@ 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();
|
||||||
public static DoNotTypeDBHelper mDoNotTypeDBHelper = new DoNotTypeDBHelper();
|
public static DoNotTypeDBHelper mDoNotTypeDBHelper = new DoNotTypeDBHelper();
|
||||||
public static Dialog mDialog;
|
|
||||||
|
|
||||||
public static boolean isDnrEnabledFor(int id) {
|
public static boolean isDnrEnabledFor(int id) {
|
||||||
var isEnabled = mDoNotReadDBHelper.isEnabledForPeerId(id);
|
var isEnabled = mDoNotReadDBHelper.isEnabledForPeerId(id);
|
||||||
@@ -51,11 +51,13 @@ 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 -> {
|
F0x1dRequest.makeRequest("https://" + Proxy.getApiCom() + "/method/messages.markAsRead?start_message_id=" + dialog.lastMsgVkId + "&peer_id=" + dialog.a() + "&v=5.91&access_token=" + Helper.GetUserToken(), response -> {
|
||||||
ToastUtils.a("Чат помечен как прочитанный!");
|
ToastUtils.a("Чат помечен как прочитанный!");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Dialog mDialog;
|
||||||
|
|
||||||
public static void hookDNR(int peerId) {
|
public static void hookDNR(int peerId) {
|
||||||
mDoNotReadDBHelper.setEnabledForPeerId(peerId, !mDoNotReadDBHelper.isEnabledForPeerId(peerId));
|
mDoNotReadDBHelper.setEnabledForPeerId(peerId, !mDoNotReadDBHelper.isEnabledForPeerId(peerId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
package ru.vtosters.lite.dnr;
|
package ru.vtosters.lite.dnr;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.BooleanFalse;
|
import ru.vtosters.lite.utils.Prefs;
|
||||||
|
|
||||||
|
// Настройки Донецкой Народной Республики
|
||||||
public class DNRPrefs {
|
public class DNRPrefs {
|
||||||
public static boolean getStoriesRead() {
|
public static boolean getStoriesRead() {
|
||||||
return BooleanFalse("read_s");
|
return Prefs.BooleanFalse("read_s");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getMarkAsReadWithoutExceptions(int peerId) {
|
public static boolean getMarkAsReadWithoutExceptions(int peerId) {
|
||||||
@@ -28,27 +29,27 @@ public class DNRPrefs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean readPM(int peer) {
|
public static boolean readPM(int peer) {
|
||||||
return (peer > 0 && peer < 2000000000) && BooleanFalse("read_pm");
|
return (peer > 0 && peer < 2000000000) && Prefs.BooleanFalse("read_pm");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean readConversations(int peer) {
|
public static boolean readConversations(int peer) {
|
||||||
return (peer > 2000000000) && BooleanFalse("read_conversations");
|
return (peer > 2000000000) && Prefs.BooleanFalse("read_conversations");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean readBots(int peer) {
|
public static boolean readBots(int peer) {
|
||||||
return (peer < 0) && BooleanFalse("read_bot");
|
return (peer < 0) && Prefs.BooleanFalse("read_bot");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean writePM(int peer) {
|
public static boolean writePM(int peer) {
|
||||||
return (peer > 0 && peer < 2000000000) && BooleanFalse("write_pm");
|
return (peer > 0 && peer < 2000000000) && Prefs.BooleanFalse("write_pm");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean writeConversations(int peer) {
|
public static boolean writeConversations(int peer) {
|
||||||
return (peer > 2000000000) && BooleanFalse("write_conversations");
|
return (peer > 2000000000) && Prefs.BooleanFalse("write_conversations");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean writeBots(int peer) {
|
public static boolean writeBots(int peer) {
|
||||||
return (peer < 0) && BooleanFalse("write_bot");
|
return (peer < 0) && Prefs.BooleanFalse("write_bot");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getActivityWithoutExceptions(int peerId) {
|
public static boolean getActivityWithoutExceptions(int peerId) {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
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;
|
||||||
@@ -11,10 +9,11 @@ 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(Helper.GetContext(), "dnr", null, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
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;
|
||||||
@@ -11,10 +9,11 @@ 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(getContext(), "dnt", null, 1);
|
super(Helper.GetContext(), "dnt", null, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import ru.vtosters.lite.R;
|
||||||
|
|
||||||
public class VideoDownloader {
|
public class VideoDownloader {
|
||||||
public static void downloadVideo(VideoFile videoFile, Context context) {
|
public static void downloadVideo(VideoFile videoFile, Context context) {
|
||||||
final List<String> list = new ArrayList<>();
|
final List<String> list = new ArrayList<>();
|
||||||
@@ -64,7 +66,7 @@ public class VideoDownloader {
|
|||||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||||
request.setTitle(videoFile.toString());
|
request.setTitle(videoFile.toString());
|
||||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile + ".mp4");
|
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile.s + ".mp4");
|
||||||
((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
||||||
}));
|
}));
|
||||||
builder.show();
|
builder.show();
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
package ru.vtosters.lite.encryption;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
import android.util.Pair;
|
|
||||||
|
|
||||||
import com.vk.im.engine.models.messages.Msg;
|
|
||||||
import com.vk.im.engine.models.messages.MsgFromUser;
|
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ru.vtosters.lite.encryption.base.IMProcessor;
|
|
||||||
import ru.vtosters.lite.encryption.processors.BeeCryptProcessor;
|
|
||||||
import ru.vtosters.lite.encryption.processors.DefaultCoffeeProcessor;
|
|
||||||
import ru.vtosters.lite.encryption.processors.DonateCoffeeProcessor;
|
|
||||||
import ru.vtosters.lite.encryption.processors.MP3InvisibleProcessor;
|
|
||||||
import ru.vtosters.lite.encryption.processors.VTostersAESProcessor;
|
|
||||||
import ru.vtosters.lite.encryption.processors.VTostersProcessor;
|
|
||||||
|
|
||||||
public class EncryptProvider {
|
|
||||||
public static List<IMProcessor> processors = new ArrayList<>();
|
|
||||||
|
|
||||||
public static IMProcessor getProcessorFor(int peerId) {
|
|
||||||
IMProcessor enabled = null;
|
|
||||||
for (IMProcessor processor: EncryptProvider.processors) {
|
|
||||||
if (processor.isUsedToEncrypt(peerId)) {
|
|
||||||
enabled = processor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getBody(MsgFromUser msg) {
|
|
||||||
return msg.E();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getPeerId(Msg msg) {
|
|
||||||
return msg.b();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This will run through EVERY single processor available.
|
|
||||||
public static String decryptMessage(MsgFromUser msg) {
|
|
||||||
return decryptMessage(getBody(msg), getPeerId(msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String decryptMessage(String msgBody, int peer) {
|
|
||||||
try {
|
|
||||||
for (IMProcessor processor : processors) {
|
|
||||||
if ((processor.isUsed() || !processor.isPublic()) && processor.isEncrypted(msgBody) && (processor.isPublic() || getKeyForProcessor(processor, peer) != null))
|
|
||||||
return "\uD83D\uDD12 " + processor.decode(msgBody, getKeyForProcessor(processor, peer));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return msgBody;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] getKeyForProcessor(IMProcessor processor, int peer) {
|
|
||||||
if (processor.isPublic()) return null;
|
|
||||||
String keyString = processor.getEncryptionKeyFor(peer);
|
|
||||||
if (keyString == null) return null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
|
||||||
byte[] hash = digest.digest(keyString.getBytes());
|
|
||||||
byte[] key = new byte[16];
|
|
||||||
System.arraycopy(hash, 0, key, 0, key.length);
|
|
||||||
return key;
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return keyString.getBytes();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This will use only the processor which was chosen in chat menu [that's why ID is needed, bruh]
|
|
||||||
public static String encryptMessage(MsgFromUser msg) {
|
|
||||||
|
|
||||||
String msgBody = getBody(msg);
|
|
||||||
|
|
||||||
Log.d("EncryptProvider", "encryptMessage: msg = " + msg.toString());
|
|
||||||
Log.d("EncryptProvider", "encryptMessage: body = " + msgBody);
|
|
||||||
Log.d("EncryptProvider", "encryptMessage: peerId = " + getPeerId(msg));
|
|
||||||
|
|
||||||
for (IMProcessor processor: processors) {
|
|
||||||
int peer = getPeerId(msg);
|
|
||||||
if (processor.isUsedToEncrypt(peer)) {
|
|
||||||
return processor.encode(msgBody, getKeyForProcessor(processor, peer));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return msgBody;
|
|
||||||
}
|
|
||||||
|
|
||||||
// For rendering UI
|
|
||||||
public static List<Pair<String, String>> getUserVisibleEncoders() {
|
|
||||||
List<Pair<String, String>> theList = new ArrayList<>();
|
|
||||||
|
|
||||||
for (IMProcessor processor: processors) {
|
|
||||||
if (processor.isPublic()) theList.add(new Pair<>("VT_IMDecode_"+processor.getPrefKey(), processor.getUIName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return theList;
|
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
processors.add(new VTostersProcessor());
|
|
||||||
processors.add(new VTostersAESProcessor());
|
|
||||||
processors.add(new DefaultCoffeeProcessor());
|
|
||||||
processors.add(new DonateCoffeeProcessor());
|
|
||||||
processors.add(new BeeCryptProcessor());
|
|
||||||
processors.add(new MP3InvisibleProcessor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
package ru.vtosters.lite.encryption.base;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.BooleanFalse;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.BooleanTrue;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import ru.vtosters.lite.utils.Globals;
|
|
||||||
|
|
||||||
public abstract class IMProcessor {
|
|
||||||
// By default it checks start and end tag.
|
|
||||||
public boolean isEncrypted(String source) {
|
|
||||||
//Log.d("IMProcessor", "Checking if encrypted: "+source+" / "+getUIName());
|
|
||||||
return source.startsWith(startTag()) && source.endsWith(endTag());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Key can be null - if it's a public processor
|
|
||||||
@NonNull protected abstract String encodeInternal(@NonNull String source, @Nullable byte[] key);
|
|
||||||
@NonNull protected abstract String decodeInternal(@NonNull String source, @Nullable byte[] key);
|
|
||||||
|
|
||||||
// Automatically removes tags. Magic!
|
|
||||||
@NonNull
|
|
||||||
public String encode(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
//Log.d("IMProcessor", "Encoding "+source);
|
|
||||||
return startTag() + encodeInternal(source, key) + endTag();
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
public String decode(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
//Log.d("IMProcessor", "Decoding");
|
|
||||||
return decodeInternal(source.substring(startTag().length(), source.length() - endTag().length()), key);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Public - no key required.
|
|
||||||
public boolean isPublic() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// UI thing
|
|
||||||
@NonNull abstract public String getUIName();
|
|
||||||
@NonNull abstract public String getPrefKey();
|
|
||||||
|
|
||||||
@NonNull public String startTag() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
@NonNull public String endTag() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isUsed() {
|
|
||||||
//Log.d("IMProcessor", "Checking if decoded with "+getUIName());
|
|
||||||
return BooleanTrue("VT_IMDecode_"+getPrefKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isUsedToEncrypt(int id) {
|
|
||||||
//Log.d("IMProcessor", "Checking if "+id+" is ready to be encrypted with "+getUIName());
|
|
||||||
return BooleanFalse("VT_IMEncode_"+getPrefKey()+"_"+id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void enableEncryptFor(int id) {
|
|
||||||
Globals.getPrefs().edit().putBoolean("VT_IMEncode_"+getPrefKey()+"_"+id, true).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void disableEncryptFor(int id) {
|
|
||||||
Globals.getPrefs().edit().putBoolean("VT_IMEncode_"+getPrefKey()+"_"+id, false).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEncryptionKeyFor(int id, @Nullable String key) {
|
|
||||||
if (key == null || key.isEmpty()) key = "VTAesDefault";
|
|
||||||
Globals.getPrefs().edit().putString("VT_IMEncodeKey_"+getPrefKey()+"_"+id, key).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public String getEncryptionKeyFor(int id) {
|
|
||||||
return Globals.getPrefs().getString("VT_IMEncodeKey_"+getPrefKey()+"_"+id, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
package ru.vtosters.lite.encryption.processors;
|
|
||||||
|
|
||||||
import android.util.Base64;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
import ru.vtosters.lite.encryption.base.IMProcessor;
|
|
||||||
|
|
||||||
public class BeeCryptProcessor extends IMProcessor {
|
|
||||||
private static final String BC_CHARSET = "жъЖЪ";
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected String encodeInternal(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
try {
|
|
||||||
String a = Base64.encodeToString(source.getBytes(StandardCharsets.UTF_8), 2);
|
|
||||||
StringBuilder res = new StringBuilder();
|
|
||||||
for (int i = 0; i < a.length(); i++) {
|
|
||||||
StringBuilder bintxt = new StringBuilder();
|
|
||||||
int c = a.charAt(i);
|
|
||||||
for (int j = 0; j < 4; j++) {
|
|
||||||
bintxt.insert(0, BC_CHARSET.charAt(c % 4));
|
|
||||||
c /= 4;
|
|
||||||
}
|
|
||||||
res.append(bintxt);
|
|
||||||
}
|
|
||||||
return res.toString();
|
|
||||||
} catch (java.lang.Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEncrypted(String source) {
|
|
||||||
return source.matches("[жъЖЪ]{16,}");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected String decodeInternal(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
StringBuilder b64 = new StringBuilder();
|
|
||||||
int i = 0;
|
|
||||||
while (i < source.length() - 3) {
|
|
||||||
try {
|
|
||||||
String bintxt = source.substring(i, i + 4);
|
|
||||||
int c = 0;
|
|
||||||
for (int j = 0; j < 4; j++) {
|
|
||||||
c = (c * 4) + Math.max(0, BC_CHARSET.indexOf(bintxt.charAt(j)));
|
|
||||||
}
|
|
||||||
b64.append((char) c);
|
|
||||||
i += 4;
|
|
||||||
} catch (java.lang.Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new String(Base64.decode(b64.toString(), 2), StandardCharsets.UTF_8);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getUIName() {
|
|
||||||
return "MP3 [beecrypt]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getPrefKey() {
|
|
||||||
return "mp3_bc";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
package ru.vtosters.lite.encryption.processors;
|
|
||||||
|
|
||||||
import android.util.Base64;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
|
||||||
|
|
||||||
import ru.vtosters.lite.encryption.base.IMProcessor;
|
|
||||||
|
|
||||||
public class DefaultCoffeeProcessor extends IMProcessor {
|
|
||||||
private final static String KEY = "stupidUsersMustD";
|
|
||||||
private static Cipher dCipher, eCipher;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
SecretKeySpec key = new SecretKeySpec(KEY.getBytes(), "AES");
|
|
||||||
|
|
||||||
dCipher = Cipher.getInstance("AES");
|
|
||||||
dCipher.init(Cipher.DECRYPT_MODE, key);
|
|
||||||
|
|
||||||
eCipher = Cipher.getInstance("AES");
|
|
||||||
eCipher.init(Cipher.ENCRYPT_MODE, key);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String toHex(String text) {
|
|
||||||
char[] chars = text.toCharArray();
|
|
||||||
StringBuilder str = new StringBuilder();
|
|
||||||
for (char aChar : chars) {
|
|
||||||
String s = Integer.toHexString(aChar);
|
|
||||||
if (s.length() < 2) s = "0" + s;
|
|
||||||
str.append(s.toUpperCase()).append(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
String string = str.toString();
|
|
||||||
return string.substring(0, string.length()-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String fromHex(String text) {
|
|
||||||
text = text.replace(" ", "");
|
|
||||||
char[] chars = text.toCharArray();
|
|
||||||
char[] chars2 = new char[chars.length/2];
|
|
||||||
for (int i = 0; i < chars.length; i+=2) {
|
|
||||||
String c = String.valueOf(chars[i]) + chars[i + 1];
|
|
||||||
chars2[i/2] = (char) Integer.parseInt(c, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new String(chars2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected String encodeInternal(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
try {
|
|
||||||
return toHex(Base64.encodeToString(eCipher.doFinal(source.getBytes()), 0));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected String decodeInternal(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
try {
|
|
||||||
return new String(dCipher.doFinal(Base64.decode(fromHex(source), 0)));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NonNull
|
|
||||||
public String startTag() {
|
|
||||||
return "VK CO FF EE ";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NonNull
|
|
||||||
public String endTag() {
|
|
||||||
return " VK CO FF EE";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getUIName() {
|
|
||||||
return "VK Coffee [default]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getPrefKey() {
|
|
||||||
return "coffee_default";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package ru.vtosters.lite.encryption.processors;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
public class DonateCoffeeProcessor extends DefaultCoffeeProcessor {
|
|
||||||
@Override
|
|
||||||
@NonNull
|
|
||||||
public String startTag() {
|
|
||||||
return "II ";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NonNull
|
|
||||||
public String endTag() {
|
|
||||||
return " II";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getUIName() {
|
|
||||||
return "VK Coffee [hidden]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getPrefKey() {
|
|
||||||
return "coffee_donate";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
package ru.vtosters.lite.encryption.processors;
|
|
||||||
|
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
import ru.vtosters.lite.encryption.base.IMProcessor;
|
|
||||||
|
|
||||||
public class MP3InvisibleProcessor extends IMProcessor {
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected String encodeInternal(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
try {
|
|
||||||
byte[] bytes = source.getBytes(StandardCharsets.UTF_8);
|
|
||||||
java.lang.String[] plainText = new String[bytes.length];
|
|
||||||
for (int i = 0; i < plainText.length; i++) {
|
|
||||||
plainText[i] = toStr(bytes[i] & 255, " ");
|
|
||||||
}
|
|
||||||
return " " + TextUtils.join(" ", plainText);
|
|
||||||
} catch (java.lang.Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected String decodeInternal(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
try {
|
|
||||||
java.lang.String[] t = source.replaceAll("^" + " ", "").split(" ");
|
|
||||||
byte[] plainText = new byte[t.length];
|
|
||||||
for (int i = 0; i < plainText.length; i++) {
|
|
||||||
plainText[i] = (byte) toNum(t[i], " ");
|
|
||||||
}
|
|
||||||
return new String(plainText, StandardCharsets.UTF_8);
|
|
||||||
} catch (java.lang.Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String toStr(int a, String cc) {
|
|
||||||
StringBuilder s = new StringBuilder();
|
|
||||||
while (a > 0) {
|
|
||||||
s.insert(0, cc.charAt(a % cc.length()));
|
|
||||||
a /= cc.length();
|
|
||||||
}
|
|
||||||
return s.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int toNum(String a, String cc) {
|
|
||||||
int n = 0;
|
|
||||||
for (int i = 0; i < a.length(); i++) {
|
|
||||||
int start = (a.length() - i) - 1;
|
|
||||||
n = (int) (((double) n) + (((double) cc.indexOf(a.substring(start, start + 1))) * Math.pow(cc.length(), i)));
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEncrypted(String source) {
|
|
||||||
return source.matches("^" + " " + "([" + " " + "\\s]*)");
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getUIName() {
|
|
||||||
return "MP3 [invisible]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getPrefKey() {
|
|
||||||
return "mp3";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
package ru.vtosters.lite.encryption.processors;
|
|
||||||
|
|
||||||
import android.util.Base64;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
|
||||||
import java.security.InvalidKeyException;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
|
||||||
import javax.crypto.NoSuchPaddingException;
|
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
|
||||||
|
|
||||||
import ru.vtosters.lite.encryption.base.IMProcessor;
|
|
||||||
import ru.vtosters.lite.utils.Globals;
|
|
||||||
|
|
||||||
public class VTostersAESProcessor extends IMProcessor {
|
|
||||||
private final static String CIPHER_INSTANCE = "AES/CBC/PKCS7Padding";
|
|
||||||
private final static String KEY_METHOD = "AES";
|
|
||||||
|
|
||||||
private HashMap<byte[], Cipher> decodeMap = new HashMap<>(), encodeMap = new HashMap<>();
|
|
||||||
|
|
||||||
public void free(byte[] key) {
|
|
||||||
decodeMap.remove(key);
|
|
||||||
encodeMap.remove(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
private Cipher wrapEncoder(byte[] key) throws InvalidAlgorithmParameterException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException {
|
|
||||||
if (encodeMap.containsKey(key)) return encodeMap.get(key);
|
|
||||||
|
|
||||||
Triple<Cipher, SecretKeySpec, IvParameterSpec> encodeCipher = getBaseCipher(key);
|
|
||||||
encodeCipher.first.init(Cipher.ENCRYPT_MODE, encodeCipher.second, encodeCipher.third);
|
|
||||||
encodeMap.put(key, encodeCipher.first);
|
|
||||||
|
|
||||||
return encodeCipher.first;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
private Cipher wrapDecoder(byte[] key) throws InvalidAlgorithmParameterException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException {
|
|
||||||
if (decodeMap.containsKey(key)) return decodeMap.get(key);
|
|
||||||
|
|
||||||
Triple<Cipher, SecretKeySpec, IvParameterSpec> decodeCipher = getBaseCipher(key);
|
|
||||||
decodeCipher.first.init(Cipher.DECRYPT_MODE, decodeCipher.second, decodeCipher.third);
|
|
||||||
decodeMap.put(key, decodeCipher.first);
|
|
||||||
|
|
||||||
return decodeCipher.first;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
private Triple<Cipher, SecretKeySpec, IvParameterSpec> getBaseCipher(byte[] key) throws NoSuchPaddingException, NoSuchAlgorithmException {
|
|
||||||
byte[] off = new byte[16];
|
|
||||||
System.arraycopy(key, 0, off, 0, off.length);
|
|
||||||
return new Triple<>(Cipher.getInstance(CIPHER_INSTANCE), new SecretKeySpec(key, KEY_METHOD), new IvParameterSpec(off));
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected String encodeInternal(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
try {
|
|
||||||
return Base64.encodeToString(wrapEncoder(key).doFinal(source.getBytes(StandardCharsets.UTF_8)), Base64.DEFAULT);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected String decodeInternal(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
try {
|
|
||||||
return new String(wrapDecoder(key).doFinal(Base64.decode(source, Base64.DEFAULT)), StandardCharsets.UTF_8);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPublic() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String startTag() {
|
|
||||||
return "VT0ST3RS [AES] ";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String endTag() {
|
|
||||||
return " VT0ST3RS [AES]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getUIName() {
|
|
||||||
return "VTosters [AES]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getPrefKey() {
|
|
||||||
return "vtaes";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public String getEncryptionKeyFor(int id) {
|
|
||||||
return Globals.getPrefs().getString("VT_IMEncodeKey_"+getPrefKey()+"_"+id, "VTAesDefault");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Triple<F, S, T> {
|
|
||||||
public final F first;
|
|
||||||
public final S second;
|
|
||||||
public final T third;
|
|
||||||
|
|
||||||
public Triple(F first, S second, T third) {
|
|
||||||
this.first = first;
|
|
||||||
this.second = second;
|
|
||||||
this.third = third;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
package ru.vtosters.lite.encryption.processors;
|
|
||||||
|
|
||||||
import android.util.Base64;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
|
|
||||||
import ru.vtosters.lite.encryption.base.IMProcessor;
|
|
||||||
|
|
||||||
public class VTostersProcessor extends IMProcessor {
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected String encodeInternal(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
return Base64.encodeToString(source.getBytes(), Base64.DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
protected String decodeInternal(@NonNull String source, @Nullable byte[] key) {
|
|
||||||
return new String(Base64.decode(source, Base64.DEFAULT));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NonNull
|
|
||||||
public String startTag() {
|
|
||||||
return "VT0ST3RS ";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@NonNull
|
|
||||||
public String endTag() {
|
|
||||||
return " VT0ST3RS";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getUIName() {
|
|
||||||
return "VTosters Classique [Base64]";
|
|
||||||
}
|
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Override
|
|
||||||
public String getPrefKey() {
|
|
||||||
return "vt64";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,5 @@
|
|||||||
package ru.vtosters.lite.f0x1d;
|
package ru.vtosters.lite.f0x1d;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.About.getBuildNumber;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
@@ -19,7 +16,9 @@ import com.vtosters.lite.R;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
import ru.vtosters.lite.deviceinfo.DeviceInfoCollector;
|
import ru.vtosters.lite.utils.Helper;
|
||||||
|
import ru.vtosters.lite.badmanners.DeviceInfoCollector;
|
||||||
|
import ru.vtosters.lite.utils.Prefs;
|
||||||
|
|
||||||
public class Crashreporter {
|
public class Crashreporter {
|
||||||
protected static String logString;
|
protected static String logString;
|
||||||
@@ -36,12 +35,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() + ", commit: " + getBuildNumber();
|
logString = getStackTrace(th) + "\n\n" + new DeviceInfoCollector().collect(Helper.GetContext()).toDeviceName() + "\n VTL Version: " + Prefs.VERSIONNAME + ", build: " + Prefs.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) Helper.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");
|
||||||
@@ -53,19 +52,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(Helper.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(Helper.GetContext(), 0, saveLogIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||||
|
|
||||||
var builder = new Notification.Builder(getContext());
|
var builder = new Notification.Builder(Helper.GetContext());
|
||||||
builder.setSmallIcon(R.drawable.ic_bug_24);
|
builder.setSmallIcon(R.drawable.ic_bug_24);
|
||||||
builder.setContentTitle("Произошла ошибка в работе VTLite!");
|
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(Helper.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));
|
||||||
@@ -76,13 +75,13 @@ public class Crashreporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(-2147483548, builder.build());
|
((NotificationManager) Helper.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 = Helper.GetContext().getPackageManager();
|
||||||
try {
|
try {
|
||||||
pm.getPackageInfo("com.f0x1d.dogbin", 0);
|
pm.getPackageInfo("com.f0x1d.dogbin", 0);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
package ru.vtosters.lite.f0x1d;
|
package ru.vtosters.lite.f0x1d;
|
||||||
|
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
|
||||||
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;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -11,6 +7,7 @@ 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,6 +16,8 @@ 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() {
|
||||||
}
|
}
|
||||||
@@ -39,12 +38,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();
|
Toast.makeText(Helper.GetContext(), "Не удалось сохранить лог-файл", Toast.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) Helper.GetContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
manager.cancel(notificationId);
|
manager.cancel(notificationId);
|
||||||
makeText(getContext(), "Лог-файл был сохранен", LENGTH_SHORT).show();
|
Toast.makeText(Helper.GetContext(), "Лог-файл был сохранен", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
stopSelf();
|
stopSelf();
|
||||||
return START_NOT_STICKY;
|
return START_NOT_STICKY;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
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;
|
||||||
@@ -11,14 +9,14 @@ import android.widget.Toast;
|
|||||||
import com.vk.dto.common.VerifyInfo;
|
import com.vk.dto.common.VerifyInfo;
|
||||||
import com.vk.navigation.NavigatorKeys;
|
import com.vk.navigation.NavigatorKeys;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import okhttp3.Call;
|
import okhttp3.Call;
|
||||||
import okhttp3.Callback;
|
import okhttp3.Callback;
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
@@ -26,19 +24,21 @@ 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<>();
|
|
||||||
private static final String TAG = "VTVerifications";
|
private static final String TAG = "VTVerifications";
|
||||||
private static final String DEVELOPERS_KEY = "VTNRS3";
|
private static final String DEVELOPERS_KEY = "VTNRS3";
|
||||||
private static final String PROMETHEUS_KEY = "VTNRS1";
|
private static final String PROMETHEUS_KEY = "VTNRS1";
|
||||||
private static final String SERVICE_ACCOUNTS_KEY = "VTNRS4";
|
private static final String SERVICE_ACCOUNTS_KEY = "VTNRS4";
|
||||||
private static final String VERIFICATIONS_KEY = "VTNRS0";
|
private static final String VERIFICATIONS_KEY = "VTNRS0";
|
||||||
|
private static SharedPreferences mVerificationsCache;
|
||||||
private static final HashMap<Integer, Boolean> sDevelopersMap = new HashMap<>();
|
private static final HashMap<Integer, Boolean> sDevelopersMap = new HashMap<>();
|
||||||
private static final HashMap<Integer, Boolean> sPrometheusMap = new HashMap<>();
|
private static final HashMap<Integer, Boolean> sPrometheusMap = new HashMap<>();
|
||||||
|
public static final HashMap<Integer, Boolean> sServiceAccountsMap = new HashMap<>();
|
||||||
private static final HashMap<Integer, Boolean> sVerificationsMap = new HashMap<>();
|
private static final HashMap<Integer, Boolean> sVerificationsMap = new HashMap<>();
|
||||||
private static SharedPreferences mVerificationsCache;
|
|
||||||
private static final OkHttpClient client = new OkHttpClient();
|
private static OkHttpClient client = new OkHttpClient();
|
||||||
|
|
||||||
public static void load(Context context) {
|
public static void load(Context context) {
|
||||||
mVerificationsCache = context.getSharedPreferences("vt_another_data", 0);
|
mVerificationsCache = context.getSharedPreferences("vt_another_data", 0);
|
||||||
@@ -136,24 +136,30 @@ public class VTVerifications {
|
|||||||
if (jSONObject.optInt("verified", 0) == 1) {
|
if (jSONObject.optInt("verified", 0) == 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!BooleanTrue("VT_Verification")) {
|
if (!Prefs.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));
|
if (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 true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasPrometheus(JSONObject jSONObject) {
|
public static boolean hasPrometheus(JSONObject jSONObject) {
|
||||||
if (jSONObject.optInt("trending", 0) == 1) {
|
if (jSONObject.optInt("trending", 0) == 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!BooleanTrue("VT_Fire")) {
|
if (!Prefs.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));
|
if (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 true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasDeveloper(JSONObject jSONObject) {
|
public static boolean hasDeveloper(JSONObject jSONObject) {
|
||||||
if (!BooleanTrue("VT_Dev")) {
|
if (!Prefs.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,19 +1,14 @@
|
|||||||
package ru.vtosters.lite.foaf;
|
package ru.vtosters.lite.foaf;
|
||||||
|
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
|
||||||
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.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;
|
||||||
|
|
||||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||||
import com.vtosters.lite.R;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
@@ -27,13 +22,17 @@ 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.Preferences;
|
|
||||||
|
import com.vtosters.lite.R;
|
||||||
|
|
||||||
|
import ru.vtosters.lite.utils.Helper;
|
||||||
|
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=\"(.+?)\"\\/>");
|
||||||
private static final Pattern FOAF_REGEX_LAST_SEEN = Pattern.compile("<ya:lastLoggedIn dc:date=\"(.*)(((\\+|-)\\d\\d):(\\d\\d))\"\\/>");
|
private static final Pattern FOAF_REGEX_LAST_SEEN = Pattern.compile("<ya:lastLoggedIn dc:date=\"(.*)(((\\+|-)\\d\\d):(\\d\\d))\"\\/>");
|
||||||
private static final Pattern FOAF_REGEX_LOGIN = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
private static final Pattern FOAF_REGEX_LOGIN = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||||
private static final OkHttpClient client = new OkHttpClient();
|
private static OkHttpClient client = new OkHttpClient();
|
||||||
|
|
||||||
public static int GetLastSeenInt(int i) throws ParseException, IOException {
|
public static int GetLastSeenInt(int i) throws ParseException, IOException {
|
||||||
Matcher matcher = FOAF_REGEX_LAST_SEEN.matcher(client.newCall(new Request.Builder().url(getLink(i)).build()).b().body().string());
|
Matcher matcher = FOAF_REGEX_LAST_SEEN.matcher(client.newCall(new Request.Builder().url(getLink(i)).build()).b().body().string());
|
||||||
@@ -50,9 +49,9 @@ public class FoafBase {
|
|||||||
private static String getLink(int i) {
|
private static String getLink(int i) {
|
||||||
String str;
|
String str;
|
||||||
StringBuilder sb;
|
StringBuilder sb;
|
||||||
if (proxy()) {
|
if (Prefs.proxy()) {
|
||||||
sb = new StringBuilder();
|
sb = new StringBuilder();
|
||||||
str = "https://" + getApiCom() + "/_/vk.com/foaf.php?id=";
|
str = "https://vk-api-proxy.xtrafrancyz.net/_/vk.com/foaf.php?id=";
|
||||||
} else {
|
} else {
|
||||||
sb = new StringBuilder();
|
sb = new StringBuilder();
|
||||||
str = "https://vk.com/foaf.php?id=";
|
str = "https://vk.com/foaf.php?id=";
|
||||||
@@ -72,7 +71,7 @@ public class FoafBase {
|
|||||||
F0x1dRequest.makeRequest(getLink(i), callback);
|
F0x1dRequest.makeRequest(getLink(i), callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lambdaLoadAndShow(ProgressDialog progressDialog, Context context, int i, String str) {
|
static /* synthetic */ void lambdaLoadAndShow(ProgressDialog progressDialog, Context context, int i, String str) {
|
||||||
try {
|
try {
|
||||||
progressDialog.cancel();
|
progressDialog.cancel();
|
||||||
Matcher matcher = FOAF_REGEX.matcher(str);
|
Matcher matcher = FOAF_REGEX.matcher(str);
|
||||||
@@ -82,10 +81,10 @@ public class FoafBase {
|
|||||||
String normalHumanDate = getNormalHumanDate(matcher.group(1));
|
String normalHumanDate = getNormalHumanDate(matcher.group(1));
|
||||||
getNormalHumanDate(matcher2.group(1));
|
getNormalHumanDate(matcher2.group(1));
|
||||||
AlertDialog.a a2 = new VkAlertDialog.a(context).a(R.string.addinf);
|
AlertDialog.a a2 = new VkAlertDialog.a(context).a(R.string.addinf);
|
||||||
a2.b(getString("foafid") + " " + i + getString("foafregdate") + " " + normalHumanDate + getString("foafdate") + " " + daysPassedFromFoafDate(normalHumanDate)).b(17039370, null).b().show();
|
a2.b(Helper.getString("foafid") + " " + i + Helper.getString("foafregdate") + " " + normalHumanDate + Helper.getString("foafdate") + " " + daysPassedFromFoafDate(normalHumanDate)).b(17039370, (DialogInterface.OnClickListener) null).b().show();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
makeText(context, getString("foaferr"), LENGTH_SHORT).show();
|
Toast.makeText(context, Helper.getString("foaferr"), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ package ru.vtosters.lite.provider;
|
|||||||
|
|
||||||
import android.support.v4.content.FileProvider;
|
import android.support.v4.content.FileProvider;
|
||||||
|
|
||||||
|
/* compiled from: VKFileProvider.kt */
|
||||||
public final class VKFileProvider extends FileProvider {
|
public final class VKFileProvider extends FileProvider {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
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;
|
||||||
|
|
||||||
public class TGPref {
|
import ru.vtosters.lite.utils.Helper;
|
||||||
private static final SharedPreferences Prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
||||||
|
|
||||||
private static final String CNCT_METHOD = "VTGS:CM";
|
public class TGPref {
|
||||||
private static final String TG_BOTKEY = "VTGS:BKey";
|
private static SharedPreferences Prefs = PreferenceManager.getDefaultSharedPreferences(Helper.GetContext());
|
||||||
private static final String TG_PROXYIP = "VTGS:PIP";
|
|
||||||
private static final String TG_PROXYPORT = "VTGS:PPT";
|
private static String
|
||||||
private static final String TG_PROXYPASS = "VTGS:PPS";
|
CNCT_METHOD = "VTGS:CM",
|
||||||
private static final String TG_PROXYUSER = "VTGS:PUS";
|
TG_BOTKEY = "VTGS:BKey",
|
||||||
private static final String TG_PROXYUSEPASS = "VTGS:PUsePassword";
|
TG_PROXYIP = "VTGS:PIP",
|
||||||
|
TG_PROXYPORT = "VTGS:PPT",
|
||||||
|
TG_PROXYPASS = "VTGS:PPS",
|
||||||
|
TG_PROXYUSER = "VTGS:PUS",
|
||||||
|
TG_PROXYUSEPASS = "VTGS:PUsePassword";
|
||||||
|
|
||||||
public static int getTGConnectMethod() {
|
public static int getTGConnectMethod() {
|
||||||
return Integer.parseInt(Prefs.getString(CNCT_METHOD, "0"));
|
return Integer.parseInt(Prefs.getString(CNCT_METHOD, "0"));
|
||||||
@@ -36,10 +37,6 @@ public class TGPref {
|
|||||||
return Prefs.getString(TG_PROXYIP, null);
|
return Prefs.getString(TG_PROXYIP, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTGProxyIP(String ip) {
|
|
||||||
Prefs.edit().putString(TG_PROXYIP, ip).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getTGProxyPort() {
|
public static int getTGProxyPort() {
|
||||||
return Prefs.getInt(TG_PROXYPORT, 0);
|
return Prefs.getInt(TG_PROXYPORT, 0);
|
||||||
}
|
}
|
||||||
@@ -56,8 +53,13 @@ public class TGPref {
|
|||||||
return Prefs.getString(TG_PROXYUSER, "");
|
return Prefs.getString(TG_PROXYUSER, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setTGProxyIP(String ip) {
|
||||||
|
Prefs.edit().putString(TG_PROXYIP, ip).apply();
|
||||||
|
}
|
||||||
|
|
||||||
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).apply();
|
Prefs.edit().putString(TG_PROXYUSER, user).putString(TG_PROXYPASS, pass)
|
||||||
|
.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTGProxyPassEnabled() {
|
public static boolean isTGProxyPassEnabled() {
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package ru.vtosters.lite.tgs;
|
package ru.vtosters.lite.tgs;
|
||||||
|
|
||||||
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;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.aefyr.tsg.g2.TelegramStickersPack;
|
import com.aefyr.tsg.g2.TelegramStickersPack;
|
||||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||||
@@ -23,20 +21,24 @@ 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 {
|
||||||
|
private final static Stack<Integer> pendingStickers = new Stack<>();
|
||||||
|
|
||||||
public static final int N = 76820000;
|
public static final int N = 76820000;
|
||||||
public static final int X = 976820000;
|
public static final int X = 976820000;
|
||||||
private final static Stack<Integer> pendingStickers = new Stack<>();
|
|
||||||
private static final String TAG = "TGRoot";
|
private static String TAG = "TGRoot";
|
||||||
|
|
||||||
public static String getSummary() {
|
public static String getSummary() {
|
||||||
switch (TGPref.getTGConnectMethod()) {
|
switch (TGPref.getTGConnectMethod()) {
|
||||||
case 0:
|
case 0:
|
||||||
return getString("ctypedirect");
|
return Helper.getString("ctypedirect");
|
||||||
case 2:
|
case 2:
|
||||||
return getString("ctypesocks");
|
return Helper.getString("ctypesocks");
|
||||||
default:
|
default:
|
||||||
return getString("ctypedisabled");
|
return Helper.getString("ctypedisabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +50,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(Helper.GetContext()).getActivePacksListReference()) {
|
||||||
if (p.index == index) {
|
if (p.index == index) {
|
||||||
pack = p;
|
pack = p;
|
||||||
break;
|
break;
|
||||||
@@ -69,7 +71,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(Helper.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) {
|
||||||
@@ -82,7 +84,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(Helper.GetContext())
|
||||||
.getActivePacksListReference()) {
|
.getActivePacksListReference()) {
|
||||||
if (p_.index == index) {
|
if (p_.index == index) {
|
||||||
p = p_;
|
p = p_;
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package ru.vtosters.lite.ui;
|
package ru.vtosters.lite.ui;
|
||||||
|
|
||||||
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;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
@@ -25,17 +22,22 @@ 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 {
|
||||||
|
|
||||||
|
public interface EditTextPrefChangeListener {
|
||||||
|
boolean onChanged(Preference preference, Object obj);
|
||||||
|
}
|
||||||
|
|
||||||
public static Drawable setTint(Context ctx, Drawable d) {
|
public static Drawable setTint(Context ctx, Drawable d) {
|
||||||
d.setColorFilter(Themes.getAccentColor(), PorterDuff.Mode.SRC_ATOP);
|
d.setColorFilter(Themes.getAccentColor(), PorterDuff.Mode.SRC_ATOP);
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
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(Helper.GetContext());
|
||||||
preference.a(entries);
|
preference.a(entries);
|
||||||
preference.b(entriesValue);
|
preference.b(entriesValue);
|
||||||
preference.c(title); // setTitle
|
preference.c(title); // setTitle
|
||||||
@@ -46,7 +48,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(Helper.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 +58,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(Helper.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 +66,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(Helper.GetContext(), ContextCompat.getDrawable(Helper.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(Helper.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 +80,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(Helper.GetContext(), getDrawable(Helper.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(Helper.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,64 +96,64 @@ 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(Helper.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(Helper.GetContext(), getDrawable(Helper.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(Helper.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(Helper.GetContext(), getDrawable(Helper.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(Helper.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(Helper.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(Helper.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(Helper.GetContext());
|
||||||
|
|
||||||
final EditText editText = new EditText(getContext());
|
final EditText editText = new EditText(Helper.GetContext());
|
||||||
editText.setText(PreferenceManager.getDefaultSharedPreferences(getContext()).getString(key, ""));
|
editText.setText(PreferenceManager.getDefaultSharedPreferences(Helper.GetContext()).getString(key, ""));
|
||||||
editText.setHint(title);
|
editText.setHint(title);
|
||||||
editText.setHintTextColor(PreferencesUtil.getSTextColor(getContext()));
|
editText.setHintTextColor(PreferencesUtil.getSTextColor(Helper.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(Helper.GetContext())));
|
||||||
} else {
|
} else {
|
||||||
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(getContext())));
|
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(Helper.GetContext())));
|
||||||
}
|
}
|
||||||
linearLayout.addView(editText);
|
linearLayout.addView(editText);
|
||||||
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) editText.getLayoutParams());
|
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) editText.getLayoutParams());
|
||||||
margin.setMargins(convertDpToPixel(24f), 0, convertDpToPixel(24f), 0);
|
margin.setMargins(Helper.convertDpToPixel(24f), 0, Helper.convertDpToPixel(24f), 0);
|
||||||
editText.setLayoutParams(margin);
|
editText.setLayoutParams(margin);
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.p());
|
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.p());
|
||||||
@@ -162,7 +164,7 @@ public class PreferencesUtil {
|
|||||||
if (!change)
|
if (!change)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PreferenceManager.getDefaultSharedPreferences(getContext())
|
PreferenceManager.getDefaultSharedPreferences(Helper.GetContext())
|
||||||
.edit()
|
.edit()
|
||||||
.putString(key, editText.getText().toString())
|
.putString(key, editText.getText().toString())
|
||||||
.apply();
|
.apply();
|
||||||
@@ -190,8 +192,4 @@ public class PreferencesUtil {
|
|||||||
var id = ctx.getResources().getIdentifier(name, "drawable", ctx.getPackageName());
|
var id = ctx.getResources().getIdentifier(name, "drawable", ctx.getPackageName());
|
||||||
return ContextCompat.getDrawable(ctx, id);
|
return ContextCompat.getDrawable(ctx, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface EditTextPrefChangeListener {
|
|
||||||
boolean onChanged(Preference preference, Object obj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
package ru.vtosters.lite.ui.dialogs;
|
package ru.vtosters.lite.ui.dialogs;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.edit;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.BooleanTrue;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -13,12 +9,14 @@ 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 && BooleanTrue("showDoze")) {
|
if (OEMDetector.isOEM() && Build.VERSION.SDK_INT >= 23 && Prefs.BooleanTrue("showDoze")) {
|
||||||
final Context context = getContext();
|
final Context context = Helper.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("Выключите оптимизацию батареи!");
|
||||||
@@ -38,7 +36,7 @@ public class DisableBattery {
|
|||||||
builder.setNeutralButton("Игнорировать", new DialogInterface.OnClickListener() {
|
builder.setNeutralButton("Игнорировать", new DialogInterface.OnClickListener() {
|
||||||
@Override // android.content.DialogInterface.OnClickListener
|
@Override // android.content.DialogInterface.OnClickListener
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
edit().putBoolean("showDoze", false).apply();
|
Helper.edit().putBoolean("showDoze", false).apply();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.show();
|
builder.show();
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
package ru.vtosters.lite.ui.dialogs;
|
package ru.vtosters.lite.ui.dialogs;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.edit;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.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;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -13,11 +8,13 @@ import android.content.Intent;
|
|||||||
|
|
||||||
import com.vk.navigation.Navigator;
|
import com.vk.navigation.Navigator;
|
||||||
|
|
||||||
|
import ru.vtosters.lite.utils.Helper;
|
||||||
|
import ru.vtosters.lite.utils.Prefs;
|
||||||
import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
|
import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
|
||||||
|
|
||||||
public class InstallGMS {
|
public class InstallGMS {
|
||||||
public static void alert(final Activity activity) {
|
public static void alert(final Activity activity) {
|
||||||
if (!isGmsInstalled()) {
|
if (!Helper.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());
|
||||||
@@ -26,20 +23,20 @@ public class InstallGMS {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
edit().putBoolean("showAlertGms", false).apply();
|
Helper.edit().putBoolean("showAlertGms", false).apply();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNeutralButton("Установить GMS", new DialogInterface.OnClickListener() {
|
builder.setNeutralButton("Установить GMS", new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
edit().putBoolean("showAlertGms", false).apply();
|
Helper.edit().putBoolean("showAlertGms", false).apply();
|
||||||
Context context = getContext();
|
Context context = Helper.GetContext();
|
||||||
Intent a2 = new Navigator(InstallGMSFragment.class).a(context);
|
Intent a2 = new Navigator(InstallGMSFragment.class).a(context);
|
||||||
context.startActivity(a2);
|
context.startActivity(a2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (BooleanTrue("showAlertGms")) {
|
if (Prefs.BooleanTrue("showAlertGms")) {
|
||||||
builder.show();
|
builder.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package ru.vtosters.lite.ui.dialogs;
|
package ru.vtosters.lite.ui.dialogs;
|
||||||
|
|
||||||
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;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@@ -10,7 +7,9 @@ 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) {
|
||||||
@@ -22,21 +21,23 @@ public class Start {
|
|||||||
builder.setMessage(getWelcome());
|
builder.setMessage(getWelcome());
|
||||||
builder.setCancelable(false);
|
builder.setCancelable(false);
|
||||||
builder.setPositiveButton("Продолжить", new DialogInterface.OnClickListener() {
|
builder.setPositiveButton("Продолжить", new DialogInterface.OnClickListener() {
|
||||||
|
/* class ru.vtosters.lite.utils.lite.dialog.Start.AnonymousClass1 */
|
||||||
|
|
||||||
@Override // android.content.DialogInterface.OnClickListener
|
@Override // android.content.DialogInterface.OnClickListener
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
edit().putBoolean("showAlert", false).apply();
|
Helper.edit().putBoolean("showAlert", false).apply();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNeutralButton("Новости", new DialogInterface.OnClickListener() {
|
builder.setNeutralButton("Новости", new DialogInterface.OnClickListener() {
|
||||||
|
/* class ru.vtosters.lite.utils.lite.dialog.Start.AnonymousClass2 */
|
||||||
|
|
||||||
@Override // android.content.DialogInterface.OnClickListener
|
@Override // android.content.DialogInterface.OnClickListener
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
edit().putBoolean("showAlert", false).apply();
|
Helper.edit().putBoolean("showAlert", false).apply();
|
||||||
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 (BooleanTrue("showAlert")) {
|
if (Prefs.BooleanTrue("showAlert")) {
|
||||||
builder.show();
|
builder.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ package ru.vtosters.lite.ui.fragments;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.vtosters.lite.R;
|
|
||||||
import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
||||||
|
|
||||||
|
import com.vtosters.lite.R;
|
||||||
|
|
||||||
public class ActivityFragment extends MaterialPreferenceToolbarFragment {
|
public class ActivityFragment extends MaterialPreferenceToolbarFragment {
|
||||||
@Override
|
@Override
|
||||||
|
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||||
public void b(Bundle bundle) {
|
public void b(Bundle bundle) {
|
||||||
super.b(bundle);
|
super.b(bundle);
|
||||||
a(R.xml.preferences_activity);
|
a(R.xml.preferences_activity);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
|||||||
|
|
||||||
public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
||||||
@Override
|
@Override
|
||||||
|
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||||
public void b(Bundle bundle) {
|
public void b(Bundle bundle) {
|
||||||
super.b(bundle);
|
super.b(bundle);
|
||||||
a(R.xml.preferences_feed);
|
a(R.xml.preferences_feed);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
|||||||
|
|
||||||
public class InstallGMSFragment extends MaterialPreferenceToolbarFragment {
|
public class InstallGMSFragment extends MaterialPreferenceToolbarFragment {
|
||||||
@Override
|
@Override
|
||||||
|
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||||
public void b(Bundle bundle) {
|
public void b(Bundle bundle) {
|
||||||
super.b(bundle);
|
super.b(bundle);
|
||||||
a(R.xml.preferences_gms);
|
a(R.xml.preferences_gms);
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
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;
|
||||||
|
|
||||||
@@ -9,30 +7,34 @@ 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;
|
||||||
|
|
||||||
|
/* renamed from: ru.vtosters.lite.utils.lite.ui.activities.interface reason: invalid class name */
|
||||||
public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
|
public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
|
||||||
@Override
|
@Override
|
||||||
|
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||||
public void b(Bundle bundle) {
|
public void b(Bundle bundle) {
|
||||||
super.b(bundle);
|
super.b(bundle);
|
||||||
a(R.xml.preferences_interface);
|
a(R.xml.preferences_interface);
|
||||||
prefs();
|
prefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prefs() {
|
/* access modifiers changed from: package-private */
|
||||||
a("newfeed").a(new a());
|
/* renamed from: ru.vtosters.lite.utils.lite.ui.activities.interface$a */
|
||||||
}
|
|
||||||
|
|
||||||
public boolean restart(Preference preference, Object obj) {
|
|
||||||
ToastUtils.a(getString("restartapp"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class a implements Preference.b {
|
public class a implements Preference.b {
|
||||||
a() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@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) {
|
||||||
return InterfaceFragment.this.restart(preference, obj);
|
return InterfaceFragment.this.restart(preference, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void prefs() {
|
||||||
|
a("newfeed").a((Preference.b) new a());
|
||||||
|
}
|
||||||
|
|
||||||
|
public /* synthetic */ boolean restart(Preference preference, Object obj) {
|
||||||
|
ToastUtils.a("Пожалуйста перезапустите приложение");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
|||||||
|
|
||||||
public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||||
@Override
|
@Override
|
||||||
|
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||||
public void b(Bundle bundle) {
|
public void b(Bundle bundle) {
|
||||||
super.b(bundle);
|
super.b(bundle);
|
||||||
a(R.xml.preferences_messages);
|
a(R.xml.preferences_messages);
|
||||||
|
|||||||
@@ -1,21 +1,11 @@
|
|||||||
package ru.vtosters.lite.ui.fragments;
|
package ru.vtosters.lite.ui.fragments;
|
||||||
|
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
|
||||||
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.deletePrefs;
|
|
||||||
import static ru.vtosters.lite.utils.SettBackup.restoreBackup;
|
|
||||||
|
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
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;
|
||||||
@@ -29,62 +19,53 @@ 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 {
|
||||||
|
|
||||||
|
/* access modifiers changed from: package-private */
|
||||||
|
static class c implements Preference.c {
|
||||||
|
@Override // android.support.v7.preference.Preference.c
|
||||||
|
public boolean a(Preference preference) {
|
||||||
|
copy(Helper.GetContext(), Helper.GetUserToken());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void copy(Context context, String str) {
|
||||||
|
((ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", str));
|
||||||
|
Toast.makeText(context, Helper.getString("copybtn"), Toast.LENGTH_SHORT).show();
|
||||||
|
ToastUtils.a(Helper.getString("tokenwarning"));
|
||||||
|
}
|
||||||
|
|
||||||
|
c() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||||
public void b(Bundle bundle) {
|
public void b(Bundle bundle) {
|
||||||
super.b(bundle);
|
super.b(bundle);
|
||||||
a(R.xml.preferences_other);
|
a(R.xml.preferences_other);
|
||||||
prefs();
|
prefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prefs() {
|
/* access modifiers changed from: package-private */
|
||||||
a("firebasefix").a(new a());
|
|
||||||
a("applicationstop").a(new b());
|
|
||||||
a("tokencopy").a(new c());
|
|
||||||
a("applicationrestart").a(new d());
|
|
||||||
a("clearcache").a(new e());
|
|
||||||
a("stickfix").a(new f());
|
|
||||||
a("deleteprefs").a(new deleteprefs());
|
|
||||||
|
|
||||||
// a("saveprefs").a((Preference.c) new saveprefs());
|
|
||||||
// a("restoreprefs").a((Preference.c) new restoreprefs());
|
|
||||||
}
|
|
||||||
|
|
||||||
static class c implements Preference.c {
|
|
||||||
c() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void copy(Context context, String str) {
|
|
||||||
((ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", str));
|
|
||||||
makeText(context, getString("copybtn"), LENGTH_SHORT).show();
|
|
||||||
ToastUtils.a(getString("tokenwarning"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.support.v7.preference.Preference.c
|
|
||||||
public boolean a(Preference preference) {
|
|
||||||
copy(getContext(), getUserToken());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class e implements Preference.c {
|
public class e implements Preference.c {
|
||||||
e() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
|
||||||
prefs.edit().clear().commit();
|
|
||||||
VKImageLoader.b();
|
VKImageLoader.b();
|
||||||
ImEngineProvider.a().h();
|
ImEngineProvider.a().h();
|
||||||
AudioMessageUtils.j();
|
AudioMessageUtils.j();
|
||||||
FileUtils.l();
|
FileUtils.l();
|
||||||
ToastUtils.a(getString("cachecleaned"));
|
ToastUtils.a(Helper.getString("cachecleaned"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* access modifiers changed from: package-private */
|
||||||
public class b implements Preference.c {
|
public class b implements Preference.c {
|
||||||
b() {
|
b() {
|
||||||
}
|
}
|
||||||
@@ -96,17 +77,19 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* access modifiers changed from: package-private */
|
||||||
public class d implements Preference.c {
|
public class d implements Preference.c {
|
||||||
d() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean a(Preference preference) {
|
public boolean a(Preference preference) {
|
||||||
restartApplication();
|
Helper.restarting();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* access modifiers changed from: package-private */
|
||||||
public class a implements Preference.c {
|
public class a implements Preference.c {
|
||||||
a() {
|
a() {
|
||||||
}
|
}
|
||||||
@@ -115,61 +98,22 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
|||||||
public boolean a(Preference preference) {
|
public boolean a(Preference preference) {
|
||||||
VKAccount b = VKAccountManager.b();
|
VKAccount b = VKAccountManager.b();
|
||||||
PushSubscriber.a.a(b.b(), b.c());
|
PushSubscriber.a.a(b.b(), b.c());
|
||||||
ToastUtils.a(getString("fcmtokenrem"));
|
ToastUtils.a(Helper.getString("fcmtokenrem"));
|
||||||
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
|
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
|
||||||
OtherFragment.this.aB().postDelayed(() -> {
|
OtherFragment.this.aB().postDelayed(() -> {
|
||||||
PushSubscriber.a.a(true);
|
PushSubscriber.a.a(true);
|
||||||
ToastUtils.a(getString("fcmtokenget"));
|
ToastUtils.a(Helper.getString("fcmtokenget"));
|
||||||
ToastUtils.a(getString("fcmtokenfixed"));
|
ToastUtils.a(Helper.getString("fcmtokenfixed"));
|
||||||
}, 1000);
|
}, 1000);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class f implements Preference.c {
|
private void prefs() {
|
||||||
f() {
|
a("firebasefix").a((Preference.c) new a());
|
||||||
}
|
a("applicationstop").a((Preference.c) new b());
|
||||||
|
a("tokencopy").a((Preference.c) new c());
|
||||||
@Override // android.support.v7.preference.Preference.c
|
a("applicationrestart").a((Preference.c) new d());
|
||||||
public boolean a(Preference preference) {
|
a("clearcache").a((Preference.c) new e());
|
||||||
SharedPreferences prefs = getContext().getSharedPreferences("stickers", Context.MODE_PRIVATE);
|
|
||||||
prefs.edit().clear().commit();
|
|
||||||
restartApplication();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class deleteprefs implements Preference.c {
|
|
||||||
deleteprefs() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.support.v7.preference.Preference.c
|
|
||||||
public boolean a(Preference preference) {
|
|
||||||
deletePrefs();
|
|
||||||
restartApplication();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class saveprefs implements Preference.c {
|
|
||||||
saveprefs() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.support.v7.preference.Preference.c
|
|
||||||
public boolean a(Preference preference) {
|
|
||||||
backupSettings();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class restoreprefs implements Preference.c {
|
|
||||||
restoreprefs() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // android.support.v7.preference.Preference.c
|
|
||||||
public boolean a(Preference preference) {
|
|
||||||
restoreBackup();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
|||||||
|
|
||||||
public class ProxySettingsFragment extends MaterialPreferenceToolbarFragment {
|
public class ProxySettingsFragment extends MaterialPreferenceToolbarFragment {
|
||||||
@Override
|
@Override
|
||||||
|
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||||
public void b(Bundle bundle) {
|
public void b(Bundle bundle) {
|
||||||
super.b(bundle);
|
super.b(bundle);
|
||||||
a(R.xml.preferences_proxy);
|
a(R.xml.preferences_proxy);
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
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;
|
||||||
|
|
||||||
@@ -11,43 +7,41 @@ 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 {
|
||||||
|
|
||||||
|
/* access modifiers changed from: package-private */
|
||||||
|
public class a implements Preference.b {
|
||||||
|
public /* synthetic */ a() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override // android.support.v7.preference.Preference.b
|
||||||
|
public boolean a(Preference preference, Object obj) {
|
||||||
|
return ThemesFragment.this.apply(preference, obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||||
public void b(Bundle bundle) {
|
public void b(Bundle bundle) {
|
||||||
super.b(bundle);
|
super.b(bundle);
|
||||||
a(R.xml.preferences_themes);
|
a(R.xml.preferences_themes);
|
||||||
prefs();
|
prefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean apply(Preference preference, Object obj) {
|
public /* synthetic */ boolean apply(Preference preference, Object obj) {
|
||||||
if (((Boolean) obj).booleanValue()) {
|
if (((Boolean) obj).booleanValue()) {
|
||||||
switchToVK();
|
IconHelper.switchToVK();
|
||||||
} else {
|
} else {
|
||||||
switchToDefault();
|
IconHelper.switchToDefault();
|
||||||
}
|
}
|
||||||
ToastUtils.a(getString("iconapplying"));
|
ToastUtils.a(Helper.getString("iconapplying"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prefs() {
|
private void prefs() {
|
||||||
a("iconvk").a(new a());
|
a("iconvk").a((Preference.b) new a());
|
||||||
a("darktheme").a(new b());
|
|
||||||
a("lighttheme").a(new b());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class b implements Preference.b {
|
|
||||||
@Override // android.support.v7.preference.Preference.b
|
|
||||||
public boolean a(Preference preference, Object obj) {
|
|
||||||
ToastUtils.a(getString("restartapp"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class a implements Preference.b {
|
|
||||||
@Override // android.support.v7.preference.Preference.b
|
|
||||||
public boolean a(Preference preference, Object obj) {
|
|
||||||
return ThemesFragment.this.apply(preference, obj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,190 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
|
|
||||||
import android.content.res.ColorStateList;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ru.vtosters.lite.utils.Themes;
|
|
||||||
|
|
||||||
public class DockBarAdapter extends RecyclerView.a
|
|
||||||
implements IItemTouchHelper {
|
|
||||||
|
|
||||||
public static final int SELECTED_TAB_TYPE = 1;
|
|
||||||
public static final int DISABLED_TAB_TYPE = 2;
|
|
||||||
public static final int GROUP_TITLE_TYPE = 3;
|
|
||||||
|
|
||||||
|
|
||||||
private final DockBarManager mDockBarManager = DockBarManager.getInstance();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecyclerView.x b(ViewGroup parent, int viewType) {
|
|
||||||
if (viewType == GROUP_TITLE_TYPE) {
|
|
||||||
return new GroupViewHolder(createGroupTitle());
|
|
||||||
} else {
|
|
||||||
return new DockBarEditViewHolder(createTabItem());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int b(int i) {
|
|
||||||
return getItemType(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
private View createTabItem() {
|
|
||||||
LinearLayout container = new LinearLayout(getContext());
|
|
||||||
container.setTag("tab_item_container");
|
|
||||||
container.setGravity(Gravity.CENTER_VERTICAL);
|
|
||||||
container.setOrientation(LinearLayout.HORIZONTAL);
|
|
||||||
container.setPadding(
|
|
||||||
convertDpToPixel(12),
|
|
||||||
convertDpToPixel(12),
|
|
||||||
convertDpToPixel(12),
|
|
||||||
convertDpToPixel(12)
|
|
||||||
);
|
|
||||||
container.setLayoutParams(new LinearLayout.LayoutParams(-1, convertDpToPixel(48)));
|
|
||||||
|
|
||||||
ImageView icon = new ImageView(getContext());
|
|
||||||
icon.setTag("icon");
|
|
||||||
icon.setImageTintList(ColorStateList.valueOf(Themes.getAccentColor()));
|
|
||||||
icon.setLayoutParams(new LinearLayout.LayoutParams(
|
|
||||||
convertDpToPixel(24),
|
|
||||||
convertDpToPixel(24)));
|
|
||||||
container.addView(icon);
|
|
||||||
|
|
||||||
TextView title = new TextView(getContext());
|
|
||||||
title.setTag("title");
|
|
||||||
title.setTextSize(16.0f);
|
|
||||||
title.setTypeface(Typeface.DEFAULT_BOLD);
|
|
||||||
title.setTextColor(Themes.getTextAttr());
|
|
||||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(-1, -2);
|
|
||||||
params.weight = 1;
|
|
||||||
params.leftMargin = convertDpToPixel(16);
|
|
||||||
container.addView(title, params);
|
|
||||||
|
|
||||||
return container;
|
|
||||||
}
|
|
||||||
|
|
||||||
private View createGroupTitle() {
|
|
||||||
LinearLayout layout = new LinearLayout(getContext());
|
|
||||||
layout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
|
|
||||||
|
|
||||||
TextView title = new TextView(getContext());
|
|
||||||
title.setTag("group_title");
|
|
||||||
title.setTextSize(13.0f);
|
|
||||||
title.setPadding(
|
|
||||||
convertDpToPixel(16),
|
|
||||||
convertDpToPixel(13),
|
|
||||||
convertDpToPixel(16),
|
|
||||||
convertDpToPixel(13)
|
|
||||||
);
|
|
||||||
title.setAllCaps(true);
|
|
||||||
title.setTextColor(Themes.getTextAttr());
|
|
||||||
layout.addView(title, new LinearLayout.LayoutParams(-2, -2));
|
|
||||||
|
|
||||||
return layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(RecyclerView.x holder, int position) {
|
|
||||||
if (holder instanceof GroupViewHolder) {
|
|
||||||
((GroupViewHolder) holder).bind(mDockBarManager.getGroupTitle(position));
|
|
||||||
} else {
|
|
||||||
int viewType = getItemType(position);
|
|
||||||
if (viewType == SELECTED_TAB_TYPE) {
|
|
||||||
((DockBarEditViewHolder) holder).bind(mDockBarManager.getSelectedTab(position));
|
|
||||||
} else if (viewType == DISABLED_TAB_TYPE) {
|
|
||||||
((DockBarEditViewHolder) holder).bind(mDockBarManager.getDisabledTab(position));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int au_() {
|
|
||||||
return mDockBarManager.getItemCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemDismiss(int index) {
|
|
||||||
mDockBarManager.move(this, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onItemMove(int fromPosition, int toPosition) {
|
|
||||||
int fromViewType = getItemType(fromPosition);
|
|
||||||
int toViewType = getItemType(toPosition);
|
|
||||||
|
|
||||||
if (fromPosition < toPosition) {
|
|
||||||
|
|
||||||
if (fromViewType != toViewType) {
|
|
||||||
mDockBarManager.swapAndMigrate(this, fromPosition, toPosition);
|
|
||||||
} else {
|
|
||||||
List<DockBarTab> list = fromViewType == SELECTED_TAB_TYPE ? mDockBarManager.getSelectedTabs() : mDockBarManager.getDisabledTabs();
|
|
||||||
mDockBarManager.swap(this, list, fromViewType, fromPosition, toPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (toPosition != 0) {
|
|
||||||
|
|
||||||
if (fromViewType != toViewType) {
|
|
||||||
mDockBarManager.swapAndMigrate(this, fromPosition, toPosition);
|
|
||||||
} else {
|
|
||||||
List<DockBarTab> list = fromViewType == SELECTED_TAB_TYPE ? mDockBarManager.getSelectedTabs() : mDockBarManager.getDisabledTabs();
|
|
||||||
mDockBarManager.swap(this, list, fromViewType, fromPosition, toPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIndexByViewType(int position, int viewType) {
|
|
||||||
return mDockBarManager.getIndexByViewType(position, viewType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getItemType(int position) {
|
|
||||||
return mDockBarManager.getItemType(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
static class DockBarEditViewHolder extends RecyclerView.x {
|
|
||||||
|
|
||||||
private final ImageView mIcon;
|
|
||||||
private final TextView mTitle;
|
|
||||||
|
|
||||||
public DockBarEditViewHolder(View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
|
|
||||||
mIcon = itemView.findViewWithTag("icon");
|
|
||||||
mTitle = itemView.findViewWithTag("title");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bind(DockBarTab tab) {
|
|
||||||
mIcon.setImageResource(tab.iconID);
|
|
||||||
mTitle.setText(tab.titleID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static class GroupViewHolder extends RecyclerView.x {
|
|
||||||
|
|
||||||
private final TextView mGroupTitle;
|
|
||||||
|
|
||||||
public GroupViewHolder(View view) {
|
|
||||||
super(view);
|
|
||||||
|
|
||||||
mGroupTitle = view.findViewWithTag("group_title");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bind(String groupTitle) {
|
|
||||||
mGroupTitle.setText(groupTitle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
|
||||||
|
|
||||||
public class DockBarDragItem {
|
|
||||||
|
|
||||||
public boolean active;
|
|
||||||
public int index;
|
|
||||||
public DockBarTab dockBarTab;
|
|
||||||
|
|
||||||
public DockBarDragItem(boolean active, int index, DockBarTab dockBarTab) {
|
|
||||||
this.active = active;
|
|
||||||
this.index = index;
|
|
||||||
this.dockBarTab = dockBarTab;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.restartApplication;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.support.v7.widget.a.ItemTouchHelper;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
|
|
||||||
import me.grishka.appkit.fragments.ToolbarFragment;
|
|
||||||
|
|
||||||
public class DockBarFragment extends ToolbarFragment {
|
|
||||||
|
|
||||||
private RecyclerView mRecyclerView;
|
|
||||||
private DockBarAdapter mAdapter;
|
|
||||||
private ItemTouchHelper mItemTouchHelper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View d(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
|
||||||
super.b(bundle);
|
|
||||||
|
|
||||||
LinearLayout container = new LinearLayout(n());
|
|
||||||
container.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
|
|
||||||
container.setOrientation(LinearLayout.VERTICAL);
|
|
||||||
|
|
||||||
LinearLayout buttonsContainer = new LinearLayout(n());
|
|
||||||
buttonsContainer.setPadding(
|
|
||||||
convertDpToPixel(13),
|
|
||||||
convertDpToPixel(10),
|
|
||||||
convertDpToPixel(13),
|
|
||||||
convertDpToPixel(10)
|
|
||||||
);
|
|
||||||
container.addView(buttonsContainer, new LinearLayout.LayoutParams(-1, -2));
|
|
||||||
|
|
||||||
Button save = new Button(n());
|
|
||||||
save.setText("Сохранить");
|
|
||||||
save.setOnClickListener(v -> {
|
|
||||||
DockBarManager.getInstance().save();
|
|
||||||
restartApplication();
|
|
||||||
});
|
|
||||||
|
|
||||||
LinearLayout.LayoutParams saveParams = new LinearLayout.LayoutParams(0, -2);
|
|
||||||
saveParams.weight = 1.0f;
|
|
||||||
buttonsContainer.addView(save, saveParams);
|
|
||||||
|
|
||||||
View divider = new View(n());
|
|
||||||
buttonsContainer.addView(divider, new LinearLayout.LayoutParams(convertDpToPixel(10), 0));
|
|
||||||
|
|
||||||
Button reset = new Button(n());
|
|
||||||
reset.setText("Сбросить");
|
|
||||||
reset.setOnClickListener(v -> {
|
|
||||||
DockBarManager.getInstance().delete();
|
|
||||||
restartApplication();
|
|
||||||
});
|
|
||||||
|
|
||||||
LinearLayout.LayoutParams resetParams = new LinearLayout.LayoutParams(0, -2);
|
|
||||||
resetParams.weight = 1.0f;
|
|
||||||
buttonsContainer.addView(reset, resetParams);
|
|
||||||
|
|
||||||
mRecyclerView = new RecyclerView(n());
|
|
||||||
mRecyclerView.setHasFixedSize(true);
|
|
||||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(n()));
|
|
||||||
mAdapter = new DockBarAdapter();
|
|
||||||
mRecyclerView.setAdapter(mAdapter);
|
|
||||||
container.addView(mRecyclerView, new LinearLayout.LayoutParams(-1, -1));
|
|
||||||
|
|
||||||
mItemTouchHelper = new ItemTouchHelper(new ItemTouchHelperCallback(mAdapter));
|
|
||||||
mItemTouchHelper.a(mRecyclerView);
|
|
||||||
|
|
||||||
return container;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(View arg0, Bundle arg1) {
|
|
||||||
o_(true);
|
|
||||||
|
|
||||||
super.a(arg0, arg1);
|
|
||||||
|
|
||||||
a("Редактор докбара");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,210 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
import static ru.vtosters.lite.utils.Themes.getAccentColor;
|
|
||||||
|
|
||||||
import android.content.res.ColorStateList;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
|
|
||||||
import com.vk.apps.AppsFragment;
|
|
||||||
import com.vk.core.d.RecoloredDrawable;
|
|
||||||
import com.vk.core.fragments.FragmentImpl;
|
|
||||||
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationMenuView;
|
|
||||||
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationView;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class DockBarInjector {
|
|
||||||
private static final DockBarManager sManager = DockBarManager.getInstance();
|
|
||||||
|
|
||||||
public static Map<Class<? extends FragmentImpl>, Integer> injectMap() {
|
|
||||||
LinkedHashMap<Class<? extends FragmentImpl>, Integer> map = new LinkedHashMap<>();
|
|
||||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
|
||||||
map.put(tab.fragmentClass, tab.id);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void inject(BottomNavigationView navigationView) {
|
|
||||||
Menu menu = navigationView.getMenu();
|
|
||||||
menu.clear();
|
|
||||||
try {
|
|
||||||
Field field = BottomNavigationMenuView.class.getDeclaredField("h");
|
|
||||||
field.setAccessible(true);
|
|
||||||
|
|
||||||
Object synchronizedPool = field.get(null);
|
|
||||||
|
|
||||||
Class<?> synchronisedPoolCls = Class.forName("android.support.v4.f.Pools$a");
|
|
||||||
|
|
||||||
Method acquire = synchronisedPoolCls.getDeclaredMethod("a");
|
|
||||||
|
|
||||||
if (synchronizedPool != null) {
|
|
||||||
do {
|
|
||||||
} while (acquire.invoke(synchronizedPool) != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (NoSuchFieldException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
|
||||||
MenuItem add = menu.add(0, tab.id, 0, tab.titleID);
|
|
||||||
Drawable drawable = getContext().getResources().getDrawable(tab.iconID);
|
|
||||||
ColorStateList dockcolors = new ColorStateList(
|
|
||||||
new int[][]{
|
|
||||||
new int[]{android.R.attr.state_checked},
|
|
||||||
new int[]{-android.R.attr.state_checked}
|
|
||||||
},
|
|
||||||
new int[] {
|
|
||||||
getAccentColor(),
|
|
||||||
Color.parseColor("#ffaaaeb3")
|
|
||||||
}
|
|
||||||
);
|
|
||||||
add.setIcon(new RecoloredDrawable(drawable, dockcolors));
|
|
||||||
add.setShowAsAction(1);
|
|
||||||
add.setCheckable(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int injectId(String tag) {
|
|
||||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
|
||||||
if (tag.equals(tab.tag))
|
|
||||||
return tab.id;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void injectMenuFragment(Menu menu) {
|
|
||||||
List<MenuItem> menuItems = new ArrayList<>();
|
|
||||||
for (int i = 0; i < menu.size(); i++) {
|
|
||||||
menuItems.add(menu.getItem(i));
|
|
||||||
}
|
|
||||||
menu.clear();
|
|
||||||
|
|
||||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
|
||||||
if (tab.id != com.vtosters.lite.R.id.tab_menu) {
|
|
||||||
int itemId = tab.id;
|
|
||||||
if (tab.id == com.vtosters.lite.R.id.tab_news) {
|
|
||||||
itemId = com.vtosters.lite.R.id.menu_newsfeed;
|
|
||||||
} else if (tab.id == com.vtosters.lite.R.id.tab_discover) {
|
|
||||||
itemId = com.vtosters.lite.R.id.menu_search;
|
|
||||||
} else if (tab.id == com.vtosters.lite.R.id.tab_feedback) {
|
|
||||||
itemId = com.vtosters.lite.R.id.menu_feedback;
|
|
||||||
} else if (tab.id == com.vtosters.lite.R.id.tab_messages) {
|
|
||||||
itemId = com.vtosters.lite.R.id.menu_messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
MenuItem add = menu.add(0, itemId, 0, tab.titleID);
|
|
||||||
add.setIcon(tab.iconID);
|
|
||||||
add.setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MenuItem menuItem : menuItems) {
|
|
||||||
MenuItem item = menu.add(menuItem.getGroupId(), menuItem.getItemId(), menuItem.getOrder(), menuItem.getTitle());
|
|
||||||
item.setIcon(menuItem.getIcon());
|
|
||||||
}
|
|
||||||
menuItems.clear();
|
|
||||||
|
|
||||||
for (int i = 0; i < menu.size(); i++) {
|
|
||||||
MenuItem menuItem = menu.getItem(i);
|
|
||||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
|
||||||
int itemId = menuItem.getItemId();
|
|
||||||
if (itemId == com.vtosters.lite.R.id.menu_newsfeed) {
|
|
||||||
itemId = com.vtosters.lite.R.id.tab_news;
|
|
||||||
} else if (itemId == com.vtosters.lite.R.id.menu_search) {
|
|
||||||
itemId = com.vtosters.lite.R.id.tab_discover;
|
|
||||||
} else if (itemId == com.vtosters.lite.R.id.menu_feedback) {
|
|
||||||
itemId = com.vtosters.lite.R.id.tab_feedback;
|
|
||||||
} else if (itemId == com.vtosters.lite.R.id.menu_messages) {
|
|
||||||
itemId = com.vtosters.lite.R.id.tab_messages;
|
|
||||||
}
|
|
||||||
if (itemId == tab.id && tab.id != com.vtosters.lite.R.id.menu_vk_pay) {
|
|
||||||
menuItems.add(menuItem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MenuItem menuItem : menuItems) {
|
|
||||||
menu.removeItem(menuItem.getItemId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static JSONArray injectMenuJSON(JSONArray arr) {
|
|
||||||
List<String> arrayList = new ArrayList(Arrays.asList(
|
|
||||||
"news",
|
|
||||||
"messages",
|
|
||||||
"feedback",
|
|
||||||
"discover"
|
|
||||||
));
|
|
||||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
|
||||||
if (tab.id == com.vtosters.lite.R.id.tab_discover) {
|
|
||||||
arrayList.remove("discover");
|
|
||||||
} else if (tab.id == com.vtosters.lite.R.id.tab_feedback) {
|
|
||||||
arrayList.remove("feedback");
|
|
||||||
} else if (tab.id == com.vtosters.lite.R.id.tab_messages) {
|
|
||||||
arrayList.remove("messages");
|
|
||||||
} else if (tab.id == com.vtosters.lite.R.id.tab_news) {
|
|
||||||
arrayList.remove("news");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
JSONArray jSONArray = new JSONArray();
|
|
||||||
for (int i = 0; i < arrayList.size(); i++) {
|
|
||||||
jSONArray.put(new JSONObject().put("name", arrayList.get(i)));
|
|
||||||
}
|
|
||||||
for (int i2 = 0; i2 < arr.length(); i2++) {
|
|
||||||
jSONArray.put(arr.getJSONObject(i2));
|
|
||||||
}
|
|
||||||
return jSONArray;
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getItemCount() {
|
|
||||||
return sManager.getSelectedTabs().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isDockOpenAllowed(FragmentImpl fragment) {
|
|
||||||
return isDockOpenAllowed(fragment.getClass());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isDockOpenAllowed(Class<?> cls) {
|
|
||||||
for (DockBarTab tab : sManager.getSelectedTabs())
|
|
||||||
if (tab.fragmentClass == cls)
|
|
||||||
return true;
|
|
||||||
for (DockBarTab tab : sManager.getDisabledTabs())
|
|
||||||
if (tab.fragmentClass == cls)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Class<?> interceptClick(int id) {
|
|
||||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
|
||||||
if (id == tab.id)
|
|
||||||
return tab.fragmentClass;
|
|
||||||
}
|
|
||||||
for (DockBarTab tab : sManager.getDisabledTabs()) {
|
|
||||||
if (id == tab.id)
|
|
||||||
return tab.fragmentClass;
|
|
||||||
}
|
|
||||||
return AppsFragment.class;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,314 +0,0 @@
|
|||||||
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.discover.DiscoverFragment;
|
|
||||||
import com.vk.discover.GatewaysFragment;
|
|
||||||
import com.vk.fave.fragments.FaveTabFragment;
|
|
||||||
import com.vk.feedlikes.fragments.FeedLikesFragment;
|
|
||||||
import com.vk.menu.MenuFragment;
|
|
||||||
import com.vk.music.fragment.MusicFragment;
|
|
||||||
import com.vk.newsfeed.HomeFragment;
|
|
||||||
import com.vk.newsfeed.NewsfeedFragment;
|
|
||||||
import com.vk.notifications.NotificationsContainerFragment;
|
|
||||||
import com.vtosters.lite.R;
|
|
||||||
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.LivesPostListFragment;
|
|
||||||
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.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class DockBarManager {
|
|
||||||
public static final int MIN_SELECTED_TABS_LIMIT = 3;
|
|
||||||
public static final int MAX_SELECTED_TABS_LIMIT = 9;
|
|
||||||
|
|
||||||
private static DockBarManager sInstance = new DockBarManager();
|
|
||||||
private final List<DockBarTab> mSelectedTabs = new ArrayList<>();
|
|
||||||
private final List<DockBarTab> mDisabledTabs = new ArrayList<>();
|
|
||||||
private final List<String> mGroups = Arrays.asList(
|
|
||||||
"Выбранные элементы докбара",
|
|
||||||
"Невыбранные элементы"
|
|
||||||
);
|
|
||||||
public DockBarManager() {
|
|
||||||
load();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DockBarManager getInstance() {
|
|
||||||
if (sInstance == null)
|
|
||||||
sInstance = new DockBarManager();
|
|
||||||
return sInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String readFully(InputStream is) throws IOException {
|
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
||||||
byte[] buffer = new byte[2048];
|
|
||||||
int len;
|
|
||||||
while ((len = is.read(buffer)) > 0) {
|
|
||||||
bos.write(buffer, 0, len);
|
|
||||||
}
|
|
||||||
return bos.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void load() {
|
|
||||||
File dockbar = new File(getContext().getFilesDir(), "dockbar.json");
|
|
||||||
|
|
||||||
if (!dockbar.exists()) {
|
|
||||||
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", olddock() ? R.drawable.ic_search_28 : R.drawable.ic_menu_search_outline_28, R.string.search, R.id.tab_discover, newfeed() ? GatewaysFragment.class : DiscoverFragment.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", 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", 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_groups", R.drawable.ic_users_24, R.string.groups, R.id.menu_groups, GroupsFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_photos", R.drawable.ic_camera_24, R.string.photos, R.id.menu_photos, PhotosFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_audios", R.drawable.ic_music_24, R.string.music, R.id.menu_audios, MusicFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_videos", R.drawable.ic_video_24, R.string.videos, R.id.menu_videos, VideosFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_lives", R.drawable.ic_live_filter_24dp, R.string.sett_live, R.id.menu_lives, LivesPostListFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_games", R.drawable.ic_games_24, R.string.games, R.id.menu_games, GamesFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_liked", R.drawable.ic_menu_like_24, R.string.sett_likes, R.id.menu_feed_likes, FeedLikesFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_fave", R.drawable.ic_favorite_24, R.string.exo_track_selection_title_video_res_0x7f11031e, R.id.menu_fave, FaveTabFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_documents", R.drawable.ic_document_24, R.string.docs, R.id.menu_documents, DocumentsViewFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_payments", R.drawable.ic_money_transfer_24, R.string.money_transfer_money_transfers, R.id.menu_payments, MoneyTransfersFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_vk_apps", R.drawable.ic_services_24, R.string.menu_apps, R.id.menu_vk_apps, AppsFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_profile", R.drawable.libverify_ic_account_circle_white, R.string.profile, R.id.profile, ProfileFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_settings", R.drawable.ic_settings_24, R.string.menu_settings, R.id.menu_settings, SettingsListFragment.class));
|
|
||||||
mDisabledTabs.add(new DockBarTab("tab_brtd", R.drawable.ic_menu_birthdays, R.string.birthdays_title, R.id.menu_birthdays, BirthdaysFragment.class));
|
|
||||||
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
JSONObject json = new JSONObject(readFully(new FileInputStream(dockbar)));
|
|
||||||
|
|
||||||
JSONArray selected = json.getJSONArray("selected");
|
|
||||||
for (int i = 0; i < selected.length(); i++) {
|
|
||||||
JSONObject item = selected.getJSONObject(i);
|
|
||||||
DockBarTab tab = new DockBarTab(
|
|
||||||
item.getString("tag"),
|
|
||||||
item.getInt("iconID"),
|
|
||||||
item.getInt("titleID"),
|
|
||||||
item.getInt("id"),
|
|
||||||
Class.forName(item.getString("fragmentClass"))
|
|
||||||
);
|
|
||||||
if (newfeed()) {
|
|
||||||
if (tab.fragmentClass == NewsfeedFragment.class) {
|
|
||||||
tab.fragmentClass = HomeFragment.class;
|
|
||||||
} else if (tab.fragmentClass == DiscoverFragment.class) {
|
|
||||||
tab.fragmentClass = DiscoverFragment.class;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (tab.fragmentClass == HomeFragment.class) {
|
|
||||||
tab.fragmentClass = NewsfeedFragment.class;
|
|
||||||
} else if (tab.fragmentClass == GatewaysFragment.class) {
|
|
||||||
tab.fragmentClass = GatewaysFragment.class;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mSelectedTabs.add(tab);
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONArray disabled = json.getJSONArray("disabled");
|
|
||||||
for (int i = 0; i < disabled.length(); i++) {
|
|
||||||
JSONObject item = disabled.getJSONObject(i);
|
|
||||||
DockBarTab tab = new DockBarTab(
|
|
||||||
item.getString("tag"),
|
|
||||||
item.getInt("iconID"),
|
|
||||||
item.getInt("titleID"),
|
|
||||||
item.getInt("id"),
|
|
||||||
Class.forName(item.getString("fragmentClass"))
|
|
||||||
);
|
|
||||||
if (newfeed()) {
|
|
||||||
if (tab.fragmentClass == NewsfeedFragment.class) {
|
|
||||||
tab.fragmentClass = HomeFragment.class;
|
|
||||||
} else if (tab.fragmentClass == DiscoverFragment.class) {
|
|
||||||
tab.fragmentClass = GatewaysFragment.class;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (tab.fragmentClass == HomeFragment.class) {
|
|
||||||
tab.fragmentClass = NewsfeedFragment.class;
|
|
||||||
} else if (tab.fragmentClass == GatewaysFragment.class) {
|
|
||||||
tab.fragmentClass = DiscoverFragment.class;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mDisabledTabs.add(tab);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (JSONException | IOException | ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void delete() {
|
|
||||||
File dockbar = new File(getContext().getFilesDir(), "dockbar.json");
|
|
||||||
if (dockbar.exists()) dockbar.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save() {
|
|
||||||
try {
|
|
||||||
File dockbar = new File(getContext().getFilesDir(), "dockbar.json");
|
|
||||||
|
|
||||||
JSONArray selected = new JSONArray();
|
|
||||||
for (DockBarTab tab : mSelectedTabs) {
|
|
||||||
|
|
||||||
JSONObject item = new JSONObject()
|
|
||||||
.put("tag", tab.tag)
|
|
||||||
.put("iconID", tab.iconID)
|
|
||||||
.put("titleID", tab.titleID)
|
|
||||||
.put("id", tab.id)
|
|
||||||
.put("fragmentClass", tab.fragmentClass.getName());
|
|
||||||
selected.put(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONArray disabled = new JSONArray();
|
|
||||||
for (DockBarTab tab : mDisabledTabs) {
|
|
||||||
JSONObject item = new JSONObject()
|
|
||||||
.put("tag", tab.tag)
|
|
||||||
.put("iconID", tab.iconID)
|
|
||||||
.put("titleID", tab.titleID)
|
|
||||||
.put("id", tab.id)
|
|
||||||
.put("fragmentClass", tab.fragmentClass.getName());
|
|
||||||
disabled.put(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("selected", selected).put("disabled", disabled);
|
|
||||||
|
|
||||||
FileOutputStream fos = new FileOutputStream(dockbar);
|
|
||||||
fos.write(json.toString().getBytes(StandardCharsets.UTF_8));
|
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void swap(DockBarAdapter adapter, List<DockBarTab> list, int itemType, int fromPosition, int toPosition) {
|
|
||||||
int curr = adapter.getIndexByViewType(fromPosition, itemType);
|
|
||||||
int target = adapter.getIndexByViewType(toPosition, itemType);
|
|
||||||
if (fromPosition < toPosition) {
|
|
||||||
for (int i = curr; i < target; i++) {
|
|
||||||
Collections.swap(list, i, i + 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = curr; i > target; i--) {
|
|
||||||
Collections.swap(list, i, i - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
adapter.b(fromPosition, toPosition);// notifyItemMoved
|
|
||||||
}
|
|
||||||
|
|
||||||
public void swapAndMigrate(DockBarAdapter adapter, int fromPosition, int toPosition) {
|
|
||||||
int curr = adapter.getIndexByViewType(fromPosition, adapter.getItemType(fromPosition));
|
|
||||||
int target = adapter.getIndexByViewType(toPosition, adapter.getItemType(toPosition));
|
|
||||||
if (fromPosition < toPosition) {
|
|
||||||
|
|
||||||
if (mSelectedTabs.size() <= MIN_SELECTED_TABS_LIMIT || mSelectedTabs.get(curr).tag.equals("tab_menu"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
DockBarTab tab = mSelectedTabs.get(curr);
|
|
||||||
mSelectedTabs.remove(tab);
|
|
||||||
mDisabledTabs.add(tab);
|
|
||||||
|
|
||||||
for (int i = mDisabledTabs.size() - 1; i > target; i--) {
|
|
||||||
Collections.swap(mDisabledTabs, i, i - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < target; i++) {
|
|
||||||
Collections.swap(mDisabledTabs, i, i + 1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (mSelectedTabs.size() >= MAX_SELECTED_TABS_LIMIT) return;
|
|
||||||
|
|
||||||
DockBarTab tab = mDisabledTabs.get(curr);
|
|
||||||
mDisabledTabs.remove(tab);
|
|
||||||
mSelectedTabs.add(tab);
|
|
||||||
}
|
|
||||||
adapter.b(fromPosition, toPosition);// notifyItemMoved
|
|
||||||
}
|
|
||||||
|
|
||||||
public void move(DockBarAdapter adapter, int index) {
|
|
||||||
if (getItemType(index) == 1) {
|
|
||||||
DockBarTab item = mSelectedTabs.get(getIndexByViewType(index, 1));
|
|
||||||
|
|
||||||
mSelectedTabs.remove(item);
|
|
||||||
|
|
||||||
mDisabledTabs.add(item);
|
|
||||||
|
|
||||||
for (int i = mDisabledTabs.size() - 1; i > 0; i--) {
|
|
||||||
Collections.swap(mDisabledTabs, i, i - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
adapter.e_(index); // notifyItemRemoved
|
|
||||||
adapter.d_(getItemCount() - mDisabledTabs.size()); // notifyItemInserted
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getItemCount() {
|
|
||||||
return mSelectedTabs.size() + mDisabledTabs.size() + mGroups.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getIndexByViewType(int position, int viewType) {
|
|
||||||
if (viewType == DockBarAdapter.SELECTED_TAB_TYPE) {
|
|
||||||
return position - 1;
|
|
||||||
} else if (viewType == DockBarAdapter.DISABLED_TAB_TYPE) {
|
|
||||||
return position - mSelectedTabs.size() - mGroups.size();
|
|
||||||
} else {
|
|
||||||
return position != 0 ? 1 : 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getItemType(int position) {
|
|
||||||
if (position == 0 || position == mSelectedTabs.size() + 1) {
|
|
||||||
return DockBarAdapter.GROUP_TITLE_TYPE;
|
|
||||||
} else if (position - 1 < mSelectedTabs.size()) {
|
|
||||||
return DockBarAdapter.SELECTED_TAB_TYPE;
|
|
||||||
} else if (position - 1 >= mSelectedTabs.size()) {
|
|
||||||
return DockBarAdapter.DISABLED_TAB_TYPE;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DockBarTab getSelectedTab(int pos) {
|
|
||||||
return mSelectedTabs.get(getIndexByViewType(pos, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public DockBarTab getDisabledTab(int pos) {
|
|
||||||
return mDisabledTabs.get(getIndexByViewType(pos, 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGroupTitle(int pos) {
|
|
||||||
return mGroups.get(getIndexByViewType(pos, -1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DockBarTab> getSelectedTabs() {
|
|
||||||
return mSelectedTabs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DockBarTab> getDisabledTabs() {
|
|
||||||
return mDisabledTabs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
|
||||||
|
|
||||||
import com.vk.core.fragments.FragmentImpl;
|
|
||||||
|
|
||||||
public class DockBarTab {
|
|
||||||
|
|
||||||
public String tag;
|
|
||||||
public int iconID;
|
|
||||||
public int titleID;
|
|
||||||
public int id;
|
|
||||||
public Class<? extends FragmentImpl> fragmentClass;
|
|
||||||
|
|
||||||
public DockBarTab(String tag, int iconID, int titleID, int resID, Class<?> fragmentClass) {
|
|
||||||
this.tag = tag;
|
|
||||||
this.iconID = iconID;
|
|
||||||
this.titleID = titleID;
|
|
||||||
this.id = resID;
|
|
||||||
this.fragmentClass = (Class<? extends FragmentImpl>) fragmentClass;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
|
||||||
|
|
||||||
public interface IItemTouchHelper {
|
|
||||||
|
|
||||||
void onItemDismiss(int index);
|
|
||||||
|
|
||||||
boolean onItemMove(int fromPosition, int toPosition);
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
|
||||||
|
|
||||||
import static androidx.recyclerview.widget.ItemTouchHelper.Callback.makeMovementFlags;
|
|
||||||
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.support.v7.widget.a.ItemTouchHelper;
|
|
||||||
|
|
||||||
public class ItemTouchHelperCallback extends ItemTouchHelper.a {
|
|
||||||
|
|
||||||
private final DockBarAdapter mAdapter;
|
|
||||||
|
|
||||||
public ItemTouchHelperCallback(DockBarAdapter mAdapter) {
|
|
||||||
this.mAdapter = mAdapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // isLongPressDragEnabled
|
|
||||||
public boolean a() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override // isItemViewSwipeEnabled
|
|
||||||
public boolean b() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int a(RecyclerView recyclerView, RecyclerView.x viewHolder) {
|
|
||||||
int pos = mAdapter.getItemType(viewHolder.d());
|
|
||||||
int dragFlags = pos != DockBarAdapter.GROUP_TITLE_TYPE ? androidx.recyclerview.widget.ItemTouchHelper.UP | androidx.recyclerview.widget.ItemTouchHelper.DOWN : 0;
|
|
||||||
int swipeFlags = pos == 1 ? androidx.recyclerview.widget.ItemTouchHelper.START | androidx.recyclerview.widget.ItemTouchHelper.END : 0;
|
|
||||||
return makeMovementFlags(dragFlags, swipeFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(RecyclerView.x viewHolder, int direction) {
|
|
||||||
mAdapter.onItemDismiss(viewHolder.d());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean b(RecyclerView recyclerView, RecyclerView.x viewHolder, RecyclerView.x target) {
|
|
||||||
if (mAdapter.getItemType(viewHolder.d()) == DockBarAdapter.GROUP_TITLE_TYPE)
|
|
||||||
return false;
|
|
||||||
return mAdapter.onItemMove(viewHolder.d(), target.d());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.multiaccount;
|
|
||||||
|
|
||||||
class MultiAccountItem {
|
|
||||||
public String nickname;
|
|
||||||
public String imageUrl;
|
|
||||||
public int index;
|
|
||||||
|
|
||||||
public MultiAccountItem(String name, String imageUrl, int index) {
|
|
||||||
this.nickname = name;
|
|
||||||
this.imageUrl = imageUrl;
|
|
||||||
this.index = index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-181
@@ -1,181 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.multiaccount;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
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.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.vk.audio.AudioMessageUtils;
|
|
||||||
import com.vk.auth.api.VKAccount;
|
|
||||||
import com.vk.core.f.FileUtils;
|
|
||||||
import com.vk.core.util.AppContextHolder;
|
|
||||||
import com.vk.imageloader.VKImageLoader;
|
|
||||||
import com.vk.imageloader.view.VKCircleImageView;
|
|
||||||
import com.vk.pushes.PushSubscriber;
|
|
||||||
import com.vtosters.lite.R;
|
|
||||||
import com.vtosters.lite.auth.VKAccountManager;
|
|
||||||
import com.vtosters.lite.im.ImEngineProvider;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class MultiAccountAdapter extends RecyclerView.a<MultiAccountAdapter.MultiAccountViewHolder> {
|
|
||||||
|
|
||||||
private final List<MultiAccountItem> mAccounts = MultiAccountManager.buildList();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MultiAccountViewHolder b(ViewGroup parent, int viewType) {
|
|
||||||
RelativeLayout layout = new RelativeLayout(parent.getContext());
|
|
||||||
layout.setPadding(
|
|
||||||
convertDpToPixel(12),
|
|
||||||
convertDpToPixel(6),
|
|
||||||
convertDpToPixel(6),
|
|
||||||
convertDpToPixel(6)
|
|
||||||
);
|
|
||||||
|
|
||||||
VKCircleImageView avatar = new VKCircleImageView(parent.getContext());
|
|
||||||
avatar.setId(1);
|
|
||||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
|
|
||||||
convertDpToPixel(48),
|
|
||||||
convertDpToPixel(48)
|
|
||||||
);
|
|
||||||
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
|
|
||||||
params.addRule(RelativeLayout.CENTER_VERTICAL);
|
|
||||||
layout.addView(avatar, params);
|
|
||||||
|
|
||||||
TextView nickname = new TextView(parent.getContext());
|
|
||||||
nickname.setId(2);
|
|
||||||
nickname.setPaddingRelative(
|
|
||||||
convertDpToPixel(12),
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
nickname.setEllipsize(TextUtils.TruncateAt.END);
|
|
||||||
nickname.setSingleLine(true);
|
|
||||||
nickname.setTextSize(15.0f);
|
|
||||||
nickname.setTextColor(getTextAttr());
|
|
||||||
nickname.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));
|
|
||||||
RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(-2, -2);
|
|
||||||
params1.addRule(RelativeLayout.CENTER_VERTICAL);
|
|
||||||
params1.addRule(RelativeLayout.RIGHT_OF, 1);
|
|
||||||
layout.addView(nickname, params1);
|
|
||||||
|
|
||||||
ImageButton action = new ImageButton(parent.getContext());
|
|
||||||
action.setId(3);
|
|
||||||
action.setBackgroundResource(com.vtosters.lite.R.drawable.rounded_list_selector);
|
|
||||||
Drawable drawable = recolorDrawable(getResources().getDrawable(R.drawable.ic_list_remove));
|
|
||||||
action.setImageDrawable(drawable);
|
|
||||||
RelativeLayout.LayoutParams params2 = new RelativeLayout.LayoutParams(
|
|
||||||
convertDpToPixel(48),
|
|
||||||
convertDpToPixel(48)
|
|
||||||
);
|
|
||||||
params2.addRule(RelativeLayout.CENTER_VERTICAL);
|
|
||||||
params2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
|
||||||
layout.addView(action, params2);
|
|
||||||
|
|
||||||
return new MultiAccountViewHolder(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(MultiAccountViewHolder holder, int pos) {
|
|
||||||
holder.bind(pos == 0 ? null : mAccounts.get(pos - 1), pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int au_() {
|
|
||||||
return mAccounts.size() + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static class MultiAccountViewHolder extends RecyclerView.x {
|
|
||||||
|
|
||||||
private final RelativeLayout mContainer;
|
|
||||||
private final VKCircleImageView mAvatar;
|
|
||||||
private final TextView mNickname;
|
|
||||||
private final ImageButton mAction;
|
|
||||||
|
|
||||||
public MultiAccountViewHolder(View view) {
|
|
||||||
super(view);
|
|
||||||
|
|
||||||
mContainer = (RelativeLayout) view;
|
|
||||||
mAvatar = view.findViewById(1);
|
|
||||||
mNickname = view.findViewById(2);
|
|
||||||
mAction = view.findViewById(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bind(MultiAccountItem item, int pos) {
|
|
||||||
if (pos == 0) {
|
|
||||||
mNickname.setText("Добавить новый аккаунт");
|
|
||||||
mContainer.setOnClickListener(v -> {
|
|
||||||
MultiAccountManager.addAccount();
|
|
||||||
|
|
||||||
VKImageLoader.b();
|
|
||||||
ImEngineProvider.a().h();
|
|
||||||
AudioMessageUtils.j();
|
|
||||||
FileUtils.l();
|
|
||||||
VKAccount b = VKAccountManager.b();
|
|
||||||
PushSubscriber.a.a(b.b(), b.c());
|
|
||||||
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
|
|
||||||
SharedPreferences prefs = getContext().getSharedPreferences("stickers", Context.MODE_PRIVATE);
|
|
||||||
prefs.edit().clear().commit();
|
|
||||||
restartApplication();
|
|
||||||
});
|
|
||||||
Drawable drawable = recolorDrawable(getResources().getDrawable(R.drawable.ic_list_add));
|
|
||||||
mAction.setImageDrawable(drawable);
|
|
||||||
mAction.setClickable(false);
|
|
||||||
} else {
|
|
||||||
mContainer.setOnClickListener(v -> {
|
|
||||||
MultiAccountManager.switchAccount(item.index);
|
|
||||||
|
|
||||||
VKImageLoader.b();
|
|
||||||
ImEngineProvider.a().h();
|
|
||||||
AudioMessageUtils.j();
|
|
||||||
FileUtils.l();
|
|
||||||
VKAccount b = VKAccountManager.b();
|
|
||||||
PushSubscriber.a.a(b.b(), b.c());
|
|
||||||
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
|
|
||||||
SharedPreferences prefs = getContext().getSharedPreferences("stickers", Context.MODE_PRIVATE);
|
|
||||||
prefs.edit().clear().commit();
|
|
||||||
restartApplication();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isNetworkConnected())
|
|
||||||
mAvatar.a(item.imageUrl);
|
|
||||||
else
|
|
||||||
mAvatar.a(R.drawable.vkim_ic_placeholder_user_square_64dp);
|
|
||||||
|
|
||||||
mNickname.setText(item.nickname);
|
|
||||||
|
|
||||||
mAction.setOnClickListener(v -> {
|
|
||||||
MultiAccountManager.deleteAccount(item.index);
|
|
||||||
|
|
||||||
VKImageLoader.b();
|
|
||||||
ImEngineProvider.a().h();
|
|
||||||
AudioMessageUtils.j();
|
|
||||||
FileUtils.l();
|
|
||||||
VKAccount b = VKAccountManager.b();
|
|
||||||
PushSubscriber.a.a(b.b(), b.c());
|
|
||||||
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
|
|
||||||
SharedPreferences prefs = getContext().getSharedPreferences("stickers", Context.MODE_PRIVATE);
|
|
||||||
prefs.edit().clear().commit();
|
|
||||||
restartApplication();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-42
@@ -1,42 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.multiaccount;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getString;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
|
|
||||||
import me.grishka.appkit.fragments.ToolbarFragment;
|
|
||||||
|
|
||||||
public class MultiAccountFragment extends ToolbarFragment {
|
|
||||||
|
|
||||||
private RecyclerView mRecyclerView;
|
|
||||||
private MultiAccountAdapter mAdapter;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View d(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
|
||||||
|
|
||||||
LinearLayout layout = new LinearLayout(n());
|
|
||||||
|
|
||||||
mRecyclerView = new RecyclerView(n());
|
|
||||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(n()));
|
|
||||||
mAdapter = new MultiAccountAdapter();
|
|
||||||
mRecyclerView.setAdapter(mAdapter);
|
|
||||||
layout.addView(mRecyclerView, new LinearLayout.LayoutParams(-1, -1));
|
|
||||||
|
|
||||||
return layout;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void a(View arg0, Bundle arg1) {
|
|
||||||
o_(true);
|
|
||||||
|
|
||||||
super.a(arg0, arg1);
|
|
||||||
|
|
||||||
a(getString("accounts"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-104
@@ -1,104 +0,0 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.multiaccount;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import ru.vtosters.lite.utils.Globals;
|
|
||||||
|
|
||||||
public class MultiAccountManager {
|
|
||||||
|
|
||||||
public static void migrate() {
|
|
||||||
SharedPreferences OldPrefs = getContext().getSharedPreferences("pref_account_manager", Context.MODE_PRIVATE);
|
|
||||||
String OldPrefsValue = OldPrefs.getString("key_vk_account", "");
|
|
||||||
SharedPreferences NewPrefs = getContext().getSharedPreferences("pref_account_manager0", Context.MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = NewPrefs.edit();
|
|
||||||
editor.putString("key_vk_account", OldPrefsValue);
|
|
||||||
editor.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void migrationRestart() {
|
|
||||||
SharedPreferences prefs = getPreferences();
|
|
||||||
if (prefs.getBoolean("multiaccount_restart", true)) {
|
|
||||||
prefs.edit().putBoolean("multiaccount_restart", false).commit();
|
|
||||||
Globals.restartApplication();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SharedPreferences getCurrentAccount() {
|
|
||||||
int account = getPreferences().getInt("account", 0);
|
|
||||||
return getContext().getSharedPreferences("pref_account_manager" + (account != 0 ? account : ""), Context.MODE_PRIVATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getAccountPrefsCount() {
|
|
||||||
File[] prefs = new File(getContext().getFilesDir().getParent(), "shared_prefs")
|
|
||||||
.listFiles((dir, name) -> {
|
|
||||||
return name.matches("pref_account_manager\\d+\\.xml");
|
|
||||||
});
|
|
||||||
return prefs != null ? prefs.length : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String withRegex(String base, String regex, String def) {
|
|
||||||
Pattern pattern = Pattern.compile(regex);
|
|
||||||
Matcher matcher = pattern.matcher(base);
|
|
||||||
if (matcher.find()) {
|
|
||||||
return matcher.group(1);
|
|
||||||
}
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<MultiAccountItem> buildList() {
|
|
||||||
List<MultiAccountItem> list = new ArrayList<>();
|
|
||||||
for (int i = 0; i <= getAccountPrefsCount(); i++) {
|
|
||||||
SharedPreferences prefs = getContext().getSharedPreferences("pref_account_manager" + i, Context.MODE_PRIVATE);
|
|
||||||
String keyVKAccount = prefs.getString("key_vk_account", "");
|
|
||||||
if (!keyVKAccount.isEmpty()) {
|
|
||||||
String name = withRegex(keyVKAccount, ".*\"name\":\\{.*?:\"(.*?)\"\\}.*", "");
|
|
||||||
String avatarUrl = withRegex(keyVKAccount, ".*\"photo\":\\{.*?:\"(.*?)\"\\}.*", "https://vk.com/images/camera_200.png")
|
|
||||||
.replace("\\/", "/");
|
|
||||||
list.add(new MultiAccountItem(
|
|
||||||
name, avatarUrl, i
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean switchAccount(int i) {
|
|
||||||
int account = getPreferences().getInt("account", 0);
|
|
||||||
if (account == i) return false;
|
|
||||||
|
|
||||||
getPreferences().edit().putInt("account", i).commit();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addAccount() {
|
|
||||||
getPreferences().edit().putInt("account", getAccountPrefsCount()).commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void deleteAccount(int i) {
|
|
||||||
int account = getPreferences().getInt("account", 0);
|
|
||||||
SharedPreferences prefs = getContext().getSharedPreferences("pref_account_manager" + i, Context.MODE_PRIVATE);
|
|
||||||
prefs.edit().clear().commit();
|
|
||||||
File file = new File(new File(getContext().getFilesDir().getParent(), "shared_prefs"), "pref_account_manager" + i);
|
|
||||||
if (file.exists()) file.delete();
|
|
||||||
if (account == i && getAccountPrefsCount() > 0) {
|
|
||||||
List<MultiAccountItem> accounts = buildList();
|
|
||||||
if (accounts.size() > 0)
|
|
||||||
switchAccount(buildList().get(0).index);
|
|
||||||
else {
|
|
||||||
getContext().getSharedPreferences("pref_account_manager", Context.MODE_PRIVATE)
|
|
||||||
.edit().clear().commit();
|
|
||||||
Globals.getPreferences().edit().putBoolean("multiaccount_restart", true).commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +1,5 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.tgstickers;
|
package ru.vtosters.lite.ui.fragments.tgstickers;
|
||||||
|
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
|
||||||
import static android.widget.Toast.makeText;
|
|
||||||
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;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
@@ -37,6 +24,7 @@ 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;
|
||||||
@@ -54,22 +42,33 @@ 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.utils.Helper;
|
||||||
import ru.vtosters.lite.ui.PreferencesUtil;
|
import ru.vtosters.lite.ui.PreferencesUtil;
|
||||||
|
import ru.vtosters.lite.utils.Prefs;
|
||||||
|
import ru.vtosters.lite.utils.Themes;
|
||||||
|
|
||||||
public class StickersFragment extends ToolbarFragment {
|
public class StickersFragment extends ToolbarFragment {
|
||||||
|
|
||||||
public final static String ACTION_RELOAD = "com.vtosters.lite.action.RELOAD_TGS_LIST";
|
public final static String ACTION_RELOAD = "com.vtosters.lite.action.RELOAD_TGS_LIST";
|
||||||
|
|
||||||
private final static int TYPE_DIRECT = 0, TYPE_SOCKS = 2, TYPE_TOASTER_SERVER = 3;
|
private final static int TYPE_DIRECT = 0, TYPE_SOCKS = 2, TYPE_TOASTER_SERVER = 3;
|
||||||
private static final String TAG = "StickersFragment";
|
|
||||||
public int from;
|
|
||||||
public int to;
|
|
||||||
private TelegramStickersGrabber grabber;
|
private TelegramStickersGrabber grabber;
|
||||||
private TelegramStickersService stickersService;
|
private TelegramStickersService stickersService;
|
||||||
private FloatingActionButton fab;
|
private FloatingActionButton fab;
|
||||||
|
|
||||||
|
private static final String TAG = "StickersFragment";
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private RecyclerView.Adapter adapter;
|
private RecyclerView.Adapter adapter;
|
||||||
|
|
||||||
private boolean movePending = false;
|
private boolean movePending = false;
|
||||||
|
public int from;
|
||||||
|
public int to;
|
||||||
|
|
||||||
|
private int editPadding;
|
||||||
|
private RecyclerView recycler;
|
||||||
|
|
||||||
private final BroadcastReceiver receiver = new BroadcastReceiver() {
|
private final BroadcastReceiver receiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@@ -91,8 +90,6 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private int editPadding;
|
|
||||||
private RecyclerView recycler;
|
|
||||||
|
|
||||||
private void initGrabber() {
|
private void initGrabber() {
|
||||||
int method = TGPref.getTGConnectMethod();
|
int method = TGPref.getTGConnectMethod();
|
||||||
@@ -121,7 +118,7 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
|
|
||||||
private void openMenu(String toast) {
|
private void openMenu(String toast) {
|
||||||
if (toast != null) {
|
if (toast != null) {
|
||||||
makeText(super.n(), toast, LENGTH_SHORT).show();
|
Toast.makeText(super.n(), toast, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
var intent = new Navigator(StickersPreferencesFragment.class, new Bundle()).a(super.n());
|
var intent = new Navigator(StickersPreferencesFragment.class, new Bundle()).a(super.n());
|
||||||
super.n().startActivity(intent);
|
super.n().startActivity(intent);
|
||||||
@@ -133,7 +130,7 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
super.a(menu, menuInflater);
|
super.a(menu, menuInflater);
|
||||||
MenuItem add = menu.add(0, 0, 0, "");
|
MenuItem add = menu.add(0, 0, 0, "");
|
||||||
add.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
add.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
add.setIcon(getResources().getDrawable(com.vtosters.lite.R.drawable.ic_settings_24));
|
add.setIcon(Helper.getResources().getDrawable(com.vtosters.lite.R.drawable.ic_settings_24));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -158,21 +155,21 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
linearLayout.addView(editText);
|
linearLayout.addView(editText);
|
||||||
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) editText.getLayoutParams());
|
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) editText.getLayoutParams());
|
||||||
margin.setMargins(convertDpToPixel(24f), 0, convertDpToPixel(24f), 0);
|
margin.setMargins(Helper.convertDpToPixel(24f), 0, Helper.convertDpToPixel(24f), 0);
|
||||||
editText.setLayoutParams(margin);
|
editText.setLayoutParams(margin);
|
||||||
|
|
||||||
new AlertDialog.Builder(super.n())
|
new AlertDialog.Builder(super.n())
|
||||||
.setTitle(getString("stickersapi5"))
|
.setTitle(Helper.getString("stickersapi5"))
|
||||||
.setMessage(getString("stickersapi6"))
|
.setMessage(Helper.getString("stickersapi6"))
|
||||||
.setView(linearLayout)
|
.setView(linearLayout)
|
||||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||||
TGPref.setTGBotKey(editText.getText().toString());
|
TGPref.setTGBotKey(editText.getText().toString());
|
||||||
if (r != null) r.run();
|
if (r != null) r.run();
|
||||||
}).setNegativeButton(android.R.string.cancel, null).setNeutralButton(getString("stickersapi7"), (dialog, which) -> new AlertDialog.Builder(super.n())
|
}).setNegativeButton(android.R.string.cancel, null).setNeutralButton(Helper.getString("stickersapi7"), (dialog, which) -> new AlertDialog.Builder(super.n())
|
||||||
.setTitle(getString("stickersapi8"))
|
.setTitle(Helper.getString("stickersapi8"))
|
||||||
.setMessage(getString("stickersapi9") +
|
.setMessage(Helper.getString("stickersapi9") +
|
||||||
getString("stickersapi10")).setPositiveButton(android.R.string.ok, null)
|
Helper.getString("stickersapi10")).setPositiveButton(android.R.string.ok, null)
|
||||||
.create().show()).create().show();
|
.create().show()).create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkApiKey(final Runnable r) {
|
private void checkApiKey(final Runnable r) {
|
||||||
@@ -182,7 +179,7 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
|
|
||||||
final ProgressDialog progressDialog = new ProgressDialog(context);
|
final ProgressDialog progressDialog = new ProgressDialog(context);
|
||||||
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||||
progressDialog.setMessage(getString("stickersapi1"));
|
progressDialog.setMessage(Helper.getString("stickersapi1"));
|
||||||
progressDialog.show();
|
progressDialog.show();
|
||||||
|
|
||||||
grabber.checkKey(new TelegramStickersGrabber.KeyCheckListener() {
|
grabber.checkKey(new TelegramStickersGrabber.KeyCheckListener() {
|
||||||
@@ -190,7 +187,7 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
public void onKeyChecked(boolean ok) {
|
public void onKeyChecked(boolean ok) {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
makeText(context, getString("stickersapi2"), LENGTH_SHORT).show();
|
Toast.makeText(context, Helper.getString("stickersapi2"), Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
stickersService.setBotKey(TGPref.getTGBotKey());
|
stickersService.setBotKey(TGPref.getTGBotKey());
|
||||||
@@ -202,9 +199,9 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
public void onNetError() {
|
public void onNetError() {
|
||||||
progressDialog.dismiss();
|
progressDialog.dismiss();
|
||||||
new AlertDialog.Builder(context)
|
new AlertDialog.Builder(context)
|
||||||
.setMessage(getString("stickersapi3"))
|
.setMessage(Helper.getString("stickersapi3"))
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.setPositiveButton(getString("stickersapi4"), (arg0, arg1) -> checkApiKey(r)).create().show();
|
.setPositiveButton(Helper.getString("stickersapi4"), (arg0, arg1) -> checkApiKey(r)).create().show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -214,9 +211,9 @@ 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(Helper.GetContext());
|
||||||
|
|
||||||
editPadding = convertDpToPixel(24f);
|
editPadding = Helper.convertDpToPixel(24f);
|
||||||
|
|
||||||
FrameLayout v = new FrameLayout(container.getContext());
|
FrameLayout v = new FrameLayout(container.getContext());
|
||||||
|
|
||||||
@@ -225,11 +222,11 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
|
|
||||||
fab = new FloatingActionButton(container.getContext());
|
fab = new FloatingActionButton(container.getContext());
|
||||||
fab.setImageResource(R.drawable.ic_add_24);
|
fab.setImageResource(R.drawable.ic_add_24);
|
||||||
fab.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
fab.setBackgroundTintList(ColorStateList.valueOf(Themes.getAccentColor()));
|
||||||
fab.setOnClickListener(v2 -> fabClick());
|
fab.setOnClickListener(v2 -> fabClick());
|
||||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
|
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||||
params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
|
params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
|
||||||
params.setMargins(0, 0, 0, convertDpToPixel(12f));
|
params.setMargins(0, 0, 0, Helper.convertDpToPixel(12f));
|
||||||
fab.setLayoutParams(params);
|
fab.setLayoutParams(params);
|
||||||
|
|
||||||
v.addView(recycler);
|
v.addView(recycler);
|
||||||
@@ -248,7 +245,7 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
switch (method) {
|
switch (method) {
|
||||||
case TYPE_SOCKS:
|
case TYPE_SOCKS:
|
||||||
if (TGPref.getTGProxyIP() == null) {
|
if (TGPref.getTGProxyIP() == null) {
|
||||||
openMenu(getString("stickersproxy1"));
|
openMenu(Helper.getString("stickersproxy1"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case TYPE_TOASTER_SERVER:
|
case TYPE_TOASTER_SERVER:
|
||||||
@@ -257,27 +254,27 @@ 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(Helper.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(Helper.GetContext())));
|
||||||
} else {
|
} else {
|
||||||
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(getContext())));
|
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(Helper.GetContext())));
|
||||||
}
|
}
|
||||||
linearLayout.addView(editText);
|
linearLayout.addView(editText);
|
||||||
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) editText.getLayoutParams());
|
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) editText.getLayoutParams());
|
||||||
margin.setMargins(convertDpToPixel(24f), 0, convertDpToPixel(24f), 0);
|
margin.setMargins(Helper.convertDpToPixel(24f), 0, Helper.convertDpToPixel(24f), 0);
|
||||||
editText.setLayoutParams(margin);
|
editText.setLayoutParams(margin);
|
||||||
|
|
||||||
new AlertDialog.Builder(super.n()).setTitle(getString("stickershelp1"))
|
new AlertDialog.Builder(super.n()).setTitle(Helper.getString("stickershelp1"))
|
||||||
.setMessage(getString("stickershelp2"))
|
.setMessage(Helper.getString("stickershelp2"))
|
||||||
.setView(linearLayout)
|
.setView(linearLayout)
|
||||||
.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(Helper.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));
|
||||||
@@ -287,7 +284,7 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (method == -1) {
|
if (method == -1) {
|
||||||
openMenu(getString("stickersconnection"));
|
openMenu(Helper.getString("stickersconnection"));
|
||||||
} else {
|
} else {
|
||||||
r.run();
|
r.run();
|
||||||
}
|
}
|
||||||
@@ -296,7 +293,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));
|
Helper.GetContext().registerReceiver(receiver, new IntentFilter(ACTION_RELOAD));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -305,13 +302,13 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
|
|
||||||
super.a(arg0, arg1);
|
super.a(arg0, arg1);
|
||||||
|
|
||||||
a(getString("vtltgs"));
|
a(Helper.getString("vtltgs"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void A_() {
|
public void A_() {
|
||||||
super.A_();
|
super.A_();
|
||||||
getContext().unregisterReceiver(receiver);
|
Helper.GetContext().unregisterReceiver(receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String parsePack(String pack) {
|
private String parsePack(String pack) {
|
||||||
@@ -324,12 +321,31 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.StickerPackViewHolder> {
|
public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.StickerPackViewHolder> {
|
||||||
private final String TAG = "StickerPackAdapter";
|
private String TAG = "StickerPackAdapter";
|
||||||
|
|
||||||
|
public class StickerPackViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
private SwitchCompat switchCompat;
|
||||||
|
private ImageView stickerImage, updateButton, deleteButton;
|
||||||
|
private TextView name, count;
|
||||||
|
private LinearLayout layout;
|
||||||
|
|
||||||
|
StickerPackViewHolder(@NonNull View view) {
|
||||||
|
super(view);
|
||||||
|
|
||||||
|
switchCompat = (SwitchCompat) view.findViewById(R.id.choose_btn);
|
||||||
|
stickerImage = (ImageView) view.findViewById(R.id.photo);
|
||||||
|
updateButton = (ImageView) view.findViewById(R.id.button_update);
|
||||||
|
deleteButton = (ImageView) view.findViewById(R.id.action_delete);
|
||||||
|
name = (TextView) view.findViewById(R.id.vkim_cancel);
|
||||||
|
count = (TextView) view.findViewById(R.id.vkim_cancel_label_text);
|
||||||
|
layout = (LinearLayout) view.findViewById(R.id.linearLayout5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public StickerPackViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public StickerPackViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
var view = LayoutInflater.from(parent.getContext()).inflate(getIdentifier("tgs_entry", "layout"), parent, false);
|
var view = LayoutInflater.from(parent.getContext()).inflate(Helper.getIdentifier("tgs_entry", "layout"), parent, false);
|
||||||
return new StickerPackViewHolder(view);
|
return new StickerPackViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,19 +365,19 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
holder.stickerImage.setImageURI(Uri.parse("file://" + f.getAbsolutePath()));
|
holder.stickerImage.setImageURI(Uri.parse("file://" + f.getAbsolutePath()));
|
||||||
} else {
|
} else {
|
||||||
holder.stickerImage.setImageDrawable(getResources().getDrawable(R.drawable.icon_vk_104));
|
holder.stickerImage.setImageDrawable(Helper.getResources().getDrawable(R.drawable.icon_vk_104));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.updateButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.ic_camera_switch_48)));
|
holder.updateButton.setImageDrawable(Themes.recolorDrawable(Helper.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(Helper.GetContext().getFilesDir(), new File("VT-Stickers", pack.id).getAbsolutePath()));
|
||||||
});
|
});
|
||||||
|
|
||||||
holder.deleteButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.vkim_ic_msg_delete)));
|
holder.deleteButton.setImageDrawable(Themes.recolorDrawable(Helper.getResources().getDrawable(R.drawable.vkim_ic_msg_delete)));
|
||||||
holder.deleteButton.setOnClickListener(listener -> {
|
holder.deleteButton.setOnClickListener(listener -> {
|
||||||
stickersService.deletePack(pack);
|
stickersService.deletePack(pack);
|
||||||
notifyItemRemoved(position);
|
notifyItemRemoved(position);
|
||||||
@@ -370,13 +386,13 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
holder.name.setText(pack.title);
|
holder.name.setText(pack.title);
|
||||||
holder.switchCompat.setChecked(pack.enabled);
|
holder.switchCompat.setChecked(pack.enabled);
|
||||||
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 + " " + Helper.getString("stickerscount"));
|
||||||
|
|
||||||
holder.layout.setBackgroundColor(getNavbarColor());
|
holder.layout.setBackgroundColor(Prefs.getNavbarColor());
|
||||||
|
|
||||||
// Color костыль
|
// Color костыль
|
||||||
int color = getTextAttr();
|
int color = Themes.getTextAttr();
|
||||||
int secondary = getSTextAttr();
|
int secondary = Themes.getSTextAttr();
|
||||||
|
|
||||||
holder.name.setTextColor(color);
|
holder.name.setTextColor(color);
|
||||||
holder.count.setTextColor(secondary);
|
holder.count.setTextColor(secondary);
|
||||||
@@ -386,28 +402,6 @@ public class StickersFragment extends ToolbarFragment {
|
|||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return stickersService.getPacksListReference().size();
|
return stickersService.getPacksListReference().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StickerPackViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
private final SwitchCompat switchCompat;
|
|
||||||
private final ImageView stickerImage;
|
|
||||||
private final ImageView updateButton;
|
|
||||||
private final ImageView deleteButton;
|
|
||||||
private final TextView name;
|
|
||||||
private final TextView count;
|
|
||||||
private final LinearLayout layout;
|
|
||||||
|
|
||||||
StickerPackViewHolder(@NonNull View view) {
|
|
||||||
super(view);
|
|
||||||
|
|
||||||
switchCompat = view.findViewById(R.id.choose_btn);
|
|
||||||
stickerImage = view.findViewById(R.id.photo);
|
|
||||||
updateButton = view.findViewById(R.id.button_update);
|
|
||||||
deleteButton = view.findViewById(R.id.action_delete);
|
|
||||||
name = view.findViewById(R.id.vkim_cancel);
|
|
||||||
count = view.findViewById(R.id.vkim_cancel_label_text);
|
|
||||||
layout = view.findViewById(R.id.linearLayout5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-18
@@ -1,8 +1,5 @@
|
|||||||
package ru.vtosters.lite.ui.fragments.tgstickers;
|
package ru.vtosters.lite.ui.fragments.tgstickers;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getString;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||||
@@ -11,6 +8,7 @@ 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.utils.Helper;
|
||||||
import ru.vtosters.lite.ui.PreferencesUtil;
|
import ru.vtosters.lite.ui.PreferencesUtil;
|
||||||
|
|
||||||
public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragment {
|
public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragment {
|
||||||
@@ -19,19 +17,19 @@ 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 = Helper.GetContext().getResources().getIdentifier("empty", "xml", Helper.GetContext().getPackageName());
|
||||||
this.a(vtosterXml);
|
this.a(vtosterXml);
|
||||||
|
|
||||||
PreferencesUtil.addPreferenceCategory(this, getString("sprefsstickers"));
|
PreferencesUtil.addPreferenceCategory(this, Helper.getString("sprefsstickers"));
|
||||||
PreferencesUtil.addPreference(this, "", getString("sprefsdelkey"), "", null, preference -> {
|
PreferencesUtil.addPreference(this, "", Helper.getString("sprefsdelkey"), "", null, preference -> {
|
||||||
TGPref.setTGBotKey(null);
|
TGPref.setTGBotKey(null);
|
||||||
ToastUtils.a(getString("sprefsdelkey2"));
|
ToastUtils.a(Helper.getString("sprefsdelkey2"));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
PreferencesUtil.addPreferenceCategory(this, getString("sprefsnetwork"));
|
PreferencesUtil.addPreferenceCategory(this, Helper.getString("sprefsnetwork"));
|
||||||
PreferencesUtil.addListPreference(this, "VTGS:CM", "0", getString("sprefsctype"), new CharSequence[]{
|
PreferencesUtil.addListPreference(this, "VTGS:CM", "0", Helper.getString("sprefsctype"), new CharSequence[]{
|
||||||
getString("ctypedirect"), getString("ctypesocks")
|
Helper.getString("ctypedirect"), Helper.getString("ctypesocks")
|
||||||
}, new String[]{
|
}, new String[]{
|
||||||
"0", "2"
|
"0", "2"
|
||||||
});
|
});
|
||||||
@@ -46,22 +44,22 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
PreferencesUtil.addPreferenceCategory(this, getString("ssocks"));
|
PreferencesUtil.addPreferenceCategory(this, Helper.getString("ssocks"));
|
||||||
|
|
||||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_host", getString("ssockshost"), (preference, o) -> {
|
PreferencesUtil.addEditTextPreference(this, "tg_proxy_host", Helper.getString("ssockshost"), (preference, o) -> {
|
||||||
TGPref.setTGProxyIP((String) o);
|
TGPref.setTGProxyIP((String) o);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_port", getString("ssocksport"), (preference, o) -> {
|
PreferencesUtil.addEditTextPreference(this, "tg_proxy_port", Helper.getString("ssocksport"), (preference, o) -> {
|
||||||
try {
|
try {
|
||||||
TGPref.setTGProxyPort(Integer.parseInt((String) o));
|
TGPref.setTGProxyPort(Integer.parseInt((String) o));
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ToastUtils.a(getString("ssockswport"));
|
ToastUtils.a(Helper.getString("ssockswport"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
PreferencesUtil.addMaterialSwitchPreference(this, "tg_proxy_auth", getString("ssocksauth"), "", null, false, (preference, o) -> {
|
PreferencesUtil.addMaterialSwitchPreference(this, "tg_proxy_auth", Helper.getString("ssocksauth"), "", null, false, (preference, o) -> {
|
||||||
boolean value = (boolean) o;
|
boolean value = (boolean) o;
|
||||||
|
|
||||||
a("tg_proxy_login").a(value); // findPreference("tg_proxy_login").setEnabled(value);
|
a("tg_proxy_login").a(value); // findPreference("tg_proxy_login").setEnabled(value);
|
||||||
@@ -70,11 +68,11 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
|||||||
TGPref.setTGProxyPassEnabled(value);
|
TGPref.setTGProxyPassEnabled(value);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_login", getString("ssockslogin"), (preference, o) -> {
|
PreferencesUtil.addEditTextPreference(this, "tg_proxy_login", Helper.getString("ssockslogin"), (preference, o) -> {
|
||||||
TGPref.setTGProxyUserPass((String) o, TGPref.getTGProxyPass());
|
TGPref.setTGProxyUserPass((String) o, TGPref.getTGProxyPass());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_pass", getString("ssockspass"), (preference, o) -> {
|
PreferencesUtil.addEditTextPreference(this, "tg_proxy_pass", Helper.getString("ssockspass"), (preference, o) -> {
|
||||||
TGPref.setTGProxyUserPass(TGPref.getTGProxyUser(), (String) o);
|
TGPref.setTGProxyUserPass(TGPref.getTGProxyUser(), (String) o);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@@ -85,7 +83,7 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int aq() {
|
public int aq() {
|
||||||
return getContext().getResources().getIdentifier("vtltgs", "string", getContext().getPackageName());
|
return Helper.GetContext().getResources().getIdentifier("vtltgs", "string", Helper.GetContext().getPackageName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
package ru.vtosters.lite.ui.vkui;
|
package ru.vtosters.lite.ui.vkui;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.vk.core.dialogs.bottomsheet.ModalBottomSheet;
|
import com.vk.core.dialogs.bottomsheet.ModalBottomSheet;
|
||||||
|
|
||||||
|
import com.vtosters.lite.R;
|
||||||
|
|
||||||
|
import ru.vtosters.lite.utils.Helper;
|
||||||
|
|
||||||
public class ModalBottomSheetProxy {
|
public class ModalBottomSheetProxy {
|
||||||
public final ModalBottomSheet.a builder;
|
public final ModalBottomSheet.a builder;
|
||||||
|
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
package ru.vtosters.lite.utils;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getApplicationName;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.VERSIONNAME;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.oldabout;
|
|
||||||
|
|
||||||
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,172 +0,0 @@
|
|||||||
package ru.vtosters.lite.utils;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.BooleanFalse;
|
|
||||||
|
|
||||||
import android.content.ContentValues;
|
|
||||||
import android.database.Cursor;
|
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import com.vk.im.engine.events.OnMsgUpdateEvent;
|
|
||||||
import com.vk.im.engine.internal.longpoll.a.MsgDeleteLpTask;
|
|
||||||
import com.vk.im.engine.internal.storage.CacheEnvironment;
|
|
||||||
import com.vk.im.engine.models.messages.Msg;
|
|
||||||
import com.vk.im.engine.models.messages.MsgFromUser;
|
|
||||||
import com.vk.im.engine.models.messages.NestedMsg;
|
|
||||||
import com.vk.libsqliteext.CustomSqliteExtensions;
|
|
||||||
|
|
||||||
import org.sqlite.database.sqlite.SQLiteDatabase;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ru.vtosters.lite.encryption.EncryptProvider;
|
|
||||||
|
|
||||||
public class DeletedMessagesHandler {
|
|
||||||
|
|
||||||
private static List<Integer> sDeletedMessagesList = new ArrayList<>();
|
|
||||||
|
|
||||||
private static SQLiteDatabase sVKSQLiteDatabase;
|
|
||||||
private static int sBodyIndex = -1;
|
|
||||||
private static DeletedMessagesDBHelper sVTDatabase;
|
|
||||||
|
|
||||||
public static void reloadMessagesList() {
|
|
||||||
if (sVTDatabase == null) {
|
|
||||||
sVTDatabase = new DeletedMessagesDBHelper();
|
|
||||||
}
|
|
||||||
sDeletedMessagesList = new ArrayList<>(sVTDatabase.loadAllMessages());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void grabVKDatabase(CacheEnvironment storageEnvironment) {
|
|
||||||
sVKSQLiteDatabase = storageEnvironment.b();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean hook() {
|
|
||||||
return BooleanFalse("undeletemsg");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setBodyDBParser(Msg msg) {
|
|
||||||
if (!(msg instanceof MsgFromUser)) return;
|
|
||||||
|
|
||||||
for (Integer integer : sDeletedMessagesList) {
|
|
||||||
MsgFromUser msgFromUser = (MsgFromUser) msg;
|
|
||||||
checkForNestedMsg(msgFromUser.g);
|
|
||||||
if (integer == msg.d) {
|
|
||||||
editTextOfMsg((MsgFromUser) msg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void checkForNestedMsg(List<NestedMsg> nestedMsgs) {
|
|
||||||
for (NestedMsg nestedMsg : nestedMsgs) {
|
|
||||||
if (!nestedMsg.i.isEmpty()) checkForNestedMsg(nestedMsg.i);
|
|
||||||
|
|
||||||
nestedMsg.b(EncryptProvider.decryptMessage(nestedMsg.E(), nestedMsg.h().c));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void editTextOfMsg(MsgFromUser msgFromUser) {
|
|
||||||
if (!msgFromUser.e.startsWith(getPreifxUndelete())) {
|
|
||||||
msgFromUser.e = getPreifxUndelete() + EncryptProvider.decryptMessage(msgFromUser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getPreifxUndelete() {
|
|
||||||
String string = getPreferences().getString("undeletemsg_prefix", "");
|
|
||||||
if (string.isEmpty()) {
|
|
||||||
return "[Удалено] ";
|
|
||||||
}
|
|
||||||
if (string.equals("icon")) {
|
|
||||||
return "\uD83D\uDDD1 ";
|
|
||||||
}
|
|
||||||
if (string.equals("icon2")) {
|
|
||||||
return "❌ ";
|
|
||||||
}
|
|
||||||
return "[Удалено] ";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void updateDialog(MsgDeleteLpTask msgDeleteLpTask) {
|
|
||||||
Cursor c = getMessageFromDatabaseById(msgDeleteLpTask.c);
|
|
||||||
if (c == null) return;
|
|
||||||
|
|
||||||
int localId = c.getInt(c.getColumnIndex("local_id"));
|
|
||||||
|
|
||||||
String str = DeletedMessagesHandler.class.getSimpleName();
|
|
||||||
msgDeleteLpTask.a.a(str, new OnMsgUpdateEvent(str, msgDeleteLpTask.b, localId));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void hookDeletedMessageId(MsgDeleteLpTask msgDeleteLpTask) {
|
|
||||||
if (!hook()) return;
|
|
||||||
|
|
||||||
int messageId = msgDeleteLpTask.c;
|
|
||||||
|
|
||||||
Cursor c = getMessageFromDatabaseById(messageId);
|
|
||||||
if (c == null) return;
|
|
||||||
if (sBodyIndex == -1) sBodyIndex = c.getColumnIndex("body");
|
|
||||||
if (TextUtils.isEmpty(c.getString(sBodyIndex))) {
|
|
||||||
deleteMessageFromDB(messageId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sDeletedMessagesList.add(messageId);
|
|
||||||
sVTDatabase.saveDeletedMessage(messageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Cursor getMessageFromDatabaseById(int messageId) {
|
|
||||||
String query = "SELECT * FROM messages WHERE vk_id = " + messageId;
|
|
||||||
Cursor c = CustomSqliteExtensions.a(sVKSQLiteDatabase, query);
|
|
||||||
if (!c.moveToFirst()) return null;
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void deleteMessageFromDB(int messageId) {
|
|
||||||
sVKSQLiteDatabase.execSQL("DELETE FROM messages WHERE vk_id = " + messageId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DeletedMessagesDBHelper extends SQLiteOpenHelper {
|
|
||||||
|
|
||||||
public DeletedMessagesDBHelper() {
|
|
||||||
super(getContext(), "deleted_msgs", null, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(android.database.sqlite.SQLiteDatabase db) {
|
|
||||||
db.execSQL("create table deleted_msgs (id integer primary key, msgId integer)");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpgrade(android.database.sqlite.SQLiteDatabase db, int oldVersion, int newVersion) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveDeletedMessage(int msgId) {
|
|
||||||
android.database.sqlite.SQLiteDatabase sqLiteDatabase = getWritableDatabase();
|
|
||||||
|
|
||||||
ContentValues contentValues = new ContentValues();
|
|
||||||
contentValues.put("msgId", msgId);
|
|
||||||
|
|
||||||
sqLiteDatabase.insert("deleted_msgs", null, contentValues);
|
|
||||||
sqLiteDatabase.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Integer> loadAllMessages() {
|
|
||||||
List<Integer> msgIdsList = new ArrayList<>();
|
|
||||||
|
|
||||||
Cursor cursor = getReadableDatabase().query("deleted_msgs", null, null, null, null, null, null);
|
|
||||||
if (cursor.moveToFirst()) {
|
|
||||||
int msgIdIndex = cursor.getColumnIndex("msgId");
|
|
||||||
|
|
||||||
do {
|
|
||||||
msgIdsList.add(cursor.getInt(msgIdIndex));
|
|
||||||
} while (cursor.moveToNext());
|
|
||||||
cursor.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return msgIdsList;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,12 @@
|
|||||||
package ru.vtosters.lite.utils;
|
package ru.vtosters.lite.utils;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.isEmpty;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.isEnableExternalOpening;
|
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.vk.dto.common.VideoFile;
|
import com.vk.dto.common.VideoFile;
|
||||||
|
|
||||||
@@ -30,41 +27,51 @@ public class ExternalLinkHandler {
|
|||||||
private static final Map<String, String> qualities = new HashMap<>();
|
private static final Map<String, String> qualities = new HashMap<>();
|
||||||
|
|
||||||
public static boolean parseVideoFile(VideoFile file, Context context) {
|
public static boolean parseVideoFile(VideoFile file, Context context) {
|
||||||
|
if (!Prefs.isEnableExternalOpening()) return false;
|
||||||
|
|
||||||
if (checkYoutubeLink(file)) {
|
if (checkYoutubeLink(file)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setData(Uri.parse(file.n));
|
intent.setData(Uri.parse(file.n));
|
||||||
|
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
return true;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!isEnableExternalOpening()) return false;
|
} else if (checkVkVideo(file)) {
|
||||||
|
|
||||||
if (checkVkVideo(file)) {
|
|
||||||
if (qualities.size() == 1) {
|
if (qualities.size() == 1) {
|
||||||
|
|
||||||
startExternalVideo((String) qualities.values().toArray()[0]);
|
startExternalVideo((String) qualities.values().toArray()[0]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
String[] titles = qualities.keySet().toArray(new String[0]);
|
String[] titles = qualities.keySet().toArray(new String[0]);
|
||||||
|
|
||||||
new AlertDialog.Builder(context)
|
new AlertDialog.Builder(context)
|
||||||
.setItems(titles, ((dialog, which) -> {
|
.setItems(titles, ((dialog, which) -> {
|
||||||
|
|
||||||
startExternalVideo(qualities.get(titles[which]));
|
startExternalVideo(qualities.get(titles[which]));
|
||||||
|
|
||||||
}))
|
}))
|
||||||
.show();
|
.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean checkYoutubeLink(VideoFile file) {
|
private static boolean checkYoutubeLink(VideoFile file) {
|
||||||
if (!isEmpty(file.n)) {
|
if (!Helper.isEmpty(file.n)) {
|
||||||
for (String filter : filters) {
|
for (String filter : filters) {
|
||||||
if (file.n.contains(filter))
|
if (file.n.contains(filter))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,25 +85,25 @@ public class ExternalLinkHandler {
|
|||||||
* this.k = var3.optString("mp4_2160");
|
* this.k = var3.optString("mp4_2160");
|
||||||
*/
|
*/
|
||||||
public static boolean checkVkVideo(VideoFile videoFile) {
|
public static boolean checkVkVideo(VideoFile videoFile) {
|
||||||
if (!isEmpty(videoFile.e)) {
|
if (!Helper.isEmpty(videoFile.e)) {
|
||||||
qualities.put("240", videoFile.e);
|
qualities.put("240", videoFile.e);
|
||||||
}
|
}
|
||||||
if (!isEmpty(videoFile.f)) {
|
if (!Helper.isEmpty(videoFile.f)) {
|
||||||
qualities.put("360", videoFile.f);
|
qualities.put("360", videoFile.f);
|
||||||
}
|
}
|
||||||
if (!isEmpty(videoFile.g)) {
|
if (!Helper.isEmpty(videoFile.g)) {
|
||||||
qualities.put("480", videoFile.g);
|
qualities.put("480", videoFile.g);
|
||||||
}
|
}
|
||||||
if (!isEmpty(videoFile.h)) {
|
if (!Helper.isEmpty(videoFile.h)) {
|
||||||
qualities.put("720", videoFile.h);
|
qualities.put("720", videoFile.h);
|
||||||
}
|
}
|
||||||
if (!isEmpty(videoFile.i)) {
|
if (!Helper.isEmpty(videoFile.i)) {
|
||||||
qualities.put("1080", videoFile.i);
|
qualities.put("1080", videoFile.i);
|
||||||
}
|
}
|
||||||
if (!isEmpty(videoFile.j)) {
|
if (!Helper.isEmpty(videoFile.j)) {
|
||||||
qualities.put("1440", videoFile.j);
|
qualities.put("1440", videoFile.j);
|
||||||
}
|
}
|
||||||
if (!isEmpty(videoFile.k)) {
|
if (!Helper.isEmpty(videoFile.k)) {
|
||||||
qualities.put("2160", videoFile.k);
|
qualities.put("2160", videoFile.k);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,27 +118,34 @@ public class ExternalLinkHandler {
|
|||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
|
|
||||||
String packageName = getMXPlayerPackageName();
|
String packageName = getMXPlayerPackageName();
|
||||||
if (!isEmpty(packageName)) {
|
if (!Helper.isEmpty(packageName)) {
|
||||||
|
|
||||||
intent.setPackage(packageName);
|
intent.setPackage(packageName);
|
||||||
intent.setDataAndType(uri, "application/mp4");
|
intent.setDataAndType(uri, "application/mp4");
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
intent.setAction(Intent.ACTION_VIEW);
|
intent.setAction(Intent.ACTION_VIEW);
|
||||||
intent.setDataAndType(uri, "video/mp4");
|
intent.setDataAndType(uri, "video/mp4");
|
||||||
|
|
||||||
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);
|
|
||||||
|
Helper.GetContext().startActivity(intent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getMXPlayerPackageName() {
|
private static String getMXPlayerPackageName() {
|
||||||
for (ApplicationInfo info : getContext().getPackageManager().getInstalledApplications(0)) {
|
for (ApplicationInfo info : Helper.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;
|
||||||
|
|||||||
@@ -1,251 +0,0 @@
|
|||||||
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 android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
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<>();
|
|
||||||
|
|
||||||
static SharedPreferences prefs = getContext().getSharedPreferences("com.vtosters.lite_preferences", Context.MODE_PRIVATE);
|
|
||||||
|
|
||||||
public static SharedPreferences getPrefs() {
|
|
||||||
if (prefs == null) prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
||||||
return prefs;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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) {
|
|
||||||
Toast.makeText(getContext(), text, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
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 Activity getCurrentActivity() {
|
|
||||||
if (activities.size() == 0) return null;
|
|
||||||
else return activities.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float[] getCenterScreenCoords() {
|
|
||||||
int width = getResources().getDisplayMetrics().widthPixels;
|
|
||||||
int height = getResources().getDisplayMetrics().heightPixels;
|
|
||||||
|
|
||||||
int centerWidth = width/2;
|
|
||||||
int centerHeight = height/2;
|
|
||||||
return new float[] {centerWidth, centerHeight};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package ru.vtosters.lite.utils;
|
||||||
|
|
||||||
|
import static android.content.Context.ACTIVITY_SERVICE;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.app.ActivityManager;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
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;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
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 Proxy.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() {
|
||||||
|
GetContext().startActivity(Intent.makeRestartActivityTask(GetContext().getPackageManager().getLaunchIntentForPackage(GetContext().getPackageName()).getComponent()));
|
||||||
|
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 Helper.GetContext().getString(Integer.parseInt(String.valueOf(Helper.GetContext().getResources().getIdentifier(str, "string", Helper.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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +1,20 @@
|
|||||||
package ru.vtosters.lite.utils;
|
package ru.vtosters.lite.utils;
|
||||||
|
|
||||||
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 = Helper.GetContext().getPackageManager();
|
||||||
var packageName = getPackageName();
|
var packageName = Helper.getPackageName();
|
||||||
packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconDefault"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
packageManager.setComponentEnabledSetting(new ComponentName(packageName, Helper.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, Helper.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 = Helper.GetContext().getPackageManager();
|
||||||
var packageName = getPackageName();
|
var packageName = Helper.getPackageName();
|
||||||
packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconDefault"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
packageManager.setComponentEnabledSetting(new ComponentName(packageName, Helper.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, Helper.getPackageName() + ".VTIconVK"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,239 +0,0 @@
|
|||||||
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.DiscoverFragment;
|
|
||||||
import com.vk.discover.GatewaysFragment;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
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) {
|
|
||||||
switch (getPreferences().getString("commentssort", "")) {
|
|
||||||
case "new":
|
|
||||||
return "desc";
|
|
||||||
case "old":
|
|
||||||
return "asc";
|
|
||||||
default:
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getUpdateNewsfeed(boolean refresh_timeout) {
|
|
||||||
switch (getPreferences().getString("newsupdate", "")) {
|
|
||||||
case "no_update":
|
|
||||||
return MAX_VALUE;
|
|
||||||
case "imd_update":
|
|
||||||
return 10000L;
|
|
||||||
default:
|
|
||||||
return Preference.b().getLong(refresh_timeout ? "refresh_timeout_top" : "refresh_timeout_recent", 600000L);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Class getStartFragment() {
|
|
||||||
switch (getPreferences().getString("start_values", "")) {
|
|
||||||
case "newsfeed":
|
|
||||||
return newfeed() ? HomeFragment.class : NewsfeedFragment.class;
|
|
||||||
case "messenger":
|
|
||||||
return DialogsFragment.class;
|
|
||||||
case "groups":
|
|
||||||
return GroupsFragment.class;
|
|
||||||
case "music":
|
|
||||||
return MusicFragment.class;
|
|
||||||
case "friends":
|
|
||||||
return FriendsFragment.class;
|
|
||||||
case "photos":
|
|
||||||
return PhotosFragment.class;
|
|
||||||
case "videos":
|
|
||||||
return VideosFragment.class;
|
|
||||||
case "settings":
|
|
||||||
return SettingsListFragment.class;
|
|
||||||
case "apps":
|
|
||||||
return AppsFragment.class;
|
|
||||||
case "discover":
|
|
||||||
return newfeed() ? GatewaysFragment.class : DiscoverFragment.class;
|
|
||||||
case "notifications":
|
|
||||||
return NotificationsContainerFragment.class;
|
|
||||||
case "money":
|
|
||||||
return MoneyTransfersFragment.class;
|
|
||||||
case "games":
|
|
||||||
return GamesFragment.class;
|
|
||||||
case "liked":
|
|
||||||
return FaveTabFragment.class;
|
|
||||||
case "menu":
|
|
||||||
return MenuFragment.class;
|
|
||||||
case "profile":
|
|
||||||
return ProfileFragment.class;
|
|
||||||
case "lives":
|
|
||||||
return LivesTabsFragment.class;
|
|
||||||
case "docs":
|
|
||||||
return DocumentsViewFragment.class;
|
|
||||||
case "brtd":
|
|
||||||
return BirthdaysFragment.class;
|
|
||||||
default:
|
|
||||||
return getInstance().getSelectedTabs().get(0).fragmentClass;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
package ru.vtosters.lite.utils;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.opusmodule;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.vk.medianative.MediaNative;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
|
|
||||||
public class OpusLoader {
|
|
||||||
private static long timetracker;
|
|
||||||
private static boolean inited;
|
|
||||||
|
|
||||||
public static void LoadLibrary(String libname){
|
|
||||||
try {
|
|
||||||
System.loadLibrary(libname);
|
|
||||||
inited = true;
|
|
||||||
} catch (UnsatisfiedLinkError unused2) {
|
|
||||||
if(dev()) Log.d("VTLite", "Failed to load " + libname);
|
|
||||||
inited = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long getLength() {
|
|
||||||
if (isReadyToUse()) {
|
|
||||||
long length = System.currentTimeMillis() - timetracker;
|
|
||||||
timetracker = System.currentTimeMillis();
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
return 0L;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int AudioStartRecordBridge(String str) {
|
|
||||||
if (isReadyToUse()) {
|
|
||||||
// Init custom AudioStartRecord
|
|
||||||
timetracker = System.currentTimeMillis();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return MediaNative.nativeAudioStartRecord(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int AudioWriteFrameBridge(ByteBuffer buffer, int length) {
|
|
||||||
if (isReadyToUse()) {
|
|
||||||
// Init custom AudioWriteFrame
|
|
||||||
}
|
|
||||||
return MediaNative.nativeAudioWriteFrame(buffer, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AudioStopRecordBridge() {
|
|
||||||
if (isReadyToUse()) {
|
|
||||||
// Init custom AudioStopRecord
|
|
||||||
}
|
|
||||||
MediaNative.nativeAudioStopRecord();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isReadyToUse() {
|
|
||||||
return opusmodule() && inited;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,346 +0,0 @@
|
|||||||
package ru.vtosters.lite.utils;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.ui.fragments.multiaccount.MultiAccountManager.migrate;
|
|
||||||
import static ru.vtosters.lite.utils.DeletedMessagesHandler.reloadMessagesList;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.fixGapps;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.registerActivities;
|
|
||||||
import static ru.vtosters.lite.utils.Newsfeed.setupFilters;
|
|
||||||
import static ru.vtosters.lite.utils.OpusLoader.LoadLibrary;
|
|
||||||
import static ru.vtosters.lite.utils.Proxy.setProxy;
|
|
||||||
import static ru.vtosters.lite.utils.Themes.systemThemeChanger;
|
|
||||||
|
|
||||||
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 Integer VKBUILD = 12116; // 3439 orig
|
|
||||||
public static String VKVER = "7.24"; // 5.29 orig
|
|
||||||
|
|
||||||
public static void init(Application application) {
|
|
||||||
setupFilters();
|
|
||||||
fixGapps();
|
|
||||||
setProxy();
|
|
||||||
migrate();
|
|
||||||
reloadMessagesList();
|
|
||||||
registerActivities(application);
|
|
||||||
LoadLibrary("vkopustest");
|
|
||||||
systemThemeChanger();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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 opusmodule() {
|
|
||||||
return BooleanTrue("opusmodule");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean systemtheme() {
|
|
||||||
return BooleanTrue("systemtheme");
|
|
||||||
}
|
|
||||||
|
|
||||||
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("vkver", "");
|
|
||||||
return !string.isEmpty() ? string : VKVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int VKVersionBuild() {
|
|
||||||
String string = getPreferences().getString("vkbuild", "");
|
|
||||||
return !string.isEmpty() ? Integer.parseInt(string) : VKBUILD;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long VKVersionBuildLong() {
|
|
||||||
return (long) VKVersionBuild();
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,834 @@
|
|||||||
|
package ru.vtosters.lite.utils;
|
||||||
|
|
||||||
|
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.View;
|
||||||
|
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.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.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 kotlin.jvm.internal.Intrinsics;
|
||||||
|
|
||||||
|
public class Prefs {
|
||||||
|
public static String VERSIONNAME = "2.0 DEV";
|
||||||
|
private static List<String> mFilters;
|
||||||
|
private static List<Activity> activities = new ArrayList<>();
|
||||||
|
|
||||||
|
public static boolean BooleanFalse(String key) {
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Helper.GetContext());
|
||||||
|
return prefs.getBoolean(key, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean BooleanTrue(String key) {
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Helper.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 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 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 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.loadAssetTextAsString(Helper.GetContext(), "version.properties");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String loadAssetTextAsString(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=", "");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getBranch() {
|
||||||
|
return Helper.GetPreferences().getString("ota_branches", "Stable");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDarkVKUI() {
|
||||||
|
return !VKThemeHelper.d() ? "1" : "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMeToken() {
|
||||||
|
return Helper.GetPreferences().getString("me_token", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getNavbarColor() {
|
||||||
|
return VKThemeHelper.a((int) R.attr.tabbar_background);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSSFSLink() {
|
||||||
|
return SSFSDomain() + "?token=" + ru.vtosters.lite.utils.Helper.GetUserToken() + "&vt_dark=" + getDarkVKUI() + "&secret=" + ru.vtosters.lite.utils.Helper.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(Helper.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 BooleanFalse("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 = Helper.GetPreferences().getString("proxyHostHTTP", "");
|
||||||
|
return string.isEmpty() ? "192.168.0.1" : string;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String proxyHostHTTPS() {
|
||||||
|
String string = Helper.GetPreferences().getString("proxyHostHTTPS", "");
|
||||||
|
return string.isEmpty() ? "192.168.0.1" : string;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String proxyHostSocks() {
|
||||||
|
String string = Helper.GetPreferences().getString("proxyHostSocks", "");
|
||||||
|
return string.isEmpty() ? "192.168.0.1" : string;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String proxyPortHTTP() {
|
||||||
|
String string = Helper.GetPreferences().getString("proxyPortHTTP", "");
|
||||||
|
return string.isEmpty() ? "8888" : string;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String proxyPortHTTPS() {
|
||||||
|
String string = ru.vtosters.lite.utils.Helper.GetPreferences().getString("proxyPortHTTPS", "");
|
||||||
|
return string.isEmpty() ? "8888" : string;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String proxyPortSocks() {
|
||||||
|
String string = Helper.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 void setMeToken(String str) {
|
||||||
|
ru.vtosters.lite.utils.Helper.GetPreferences().edit().putString("me_token", str).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
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 String widgetads() {
|
||||||
|
return ads() ? "null" : "app_widget";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setNavbarColor(Window window, int i) {
|
||||||
|
if (navbar()) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
window.setNavigationBarColor(getNavbarColor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Build.VERSION.SDK_INT >= 31 && VKThemeHelper.d()) {
|
||||||
|
View decorView = window.getDecorView();
|
||||||
|
Intrinsics.a((Object) decorView, "view");
|
||||||
|
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | 8192);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
String string = Helper.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(Helper.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(Helper.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(Helper.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 String SSFSDomain() {
|
||||||
|
String string = Helper.GetPreferences().getString("ssfscustom", "");
|
||||||
|
if (!string.isEmpty()) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
return "https://sf.vknext.ru";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String VKVersion() {
|
||||||
|
String string = Helper.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(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 = Helper.GetPreferences().getString("lang_value", "");
|
||||||
|
if (string.equals("system")) {
|
||||||
|
return Locale.getDefault().getLanguage();
|
||||||
|
}
|
||||||
|
return string.isEmpty() ? Locale.getDefault().getLanguage() : string;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean proxy() {
|
||||||
|
return ru.vtosters.lite.utils.Helper.GetPreferences().getString("proxy", "").equals("xtrafrancyz");
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
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 Class getStartFragment() {
|
||||||
|
String string = ru.vtosters.lite.utils.Helper.GetPreferences().getString("start_value", "");
|
||||||
|
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(NavigatorKeys.v)) {
|
||||||
|
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 DiscoverFragment.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 : Feed2049.b.c();
|
||||||
|
}
|
||||||
|
|
||||||
|
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) ru.vtosters.lite.utils.Helper.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", ru.vtosters.lite.utils.Helper.getResources().getString(R.string.audio_message_play_error), NotificationManager.IMPORTANCE_LOW));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ package ru.vtosters.lite.utils;
|
|||||||
public class ProfileHide {
|
public class ProfileHide {
|
||||||
// private static final OkHttpClient client = new OkHttpClient();
|
// private static final OkHttpClient client = new OkHttpClient();
|
||||||
//
|
//
|
||||||
|
// /* JADX WARN: Type inference failed for: r1v1, types: [boolean] */
|
||||||
|
// /* JADX WARNING: Unknown variable types count: 1 */
|
||||||
// public static void injectMap(HashMap<Integer, AdministratorProfileFragment.a.a> hashMap) {
|
// public static void injectMap(HashMap<Integer, AdministratorProfileFragment.a.a> hashMap) {
|
||||||
// for (int i = 0; VTVerifications.sServiceAccountsMap.valueOf(i) < 0; i++) {
|
// for (int i = 0; VTVerifications.sServiceAccountsMap.valueOf(i) < 0; i++) {
|
||||||
// boolean valueOf = VTVerifications.sServiceAccountsMap.valueOf(Helper.getId());
|
// boolean valueOf = VTVerifications.sServiceAccountsMap.valueOf(Helper.getId());
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package ru.vtosters.lite.utils;
|
package ru.vtosters.lite.utils;
|
||||||
|
|
||||||
import static java.lang.System.*;
|
import static ru.vtosters.lite.utils.Prefs.proxyHostHTTP;
|
||||||
import static ru.vtosters.lite.utils.Globals.*;
|
import static ru.vtosters.lite.utils.Prefs.proxyHostHTTPS;
|
||||||
import static ru.vtosters.lite.utils.Preferences.*;
|
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;
|
||||||
|
|
||||||
@@ -40,178 +43,127 @@ public class Proxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getApiCom() {
|
public static String getApiCom() {
|
||||||
String string = getPreferences().getString("proxyapi", "");
|
if (!Prefs.proxy()) {
|
||||||
if (!proxy() & string.isEmpty()) {
|
|
||||||
return "api.vk.com";
|
return "api.vk.com";
|
||||||
}
|
}
|
||||||
return string;
|
String string = Helper.GetPreferences().getString("proxyapi", "");
|
||||||
|
if (!string.isEmpty()) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
return "vk-api-proxy.xtrafrancyz.net";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getAwayPhpCom() {
|
public static String getAwayPhpCom() {
|
||||||
String string = getPreferences().getString("proxyapi", "");
|
if (!Prefs.proxy()) {
|
||||||
if (!proxy() & string.isEmpty()) {
|
|
||||||
return "m.vk.com";
|
return "m.vk.com";
|
||||||
}
|
}
|
||||||
return string;
|
String string = Helper.GetPreferences().getString("proxyapi", "");
|
||||||
|
if (!string.isEmpty()) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
return "vk-api-proxy.xtrafrancyz.net";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getOauthCom() {
|
public static String getOauthCom() {
|
||||||
String string = getPreferences().getString("proxyoauth", "");
|
if (!Prefs.proxy()) {
|
||||||
if (!proxy() & string.isEmpty()) {
|
|
||||||
return "oauth.vk.com";
|
return "oauth.vk.com";
|
||||||
}
|
}
|
||||||
return string;
|
String string = Helper.GetPreferences().getString("proxyoauth", "");
|
||||||
|
if (!string.isEmpty()) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
return "vk-oauth-proxy.xtrafrancyz.net";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getStaticCom() {
|
public static String getStaticCom() {
|
||||||
String string = getPreferences().getString("proxystatic", "");
|
if (!ru.vtosters.lite.utils.Prefs.proxy()) {
|
||||||
if (!proxy() & string.isEmpty()) {
|
|
||||||
return "static.vk.com";
|
return "static.vk.com";
|
||||||
}
|
}
|
||||||
return string;
|
String string = Helper.GetPreferences().getString("proxystatic", "");
|
||||||
|
if (!string.isEmpty()) {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
return "vk-static-proxy.xtrafrancyz.net";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String staticFix(String str) {
|
public static String staticFix(String str) {
|
||||||
String str2;
|
String str2;
|
||||||
String string = getPreferences().getString("proxystatic", "");
|
String str3;
|
||||||
if (!proxy() & string.isEmpty()) {
|
if (!Prefs.proxy()) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
str2 = string;
|
String string = Helper.GetPreferences().getString("proxystatic", "");
|
||||||
return str.replace(str2, "static.vk.com");
|
if (string.isEmpty()) {
|
||||||
|
str3 = "static.vk.com";
|
||||||
|
str2 = "vk-static-proxy.xtrafrancyz.net";
|
||||||
|
} else {
|
||||||
|
str3 = "static.vk.com";
|
||||||
|
str2 = string;
|
||||||
|
}
|
||||||
|
return str.replace(str2, str3);
|
||||||
|
}
|
||||||
|
|
||||||
|
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() {
|
||||||
Properties properties = getProperties();
|
switch (Helper.GetPreferences().getString("proxy", "")) {
|
||||||
switch (getPreferences().getString("proxy", "")) {
|
|
||||||
case "zaborona":
|
case "zaborona":
|
||||||
properties.setProperty("socksProxyHost", "socks.zaboronahelp.pp.ua");
|
Properties properties = System.getProperties();
|
||||||
|
properties.setProperty("socksProxyHost", "socks.zaborona.help");
|
||||||
properties.setProperty("socksProxyPort", "1488");
|
properties.setProperty("socksProxyPort", "1488");
|
||||||
resetProxySocks();
|
System.clearProperty("https.proxyHost");
|
||||||
|
System.clearProperty("https.proxyPort");
|
||||||
|
System.clearProperty("http.proxyHost");
|
||||||
|
System.clearProperty("http.proxyPort");
|
||||||
break;
|
break;
|
||||||
case "socks":
|
case "socks":
|
||||||
properties.setProperty("socksProxyHost", proxyHostSocks());
|
Properties properties2 = System.getProperties();
|
||||||
properties.setProperty("socksProxyPort", proxyPortSocks());
|
properties2.setProperty("socksProxyHost", proxyHostSocks());
|
||||||
resetProxySocks();
|
properties2.setProperty("socksProxyPort", proxyPortSocks());
|
||||||
|
System.clearProperty("https.proxyHost");
|
||||||
|
System.clearProperty("https.proxyPort");
|
||||||
|
System.clearProperty("http.proxyHost");
|
||||||
|
System.clearProperty("http.proxyPort");
|
||||||
break;
|
break;
|
||||||
case "http":
|
case "http":
|
||||||
properties.setProperty("http.proxyHost", proxyHostHTTP());
|
Properties properties3 = System.getProperties();
|
||||||
properties.setProperty("http.proxyPort", proxyPortHTTP());
|
properties3.setProperty("http.proxyHost", proxyHostHTTP());
|
||||||
properties.setProperty("http.proxyUser", proxyUserHTTP());
|
properties3.setProperty("http.proxyPort", proxyPortHTTP());
|
||||||
properties.setProperty("http.proxyPassword", proxyPassHTTP());
|
System.clearProperty("socksProxyHost");
|
||||||
resetProxyHttp();
|
System.clearProperty("socksPortHost");
|
||||||
|
System.clearProperty("https.proxyHost");
|
||||||
|
System.clearProperty("https.proxyPort");
|
||||||
break;
|
break;
|
||||||
case "https":
|
case "https":
|
||||||
properties.setProperty("https.proxyHost", proxyHostHTTPS());
|
Properties properties4 = System.getProperties();
|
||||||
properties.setProperty("https.proxyPort", proxyPortHTTPS());
|
properties4.setProperty("https.proxyHost", proxyHostHTTPS());
|
||||||
properties.setProperty("https.proxyUser", proxyUserHTTPS());
|
properties4.setProperty("https.proxyPort", proxyPortHTTPS());
|
||||||
properties.setProperty("https.proxyPassword", proxyPassHTTPS());
|
System.clearProperty("socksProxyHost");
|
||||||
resetProxyHttps();
|
System.clearProperty("socksPortHost");
|
||||||
|
System.clearProperty("http.proxyHost");
|
||||||
|
System.clearProperty("http.proxyPort");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
resetProxy();
|
System.clearProperty("socksProxyHost");
|
||||||
|
System.clearProperty("socksPortHost");
|
||||||
|
System.clearProperty("https.proxyHost");
|
||||||
|
System.clearProperty("https.proxyPort");
|
||||||
|
System.clearProperty("http.proxyHost");
|
||||||
|
System.clearProperty("http.proxyPort");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void resetProxy() {
|
|
||||||
clearProperty("https.proxyHost");
|
|
||||||
clearProperty("https.proxyPort");
|
|
||||||
clearProperty("https.proxyUser");
|
|
||||||
clearProperty("https.proxyPassword");
|
|
||||||
clearProperty("http.proxyHost");
|
|
||||||
clearProperty("http.proxyPort");
|
|
||||||
clearProperty("http.proxyUser");
|
|
||||||
clearProperty("http.proxyPassword");
|
|
||||||
clearProperty("socksProxyHost");
|
|
||||||
clearProperty("socksPortHost");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void resetProxySocks() {
|
|
||||||
clearProperty("https.proxyHost");
|
|
||||||
clearProperty("https.proxyPort");
|
|
||||||
clearProperty("https.proxyUser");
|
|
||||||
clearProperty("https.proxyPassword");
|
|
||||||
clearProperty("http.proxyHost");
|
|
||||||
clearProperty("http.proxyPort");
|
|
||||||
clearProperty("http.proxyUser");
|
|
||||||
clearProperty("http.proxyPassword");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void resetProxyHttp() {
|
|
||||||
clearProperty("https.proxyHost");
|
|
||||||
clearProperty("https.proxyPort");
|
|
||||||
clearProperty("https.proxyUser");
|
|
||||||
clearProperty("https.proxyPassword");
|
|
||||||
clearProperty("socksProxyHost");
|
|
||||||
clearProperty("socksPortHost");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void resetProxyHttps() {
|
|
||||||
clearProperty("http.proxyHost");
|
|
||||||
clearProperty("http.proxyPort");
|
|
||||||
clearProperty("http.proxyUser");
|
|
||||||
clearProperty("http.proxyPassword");
|
|
||||||
clearProperty("socksProxyHost");
|
|
||||||
clearProperty("socksPortHost");
|
|
||||||
}
|
|
||||||
|
|
||||||
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 String proxyUserHTTP() {
|
|
||||||
String string = getPreferences().getString("proxyUserHTTP", "");
|
|
||||||
return string.isEmpty() ? "" : string;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String proxyUserHTTPS() {
|
|
||||||
String string = getPreferences().getString("proxyUserHTTPS", "");
|
|
||||||
return string.isEmpty() ? "" : string;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String proxyPassHTTP() {
|
|
||||||
String string = getPreferences().getString("proxyPassHTTP", "");
|
|
||||||
return string.isEmpty() ? "" : string;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String proxyPassHTTPS() {
|
|
||||||
String string = getPreferences().getString("proxyPassHTTPS", "");
|
|
||||||
return string.isEmpty() ? "" : string;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean proxy() {
|
|
||||||
return getPreferences().getString("proxy", "").equals("apiproxy");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Official vk proxy enforcer
|
|
||||||
public static boolean proxyvk() {
|
|
||||||
return BooleanFalse("proxyvk");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
package ru.vtosters.lite.utils;
|
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.About.getBuildNumber;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getUserSecret;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.getLocale;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.vksans;
|
|
||||||
import static ru.vtosters.lite.utils.Proxy.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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
package ru.vtosters.lite.utils;
|
|
||||||
|
|
||||||
import static android.os.Environment.DIRECTORY_DOWNLOADS;
|
|
||||||
import static android.os.Environment.getExternalStoragePublicDirectory;
|
|
||||||
import static android.widget.Toast.LENGTH_LONG;
|
|
||||||
import static android.widget.Toast.LENGTH_SHORT;
|
|
||||||
import static android.widget.Toast.makeText;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.util.Base64;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class SettBackup {
|
|
||||||
static SharedPreferences prefs = getContext().getSharedPreferences("com.vtosters.lite_preferences", Context.MODE_PRIVATE);
|
|
||||||
|
|
||||||
public static void deletePrefs() {
|
|
||||||
prefs.edit().clear().commit();
|
|
||||||
File file = new File(new File(getContext().getFilesDir().getParent(), "shared_prefs"), "com.vtosters.lite_preferences");
|
|
||||||
if (file.exists()) file.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void backupSettings() {
|
|
||||||
SimpleDateFormat date = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault());
|
|
||||||
String currentDateandTime = date.format(new Date());
|
|
||||||
var directory = getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS) + "/VTLBackup_" + currentDateandTime + ".txt";
|
|
||||||
var file = new File(directory);
|
|
||||||
try {
|
|
||||||
var exists = file.createNewFile();
|
|
||||||
|
|
||||||
if (!exists) {
|
|
||||||
file.delete();
|
|
||||||
file.createNewFile();
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
FileWriter out = new FileWriter(file);
|
|
||||||
out.write(getAllPrefs());
|
|
||||||
out.close();
|
|
||||||
makeText(getContext(), "Сохранено в файл " + directory, LENGTH_LONG).show();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
makeText(getContext(), "Не удалось сохранить файл", LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
makeText(getContext(), "Не удалось сохранить файл", LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getAllPrefs() {
|
|
||||||
Map<String, ?> allPrefs = prefs.getAll();
|
|
||||||
return Base64.encodeToString(allPrefs.toString().getBytes(), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void restoreBackup() {
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
|
||||||
intent.setType("text/plain");
|
|
||||||
getContext().startActivity(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,92 +1,34 @@
|
|||||||
package ru.vtosters.lite.utils;
|
package ru.vtosters.lite.utils;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.color_grishka;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.isBGStickersEnabled;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.navbar;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.systemtheme;
|
|
||||||
import static ru.vtosters.lite.utils.Preferences.vksans;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.content.res.Configuration;
|
|
||||||
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;
|
||||||
import com.vk.core.ui.themes.VKTheme;
|
|
||||||
import com.vk.core.ui.themes.VKThemeHelper;
|
import com.vk.core.ui.themes.VKThemeHelper;
|
||||||
import com.vk.im.ui.themes.ImTheme;
|
|
||||||
import com.vk.im.ui.themes.ImThemeHelper;
|
|
||||||
import com.vtosters.lite.R;
|
import com.vtosters.lite.R;
|
||||||
|
import com.vtosters.lite.auth.VKAccountManager;
|
||||||
|
|
||||||
|
import ru.vtosters.lite.f0x1d.VTVerifications;
|
||||||
|
|
||||||
public class Themes {
|
public class Themes {
|
||||||
public static int getAccentColor() {
|
public static int getAccentColor() {
|
||||||
return VKThemeHelper.a(R.attr.accent);
|
return VKThemeHelper.a((int) R.attr.accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getTextAttr() {
|
public static int getTextAttr() {
|
||||||
return VKThemeHelper.a(R.attr.text_primary);
|
return VKThemeHelper.a((int) R.attr.text_primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSTextAttr() {
|
public static int getSTextAttr() {
|
||||||
return VKThemeHelper.a(R.attr.text_secondary);
|
return VKThemeHelper.a((int) R.attr.text_secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getTabbarBackground() {
|
public static int getTabbarBackground() {
|
||||||
return VKThemeHelper.a(R.attr.tabbar_background);
|
return VKThemeHelper.a((int) R.attr.tabbar_background);
|
||||||
}
|
|
||||||
|
|
||||||
public static int getHeaderBackground() {
|
|
||||||
return VKThemeHelper.a(R.attr.header_background);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getAmoledTheme() {
|
|
||||||
return getContext().getResources().getIdentifier("BaseAmoledStyle", "style", getContext().getPackageName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int picFix() {
|
|
||||||
return getContext().getResources().getIdentifier("ActionBarThemeFix", "style", getContext().getPackageName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getAmoledImTheme() {
|
|
||||||
return getContext().getResources().getIdentifier("VkIm.Theme.VkApp.Amoled", "style", getContext().getPackageName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static VKTheme getDarkTheme() {
|
|
||||||
switch (getPreferences().getString("darktheme", "")) {
|
|
||||||
case "amoled":
|
|
||||||
return VKTheme.AMOLED;
|
|
||||||
default:
|
|
||||||
return VKTheme.DARK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ImTheme getImDarkTheme() {
|
|
||||||
switch (getPreferences().getString("darktheme", "")) {
|
|
||||||
case "amoled":
|
|
||||||
return ImTheme.VKAPP_AMOLED;
|
|
||||||
default:
|
|
||||||
return ImTheme.VKAPP_DARK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static VKTheme getLightTheme() {
|
|
||||||
switch (getPreferences().getString("lighttheme", "")) {
|
|
||||||
default:
|
|
||||||
return VKTheme.DEFAULT_LIGHT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ImTheme getImLightTheme() {
|
|
||||||
switch (getPreferences().getString("lighttheme", "")) {
|
|
||||||
default:
|
|
||||||
return ImTheme.VKAPP_LIGHT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getColorFromAttr(int attr) {
|
public static int getColorFromAttr(int attr) {
|
||||||
@@ -94,11 +36,19 @@ public class Themes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int getHeaderText() {
|
public static int getHeaderText() {
|
||||||
return VKThemeHelper.a(R.attr.header_text);
|
return VKThemeHelper.a((int) R.attr.header_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAndroidMonet() {
|
public static boolean isAndroidMonet() {
|
||||||
return color_grishka() && Build.VERSION.SDK_INT >= 31;
|
if (color_grishka()) {
|
||||||
|
return Build.VERSION.SDK_INT >= 31;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
@@ -112,6 +62,14 @@ public class Themes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean vkim_msg() {
|
||||||
|
return ru.vtosters.lite.utils.Prefs.BooleanFalse("vkim_msg");
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
@@ -119,13 +77,6 @@ public class Themes {
|
|||||||
return new RecoloredDrawable(drawable, getAccentColor());
|
return new RecoloredDrawable(drawable, getAccentColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable recolorDrawableToolbar(Drawable drawable) {
|
|
||||||
if (drawable == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new RecoloredDrawable(drawable, getHeaderText());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ColorStateList recolorCSL(ColorStateList colorStateList) {
|
public static ColorStateList recolorCSL(ColorStateList colorStateList) {
|
||||||
if (colorStateList == null) {
|
if (colorStateList == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -147,76 +98,10 @@ public class Themes {
|
|||||||
if (isColorRefAccented(i) && isAndroidMonet()) {
|
if (isColorRefAccented(i) && isAndroidMonet()) {
|
||||||
return getAccentColor();
|
return getAccentColor();
|
||||||
}
|
}
|
||||||
return getContext().getResources().getColor(i);
|
return Helper.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", new Object[]{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";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void systemThemeChanger() {
|
|
||||||
if (!systemtheme())
|
|
||||||
return;
|
|
||||||
int currentNightMode = getContext().getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
|
||||||
switch (currentNightMode) {
|
|
||||||
case Configuration.UI_MODE_NIGHT_UNDEFINED:
|
|
||||||
changeTheme(getLightTheme(), getImLightTheme());
|
|
||||||
break;
|
|
||||||
case Configuration.UI_MODE_NIGHT_NO:
|
|
||||||
changeTheme(getLightTheme(), getImLightTheme());
|
|
||||||
break;
|
|
||||||
case Configuration.UI_MODE_NIGHT_YES:
|
|
||||||
changeTheme(getDarkTheme(), getImDarkTheme());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void changeTheme(VKTheme theme, ImTheme imtheme) {
|
|
||||||
VKThemeHelper.b.a(theme);
|
|
||||||
ImThemeHelper.b.a(imtheme);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,17 @@
|
|||||||
package ru.vtosters.lite.utils;
|
package ru.vtosters.lite.utils;
|
||||||
|
|
||||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
|
||||||
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.util.Log;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
import com.vtosters.lite.R;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import com.vtosters.lite.R;
|
||||||
|
|
||||||
public class VKUIInjector {
|
public class VKUIInjector {
|
||||||
private static boolean isLoaded = false;
|
private static boolean isLoaded = false;
|
||||||
private static String loadedCSS = "";
|
private static String loadedCSS = "";
|
||||||
@@ -29,7 +25,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 = Helper.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) {
|
||||||
@@ -49,15 +45,12 @@ public class VKUIInjector {
|
|||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
loadedCSS = load("vt_ui_accent.css")
|
loadedCSS = load("vt_ui_accent.css")
|
||||||
.replace("%header_background%", hex(getColorFromAttr(R.attr.header_background)))
|
.replace("%accent%", Themes.hex(Themes.getAccentColor()))
|
||||||
.replace("%background_content%", hex(getColorFromAttr(R.attr.background_content)))
|
.replace("%background_page%", Themes.hex(Themes.getColorFromAttr(R.attr.background_page)))
|
||||||
.replace("%header_text%", hex(getColorFromAttr(R.attr.header_text)))
|
.replace("%background_content%", Themes.hex(Themes.getColorFromAttr(R.attr.background_content)))
|
||||||
.replace("%accent%", hex(getColorFromAttr(R.attr.accent)))
|
.replace("%text_primary%", Themes.hex(Themes.getColorFromAttr(R.attr.text_primary)));
|
||||||
.replace("%background_page%", hex(getColorFromAttr(R.attr.background_page)))
|
|
||||||
.replace("%background_content%", hex(getColorFromAttr(R.attr.background_content)))
|
|
||||||
.replace("%text_primary%", hex(getColorFromAttr(R.attr.text_primary)));
|
|
||||||
|
|
||||||
loadedCSSAmoled = load("vt_ui_oled.css");
|
// loadedCSSAmoled = load("vt_ui_oled.css");
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,20 +59,17 @@ public class VKUIInjector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void inject(WebView webView) {
|
public static void inject(WebView webView) {
|
||||||
String string = getPreferences().getString("darktheme", "");
|
if (Prefs.BooleanTrue("VKUI_INJ")) {
|
||||||
if (Preferences.BooleanTrue("VKUI_INJ")) {
|
|
||||||
if (!isLoaded) {
|
if (!isLoaded) {
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (true/*Themes.isAccentedCache()*/) {
|
if (true/*Themes.isAccentedCache()*/) {
|
||||||
|
Log.d("VKUI", "Injecting Accent");
|
||||||
sb.append("\n\n");
|
sb.append("\n\n");
|
||||||
sb.append(loadedCSS);
|
sb.append(loadedCSS);
|
||||||
}
|
}
|
||||||
if (string.equals("amoled")) {
|
Log.d("VKUI", "Final CSS: " + sb.toString());
|
||||||
sb.append("\n\n");
|
|
||||||
sb.append(loadedCSSAmoled);
|
|
||||||
}
|
|
||||||
inject(webView, Base64.encodeToString(sb.toString().getBytes(), 2));
|
inject(webView, Base64.encodeToString(sb.toString().getBytes(), 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.2.0'
|
classpath 'com.android.tools.build:gradle:7.3.0-alpha01'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
android.useAndroidX=true
|
|
||||||
android.enableJetifier=true
|
|
||||||
android.jetifier.ignorelist=classes-dex2jar.jar, classes2-dex2jar.jar, classes3-dex2jar.jar, classes4-dex2jar.jar, classes5-dex2jar.jar, classes6-dex2jar.jar, classes7-dex2jar.jar
|
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#Fri Apr 22 13:33:27 MSK 2022
|
#Fri Jan 28 23:46:30 MSK 2022
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-rc-1-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
+5
-5
@@ -15,8 +15,6 @@ echo.
|
|||||||
echo %ESC%[1;4mBuild dex...%ESC%[0m
|
echo %ESC%[1;4mBuild dex...%ESC%[0m
|
||||||
echo.
|
echo.
|
||||||
call gradlew clean
|
call gradlew clean
|
||||||
del app\src\main\assets\version.properties
|
|
||||||
del smali\assets\version.properties
|
|
||||||
call gradlew versionFile
|
call gradlew versionFile
|
||||||
call gradlew assembleDebug
|
call gradlew assembleDebug
|
||||||
if "%ERRORLEVEL%" == "0" (
|
if "%ERRORLEVEL%" == "0" (
|
||||||
@@ -68,13 +66,14 @@ if "%ERRORLEVEL%" == "0" (
|
|||||||
echo %ESC%[92mSuccessful%ESC%[0m
|
echo %ESC%[92mSuccessful%ESC%[0m
|
||||||
) else (
|
) else (
|
||||||
echo %ESC%[31mFailed%ESC%[0m
|
echo %ESC%[31mFailed%ESC%[0m
|
||||||
|
exit /B 1
|
||||||
)
|
)
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo %ESC%[1;4mBuild apk...%ESC%[0m
|
echo %ESC%[1;4mBuild apk...%ESC%[0m
|
||||||
echo.
|
echo.
|
||||||
cd smali\
|
cd smali\
|
||||||
call java -jar ../scripts/apktool.jar b . -o ../scripts/VTLite.apk --use-aapt2 -p ../scripts/framework/
|
call java -jar ../scripts/apktool.jar b . -o VTLite.apk --use-aapt2 -p ../scripts/framework/
|
||||||
if "%ERRORLEVEL%" == "0" (
|
if "%ERRORLEVEL%" == "0" (
|
||||||
echo %ESC%[92mSuccessful%ESC%[0m
|
echo %ESC%[92mSuccessful%ESC%[0m
|
||||||
) else (
|
) else (
|
||||||
@@ -88,7 +87,8 @@ del assets\version.properties
|
|||||||
echo.
|
echo.
|
||||||
echo %ESC%[1;4mSign apk...%ESC%[0m
|
echo %ESC%[1;4mSign apk...%ESC%[0m
|
||||||
echo.
|
echo.
|
||||||
call java -jar ../scripts/apksigner.jar sign --ks ../scripts/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android ../scripts/VTLite.apk
|
call java -jar ../apksigner.jar sign --ks debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android VTLite.apk
|
||||||
|
del VTLite.apk
|
||||||
if "%ERRORLEVEL%" == "0" (
|
if "%ERRORLEVEL%" == "0" (
|
||||||
echo %ESC%[92mSuccessful%ESC%[0m
|
echo %ESC%[92mSuccessful%ESC%[0m
|
||||||
) else (
|
) else (
|
||||||
@@ -120,7 +120,7 @@ GOTO startinstall
|
|||||||
echo.
|
echo.
|
||||||
echo %ESC%[1;4mInstall apk...%ESC%[0m
|
echo %ESC%[1;4mInstall apk...%ESC%[0m
|
||||||
echo.
|
echo.
|
||||||
call adb install ../scripts/VTLite.apk
|
call adb install VTLite_signed.apk
|
||||||
if "%ERRORLEVEL%" == "0" (
|
if "%ERRORLEVEL%" == "0" (
|
||||||
echo %ESC%[92mSuccessful%ESC%[0m
|
echo %ESC%[92mSuccessful%ESC%[0m
|
||||||
) else (
|
) else (
|
||||||
|
|||||||
+1
-2
@@ -7,8 +7,6 @@ UNDERLINE='\033[4m'
|
|||||||
|
|
||||||
echo -e "${BOLD}${UNDERLINE}Сборка dex..${NC}\n"
|
echo -e "${BOLD}${UNDERLINE}Сборка dex..${NC}\n"
|
||||||
cd ../
|
cd ../
|
||||||
rm ../smali/assets/version.properties
|
|
||||||
rm ../lite/app/src/main/assets/version.properties
|
|
||||||
./gradlew versionFile
|
./gradlew versionFile
|
||||||
./gradlew assembleDebug
|
./gradlew assembleDebug
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@@ -51,6 +49,7 @@ if [ $? -eq 0 ]; then
|
|||||||
echo -e "${GREEN}Успех!${NC}\n"
|
echo -e "${GREEN}Успех!${NC}\n"
|
||||||
else
|
else
|
||||||
echo -e "${RED}Провал.${NC}\n"
|
echo -e "${RED}Провал.${NC}\n"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e "${BOLD}${UNDERLINE}Сборка apk..${NC}"
|
echo -e "${BOLD}${UNDERLINE}Сборка apk..${NC}"
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0840244ca18d071426e1a4cf350bdb0d446ca68f
|
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_READ"/>
|
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_READ"/>
|
||||||
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_WRITE"/>
|
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_WRITE"/>
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
|
||||||
<application android:allowBackup="false" android:debuggable="false" android:hardwareAccelerated="true" android:icon="@mipmap/vt_launcher" android:label="@string/app_name" android:largeHeap="true" android:requestLegacyExternalStorage="true" android:preserveLegacyExternalStorage="true" android:name="com.vtosters.lite.VKApplication" android:networkSecurityConfig="@xml/network_security_config" android:resizeableActivity="true" android:roundIcon="@mipmap/vt_launcher_round" android:supportsRtl="true" android:theme="@style/BaseStyle">
|
<application android:allowBackup="false" android:debuggable="false" android:hardwareAccelerated="true" android:icon="@mipmap/vt_launcher" android:label="@string/app_name" android:largeHeap="true" android:name="com.vtosters.lite.VKApplication" android:networkSecurityConfig="@xml/network_security_config" android:resizeableActivity="true" android:roundIcon="@mipmap/vt_launcher_round" android:supportsRtl="true" android:theme="@style/BaseStyle">
|
||||||
<meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyBlTHhNGPj7ktPWrUo_d4YJs_Sn_zsISZg"/>
|
<meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyBlTHhNGPj7ktPWrUo_d4YJs_Sn_zsISZg"/>
|
||||||
<meta-data android:name="com.google.android.geo.API_SECRET" android:value="yu6ZAA0OWO3kmr4es7fGtSmiyfk="/>
|
<meta-data android:name="com.google.android.geo.API_SECRET" android:value="yu6ZAA0OWO3kmr4es7fGtSmiyfk="/>
|
||||||
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fb_app_id"/>
|
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fb_app_id"/>
|
||||||
|
|||||||
@@ -1,193 +0,0 @@
|
|||||||
Путин
|
|
||||||
Путин
|
|
||||||
Путину
|
|
||||||
Путину
|
|
||||||
Путина
|
|
||||||
Путина
|
|
||||||
Путинская
|
|
||||||
путинская
|
|
||||||
Байден
|
|
||||||
байден
|
|
||||||
Байдену
|
|
||||||
байдену
|
|
||||||
Обама
|
|
||||||
обама
|
|
||||||
Обаме
|
|
||||||
обаме
|
|
||||||
Обаму
|
|
||||||
обаму
|
|
||||||
Трамп
|
|
||||||
трамп
|
|
||||||
Трампу
|
|
||||||
трампу
|
|
||||||
Санкции
|
|
||||||
санкции
|
|
||||||
Санкций
|
|
||||||
санкций
|
|
||||||
Санкциями
|
|
||||||
санкциями
|
|
||||||
Россия
|
|
||||||
россия
|
|
||||||
россии
|
|
||||||
России
|
|
||||||
МИДУ РФ
|
|
||||||
миду рф
|
|
||||||
МИД РФ
|
|
||||||
мид рф
|
|
||||||
Мид РФ
|
|
||||||
Мид рф
|
|
||||||
Российской
|
|
||||||
российской
|
|
||||||
Украина
|
|
||||||
украина
|
|
||||||
Украине
|
|
||||||
украине
|
|
||||||
Украины
|
|
||||||
украины
|
|
||||||
военные
|
|
||||||
Военные
|
|
||||||
Специальная операция
|
|
||||||
Специальная Операция
|
|
||||||
специальная операция
|
|
||||||
специальная Операция
|
|
||||||
Спец. Операция
|
|
||||||
Спец. операция
|
|
||||||
спец. Операция
|
|
||||||
Спец Операция
|
|
||||||
спец операция
|
|
||||||
Спец операция
|
|
||||||
Военная операция
|
|
||||||
Военная Операция
|
|
||||||
военная Операция
|
|
||||||
военная операция
|
|
||||||
спецоперация
|
|
||||||
Спецоперация
|
|
||||||
спецоперации
|
|
||||||
Спецоперации
|
|
||||||
спецоперацию
|
|
||||||
Спецоперацию
|
|
||||||
вторжение
|
|
||||||
Вторжение
|
|
||||||
ЛНР
|
|
||||||
лнр
|
|
||||||
ДНР
|
|
||||||
днр
|
|
||||||
Донбасс
|
|
||||||
донбасс
|
|
||||||
Луганск
|
|
||||||
луганск
|
|
||||||
Луганская
|
|
||||||
луганская
|
|
||||||
Донецк
|
|
||||||
донецк
|
|
||||||
Донецкая
|
|
||||||
донецкая
|
|
||||||
Навальным
|
|
||||||
навальным
|
|
||||||
Навальный
|
|
||||||
навальный
|
|
||||||
Навального
|
|
||||||
навального
|
|
||||||
ВСУ
|
|
||||||
всу
|
|
||||||
ВС РФ
|
|
||||||
вс рф
|
|
||||||
ВС Украины
|
|
||||||
вс украины
|
|
||||||
Шойгу
|
|
||||||
шойгу
|
|
||||||
Зеленский
|
|
||||||
зеленский
|
|
||||||
Зеленским
|
|
||||||
зеленским
|
|
||||||
Зеленскому
|
|
||||||
зеленскому
|
|
||||||
Зеленского
|
|
||||||
зеленского
|
|
||||||
евросоюз
|
|
||||||
Евросоюз
|
|
||||||
евросоюзу
|
|
||||||
Евросоюзу
|
|
||||||
Войск
|
|
||||||
войск
|
|
||||||
армия
|
|
||||||
Армия
|
|
||||||
Войне
|
|
||||||
войне
|
|
||||||
войны
|
|
||||||
Войны
|
|
||||||
войн
|
|
||||||
Войн
|
|
||||||
солдат
|
|
||||||
Солдат
|
|
||||||
солдаты
|
|
||||||
Солдаты
|
|
||||||
Вооруженные
|
|
||||||
вооруженные
|
|
||||||
нато
|
|
||||||
НАТО
|
|
||||||
Нато
|
|
||||||
Песков
|
|
||||||
песков
|
|
||||||
Пескову
|
|
||||||
Пескова
|
|
||||||
пескова
|
|
||||||
пескову
|
|
||||||
Кремль
|
|
||||||
кремль
|
|
||||||
Кремлю
|
|
||||||
кремлю
|
|
||||||
денацификация
|
|
||||||
Денацификация
|
|
||||||
денацификацию
|
|
||||||
Денацификацию
|
|
||||||
нацис
|
|
||||||
Нацис
|
|
||||||
нациз
|
|
||||||
Нациз
|
|
||||||
Медведев
|
|
||||||
медведев
|
|
||||||
денацифицировать
|
|
||||||
Денацифицировать
|
|
||||||
фашис
|
|
||||||
Фашис
|
|
||||||
фашиз
|
|
||||||
Фашиз
|
|
||||||
США
|
|
||||||
сша
|
|
||||||
Киев
|
|
||||||
киев
|
|
||||||
Харьков
|
|
||||||
харьков
|
|
||||||
Харьковская
|
|
||||||
харьковская
|
|
||||||
"Z"
|
|
||||||
"V"
|
|
||||||
«Z»
|
|
||||||
«V»
|
|
||||||
"з"
|
|
||||||
"в"
|
|
||||||
«з»
|
|
||||||
«в»
|
|
||||||
"z"
|
|
||||||
"v"
|
|
||||||
«z»
|
|
||||||
«v»
|
|
||||||
"З"
|
|
||||||
"В"
|
|
||||||
«З»
|
|
||||||
«В»
|
|
||||||
русня
|
|
||||||
Русня
|
|
||||||
хохол
|
|
||||||
Хохол
|
|
||||||
Хохлы
|
|
||||||
хохлы
|
|
||||||
ЛДНР
|
|
||||||
лднр
|
|
||||||
наказать Россию
|
|
||||||
наказать россию
|
|
||||||
наказать Русских
|
|
||||||
наказать русских
|
|
||||||
вооружение
|
|
||||||
Вооружение
|
|
||||||
@@ -36,24 +36,4 @@ cпocоб зaрaбoтать
|
|||||||
смотри в Источнике
|
смотри в Источнике
|
||||||
Смотри в Источнике
|
Смотри в Источнике
|
||||||
в источнике👇
|
в источнике👇
|
||||||
в источнике😳👇
|
в источнике😳👇
|
||||||
в Источник
|
|
||||||
в источник
|
|
||||||
В источник
|
|
||||||
в источнике
|
|
||||||
в иcтoчнике
|
|
||||||
В иcтoчнике
|
|
||||||
в Иcтoчнике
|
|
||||||
в Источнике
|
|
||||||
В Источнике
|
|
||||||
в иcтoчник
|
|
||||||
В иcтoчник
|
|
||||||
в Иcтoчник
|
|
||||||
в Источник
|
|
||||||
В Источник
|
|
||||||
в закрепленном комментарии
|
|
||||||
в Закрепленном комментарии
|
|
||||||
в закрепленном Комментарии
|
|
||||||
В закрепленном комментарии
|
|
||||||
В Закрепленном комментарии
|
|
||||||
В закрепленном Комментарии
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user