Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b3896f4ca | ||
|
|
fc9ccf66d1 | ||
|
|
d205f2894b | ||
|
|
7afc04b2b2 | ||
|
|
584ee96ee0 | ||
|
|
66f7ea1b79 | ||
|
|
7b0a83458b | ||
|
|
cdaf7909d4 | ||
|
|
c70ab388c1 | ||
|
|
50c66c2703 | ||
|
|
357e520bb0 | ||
|
|
6379ce5741 | ||
|
|
02807739a1 | ||
|
|
40635ab75a | ||
|
|
32e1bfe6fd | ||
|
|
281a0e8499 | ||
|
|
220c61afe1 | ||
|
|
7a632d5224 | ||
|
|
3218c1a46b | ||
|
|
b2028d86ba | ||
|
|
45ed5879e6 | ||
|
|
48479dd064 | ||
|
|
3b556b81a1 | ||
|
|
526c9a607a | ||
|
|
81752895ab | ||
|
|
ad970d097a | ||
|
|
bc2010b49d | ||
|
|
ff4a4094ff | ||
|
|
3629e71098 | ||
|
|
b955ac355f | ||
|
|
409279eca0 | ||
|
|
ea0a0f1d93 | ||
|
|
3cc81dfddc | ||
|
|
86041e6031 | ||
|
|
e140ce2661 | ||
|
|
f6f15132a2 | ||
|
|
e73751ecf3 | ||
|
|
3c0516b4cd | ||
|
|
38d9f4a818 | ||
|
|
207fa4f2e7 | ||
|
|
f9f778b8f4 | ||
|
|
962dcdec67 | ||
|
|
486026b8aa | ||
|
|
e78d08fb94 | ||
|
|
a5e81dbd87 | ||
|
|
49051dae9a | ||
|
|
94236c87e3 | ||
|
|
449ba8c768 | ||
|
|
0da81c01e9 | ||
|
|
b4a0b7e1ea | ||
|
|
f2209eca49 | ||
|
|
4a004971c6 | ||
|
|
e400b8761c | ||
|
|
ff8e7b7f41 | ||
|
|
2c501606be | ||
|
|
73420fe1c4 | ||
|
|
337f81346c | ||
|
|
06f9a4545b | ||
|
|
fa99df93c4 | ||
|
|
adcd2472d5 | ||
|
|
7527b9a07e | ||
|
|
800c223baa | ||
|
|
d1123d3ccf | ||
|
|
f61fc99d9c | ||
|
|
60653cc739 | ||
|
|
d25bba10b0 | ||
|
|
3b67ecaa5e | ||
|
|
6600f32392 | ||
|
|
64303b1709 | ||
|
|
5c7e50d61e | ||
|
|
f68ad105a6 | ||
|
|
164479da1d | ||
|
|
d93bf41d28 | ||
|
|
38a2b3f2b2 | ||
|
|
342534676c | ||
|
|
56a6a6de03 | ||
|
|
d1445c2801 |
@@ -21,10 +21,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set up JDK 14
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: '14'
|
java-version: '17'
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
* Стабильные сборки находятся в [Releases](https://github.com/vtosters/lite/releases)
|
* Стабильные сборки находятся в [Releases](https://github.com/vtosters/lite/releases)
|
||||||
|
|
||||||
Зеркало на нашем [<img src="https://gitea.com/assets/img/logo.svg" align="center" width="20" height="20"/> Git](https://git.maki.su/gdlbo/lite)
|
Зеркало на нашем [<img src="https://gitea.com/assets/img/logo.svg" align="center" width="20" height="20"/> Git](https://git.maki.su/vtosters/lite)
|
||||||
|
|
||||||
### Быстрая навигация
|
### Быстрая навигация
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import org.apache.tools.ant.taskdefs.condition.Os
|
import org.apache.tools.ant.taskdefs.condition.Os
|
||||||
|
|
||||||
import java.util.zip.ZipEntry
|
|
||||||
import java.util.zip.ZipFile
|
import java.util.zip.ZipFile
|
||||||
import java.util.zip.ZipInputStream
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
@@ -21,6 +19,10 @@ cargo {
|
|||||||
|
|
||||||
def smaliFolder = projectDir.toPath().resolve("../smali").normalize()
|
def smaliFolder = projectDir.toPath().resolve("../smali").normalize()
|
||||||
def scriptsFolder = projectDir.toPath().resolve("../scripts").normalize()
|
def scriptsFolder = projectDir.toPath().resolve("../scripts").normalize()
|
||||||
|
//you can add own folders with decompiled smali code
|
||||||
|
def dexes=smaliFolder.toFile()
|
||||||
|
.listFiles( { f -> f.isDirectory() && f.name.startsWith("smali") } as FileFilter)
|
||||||
|
.size()
|
||||||
|
|
||||||
versionFile {
|
versionFile {
|
||||||
file = projectDir.toPath().resolve("src/main/assets/version.properties").toFile()
|
file = projectDir.toPath().resolve("src/main/assets/version.properties").toFile()
|
||||||
@@ -50,19 +52,24 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled true
|
||||||
|
buildConfigField 'String', 'APPCENTER_KEY', '""'
|
||||||
|
proguardFile 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
rc {
|
||||||
|
minifyEnabled true
|
||||||
|
buildConfigField 'String', 'APPCENTER_KEY', '""'
|
||||||
|
proguardFile 'proguard-rules.pro'
|
||||||
|
}
|
||||||
dev {
|
dev {
|
||||||
initWith release
|
minifyEnabled false
|
||||||
buildConfigField 'String', 'APPCENTER_KEY', '""'
|
buildConfigField 'String', 'APPCENTER_KEY', '""'
|
||||||
}
|
}
|
||||||
beta {
|
beta {
|
||||||
initWith release
|
minifyEnabled false
|
||||||
buildConfigField 'String', 'APPCENTER_KEY', '""'
|
buildConfigField 'String', 'APPCENTER_KEY', '""'
|
||||||
}
|
}
|
||||||
release {
|
|
||||||
buildConfigField 'String', 'APPCENTER_KEY', '""'
|
|
||||||
minifyEnabled true
|
|
||||||
proguardFile 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@@ -72,6 +79,9 @@ android {
|
|||||||
}
|
}
|
||||||
namespace 'ru.vtosters.lite'
|
namespace 'ru.vtosters.lite'
|
||||||
ndkVersion '25.2.9519653'
|
ndkVersion '25.2.9519653'
|
||||||
|
buildFeatures {
|
||||||
|
aidl true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -79,70 +89,44 @@ dependencies {
|
|||||||
implementation 'com.microsoft.appcenter:appcenter-crashes:5.0.1'
|
implementation 'com.microsoft.appcenter:appcenter-crashes:5.0.1'
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
|
||||||
implementation 'net.sourceforge.streamsupport:streamsupport-minifuture:1.7.4'
|
implementation 'net.sourceforge.streamsupport:streamsupport-minifuture:1.7.4'
|
||||||
|
implementation 'com.google.guava:guava:23.3-android'
|
||||||
|
|
||||||
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
||||||
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
|
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation 'com.google.guava:guava:23.3-android'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task generateBuildTasks() {
|
task generateBuildTasks() {
|
||||||
android.applicationVariants.all { variant ->
|
android.applicationVariants.all { variant ->
|
||||||
variant.outputs.each { output ->
|
variant.outputs.each { output ->
|
||||||
def buildType = output.name.toString().capitalize()
|
def buildType = output.name.toString().capitalize()
|
||||||
def lowerBuildType = buildType.toLowerCase()
|
if(buildType=="Base")return
|
||||||
task "exportDex$buildType"() {
|
task "exportDex$buildType"() {
|
||||||
dependsOn('assemble' + buildType)
|
dependsOn('assemble' + buildType)
|
||||||
doLast {
|
doLast {
|
||||||
try {
|
try {
|
||||||
var z = ""
|
def suffix=buildType.toLowerCase()
|
||||||
if (lowerBuildType != "debug") {
|
String apkPath=projectDir.getAbsolutePath()+"/build/outputs/apk/$suffix/app-$suffix"
|
||||||
z = "-unsigned"
|
def apk=new File(apkPath+"-unsigned.apk")
|
||||||
}
|
if(!apk.exists())apk=new File(apkPath+".apk")
|
||||||
|
def zip=new ZipFile(apk)
|
||||||
File moduleDir = projectDir
|
def entries=zip.entries()
|
||||||
ZipInputStream inputStream = new ZipInputStream(new FileInputStream(moduleDir.getAbsolutePath() + "/build/outputs/apk/$lowerBuildType/app-$lowerBuildType${z}.apk"))
|
def dexCounter=dexes
|
||||||
ZipFile file = new ZipFile(moduleDir.getAbsolutePath() + "/build/outputs/apk/$lowerBuildType/app-$lowerBuildType${z}.apk");
|
while(entries.hasMoreElements())
|
||||||
ZipEntry entry
|
{
|
||||||
while ((entry = inputStream.nextEntry) != null) {
|
def entry=entries.nextElement()
|
||||||
if (entry.getName().equals("classes.dex")) {
|
String filename
|
||||||
print('classes.dex found!')
|
if(entry.name.matches("^classes(?:(?=\\d)2|)\\.dex\$"))filename="classes${++dexCounter}.dex"
|
||||||
|
else if(entry.name=="assets/version.properties")filename="version.properties"
|
||||||
FileOutputStream outputStream = new FileOutputStream(new File(moduleDir.getAbsoluteFile(), "classes6.dex"))
|
else continue
|
||||||
|
println("Exporting "+entry.name)
|
||||||
byte[] buffer = new byte[1024]
|
def tmpFile=new File(projectDir,filename)
|
||||||
int len = 0
|
def is=zip.getInputStream(entry)
|
||||||
while ((len = inputStream.read(buffer)) > 0) {
|
def fos=new FileOutputStream(tmpFile)
|
||||||
outputStream.write(buffer, 0, len)
|
def buff=new byte[0x800]
|
||||||
}
|
int len
|
||||||
outputStream.close()
|
while((len=is.read(buff))>0)fos.write(buff,0,len)
|
||||||
}
|
is.close()
|
||||||
if (entry.getName().equals("classes2.dex")) {
|
fos.close()
|
||||||
print('\nclasses2.dex found!')
|
|
||||||
|
|
||||||
FileOutputStream outputStream = new FileOutputStream(new File(moduleDir.getAbsoluteFile(), "classes7.dex"))
|
|
||||||
|
|
||||||
byte[] buffer = new byte[1024]
|
|
||||||
int len = 0
|
|
||||||
while ((len = inputStream.read(buffer)) > 0) {
|
|
||||||
outputStream.write(buffer, 0, len)
|
|
||||||
}
|
|
||||||
outputStream.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ZipEntry e : Collections.list(file.entries())) {
|
|
||||||
if (e.getName().endsWith("assets/version.properties")) {
|
|
||||||
var is = file.getInputStream(e)
|
|
||||||
FileOutputStream outputStream = new FileOutputStream(new File(moduleDir.getAbsoluteFile(), "version.properties"))
|
|
||||||
|
|
||||||
byte[] buffer = new byte[1024]
|
|
||||||
int len = 0
|
|
||||||
while ((len = is.read(buffer)) > 0) {
|
|
||||||
outputStream.write(buffer, 0, len)
|
|
||||||
}
|
|
||||||
outputStream.close()
|
|
||||||
|
|
||||||
print('\nversion.properties found!')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
@@ -152,17 +136,16 @@ task generateBuildTasks() {
|
|||||||
task "prepareDexForMerge$buildType"(type: Copy) {
|
task "prepareDexForMerge$buildType"(type: Copy) {
|
||||||
dependsOn('exportDex' + buildType)
|
dependsOn('exportDex' + buildType)
|
||||||
// Remove comment for native lib build
|
// Remove comment for native lib build
|
||||||
dependsOn('cargoBuild')
|
//dependsOn('cargoBuild')
|
||||||
into smaliFolder.toString()
|
into smaliFolder.toString()
|
||||||
from(projectDir) {
|
from(projectDir) {
|
||||||
include 'classes6.dex'
|
into '../smali'
|
||||||
include 'classes7.dex'
|
include "classes*.dex"
|
||||||
}
|
}
|
||||||
from(projectDir) {
|
from(projectDir) {
|
||||||
include 'version.properties'
|
include 'version.properties'
|
||||||
into 'assets'
|
into 'assets'
|
||||||
}
|
}
|
||||||
// Remove comment for native lib build
|
|
||||||
from('../native-effects/target/aarch64-linux-android/release'){
|
from('../native-effects/target/aarch64-linux-android/release'){
|
||||||
include 'libnative_effects.so'
|
include 'libnative_effects.so'
|
||||||
into 'lib/arm64-v8a'
|
into 'lib/arm64-v8a'
|
||||||
@@ -171,15 +154,16 @@ task generateBuildTasks() {
|
|||||||
include 'libnative_effects.so'
|
include 'libnative_effects.so'
|
||||||
into 'lib/armeabi-v7a'
|
into 'lib/armeabi-v7a'
|
||||||
}
|
}
|
||||||
doLast {
|
}
|
||||||
new File(projectDir, "classes6.dex").delete()
|
task "cleanTemporaryFiles$buildType"(type:Delete)
|
||||||
new File(projectDir, "classes7.dex").delete()
|
{
|
||||||
new File(projectDir, "version.properties").delete()
|
delete fileTree(dir:projectDir,include:["*.dex","version.properties"])
|
||||||
}
|
delete fileTree(dir:smaliFolder,include:['*.dex',"assets/version.properties"])
|
||||||
}
|
}
|
||||||
task "buildVTL$buildType"(type: Exec) {
|
task "buildVTL$buildType"(type: Exec) {
|
||||||
dependsOn('prepareDexForMerge' + buildType)
|
dependsOn('prepareDexForMerge' + buildType)
|
||||||
workingDir(projectDir.parentFile)
|
workingDir(projectDir.parentFile)
|
||||||
|
finalizedBy "cleanTemporaryFiles$buildType"
|
||||||
if (Os.isFamily("unix") || Os.isFamily("mac")) {
|
if (Os.isFamily("unix") || Os.isFamily("mac")) {
|
||||||
commandLine 'bash', '-c', './scripts/build.sh'
|
commandLine 'bash', '-c', './scripts/build.sh'
|
||||||
} else {
|
} else {
|
||||||
@@ -207,7 +191,6 @@ task generateBuildTasks() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task generateRjava(type: Exec) {
|
task generateRjava(type: Exec) {
|
||||||
workingDir(projectDir.parentFile)
|
workingDir(projectDir.parentFile)
|
||||||
if (Os.isFamily("unix") || Os.isFamily("mac"))
|
if (Os.isFamily("unix") || Os.isFamily("mac"))
|
||||||
|
|||||||
@@ -36,10 +36,8 @@ public class TelegramStickersPack extends CustomStickersPack {
|
|||||||
public HashMap<String, List<Integer>> emojis = new HashMap<>();
|
public HashMap<String, List<Integer>> emojis = new HashMap<>();
|
||||||
|
|
||||||
public TelegramStickersPack(String id) {
|
public TelegramStickersPack(String id) {
|
||||||
final var idLowerCase = id.toLowerCase();
|
this.id=this.title=id;
|
||||||
this.id = idLowerCase;
|
this.hash=id.hashCode();
|
||||||
this.hash = idLowerCase.hashCode();
|
|
||||||
title = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject encodeEmojis() throws JSONException {
|
public JSONObject encodeEmojis() throws JSONException {
|
||||||
@@ -103,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.equals(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.util.Log;
|
|||||||
import com.aefyr.tsg.g2.sql.TelegramStickersDbHelper;
|
import com.aefyr.tsg.g2.sql.TelegramStickersDbHelper;
|
||||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersPackInfo;
|
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersPackInfo;
|
||||||
|
import ru.vtosters.lite.ui.fragments.VTSettings;
|
||||||
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
|
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -152,6 +153,7 @@ public class TelegramStickersService {
|
|||||||
|
|
||||||
private void notifyActivePacksListChanged() {
|
private void notifyActivePacksListChanged() {
|
||||||
getGlobalContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
getGlobalContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||||
|
getGlobalContext().sendBroadcast(new Intent(VTSettings.ACTION_INVALIDATE_TGS_COUNT));
|
||||||
if (listeners.isEmpty())
|
if (listeners.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -222,7 +224,7 @@ public class TelegramStickersService {
|
|||||||
final TelegramStickersPack newPack = pack;
|
final TelegramStickersPack newPack = pack;
|
||||||
final boolean isUpdate = update;
|
final boolean isUpdate = update;
|
||||||
|
|
||||||
currentlyDownloading.add(id.toLowerCase());
|
currentlyDownloading.add(id);
|
||||||
notificationsHelper.packStartedDownloading(newPack);
|
notificationsHelper.packStartedDownloading(newPack);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -130,9 +130,9 @@ public class BinaryResourceValue implements SerializableResource {
|
|||||||
*/
|
*/
|
||||||
public static final int SIZE = 8;
|
public static final int SIZE = 8;
|
||||||
|
|
||||||
private final int size;
|
public int size;
|
||||||
private final Type type;
|
public Type type;
|
||||||
private final int data;
|
public int data;
|
||||||
|
|
||||||
public static BinaryResourceValue create(ByteBuffer buffer) {
|
public static BinaryResourceValue create(ByteBuffer buffer) {
|
||||||
int size = (buffer.getShort() & 0xFFFF);
|
int size = (buffer.getShort() & 0xFFFF);
|
||||||
|
|||||||
@@ -0,0 +1,502 @@
|
|||||||
|
package com.vk.medianative;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Process;
|
||||||
|
import android.os.*;
|
||||||
|
import android.util.Log;
|
||||||
|
import androidx.annotation.Keep;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import com.facebook.soloader.SoLoader;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public final class MediaNative {
|
||||||
|
private static final String a = NativeMediaEncoder.class.getSimpleName();
|
||||||
|
private static final Object f17443d = new Object();
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
@Keep
|
||||||
|
public static volatile Context context;
|
||||||
|
private static boolean isMediaLoaded = false;
|
||||||
|
private static boolean isMediaMasksLoaded = false;
|
||||||
|
|
||||||
|
public static int HSLToIntRGB(float f2, float f3, float f4) {
|
||||||
|
int[] iArr = new int[3];
|
||||||
|
waitForContext();
|
||||||
|
nativeHSLToRGB(f2, f3, f4, iArr);
|
||||||
|
return Color.argb(255, iArr[0], iArr[1], iArr[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void HSLToRGB(float f2, float f3, float f4, int[] iArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeHSLToRGB(f2, f3, f4, iArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int HSVToIntRGB(float f2, float f3, float f4) {
|
||||||
|
int[] iArr = new int[3];
|
||||||
|
waitForContext();
|
||||||
|
nativeHSVToRGB(f2, f3, f4, iArr);
|
||||||
|
return Color.argb(255, iArr[0], iArr[1], iArr[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void HSVToRGB(float f2, float f3, float f4, int[] iArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeHSVToRGB(f2, f3, f4, iArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int LabToIntRGB(float f2, float f3, float f4) {
|
||||||
|
int[] iArr = new int[3];
|
||||||
|
waitForContext();
|
||||||
|
nativeLabToRGB(f2, f3, f4, iArr);
|
||||||
|
return Color.argb(255, iArr[0], iArr[1], iArr[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LabToRGB(float f2, float f3, float f4, int[] iArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeLabToRGB(f2, f3, f4, iArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RGBToHSL(int i, int i2, int i3, float[] fArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeRGBToHSL(i, i2, i3, fArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RGBToHSV(int i, int i2, int i3, float[] fArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeRGBToHSV(i, i2, i3, fArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RGBToLab(int i, int i2, int i3, float[] fArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeRGBToLab(i, i2, i3, fArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long animationPlayerCreate(String str, int i, int i2, boolean z) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeAnimationPlayerCreate(str, i, i2, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int animationPlayerDecode(long j, Bitmap bitmap) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeAnimationPlayerDecode(j, bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int animationPlayerGetSize(long j) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeAnimationPlayerGetSize(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void animationPlayerRelease(long j) {
|
||||||
|
waitForContext();
|
||||||
|
nativeAnimationPlayerRelease(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean animationPlayerSeek(long j, int i) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeAnimationPlayerSeek(j, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void applyCurveAndSaturationBitmap(Bitmap bitmap, int[] iArr, float f2) {
|
||||||
|
waitForContext();
|
||||||
|
nativeCurveSaturation(bitmap, iArr, f2, Runtime.getRuntime().availableProcessors());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long audioGetTotalPcmDuration() {
|
||||||
|
waitForContext();
|
||||||
|
return nativeAudioGetTotalPcmDuration();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] audioGetWaveform(short[] sArr, int i) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeAudioGetWaveform(sArr, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int audioIsOpusFile(String str) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeAudioIsOpusFile(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void audioReadOpusFile(ByteBuffer byteBuffer, int i, int[] iArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeAudioReadOpusFile(byteBuffer, i, iArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int audioSeekOpusFile(float f2) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeAudioSeekOpusFile(f2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int audioStartRecord(String str) { // need to hack
|
||||||
|
waitForContext();
|
||||||
|
return nativeAudioStartRecord(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void audioStopRecord() { // need to hack
|
||||||
|
waitForContext();
|
||||||
|
nativeAudioStopRecord();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int audioWriteFrame(ByteBuffer byteBuffer, int i) { // need to hack
|
||||||
|
waitForContext();
|
||||||
|
return nativeAudioWriteFrame(byteBuffer, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void waitForContext() {
|
||||||
|
synchronized (f17443d) {
|
||||||
|
if (context == null) {
|
||||||
|
try {
|
||||||
|
f17443d.wait();
|
||||||
|
} catch (InterruptedException e2) {
|
||||||
|
Log.e(a, "Interrupted while waiting for context", e2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void blurBitmap(Bitmap bitmap, int i) {
|
||||||
|
waitForContext();
|
||||||
|
nativeBlur(bitmap, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String c() {
|
||||||
|
return getProcMaps(String.valueOf(Process.myPid()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cameraProcessorCreate() {
|
||||||
|
waitForContext();
|
||||||
|
nativeProcessorCreate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean cameraProcessorDo(byte[] bArr, long[] jArr) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeProcessorDo(bArr, jArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int cameraProcessorGetVersion() {
|
||||||
|
waitForContext();
|
||||||
|
return nativeProcessorGetVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean cameraProcessorInit(String str, int i, int i2) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeProcessorInit(str, i, i2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean cameraProcessorLoad(String str, boolean z) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeProcessorLoad(str, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cameraProcessorMouseTap(int i, float f2, float f3) {
|
||||||
|
waitForContext();
|
||||||
|
nativeProcessorMouseTap(i, f2, f3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cameraProcessorRelease() {
|
||||||
|
waitForContext();
|
||||||
|
nativeProcessorRelease();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void colorCorrectionBitmap(Bitmap bitmap, Bitmap bitmap2, float[] fArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeColorCorrection(bitmap, bitmap2, fArr, fArr.length, Runtime.getRuntime().availableProcessors());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] compressBitmapJpeg(Bitmap bitmap, int i) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeJpegTurboCompress(bitmap, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String createAllInOneShader() {
|
||||||
|
waitForContext();
|
||||||
|
return nativeAllInOneShader();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void createCurve(int[] iArr, int[] iArr2, int[] iArr3, int[] iArr4, int[] iArr5, float f2, float f3, float f4, float f5, float f6) {
|
||||||
|
waitForContext();
|
||||||
|
nativeCreateCurve(iArr, iArr2, iArr3, iArr4, iArr5, f2, f3, f4, f5, f6);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String createOneInAllShader() {
|
||||||
|
waitForContext();
|
||||||
|
return nativeOneInAllShader();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String d() {
|
||||||
|
return getProcMaps("self");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String dump() {
|
||||||
|
return "LD_LIBRARY_PATH:\n" + SoLoader.makeLdLibraryPath() + "\nSELF_MAPS:\n" + d() + "\nPID_MAPS:\n" + c() + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void e() {
|
||||||
|
isMediaMasksLoaded = NativeLibLoader.loadLibrary("vkmediamasks");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void enhanceBitmap(Bitmap bitmap, float f2) {
|
||||||
|
waitForContext();
|
||||||
|
nativeEnhance(bitmap, f2, Runtime.getRuntime().availableProcessors());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void loadVKMediaLibs() {
|
||||||
|
if (isMediaLoaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
NativeLibLoader.loadLibrary("ffmpeg");
|
||||||
|
isMediaLoaded = NativeLibLoader.loadLibrary("vkmedia");
|
||||||
|
isMediaLoaded = NativeLibLoader.loadLibrary("vkmediaencoder");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void flipHorizontallyBitmap(Bitmap bitmap) {
|
||||||
|
waitForContext();
|
||||||
|
nativeFlipHorizontally(bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void flipVerticallyBitmap(Bitmap bitmap) {
|
||||||
|
waitForContext();
|
||||||
|
nativeFlipVertically(bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void generateHistogram(Bitmap bitmap, int[] iArr, int[] iArr2, int[] iArr3, int[] iArr4) {
|
||||||
|
waitForContext();
|
||||||
|
nativeHistogram(bitmap, iArr, iArr2, iArr3, iArr4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init(Context context2) {
|
||||||
|
synchronized (f17443d) {
|
||||||
|
context = context2;
|
||||||
|
SoLoader.init(context2, false);
|
||||||
|
NativeLibLoader.loadLibrary("gnustl_shared");
|
||||||
|
NativeLibLoader.loadLibrary("vkchronicle");
|
||||||
|
loadVKMediaLibs();
|
||||||
|
f17443d.notifyAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void intRGBToHSL(int i, float[] fArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeRGBToHSL(Color.red(i), Color.green(i), Color.blue(i), fArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void intRGBToHSV(int i, float[] fArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeRGBToHSV(Color.red(i), Color.green(i), Color.blue(i), fArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void intRGBToLab(int i, float[] fArr) {
|
||||||
|
waitForContext();
|
||||||
|
nativeRGBToLab(Color.red(i), Color.green(i), Color.blue(i), fArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAsus() {
|
||||||
|
return "asus".equalsIgnoreCase(Build.MANUFACTURER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isMediaSupported() {
|
||||||
|
if (!isMediaMasksLoaded) {
|
||||||
|
e();
|
||||||
|
}
|
||||||
|
return isMediaMasksLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isX86() {
|
||||||
|
try {
|
||||||
|
String str = Build.SUPPORTED_ABIS[0];
|
||||||
|
if (str != null) {
|
||||||
|
return str.startsWith("x86");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} catch (Throwable unused) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void lookupBitmap(Bitmap bitmap, Bitmap bitmap2) {
|
||||||
|
waitForContext();
|
||||||
|
nativeLookup(bitmap, bitmap2, Runtime.getRuntime().availableProcessors());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long mediaEncoderCreate(MediaEncoderSettings mediaEncoderSettings) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeCreateEncoder(mediaEncoderSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int mediaEncoderDoEncode(long j) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeDoEncode(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void mediaEncoderDoRelease(long j) {
|
||||||
|
waitForContext();
|
||||||
|
nativeReleaseEncoder(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static native String nativeAllInOneShader();
|
||||||
|
|
||||||
|
private static native long nativeAnimationPlayerCreate(String str, int i, int i2, boolean z);
|
||||||
|
|
||||||
|
private static native int nativeAnimationPlayerDecode(long j, Bitmap bitmap);
|
||||||
|
|
||||||
|
private static native int nativeAnimationPlayerGetSize(long j);
|
||||||
|
|
||||||
|
private static native void nativeAnimationPlayerRelease(long j);
|
||||||
|
|
||||||
|
private static native boolean nativeAnimationPlayerSeek(long j, int i);
|
||||||
|
|
||||||
|
private static native long nativeAudioGetTotalPcmDuration();
|
||||||
|
|
||||||
|
private static native byte[] nativeAudioGetWaveform(short[] sArr, int i);
|
||||||
|
|
||||||
|
private static native int nativeAudioIsOpusFile(String str);
|
||||||
|
|
||||||
|
private static native int nativeAudioOpenOpusFile(String str);
|
||||||
|
|
||||||
|
private static native void nativeAudioReadOpusFile(ByteBuffer byteBuffer, int i, int[] iArr);
|
||||||
|
|
||||||
|
private static native int nativeAudioSeekOpusFile(float f2);
|
||||||
|
|
||||||
|
private static native int nativeAudioStartRecord(String str);
|
||||||
|
|
||||||
|
private static native void nativeAudioStopRecord();
|
||||||
|
|
||||||
|
private static native int nativeAudioWriteFrame(ByteBuffer byteBuffer, int i);
|
||||||
|
|
||||||
|
private static native void nativeBlur(Bitmap bitmap, int i);
|
||||||
|
|
||||||
|
private static native void nativeColorCorrection(Bitmap bitmap, Bitmap bitmap2, float[] fArr, int i, int i2);
|
||||||
|
|
||||||
|
private static native String nativeCreateColorCorrectionShader(float[] fArr, int i, int i2);
|
||||||
|
|
||||||
|
private static native void nativeCreateCurve(int[] iArr, int[] iArr2, int[] iArr3, int[] iArr4, int[] iArr5, float f2, float f3, float f4, float f5, float f6);
|
||||||
|
|
||||||
|
private static native long nativeCreateEncoder(MediaEncoderSettings mediaEncoderSettings);
|
||||||
|
|
||||||
|
private static native void nativeCurveSaturation(Bitmap bitmap, int[] iArr, double d2, int i);
|
||||||
|
|
||||||
|
private static native int nativeDoEncode(long j);
|
||||||
|
|
||||||
|
private static native void nativeEnhance(Bitmap bitmap, double d2, int i);
|
||||||
|
|
||||||
|
private static native void nativeFlipHorizontally(Bitmap bitmap);
|
||||||
|
|
||||||
|
private static native void nativeFlipVertically(Bitmap bitmap);
|
||||||
|
|
||||||
|
private static native void nativeHSLToRGB(float f2, float f3, float f4, int[] iArr);
|
||||||
|
|
||||||
|
private static native void nativeHSVToRGB(float f2, float f3, float f4, int[] iArr);
|
||||||
|
|
||||||
|
private static native void nativeHistogram(Bitmap bitmap, int[] iArr, int[] iArr2, int[] iArr3, int[] iArr4);
|
||||||
|
|
||||||
|
private static native byte[] nativeJpegTurboCompress(Bitmap bitmap, int i);
|
||||||
|
|
||||||
|
private static native void nativeLabToRGB(float f2, float f3, float f4, int[] iArr);
|
||||||
|
|
||||||
|
private static native void nativeLookup(Bitmap bitmap, Bitmap bitmap2, int i);
|
||||||
|
|
||||||
|
private static native String nativeOneInAllShader();
|
||||||
|
|
||||||
|
private static native void nativePinBitmap(Bitmap bitmap);
|
||||||
|
|
||||||
|
private static native void nativeProcessorCreate();
|
||||||
|
|
||||||
|
private static native boolean nativeProcessorDo(byte[] bArr, long[] jArr);
|
||||||
|
|
||||||
|
private static native int nativeProcessorGetVersion();
|
||||||
|
|
||||||
|
private static native boolean nativeProcessorInit(String str, int i, int i2);
|
||||||
|
|
||||||
|
private static native boolean nativeProcessorLoad(String str, boolean z);
|
||||||
|
|
||||||
|
private static native void nativeProcessorMouseTap(int i, float f2, float f3);
|
||||||
|
|
||||||
|
private static native void nativeProcessorRelease();
|
||||||
|
|
||||||
|
private static native void nativeRGBToHSL(int i, int i2, int i3, float[] fArr);
|
||||||
|
|
||||||
|
private static native void nativeRGBToHSV(int i, int i2, int i3, float[] fArr);
|
||||||
|
|
||||||
|
private static native void nativeRGBToLab(int i, int i2, int i3, float[] fArr);
|
||||||
|
|
||||||
|
private static native void nativeReleaseEncoder(long j);
|
||||||
|
|
||||||
|
private static native void nativeResize(Bitmap bitmap, Bitmap bitmap2, int i);
|
||||||
|
|
||||||
|
public static int openOpusFile(String str) {
|
||||||
|
waitForContext();
|
||||||
|
return nativeAudioOpenOpusFile(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void pinBitmap(Bitmap bitmap) {
|
||||||
|
waitForContext();
|
||||||
|
nativePinBitmap(bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void resizeBitmap(Bitmap bitmap, Bitmap bitmap2) {
|
||||||
|
waitForContext();
|
||||||
|
nativeResize(bitmap, bitmap2, Runtime.getRuntime().availableProcessors());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getProcMaps(String str) {
|
||||||
|
try (InputStream inputStream = Runtime.getRuntime().exec("cat /proc/" + str + "/maps").getInputStream()) {
|
||||||
|
return new Scanner(inputStream).useDelimiter("\\A").next();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return "empty";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class EncoderHandler extends Handler {
|
||||||
|
private Callback a;
|
||||||
|
|
||||||
|
public EncoderHandler(Looper looper) {
|
||||||
|
super(looper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
public static Object postEventFromNative(Object obj, int i, int i2, int i3) {
|
||||||
|
EncoderHandler encoderHandler;
|
||||||
|
if (obj != null && (encoderHandler = (EncoderHandler) ((WeakReference<?>) obj).get()) != null) {
|
||||||
|
if (i == 2) {
|
||||||
|
return encoderHandler.a.getLayerBitmap(i2, i3);
|
||||||
|
}
|
||||||
|
encoderHandler.sendMessage(encoderHandler.obtainMessage(i, i2, i3, null));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override // android.os.Handler
|
||||||
|
public void handleMessage(Message message) {
|
||||||
|
Callback callback = this.a;
|
||||||
|
if (callback == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int i = message.what;
|
||||||
|
if (i == 0) {
|
||||||
|
callback.onBytes(message.arg1);
|
||||||
|
} else if (i != 1) {
|
||||||
|
String str = MediaNative.a;
|
||||||
|
Log.e(str, "Unknown message type " + message.what);
|
||||||
|
} else {
|
||||||
|
callback.onProgress(message.arg1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCallback(Callback callback) {
|
||||||
|
this.a = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Callback {
|
||||||
|
@Nullable
|
||||||
|
Bitmap getLayerBitmap(int i, int i2);
|
||||||
|
|
||||||
|
void onBytes(int i);
|
||||||
|
|
||||||
|
void onProgress(int i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4976,30 +4976,29 @@ public final class R {
|
|||||||
public static final int ic_deepl_logo_icon = 0x7f080bcb; // 2131233739
|
public static final int ic_deepl_logo_icon = 0x7f080bcb; // 2131233739
|
||||||
public static final int ic_google_translate_logo = 0x7f080bcc; // 2131233740
|
public static final int ic_google_translate_logo = 0x7f080bcc; // 2131233740
|
||||||
public static final int ic_yandex_translate_icon = 0x7f080bd1; // 2131233745
|
public static final int ic_yandex_translate_icon = 0x7f080bd1; // 2131233745
|
||||||
public static final int microsoft = 0x7f080bd2; // 2131233746
|
public static final int $splash__0 = 0x7f080bd2; // 2131233746
|
||||||
public static final int roundmsg = 0x7f080bd3; // 2131233747
|
public static final int roundmsg = 0x7f080bd3; // 2131233747
|
||||||
public static final int tgs_entry_background = 0x7f080bd4; // 2131233748
|
public static final int tgs_entry_background = 0x7f080bd4; // 2131233748
|
||||||
public static final int yandex = 0x7f080bd7; // 2131233751
|
public static final int yandex = 0x7f080bd7; // 2131233751
|
||||||
public static final int $splash__0 = 0x7f080bd8; // 2131233752
|
public static final int $splash__1 = 0x7f080bd8; // 2131233752
|
||||||
public static final int $splash__1 = 0x7f080bd9; // 2131233753
|
public static final int $splash__10 = 0x7f080bd9; // 2131233753
|
||||||
public static final int $splash__10 = 0x7f080bda; // 2131233754
|
public static final int $splash__11 = 0x7f080bda; // 2131233754
|
||||||
public static final int $splash__11 = 0x7f080bdb; // 2131233755
|
public static final int $splash__12 = 0x7f080bdb; // 2131233755
|
||||||
public static final int $splash__12 = 0x7f080bdc; // 2131233756
|
public static final int $splash__13 = 0x7f080bdc; // 2131233756
|
||||||
public static final int $splash__13 = 0x7f080bdd; // 2131233757
|
public static final int $splash__14 = 0x7f080bdd; // 2131233757
|
||||||
public static final int $splash__14 = 0x7f080bde; // 2131233758
|
public static final int $splash__15 = 0x7f080bde; // 2131233758
|
||||||
public static final int $splash__15 = 0x7f080bdf; // 2131233759
|
public static final int $splash__2 = 0x7f080bdf; // 2131233759
|
||||||
public static final int $splash__2 = 0x7f080be0; // 2131233760
|
public static final int $splash__3 = 0x7f080be0; // 2131233760
|
||||||
public static final int $splash__3 = 0x7f080be1; // 2131233761
|
public static final int $splash__4 = 0x7f080be1; // 2131233761
|
||||||
public static final int $splash__4 = 0x7f080be2; // 2131233762
|
public static final int $splash__5 = 0x7f080be2; // 2131233762
|
||||||
public static final int $splash__5 = 0x7f080be3; // 2131233763
|
public static final int $splash__6 = 0x7f080be3; // 2131233763
|
||||||
public static final int $splash__6 = 0x7f080be4; // 2131233764
|
public static final int $splash__7 = 0x7f080be4; // 2131233764
|
||||||
public static final int $splash__7 = 0x7f080be5; // 2131233765
|
public static final int $splash__8 = 0x7f080be5; // 2131233765
|
||||||
public static final int $splash__8 = 0x7f080be6; // 2131233766
|
public static final int $splash__9 = 0x7f080be6; // 2131233766
|
||||||
public static final int $splash__9 = 0x7f080be7; // 2131233767
|
|
||||||
public static final int checker_background = 0x7f080be8; // 2131233768
|
public static final int checker_background = 0x7f080be8; // 2131233768
|
||||||
public static final int custom_thumb_selector = 0x7f080be9; // 2131233769
|
public static final int custom_thumb_selector = 0x7f080be9; // 2131233769
|
||||||
public static final int custom_track_selector = 0x7f080bea; // 2131233770
|
public static final int custom_track_selector = 0x7f080bea; // 2131233770
|
||||||
public static final int splash = 0x7f080beb; // 2131233771
|
public static final int splash = 0x7f080bec; // 2131233772
|
||||||
public static final int abc_control_background_material = 0x7f080032; // 2131230770
|
public static final int abc_control_background_material = 0x7f080032; // 2131230770
|
||||||
public static final int ic_action_close = 0x7f080322; // 2131231522
|
public static final int ic_action_close = 0x7f080322; // 2131231522
|
||||||
public static final int ic_camera_outline_28_new = 0x7f0803a0; // 2131231648
|
public static final int ic_camera_outline_28_new = 0x7f0803a0; // 2131231648
|
||||||
@@ -6797,6 +6796,9 @@ public final class R {
|
|||||||
public static final int ic_telegram_24 = 0x7f080bcf; // 2131233743
|
public static final int ic_telegram_24 = 0x7f080bcf; // 2131233743
|
||||||
public static final int ic_telegram_outline_28 = 0x7f080bd0; // 2131233744
|
public static final int ic_telegram_outline_28 = 0x7f080bd0; // 2131233744
|
||||||
public static final int vtlogo = 0x7f080bd6; // 2131233750
|
public static final int vtlogo = 0x7f080bd6; // 2131233750
|
||||||
|
public static final int bing = 0x7f080be7; // 2131233767
|
||||||
|
public static final int sauceNAO = 0x7f080beb; // 2131233771
|
||||||
|
public static final int tracemoe = 0x7f080bed; // 2131233773
|
||||||
public static final int bg_music_play_button_white = 0x7f08015e; // 2131231070
|
public static final int bg_music_play_button_white = 0x7f08015e; // 2131231070
|
||||||
public static final int bg_poll_bg_thumb = 0x7f080181; // 2131231105
|
public static final int bg_poll_bg_thumb = 0x7f080181; // 2131231105
|
||||||
public static final int bg_stickers_suggestions_left = 0x7f0801ad; // 2131231149
|
public static final int bg_stickers_suggestions_left = 0x7f0801ad; // 2131231149
|
||||||
@@ -19592,67 +19594,76 @@ public final class R {
|
|||||||
public static final int calls_not_available = 0x7f12184a; // 2131892298
|
public static final int calls_not_available = 0x7f12184a; // 2131892298
|
||||||
public static final int cannot_write = 0x7f12184b; // 2131892299
|
public static final int cannot_write = 0x7f12184b; // 2131892299
|
||||||
public static final int change_accent_color = 0x7f12184c; // 2131892300
|
public static final int change_accent_color = 0x7f12184c; // 2131892300
|
||||||
public static final int copydebuginfo_summ = 0x7f12184d; // 2131892301
|
public static final int compression_types = 0x7f12184d; // 2131892301
|
||||||
public static final int copydebuginfo_title = 0x7f12184e; // 2131892302
|
public static final int compression_types_selection = 0x7f12184e; // 2131892302
|
||||||
public static final int copyownlink_summ = 0x7f12184f; // 2131892303
|
public static final int copydebuginfo_summ = 0x7f12184f; // 2131892303
|
||||||
public static final int copyownlink_title = 0x7f121850; // 2131892304
|
public static final int copydebuginfo_title = 0x7f121850; // 2131892304
|
||||||
public static final int crash_service_name = 0x7f121851; // 2131892305
|
public static final int copyownlink_summ = 0x7f121851; // 2131892305
|
||||||
public static final int currentLanguage = 0x7f121852; // 2131892306
|
public static final int copyownlink_title = 0x7f121852; // 2131892306
|
||||||
public static final int current_theme = 0x7f121853; // 2131892307
|
public static final int crash_service_name = 0x7f121853; // 2131892307
|
||||||
public static final int custom_links_warning = 0x7f121854; // 2131892308
|
public static final int currentLanguage = 0x7f121854; // 2131892308
|
||||||
public static final int data = 0x7f121855; // 2131892309
|
public static final int current_theme = 0x7f121855; // 2131892309
|
||||||
public static final int data_updated = 0x7f121856; // 2131892310
|
public static final int custom_links_warning = 0x7f121856; // 2131892310
|
||||||
public static final int datasettings_title = 0x7f121857; // 2131892311
|
public static final int data = 0x7f121857; // 2131892311
|
||||||
public static final int device_info = 0x7f121858; // 2131892312
|
public static final int data_updated = 0x7f121858; // 2131892312
|
||||||
public static final int device_info_copied = 0x7f121859; // 2131892313
|
public static final int datasettings_title = 0x7f121859; // 2131892313
|
||||||
public static final int dialogstats = 0x7f12185a; // 2131892314
|
public static final int device_info = 0x7f12185a; // 2131892314
|
||||||
public static final int disable_analytics = 0x7f12185b; // 2131892315
|
public static final int device_info_copied = 0x7f12185b; // 2131892315
|
||||||
public static final int disable_analytics_summ = 0x7f12185c; // 2131892316
|
public static final int dialogstats = 0x7f12185c; // 2131892316
|
||||||
public static final int downloading_update = 0x7f12185d; // 2131892317
|
public static final int disable_analytics = 0x7f12185d; // 2131892317
|
||||||
public static final int error_applying_accent = 0x7f12185e; // 2131892318
|
public static final int disable_analytics_summ = 0x7f12185e; // 2131892318
|
||||||
public static final int error_no_text = 0x7f12185f; // 2131892319
|
public static final int downloading_update = 0x7f12185f; // 2131892319
|
||||||
public static final int error_saving_file = 0x7f121860; // 2131892320
|
public static final int error_applying_accent = 0x7f121860; // 2131892320
|
||||||
public static final int failed_to_get_text = 0x7f121861; // 2131892321
|
public static final int error_no_text = 0x7f121861; // 2131892321
|
||||||
public static final int invalid_pack_link = 0x7f121862; // 2131892322
|
public static final int error_saving_file = 0x7f121862; // 2131892322
|
||||||
public static final int invalidate_theme_cache_title = 0x7f121863; // 2131892323
|
public static final int failed_to_get_text = 0x7f121863; // 2131892323
|
||||||
public static final int logColors_title = 0x7f121864; // 2131892324
|
public static final int invalid_pack_link = 0x7f121864; // 2131892324
|
||||||
public static final int maxquality_summ = 0x7f121865; // 2131892325
|
public static final int invalidate_theme_cache_title = 0x7f121865; // 2131892325
|
||||||
public static final int maxquality_title = 0x7f121866; // 2131892326
|
public static final int logColors_title = 0x7f121866; // 2131892326
|
||||||
public static final int monettheme_summ = 0x7f121867; // 2131892327
|
public static final int maxquality_summ = 0x7f121867; // 2131892327
|
||||||
public static final int monettheme_title = 0x7f121868; // 2131892328
|
public static final int maxquality_title = 0x7f121868; // 2131892328
|
||||||
public static final int newsfeed_notif_summ = 0x7f121869; // 2131892329
|
public static final int microgsett = 0x7f121869; // 2131892329
|
||||||
public static final int newsfeed_notif_title = 0x7f12186a; // 2131892330
|
public static final int monettheme_summ = 0x7f12186a; // 2131892330
|
||||||
public static final int open_bot = 0x7f12186b; // 2131892331
|
public static final int monettheme_title = 0x7f12186b; // 2131892331
|
||||||
public static final int promotedstickers_title = 0x7f12186c; // 2131892332
|
public static final int newsfeed_notif_summ = 0x7f12186c; // 2131892332
|
||||||
public static final int remove_encryption_key = 0x7f12186d; // 2131892333
|
public static final int newsfeed_notif_title = 0x7f12186d; // 2131892333
|
||||||
public static final int remove_from_ads_stories_whitelist = 0x7f12186e; // 2131892334
|
public static final int open_bot = 0x7f12186e; // 2131892334
|
||||||
public static final int reset_accounts = 0x7f12186f; // 2131892335
|
public static final int promotedstickers_title = 0x7f12186f; // 2131892335
|
||||||
public static final int reset_all_settings = 0x7f121870; // 2131892336
|
public static final int remove_encryption_key = 0x7f121870; // 2131892336
|
||||||
public static final int restore_accounts = 0x7f121871; // 2131892337
|
public static final int remove_from_ads_stories_whitelist = 0x7f121871; // 2131892337
|
||||||
public static final int restore_settings = 0x7f121872; // 2131892338
|
public static final int reset_accounts = 0x7f121872; // 2131892338
|
||||||
public static final int save_accounts = 0x7f121873; // 2131892339
|
public static final int reset_all_settings = 0x7f121873; // 2131892339
|
||||||
public static final int save_online_data = 0x7f121874; // 2131892340
|
public static final int restore_accounts = 0x7f121874; // 2131892340
|
||||||
public static final int select_color = 0x7f121875; // 2131892341
|
public static final int restore_settings = 0x7f121875; // 2131892341
|
||||||
public static final int select_palette = 0x7f121876; // 2131892342
|
public static final int save_accounts = 0x7f121876; // 2131892342
|
||||||
public static final int sources = 0x7f121877; // 2131892343
|
public static final int save_online_data = 0x7f121877; // 2131892343
|
||||||
public static final int storiesGroupsAdBlock = 0x7f121878; // 2131892344
|
public static final int select_color = 0x7f121878; // 2131892344
|
||||||
public static final int storiesGroupsAdBlocksummary = 0x7f121879; // 2131892345
|
public static final int select_palette = 0x7f121879; // 2131892345
|
||||||
public static final int systemtheme = 0x7f12187a; // 2131892346
|
public static final int sources = 0x7f12187a; // 2131892346
|
||||||
public static final int systemtheme_enabled = 0x7f12187b; // 2131892347
|
public static final int storiesGroupsAdBlock = 0x7f12187b; // 2131892347
|
||||||
public static final int systemtheme_summ = 0x7f12187c; // 2131892348
|
public static final int storiesGroupsAdBlocksummary = 0x7f12187c; // 2131892348
|
||||||
public static final int updateverifdata_summ = 0x7f12187d; // 2131892349
|
public static final int systemtheme = 0x7f12187d; // 2131892349
|
||||||
public static final int updateverifdata_title = 0x7f12187e; // 2131892350
|
public static final int systemtheme_enabled = 0x7f12187e; // 2131892350
|
||||||
public static final int useCustomPrefsStyle_summ = 0x7f12187f; // 2131892351
|
public static final int systemtheme_summ = 0x7f12187f; // 2131892351
|
||||||
public static final int useCustomPrefsStyle_title = 0x7f121880; // 2131892352
|
public static final int updateverifdata_summ = 0x7f121880; // 2131892352
|
||||||
public static final int useGenius_summ = 0x7f121881; // 2131892353
|
public static final int updateverifdata_title = 0x7f121881; // 2131892353
|
||||||
public static final int useGenius_title = 0x7f121882; // 2131892354
|
public static final int useCustomPrefsStyle_summ = 0x7f121882; // 2131892354
|
||||||
public static final int useNewColorEngine_summ = 0x7f121883; // 2131892355
|
public static final int useCustomPrefsStyle_title = 0x7f121883; // 2131892355
|
||||||
public static final int useNewColorEngine_title = 0x7f121884; // 2131892356
|
public static final int useGenius_summ = 0x7f121884; // 2131892356
|
||||||
public static final int useOldAppVer_summ = 0x7f121885; // 2131892357
|
public static final int useGenius_title = 0x7f121885; // 2131892357
|
||||||
public static final int useOldAppVer_title = 0x7f121886; // 2131892358
|
public static final int useNewColorEngine_summ = 0x7f121886; // 2131892358
|
||||||
public static final int vkx_integration_enabled_info = 0x7f121887; // 2131892359
|
public static final int useNewColorEngine_title = 0x7f121887; // 2131892359
|
||||||
public static final int whitelisted_ad_groups_stories_title = 0x7f121888; // 2131892360
|
public static final int useOldAppVer_summ = 0x7f121888; // 2131892360
|
||||||
public static final int writebar_ios_title = 0x7f121889; // 2131892361
|
public static final int useOldAppVer_title = 0x7f121889; // 2131892361
|
||||||
|
public static final int vkx_integration_enabled_info = 0x7f12188a; // 2131892362
|
||||||
|
public static final int whitelisted_ad_groups_stories_title = 0x7f12188b; // 2131892363
|
||||||
|
public static final int writebar_ios_title = 0x7f12188c; // 2131892364
|
||||||
|
public static final int cache_size = 0x7f12188d; // 2131892365
|
||||||
|
public static final int cache_size_summ = 0x7f12188e; // 2131892366
|
||||||
|
public static final int clear_all_cache = 0x7f12188f; // 2131892367
|
||||||
|
public static final int invalidate_theme_cache_each_update_title = 0x7f121890; // 2131892368
|
||||||
|
public static final int invertFilters = 0x7f121891; // 2131892369
|
||||||
|
public static final int invertFilters_summ = 0x7f121892; // 2131892370
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class style {
|
public static final class style {
|
||||||
|
|||||||
@@ -19,11 +19,8 @@ import static ru.vtosters.hooks.other.Preferences.isValidSignature;
|
|||||||
|
|
||||||
|
|
||||||
public class GcmHook {
|
public class GcmHook {
|
||||||
|
|
||||||
private static final String agent = String.format("Android-GCM/1.5 (%s %s)", Build.MODEL, Build.MODEL);
|
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;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -35,15 +32,15 @@ public class GcmHook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String requestToken(String orig) {
|
public static String requestToken(String orig) {
|
||||||
return "yssp9o9p9pamz5t-nvmq8spgwtin3e0==";
|
return isValidSignature() ? "yssp9o9p9pamz5t-nvmq8spgwtin3e0==" : requestToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String requestToken() {
|
public static String requestToken() {
|
||||||
String xappide;
|
|
||||||
try {
|
try {
|
||||||
String aid = getRandomAid();
|
String aid = getRandomAid();
|
||||||
String pub2 = genNewKey();
|
String pub2 = genNewKey();
|
||||||
String sig = getSig(pub2);
|
String sig = getSig(pub2);
|
||||||
|
String xappide;
|
||||||
try {
|
try {
|
||||||
byte[] bytes = MessageDigest.getInstance("SHA1").digest(pair.getPublic().getEncoded());
|
byte[] bytes = MessageDigest.getInstance("SHA1").digest(pair.getPublic().getEncoded());
|
||||||
bytes[0] = (byte) (((bytes[0] & 15) + 112) & 255);
|
bytes[0] = (byte) (((bytes[0] & 15) + 112) & 255);
|
||||||
@@ -200,7 +197,6 @@ public class GcmHook {
|
|||||||
}).getBytes(StandardCharsets.UTF_8));
|
}).getBytes(StandardCharsets.UTF_8));
|
||||||
return Base64.encodeToString(sign.sign(), 0);
|
return Base64.encodeToString(sign.sign(), 0);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.app.Activity;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import b.h.g.k.VKProgressDialog;
|
import b.h.g.k.VKProgressDialog;
|
||||||
|
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||||
import com.vtosters.lite.R;
|
import com.vtosters.lite.R;
|
||||||
import ru.vtosters.hooks.other.Preferences;
|
import ru.vtosters.hooks.other.Preferences;
|
||||||
@@ -46,7 +47,10 @@ public class MainActivityInjector {
|
|||||||
NotificationChannels.createChannels();
|
NotificationChannels.createChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Preferences.isNewBuild() && !ThemesUtils.isMonetTheme() && ThemesManager.canApplyCustomAccent() && ThemesUtils.useNewColorEngine()) {
|
if (Preferences.isNewBuild()
|
||||||
|
&&!ThemesUtils.isMonetTheme()
|
||||||
|
&&ThemesManager.canApplyCustomAccent())
|
||||||
|
{
|
||||||
Preferences.updateBuildNumber();
|
Preferences.updateBuildNumber();
|
||||||
updateBinsAndTmpArchive(activity);
|
updateBinsAndTmpArchive(activity);
|
||||||
}
|
}
|
||||||
@@ -62,6 +66,8 @@ public class MainActivityInjector {
|
|||||||
InstallGMS.alert(activity);
|
InstallGMS.alert(activity);
|
||||||
DisableBattery.alert(activity);
|
DisableBattery.alert(activity);
|
||||||
// VKIDProtection.alert(activity);
|
// VKIDProtection.alert(activity);
|
||||||
|
//needs to show selected tgs pack count in settings after cold launch
|
||||||
|
TelegramStickersService.getInstance(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void updateBinsAndTmpArchive(Activity activity) {
|
private static void updateBinsAndTmpArchive(Activity activity) {
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import com.vk.core.preference.Preference;
|
import com.vk.core.preference.Preference;
|
||||||
import com.vk.discover.DiscoverItemDecorator;
|
import com.vk.discover.DiscoverItemDecorator;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static java.lang.Long.MAX_VALUE;
|
import static java.lang.Long.MAX_VALUE;
|
||||||
import static ru.vtosters.hooks.other.Preferences.*;
|
import static ru.vtosters.hooks.other.Preferences.*;
|
||||||
@@ -91,6 +93,7 @@ public class NewsfeedHook {
|
|||||||
public static boolean isPowerSaveMode() {
|
public static boolean isPowerSaveMode() {
|
||||||
var pw = (PowerManager) getGlobalContext().getSystemService(Context.POWER_SERVICE);
|
var pw = (PowerManager) getGlobalContext().getSystemService(Context.POWER_SERVICE);
|
||||||
|
|
||||||
return !getBoolValue("force_disable_psm", false) && pw.isPowerSaveMode();
|
// return !getBoolValue("force_disable_psm", false) && pw.isPowerSaveMode();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,16 +7,14 @@ import android.content.ClipboardManager;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
import com.vk.core.dialogs.actionspopup.ActionsPopup;
|
import com.vk.core.dialogs.actionspopup.ActionsPopup;
|
||||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||||
import com.vk.core.ui.themes.VKThemeHelper;
|
|
||||||
import com.vk.core.util.ContextExtKt;
|
|
||||||
import com.vk.core.util.ToastUtils;
|
import com.vk.core.util.ToastUtils;
|
||||||
import com.vk.dto.common.AttachmentWithMedia;
|
import com.vk.dto.common.AttachmentWithMedia;
|
||||||
import com.vk.dto.common.ImageSize;
|
import com.vk.dto.common.ImageSize;
|
||||||
@@ -24,318 +22,157 @@ import com.vtosters.lite.R;
|
|||||||
import com.vtosters.lite.attachments.DocumentAttachment;
|
import com.vtosters.lite.attachments.DocumentAttachment;
|
||||||
import com.vtosters.lite.attachments.PhotoAttachment;
|
import com.vtosters.lite.attachments.PhotoAttachment;
|
||||||
import okhttp3.*;
|
import okhttp3.*;
|
||||||
import okio.BufferedSink;
|
|
||||||
import okio.Okio;
|
import okio.Okio;
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
import ru.vtosters.hooks.other.Preferences;
|
|
||||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||||
|
import ru.vtosters.lite.themes.utils.RecolorUtils;
|
||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||||
|
import ru.vtosters.lite.utils.SearchEngine;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class PhotoViewer {
|
public class PhotoViewer {
|
||||||
static OkHttpClient client = VtOkHttpClient.getInstance();
|
static OkHttpClient client = VtOkHttpClient.getInstance();
|
||||||
|
|
||||||
|
//region INSERTION INTO SMALI
|
||||||
|
@SuppressLint("UseCompatLoadingForDrawables")
|
||||||
|
public static void addMenuItems(AttachmentWithMedia attachment, ActionsPopup.b actionPopup, int i, boolean z) {
|
||||||
|
actionPopup.a(
|
||||||
|
R.string.copy,
|
||||||
|
RecolorUtils.fixActionMenuIcons(R.drawable.ic_copy_outline_28),
|
||||||
|
false,
|
||||||
|
() -> {
|
||||||
|
copyImage(attachment);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
).a(
|
||||||
|
R.string.search_photo_content,
|
||||||
|
RecolorUtils.fixActionMenuIcons(R.drawable.ic_menu_search_outline_28),
|
||||||
|
false,
|
||||||
|
() -> {
|
||||||
|
searchImageWithUrl(attachment);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
).a(
|
||||||
|
R.string.copy_photo_url_content,
|
||||||
|
RecolorUtils.fixActionMenuIcons(R.drawable.ic_copy_outline_28),
|
||||||
|
false,
|
||||||
|
() -> {
|
||||||
|
copyImageUrl(attachment);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
).a(
|
||||||
|
R.string.open_original_photo_content,
|
||||||
|
RecolorUtils.fixActionMenuIcons(R.drawable.ic_link_outline_28),
|
||||||
|
false,
|
||||||
|
() -> {
|
||||||
|
openUrl(getImageUrlFromAttachment(attachment));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("NonConstantResourceId")
|
@SuppressLint("NonConstantResourceId")
|
||||||
public static boolean interceptClick(AttachmentWithMedia attachment, MenuItem item, View view) {
|
public static boolean interceptClick(AttachmentWithMedia attachment, MenuItem item, View view) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.copy_image -> {
|
case R.id.copy_image -> copyImage(attachment);
|
||||||
if (attachment instanceof PhotoAttachment) {
|
case R.id.search_photo -> searchImageWithUrl(attachment);
|
||||||
copyImage(getUrlFromPhotoAttachment((PhotoAttachment) attachment), String.valueOf(attachment.getId()));
|
case R.id.copy_photo_url -> copyImageUrl(attachment);
|
||||||
} else if (attachment instanceof DocumentAttachment) {
|
case R.id.open_original_photo -> openUrl(getImageUrlFromAttachment(attachment));
|
||||||
var documentAttachment = (DocumentAttachment) attachment;
|
|
||||||
if (documentAttachment.J != null)
|
|
||||||
try {
|
|
||||||
copyImage(getUrlFromDocumentAttachment(documentAttachment), String.valueOf(attachment.getId()));
|
|
||||||
} catch (Exception e) {
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case R.id.copy_photo_url -> {
|
|
||||||
if (attachment instanceof PhotoAttachment) {
|
|
||||||
copyPhotoUrl(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
|
||||||
} else if (attachment instanceof DocumentAttachment) {
|
|
||||||
var documentAttachment = (DocumentAttachment) attachment;
|
|
||||||
if (documentAttachment.J != null)
|
|
||||||
try {
|
|
||||||
copyPhotoUrl(getUrlFromDocumentAttachment(documentAttachment));
|
|
||||||
} catch (Exception e) {
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case R.id.open_original_photo -> {
|
|
||||||
if (attachment instanceof PhotoAttachment) {
|
|
||||||
openUrl(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
|
||||||
} else if (attachment instanceof DocumentAttachment) {
|
|
||||||
var documentAttachment = (DocumentAttachment) attachment;
|
|
||||||
if (documentAttachment.J != null)
|
|
||||||
try {
|
|
||||||
openUrl(getUrlFromDocumentAttachment(documentAttachment));
|
|
||||||
} catch (Exception e) {
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
//endregion
|
||||||
|
|
||||||
@SuppressLint("UseCompatLoadingForDrawables")
|
private static void copyImage(AttachmentWithMedia attachment) {
|
||||||
public static void addMenuItems(AttachmentWithMedia attachment, ActionsPopup.b actionPopup, int i, boolean z) {
|
var req = new Request.a()
|
||||||
actionPopup.a(R.string.copy,
|
.b(getImageUrlFromAttachment(attachment))
|
||||||
ContextExtKt.b(AndroidUtils.getGlobalContext(), R.drawable.ic_copy_outline_28, VKThemeHelper.g(R.attr.header_tint)),
|
|
||||||
false,
|
|
||||||
() -> {
|
|
||||||
if (attachment instanceof PhotoAttachment) {
|
|
||||||
copyImage(getUrlFromPhotoAttachment((PhotoAttachment) attachment), String.valueOf(attachment.getId()));
|
|
||||||
} else if (attachment instanceof DocumentAttachment) {
|
|
||||||
var documentAttachment = (DocumentAttachment) attachment;
|
|
||||||
if (documentAttachment.J != null)
|
|
||||||
try {
|
|
||||||
copyImage(getUrlFromDocumentAttachment(documentAttachment), String.valueOf(attachment.getId()));
|
|
||||||
} catch (Exception e) {
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
actionPopup.a(R.string.search_photo_content,
|
|
||||||
ContextExtKt.b(AndroidUtils.getGlobalContext(), R.drawable.ic_menu_search_outline_28, VKThemeHelper.g(R.attr.header_tint)),
|
|
||||||
false,
|
|
||||||
() -> {
|
|
||||||
if (attachment instanceof PhotoAttachment) {
|
|
||||||
searchDialog(LifecycleUtils.getCurrentActivity(), getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
|
||||||
} else if (attachment instanceof DocumentAttachment) {
|
|
||||||
var documentAttachment = (DocumentAttachment) attachment;
|
|
||||||
if (documentAttachment.J != null)
|
|
||||||
try {
|
|
||||||
searchDialog(LifecycleUtils.getCurrentActivity(), getUrlFromDocumentAttachment(documentAttachment));
|
|
||||||
} catch (Exception e) {
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
actionPopup.a(R.string.copy_photo_url_content,
|
|
||||||
ContextExtKt.b(AndroidUtils.getGlobalContext(), R.drawable.ic_copy_outline_28, VKThemeHelper.g(R.attr.header_tint)),
|
|
||||||
false,
|
|
||||||
() -> {
|
|
||||||
if (attachment instanceof PhotoAttachment) {
|
|
||||||
copyPhotoUrl(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
|
||||||
} else if (attachment instanceof DocumentAttachment) {
|
|
||||||
var documentAttachment = (DocumentAttachment) attachment;
|
|
||||||
if (documentAttachment.J != null)
|
|
||||||
try {
|
|
||||||
copyPhotoUrl(getUrlFromDocumentAttachment(documentAttachment));
|
|
||||||
} catch (Exception e) {
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
actionPopup.a(R.string.open_original_photo_content,
|
|
||||||
ContextExtKt.b(AndroidUtils.getGlobalContext(), R.drawable.ic_link_outline_28, VKThemeHelper.g(R.attr.header_tint)),
|
|
||||||
false,
|
|
||||||
() -> {
|
|
||||||
if (attachment instanceof PhotoAttachment) {
|
|
||||||
openUrl(getUrlFromPhotoAttachment((PhotoAttachment) attachment));
|
|
||||||
} else if (attachment instanceof DocumentAttachment) {
|
|
||||||
var documentAttachment = (DocumentAttachment) attachment;
|
|
||||||
if (documentAttachment.J != null)
|
|
||||||
try {
|
|
||||||
openUrl(getUrlFromDocumentAttachment(documentAttachment));
|
|
||||||
} catch (Exception e) {
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ToastUtils.a(R.string.photo_get_error);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getUrlFromDocumentAttachment(DocumentAttachment attachment) {
|
|
||||||
List<ImageSize> imageSizes = null;
|
|
||||||
if (attachment.J != null) {
|
|
||||||
imageSizes = attachment.J.t1();
|
|
||||||
}
|
|
||||||
return getUrlFromImageSizeList(imageSizes);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getUrlFromPhotoAttachment(PhotoAttachment attachment) {
|
|
||||||
var imageSizes = attachment.D.Q.t1();
|
|
||||||
return getUrlFromImageSizeList(imageSizes);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private static String getUrlFromImageSizeList(List<ImageSize> imageSizes) {
|
|
||||||
if (imageSizes.isEmpty())
|
|
||||||
return null;
|
|
||||||
var max = imageSizes.get(0);
|
|
||||||
for (int i = 1; i < imageSizes.size(); ++i) {
|
|
||||||
var size = imageSizes.get(i);
|
|
||||||
if (max != null && max.t1() < size.t1()) {
|
|
||||||
max = size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return max.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void searchDialog(Context context, String url) {
|
|
||||||
if (selectedEngine() == 0) {
|
|
||||||
var items = new String[]{
|
|
||||||
"Yandex", "Google", "Bing", "TraceMoe", "Ascii2d", "Saucenao"
|
|
||||||
};
|
|
||||||
|
|
||||||
new VkAlertDialog.Builder(context)
|
|
||||||
.setItems(items, (dl, i) -> {
|
|
||||||
searchPhoto(i + 1, url);
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
} else {
|
|
||||||
searchPhoto(selectedEngine(), url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void copyImage(String link, String name) {
|
|
||||||
Request request = new Request.a().b(link).a();
|
|
||||||
File file = new File(AndroidUtils.getGlobalContext().getExternalCacheDir(), name + ".jpg");
|
|
||||||
|
|
||||||
if (file.exists()) {
|
|
||||||
copyImageToClipboard(file);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try (Response response = client.a(request).execute()) {
|
|
||||||
try (BufferedSink sink = Okio.a(Okio.b(file))) {
|
|
||||||
sink.a(response.a().f());
|
|
||||||
}
|
|
||||||
|
|
||||||
copyImageToClipboard(file);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void copyImageToClipboard(File file) {
|
|
||||||
Uri path = FileProvider.getUriForFile(AndroidUtils.getGlobalContext(), "com.vtosters.lite.common.VKFileProvider", file);
|
|
||||||
ClipData clip = ClipData.newUri(AndroidUtils.getGlobalContext().getContentResolver(), "Image", path);
|
|
||||||
((ClipboardManager) AndroidUtils.getGlobalContext().getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(clip);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int selectedEngine() {
|
|
||||||
return Preferences.getPreferences().getInt("search_engine", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void searchPhoto(int i, String url) {
|
|
||||||
if (url == null || url.isEmpty()) {
|
|
||||||
Log.d("PhotoViewer", "url is null or empty");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (i) {
|
|
||||||
case 1 -> searchWithYandex(url);
|
|
||||||
case 2 -> searchWithGoogle(url);
|
|
||||||
case 3 -> searchWithBing(url);
|
|
||||||
case 4 -> searchWithTraceMoe(url);
|
|
||||||
case 5 -> searchWithAscii2d(url);
|
|
||||||
case 6 -> searchWithSaucenao(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void searchPhoto(String url) {
|
|
||||||
searchPhoto(selectedEngine(), url);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void searchWithYandex(String url) {
|
|
||||||
var request = new Request.a()
|
|
||||||
.b(String.format("https://yandex.ru/images-apphost/image-download?url=%s&images_avatars_size=preview&images_avatars_namespace=images-cbir",
|
|
||||||
URLEncoder.encode(url)))
|
|
||||||
.a();
|
.a();
|
||||||
client.a(request).a(new Callback() {
|
client.a(req).a(new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void a(Call call, IOException e) {
|
public void a(Call call, IOException e) {
|
||||||
Log.d("PhotoViewer", e.getMessage());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void a(Call call, Response response) throws IOException {
|
public void a(Call call, Response response)
|
||||||
try {
|
throws IOException {
|
||||||
JSONObject payload = new JSONObject(response.a().g());
|
var tmpImage = new File(AndroidUtils.getGlobalContext().getExternalCacheDir(), attachment.getId() + ".jpg");
|
||||||
var cbirId = payload.optInt("image_shard") + "/" + payload.optString("image_id");
|
try (var resp = client.a(req).execute();
|
||||||
var imageUrl = String.format("https://avatars.mds.yandex.net/get-images-cbir/%s/orig", cbirId);
|
var sink = Okio.a(Okio.b(tmpImage))) {
|
||||||
var searchUrl = String.format("https://yandex.ru/images/search?rpt=imageview&url=%s&cbir_id=%s", imageUrl, cbirId);
|
sink.a(resp.a().f());
|
||||||
openUrl(searchUrl);
|
var manager = (ClipboardManager) AndroidUtils.getGlobalContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
} catch (JSONException e) {
|
var uri = FileProvider.getUriForFile(
|
||||||
e.printStackTrace();
|
AndroidUtils.getGlobalContext(),
|
||||||
|
"com.vtosters.lite.common.VKFileProvider",
|
||||||
|
tmpImage);
|
||||||
|
var data = ClipData.newUri(
|
||||||
|
AndroidUtils.getGlobalContext().getContentResolver(),
|
||||||
|
"image",
|
||||||
|
uri);
|
||||||
|
manager.setPrimaryClip(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void searchWithGoogle(String url) {
|
private static void searchImageWithUrl(AttachmentWithMedia attachment) {
|
||||||
openUrl("https://www.google.com/searchbyimage?image_url=" + URLEncoder.encode(url) + "&client=app");
|
String url = getImageUrlFromAttachment(attachment);
|
||||||
|
if (TextUtils.isEmpty(url)) return;
|
||||||
|
int selectedEngine = SearchEngine.getDefaultSearchEngine();
|
||||||
|
if (selectedEngine < 0) {
|
||||||
|
var items = new String[SearchEngine.values().length];
|
||||||
|
for (int i = 0; i < SearchEngine.values().length; ++i)
|
||||||
|
items[i] = SearchEngine.values()[i].mTitle;
|
||||||
|
new VkAlertDialog.Builder(LifecycleUtils.getCurrentActivity())
|
||||||
|
.setItems(items, (di, i) -> openUrl(SearchEngine.values()[i].buildSearchUrl(url)))
|
||||||
|
.show();
|
||||||
|
} else {
|
||||||
|
// index correction for old versions with numeration "1-x"
|
||||||
|
if (selectedEngine >= SearchEngine.values().length) SearchEngine.setDefaultSearchEngine(--selectedEngine);
|
||||||
|
openUrl(SearchEngine.values()[selectedEngine].buildSearchUrl(url));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void searchWithTraceMoe(String url) {
|
private static void copyImageUrl(AttachmentWithMedia attachment) {
|
||||||
openUrl("https://trace.moe/?url=" + URLEncoder.encode(url));
|
String url = getImageUrlFromAttachment(attachment);
|
||||||
}
|
if (TextUtils.isEmpty(url)) return;
|
||||||
|
|
||||||
private static void searchWithAscii2d(String url) {
|
|
||||||
openUrl("https://ascii2d.net/search/url/" + URLEncoder.encode(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void searchWithSaucenao(String url) {
|
|
||||||
openUrl("https://saucenao.com/search.php?url=" + URLEncoder.encode(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void searchWithBing(String url) {
|
|
||||||
openUrl("https://www.bing.com/images/search?view=detailv2&iss=SBI&form=SBIIDP&sbisrc=UrlPaste&q=imgurl:"
|
|
||||||
+ URLEncoder.encode(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void copyPhotoUrl(String url) {
|
|
||||||
if (url == null || url.isEmpty()) return;
|
|
||||||
ClipboardManager manager = (ClipboardManager) AndroidUtils.getGlobalContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
ClipboardManager manager = (ClipboardManager) AndroidUtils.getGlobalContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
manager.setPrimaryClip(ClipData.newPlainText("vk_photo_url", url));
|
manager.setPrimaryClip(ClipData.newPlainText("vk_photo_url", url));
|
||||||
Toast.makeText(AndroidUtils.getGlobalContext(), R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show();
|
Toast.makeText(AndroidUtils.getGlobalContext(), R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void openUrl(String url) {
|
private static void openUrl(String url) {
|
||||||
var uri = Uri.parse(url);
|
if (TextUtils.isEmpty(url)) {
|
||||||
var intent = new Intent(Intent.ACTION_VIEW, uri);
|
Log.d("PhotoViewer", "url is null or empty");
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
return;
|
||||||
|
}
|
||||||
|
var intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||||
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
AndroidUtils.getGlobalContext().startActivity(intent);
|
AndroidUtils.getGlobalContext().startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getImageUrlFromAttachment(AttachmentWithMedia attachment) {
|
||||||
|
List<ImageSize> imageSizes;
|
||||||
|
|
||||||
|
if (attachment instanceof PhotoAttachment) {
|
||||||
|
imageSizes = ((PhotoAttachment) attachment).D.Q.t1();
|
||||||
|
} else if (attachment instanceof DocumentAttachment && ((DocumentAttachment) attachment).J != null) {
|
||||||
|
imageSizes = ((DocumentAttachment) attachment).J.t1();
|
||||||
|
} else {
|
||||||
|
ToastUtils.a(R.string.photo_get_error);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (imageSizes.isEmpty()) return "";
|
||||||
|
|
||||||
|
var max = imageSizes.get(0);
|
||||||
|
for (int i = 1; i < imageSizes.size(); i++) {
|
||||||
|
var tmp = imageSizes.get(i);
|
||||||
|
if (max.t1() < tmp.t1()) max = tmp;
|
||||||
|
}
|
||||||
|
return max.url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,29 @@
|
|||||||
package ru.vtosters.hooks;
|
package ru.vtosters.hooks;
|
||||||
|
|
||||||
import androidx.core.util.Pair;
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import ru.vtosters.lite.utils.RenameTool;
|
|
||||||
|
|
||||||
public class RenameHook {
|
public class RenameHook {
|
||||||
public static void injectIntoJson(JSONObject obj) throws JSONException {
|
public static void injectIntoJson(JSONObject obj) throws JSONException {
|
||||||
int i = obj.getInt("id");
|
// int i = obj.getInt("id");
|
||||||
if (RenameTool.updateRequested) {
|
// if (RenameTool.updateRequested) {
|
||||||
RenameTool.reloadDB();
|
// RenameTool.reloadDB();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Pair<String, String> user = RenameTool.renamedUsers.get(i);
|
// Pair<String, String> user = RenameTool.renamedUsers.get(i);
|
||||||
if (user == null) return;
|
// if (user == null) return;
|
||||||
obj.put(RenameTool.COLUMN_FIRSTNAME, user.first).put(RenameTool.COLUMN_LASTNAME, user.second);
|
// obj.put(RenameTool.COLUMN_FIRSTNAME, user.first).put(RenameTool.COLUMN_LASTNAME, user.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void injectIntoJsonGroup(JSONObject obj) throws JSONException {
|
public static void injectIntoJsonGroup(JSONObject obj) throws JSONException {
|
||||||
int i = obj.getInt("id");
|
// int i = obj.getInt("id");
|
||||||
|
//
|
||||||
if (RenameTool.updateRequested) {
|
// if (RenameTool.updateRequested) {
|
||||||
RenameTool.reloadDB();
|
// RenameTool.reloadDB();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
String user = RenameTool.renamedGroups.get(i);
|
// String user = RenameTool.renamedGroups.get(i);
|
||||||
if (user == null) return;
|
// if (user == null) return;
|
||||||
obj.put("name", user);
|
// obj.put("name", user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class VKUIHook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void applyVKUIStyles(WebView webView) {
|
private static void applyVKUIStyles(WebView webView) {
|
||||||
if (getBoolValue("VKUI_INJ", true)) {
|
if (getBoolValue("VKUI_INJ", true) && webView != null && webView.getUrl() != null && !webView.getUrl().contains("static.vk.com/memories")) {
|
||||||
if (!WebViewColoringUtils.isLoaded) {
|
if (!WebViewColoringUtils.isLoaded) {
|
||||||
WebViewColoringUtils.load();
|
WebViewColoringUtils.load();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
import com.vk.medianative.MediaImageEncoder;
|
import com.vk.medianative.MediaImageEncoder;
|
||||||
|
import com.vk.medianative.MediaNative;
|
||||||
import com.vtosters.lite.data.Users;
|
import com.vtosters.lite.data.Users;
|
||||||
import com.vtosters.lite.fragments.SettingsListFragment;
|
import com.vtosters.lite.fragments.SettingsListFragment;
|
||||||
import ru.vtosters.hooks.GmsHook;
|
import ru.vtosters.hooks.GmsHook;
|
||||||
@@ -22,7 +23,9 @@ public class Preferences {
|
|||||||
|
|
||||||
public static void init(Application application) throws Exception {
|
public static void init(Application application) throws Exception {
|
||||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||||
StrictMode.setThreadPolicy(policy);
|
StrictMode.setThreadPolicy(policy); // fix profiles hide hook
|
||||||
|
|
||||||
|
MediaNative.init(application);
|
||||||
|
|
||||||
GmsHook.fixGapps();
|
GmsHook.fixGapps();
|
||||||
ProxyUtils.setProxy();
|
ProxyUtils.setProxy();
|
||||||
@@ -163,7 +166,7 @@ public class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean superapp() {
|
public static boolean superapp() {
|
||||||
return getBoolValue("superapp", true);
|
return getBoolValue("superapp", true) && milkshake();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean vkpay() {
|
public static boolean vkpay() {
|
||||||
@@ -289,12 +292,16 @@ public class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNewBuild() {
|
public static boolean isNewBuild() {
|
||||||
try {
|
if(Preferences.getBoolValue("invalidate_theme_cache_each_update",true))
|
||||||
return getPreferences().getLong("setupTime", 0L) != AndroidUtils.getGlobalContext().getPackageManager().getPackageInfo(AndroidUtils.getPackageName(), 0).lastUpdateTime;
|
try {
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
return AndroidUtils.getGlobalContext()
|
||||||
e.printStackTrace();
|
.getPackageManager()
|
||||||
return false;
|
.getPackageInfo(AndroidUtils.getPackageName(), 0)
|
||||||
}
|
.lastUpdateTime != getPreferences().getLong("setupTime", 0L);
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateBuildNumber() {
|
public static void updateBuildNumber() {
|
||||||
@@ -327,7 +334,7 @@ public class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static long getSizeForDelete() {
|
public static long getSizeForDelete() {
|
||||||
return switch (Preferences.getPreferences().getString("clearcache", "")) {
|
return switch (Preferences.getPreferences().getString("autoclearcache", "")) {
|
||||||
case "100mb" -> 104857600L;
|
case "100mb" -> 104857600L;
|
||||||
case "500mb" -> 524288000L;
|
case "500mb" -> 524288000L;
|
||||||
case "1gb" -> 1073741824L;
|
case "1gb" -> 1073741824L;
|
||||||
|
|||||||
@@ -16,19 +16,19 @@ import android.webkit.WebView;
|
|||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.appcompat.app.AppCompatDelegate;
|
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.ColorUtils;
|
import androidx.core.graphics.ColorUtils;
|
||||||
import com.vk.articles.preload.WebCachePreloader;
|
import com.vk.articles.preload.WebCachePreloader;
|
||||||
import com.vk.core.drawable.RecoloredDrawable;
|
import com.vk.core.drawable.RecoloredDrawable;
|
||||||
import com.vk.core.preference.Preference;
|
|
||||||
import com.vk.core.ui.themes.MilkshakeHelper;
|
import com.vk.core.ui.themes.MilkshakeHelper;
|
||||||
import com.vk.core.ui.themes.VKTheme;
|
import com.vk.core.ui.themes.VKTheme;
|
||||||
import com.vk.core.ui.themes.VKThemeHelper;
|
import com.vk.core.ui.themes.VKThemeHelper;
|
||||||
import com.vtosters.lite.R;
|
import com.vtosters.lite.R;
|
||||||
import com.vtosters.lite.data.ThemeTracker;
|
import com.vtosters.lite.data.ThemeTracker;
|
||||||
import ru.vtosters.lite.deviceinfo.OEMDetector;
|
import ru.vtosters.lite.deviceinfo.OEMDetector;
|
||||||
|
import ru.vtosters.lite.themes.ThemesCore;
|
||||||
import ru.vtosters.lite.themes.ThemesHacks;
|
import ru.vtosters.lite.themes.ThemesHacks;
|
||||||
|
import ru.vtosters.lite.themes.ThemesManager;
|
||||||
import ru.vtosters.lite.ui.wallpapers.WallpapersHooks;
|
import ru.vtosters.lite.ui.wallpapers.WallpapersHooks;
|
||||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||||
import ru.vtosters.lite.utils.WebViewColoringUtils;
|
import ru.vtosters.lite.utils.WebViewColoringUtils;
|
||||||
@@ -47,22 +47,10 @@ public class ThemesUtils {
|
|||||||
}
|
}
|
||||||
} // Apply VKTheme and ImTheme (hard applying without dynamic theme changing)
|
} // Apply VKTheme and ImTheme (hard applying without dynamic theme changing)
|
||||||
|
|
||||||
public static boolean isCustomAccentEnabled() {
|
|
||||||
return ThemesUtils.isMonetTheme() || !useNewColorEngine();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ColorStateList getAccenedColorStateList() {
|
public static ColorStateList getAccenedColorStateList() {
|
||||||
return ColorStateList.valueOf(getAccentColor());
|
return ColorStateList.valueOf(getAccentColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSystemModeTheme() {
|
|
||||||
return AppCompatDelegate.getDefaultNightMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setSystemModeTheme(int theme) {
|
|
||||||
AppCompatDelegate.setDefaultNightMode(theme);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setTheme(VKTheme theme, Activity activity, Boolean restartActivity) {
|
public static void setTheme(VKTheme theme, Activity activity, Boolean restartActivity) {
|
||||||
setThemeFL(theme, activity, getCenterScreenCoords(), restartActivity);
|
setThemeFL(theme, activity, getCenterScreenCoords(), restartActivity);
|
||||||
} // apply changed theme
|
} // apply changed theme
|
||||||
@@ -72,6 +60,7 @@ public class ThemesUtils {
|
|||||||
activity = LifecycleUtils.getCurrentActivity();
|
activity = LifecycleUtils.getCurrentActivity();
|
||||||
}
|
}
|
||||||
VKThemeHelper.theme(theme, activity, fl);
|
VKThemeHelper.theme(theme, activity, fl);
|
||||||
|
if (isMonetTheme() || ThemesManager.canApplyCustomAccent()) ThemesCore.clear();
|
||||||
if (restartActivity) activity.recreate();
|
if (restartActivity) activity.recreate();
|
||||||
ThemeTracker.a();
|
ThemeTracker.a();
|
||||||
WebViewColoringUtils.isLoaded = false;
|
WebViewColoringUtils.isLoaded = false;
|
||||||
@@ -91,13 +80,8 @@ public class ThemesUtils {
|
|||||||
return getBoolValue("amoledtheme", false);
|
return getBoolValue("amoledtheme", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean useNewColorEngine() {
|
|
||||||
return getBoolValue("useNewColorEngine", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getAccentColor() {
|
public static int getAccentColor() {
|
||||||
var color = Preferences.getPreferences().getInt("accent_color", getColorFromAttr(R.attr.accent));
|
return getColorFromAttr(R.attr.accent);
|
||||||
return color == 0 || useNewColorEngine() || isMonetTheme() ? getColorFromAttr(R.attr.accent) : color;
|
|
||||||
} // Color accent
|
} // Color accent
|
||||||
|
|
||||||
//region Used for migrating accent color to new version
|
//region Used for migrating accent color to new version
|
||||||
@@ -261,14 +245,6 @@ public class ThemesUtils {
|
|||||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ? isDarkTheme() ? View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR : 0 : 0;
|
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ? isDarkTheme() ? View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR : 0 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getStockAccent() {
|
|
||||||
if (isMilkshake()) {
|
|
||||||
return isDarkTheme() ? Color.parseColor("#71aaeb") : Color.parseColor("#3f8ae0");
|
|
||||||
} else {
|
|
||||||
return isDarkTheme() ? Color.parseColor("#71aaeb") : Color.parseColor("#528bcc");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getDarkThemeRes() {
|
public static int getDarkThemeRes() {
|
||||||
if (isMonetTheme()) {
|
if (isMonetTheme()) {
|
||||||
if (isAmoledTheme()) {
|
if (isAmoledTheme()) {
|
||||||
@@ -323,7 +299,7 @@ public class ThemesUtils {
|
|||||||
} // Recolor drawable to accent color
|
} // Recolor drawable to accent color
|
||||||
|
|
||||||
public static Drawable recolorToolbarDrawable(Drawable drawable) {
|
public static Drawable recolorToolbarDrawable(Drawable drawable) {
|
||||||
if (!ThemesUtils.isCustomAccentEnabled()) return drawable;
|
if (!ThemesUtils.isMonetTheme()) return drawable;
|
||||||
if (drawable == null) return null;
|
if (drawable == null) return null;
|
||||||
return new RecoloredDrawable(drawable, (ThemesUtils.isMilkshake() && !ThemesUtils.isDarkTheme()) ? ThemesUtils.getAccentColor() : ThemesUtils.getHeaderText());
|
return new RecoloredDrawable(drawable, (ThemesUtils.isMilkshake() && !ThemesUtils.isDarkTheme()) ? ThemesUtils.getAccentColor() : ThemesUtils.getHeaderText());
|
||||||
}
|
}
|
||||||
@@ -408,15 +384,11 @@ public class ThemesUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int getNavigationHeight(int Default) {
|
public static int getNavigationHeight(int Default) {
|
||||||
int VKME = R.dimen.design_bottom_sheet_peek_height_min;
|
return vkme() ? R.dimen.design_bottom_sheet_peek_height_min : Default;
|
||||||
|
|
||||||
return vkme() ? VKME : Default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getNavigationWidth(int Default) {
|
public static int getNavigationWidth(int Default) {
|
||||||
int VKME = R.dimen.app_minimumsize_h;
|
return vkme() ? R.dimen.app_minimumsize_h : Default;
|
||||||
|
|
||||||
return vkme() ? VKME : Default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ColorStateList getCSTDock() {
|
public static ColorStateList getCSTDock() {
|
||||||
@@ -427,12 +399,8 @@ public class ThemesUtils {
|
|||||||
},
|
},
|
||||||
new int[]{
|
new int[]{
|
||||||
dockbar_accent() ? getAccentColor() : (isDarkTheme() ? getResources().getColor(R.color.white) : getResources().getColor(R.color.gray_700)),
|
dockbar_accent() ? getAccentColor() : (isDarkTheme() ? getResources().getColor(R.color.white) : getResources().getColor(R.color.gray_700)),
|
||||||
isDarkTheme() ? getResources().getColor(R.color.gray_500) : getResources().getColor(R.color.vk_steel_gray_300)
|
getColorFromAttr(R.attr.tabbar_inactive_icon)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getCurrentThemeID(VKTheme paramVKTheme) {
|
|
||||||
Preference.b("vk_theme_helper", "current_theme", paramVKTheme.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package ru.vtosters.hooks.ssfs;
|
package ru.vtosters.hooks.ssfs;
|
||||||
|
|
||||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||||
import org.json.JSONException;
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import ru.vtosters.hooks.other.Preferences;
|
import ru.vtosters.hooks.other.Preferences;
|
||||||
import ru.vtosters.lite.ssfs.ImBanner;
|
import ru.vtosters.lite.ssfs.ImBanner;
|
||||||
@@ -9,8 +8,8 @@ import ru.vtosters.lite.utils.AndroidUtils;
|
|||||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||||
|
|
||||||
public class BannerHook {
|
public class BannerHook {
|
||||||
public static JSONObject convBar(JSONObject orig) throws JSONException {
|
public static JSONObject convBar(JSONObject orig) {
|
||||||
return ImBanner.convBar(orig);
|
return ImBanner.convertToBanner(orig);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean showAlert() {
|
public static boolean showAlert() {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.vk.im.engine.utils.ImDialogsUtils;
|
|||||||
import okhttp3.Headers;
|
import okhttp3.Headers;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import ru.vtosters.hooks.other.ThemesUtils;
|
import ru.vtosters.hooks.other.ThemesUtils;
|
||||||
|
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||||
import ru.vtosters.lite.net.Request;
|
import ru.vtosters.lite.net.Request;
|
||||||
import ru.vtosters.lite.proxy.ProxyUtils;
|
import ru.vtosters.lite.proxy.ProxyUtils;
|
||||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||||
@@ -43,7 +44,7 @@ public class Requests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void pinnedMsg(int dialogid, boolean needToBePinned) {
|
public static void pinnedMsg(int dialogid, boolean needToBePinned) {
|
||||||
Thread thread = new Thread(() -> {
|
VTExecutors.getIoExecutor().execute(() -> {
|
||||||
try {
|
try {
|
||||||
var request = new okhttp3.Request.a()
|
var request = new okhttp3.Request.a()
|
||||||
.b("https://" + ProxyUtils.getApi() + "/method/" + (needToBePinned ? "messages.pinConversation" : "messages.unpinConversation") + "?peer_id=" + dialogid + "&access_token=" + AccountManagerUtils.getUserToken() + "&v=5.119")
|
.b("https://" + ProxyUtils.getApi() + "/method/" + (needToBePinned ? "messages.pinConversation" : "messages.unpinConversation") + "?peer_id=" + dialogid + "&access_token=" + AccountManagerUtils.getUserToken() + "&v=5.119")
|
||||||
@@ -56,8 +57,6 @@ public class Requests {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
thread.start();
|
|
||||||
|
|
||||||
AndroidUtils.sendToast(AndroidUtils.getString(com.vtosters.lite.R.string.pin_dialog) + " " + AndroidUtils.getString(needToBePinned ? com.vtosters.lite.R.string.dialog_pinned : com.vtosters.lite.R.string.dialog_unpinned));
|
AndroidUtils.sendToast(AndroidUtils.getString(com.vtosters.lite.R.string.pin_dialog) + " " + AndroidUtils.getString(needToBePinned ? com.vtosters.lite.R.string.dialog_pinned : com.vtosters.lite.R.string.dialog_unpinned));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
public class TransportStream {
|
public class TransportStream {
|
||||||
|
|
||||||
private String mKeyUri;
|
|
||||||
private final String mMediaSegmentUri;
|
private final String mMediaSegmentUri;
|
||||||
|
private String mKeyUri;
|
||||||
private String mMediaSegmentName;
|
private String mMediaSegmentName;
|
||||||
|
|
||||||
public TransportStream(String baseURI, String mediaSegmentName) {
|
public TransportStream(String baseURI, String mediaSegmentName) {
|
||||||
|
|||||||
@@ -15,10 +15,9 @@ public class VKM3UParser {
|
|||||||
//Playlist types
|
//Playlist types
|
||||||
static public int PLAYLIST_TYPE_VOD = 0;
|
static public int PLAYLIST_TYPE_VOD = 0;
|
||||||
static public int PLAYLIST_TYPE_EVENT = 1;
|
static public int PLAYLIST_TYPE_EVENT = 1;
|
||||||
|
private final String mData;
|
||||||
//region Extended M3U global extensions
|
//region Extended M3U global extensions
|
||||||
public List<TransportStream> mTransportStreams = new ArrayList<>();
|
public List<TransportStream> mTransportStreams = new ArrayList<>();
|
||||||
private final String mData;
|
|
||||||
/**
|
/**
|
||||||
* @see <a href="https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.1.2">EXT-X-VERSION</a>
|
* @see <a href="https://datatracker.ietf.org/doc/html/rfc8216#section-4.3.1.2">EXT-X-VERSION</a>
|
||||||
**/
|
**/
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import ru.vtosters.lite.utils.AndroidUtils;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static ru.vtosters.hooks.DateHook.getLocale;
|
import static ru.vtosters.hooks.DateHook.getLocale;
|
||||||
import static ru.vtosters.hooks.other.Preferences.getBoolValue;
|
|
||||||
import static ru.vtosters.hooks.GroupsCatalogInjector.injectIntoCatalog;
|
import static ru.vtosters.hooks.GroupsCatalogInjector.injectIntoCatalog;
|
||||||
|
import static ru.vtosters.hooks.other.Preferences.getBoolValue;
|
||||||
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.*;
|
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.*;
|
||||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
|
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
|
||||||
@@ -30,79 +30,22 @@ public class CatalogJsonInjector {
|
|||||||
|
|
||||||
public static JSONObject music(JSONObject json) throws JSONException {
|
public static JSONObject music(JSONObject json) throws JSONException {
|
||||||
var catalog = json.optJSONObject("catalog");
|
var catalog = json.optJSONObject("catalog");
|
||||||
|
var oldItems = catalog != null ? catalog.optJSONArray("sections") : null;
|
||||||
JSONArray oldItems = null;
|
|
||||||
|
|
||||||
if (catalog != null) {
|
|
||||||
oldItems = catalog.optJSONArray("sections");
|
|
||||||
}
|
|
||||||
|
|
||||||
var useOldAppVer = getBoolValue("useOldAppVer", false);
|
var useOldAppVer = getBoolValue("useOldAppVer", false);
|
||||||
var isUsersCatalog = oldItems.optJSONObject(0).optString("url").equals("https://vk.com/audios" + getUserId() + "?section=" + (useOldAppVer ? "all" : "general"));
|
var isUsersCatalog = oldItems.optJSONObject(0).optString("url").equals("https://vk.com/audios" + getUserId() + "?section=" + (useOldAppVer ? "all" : "general"));
|
||||||
|
var blocks = oldItems.optJSONObject(0).optJSONArray("blocks");
|
||||||
|
|
||||||
if (isUsersCatalog) {
|
if (isUsersCatalog && blocks != null) {
|
||||||
var blocks = oldItems.optJSONObject(0).optJSONArray("blocks");
|
|
||||||
|
|
||||||
if (!useOldAppVer) {
|
if (!useOldAppVer) {
|
||||||
fixDailyMix(blocks);
|
fixDailyMix(blocks);
|
||||||
if (blocks != null) {
|
|
||||||
for (int i = 0; i < blocks.length(); i++) {
|
|
||||||
var block = blocks.optJSONObject(i);
|
|
||||||
var layout = block.optJSONObject("layout");
|
|
||||||
if (layout != null) {
|
|
||||||
var name = layout.optString("name");
|
|
||||||
if (name.equals("header_extended")) {
|
|
||||||
if (layout.has("top_title")) blocks.remove(i);
|
|
||||||
try {
|
|
||||||
layout.put("name", "header");
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var playlists = fetchCatalogId("https://vk.com/audio?section=my_playlists");
|
removeUnsupportedLayouts(blocks);
|
||||||
if (playlists != null) {
|
|
||||||
var catalogarr = playlists.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
|
||||||
|
|
||||||
var title = catalogarr.optString("title");
|
fetchCatalogId("https://vk.com/audio?section=my_playlists", oldItems);
|
||||||
var id = catalogarr.optString("id");
|
|
||||||
var url = catalogarr.optString("url");
|
|
||||||
|
|
||||||
Log.d("VKMusic", "Added " + title + " in music sections");
|
fetchCatalogId("https://vk.com/audio?section=albums", oldItems);
|
||||||
|
|
||||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
setDefaultAudioPage(oldItems, catalog);
|
||||||
}
|
|
||||||
|
|
||||||
var albums = fetchCatalogId("https://vk.com/audio?section=albums");
|
|
||||||
if (albums != null) {
|
|
||||||
var catalogarr = albums.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
|
||||||
|
|
||||||
var title = catalogarr.optString("title");
|
|
||||||
var id = catalogarr.optString("id");
|
|
||||||
var url = catalogarr.optString("url");
|
|
||||||
|
|
||||||
Log.d("VKMusic", "Added " + title + " in music sections");
|
|
||||||
|
|
||||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < oldItems.length(); i++) {
|
|
||||||
var item = oldItems.optJSONObject(i);
|
|
||||||
var title = item.optString("title");
|
|
||||||
var id = item.optString("id");
|
|
||||||
var url = item.optString("url");
|
|
||||||
var value = Preferences.getString("musicdefcatalog");
|
|
||||||
|
|
||||||
Log.d("VKMusic", "title: " + title + " id: " + id + " url: " + url + " value: " + value);
|
|
||||||
|
|
||||||
if (url.contains(value) && !value.isEmpty()) {
|
|
||||||
catalog.put("default_section", id);
|
|
||||||
Log.d("VKMusic", "Added " + title + " as default music section");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CacheDatabaseDelegate.hasTracks() && !LibVKXClient.isIntegrationEnabled()) { // inj in playlist list
|
if (CacheDatabaseDelegate.hasTracks() && !LibVKXClient.isIntegrationEnabled()) { // inj in playlist list
|
||||||
@@ -112,15 +55,11 @@ public class CatalogJsonInjector {
|
|||||||
json.put("playlists", new JSONArray().put(getPlaylist()));
|
json.put("playlists", new JSONArray().put(getPlaylist()));
|
||||||
Log.d("catalogInjector", "added new pl");
|
Log.d("catalogInjector", "added new pl");
|
||||||
} else {
|
} else {
|
||||||
try {
|
json.optJSONArray("playlists").put(getPlaylist());
|
||||||
json.optJSONArray("playlists").put(getPlaylist());
|
Log.d("catalogInjector", "added to exist pl");
|
||||||
Log.d("catalogInjector", "added to exist pl");
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.d("catalogInjector", e.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blocks != null && (!useOldAppVer || noPlaylists)) {
|
if (!useOldAppVer || noPlaylists) {
|
||||||
var newBlocks = new JSONArray();
|
var newBlocks = new JSONArray();
|
||||||
|
|
||||||
newBlocks
|
newBlocks
|
||||||
@@ -155,6 +94,7 @@ public class CatalogJsonInjector {
|
|||||||
if (!isUsersCatalog || !CacheDatabaseDelegate.hasTracks() || LibVKXClient.isIntegrationEnabled()) {
|
if (!isUsersCatalog || !CacheDatabaseDelegate.hasTracks() || LibVKXClient.isIntegrationEnabled()) {
|
||||||
return; // early return if not users catalog or no tracks or integration enabled
|
return; // early return if not users catalog or no tracks or integration enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
var noPlaylists = !json.has("playlists");
|
var noPlaylists = !json.has("playlists");
|
||||||
|
|
||||||
if (noPlaylists) {
|
if (noPlaylists) {
|
||||||
@@ -169,7 +109,7 @@ public class CatalogJsonInjector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!useOldAppVer || noPlaylists) {
|
if (!useOldAppVer && !noPlaylists) {
|
||||||
var newBlocks = new JSONArray();
|
var newBlocks = new JSONArray();
|
||||||
|
|
||||||
newBlocks
|
newBlocks
|
||||||
@@ -278,9 +218,38 @@ public class CatalogJsonInjector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static JSONObject fetchCatalogId(String section) {
|
private static void removeUnsupportedLayouts(JSONArray blocks) throws JSONException {
|
||||||
if (section.isEmpty()) return null;
|
for (int i = 0; i < blocks.length(); i++) {
|
||||||
|
var block = blocks.optJSONObject(i);
|
||||||
|
var layout = block.optJSONObject("layout");
|
||||||
|
if (layout != null) {
|
||||||
|
var name = layout.optString("name");
|
||||||
|
if (name.equals("header_extended")) {
|
||||||
|
if (layout.has("top_title")) blocks.remove(i);
|
||||||
|
layout.put("name", "header");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setDefaultAudioPage(JSONArray jsonArray, JSONObject catalog) throws JSONException {
|
||||||
|
for (int i = 0; i < jsonArray.length(); i++) {
|
||||||
|
var item = jsonArray.optJSONObject(i);
|
||||||
|
var title = item.optString("title");
|
||||||
|
var id = item.optString("id");
|
||||||
|
var url = item.optString("url");
|
||||||
|
var value = Preferences.getString("musicdefcatalog");
|
||||||
|
|
||||||
|
Log.d("VKMusic", "title: " + title + " id: " + id + " url: " + url + " value: " + value);
|
||||||
|
|
||||||
|
if (url.contains(value) && !value.isEmpty()) {
|
||||||
|
catalog.put("default_section", id);
|
||||||
|
Log.d("VKMusic", "Added " + title + " as default music section");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void fetchCatalogId(String sectionUrl, JSONArray jsonArray) {
|
||||||
var request = new Request.a()
|
var request = new Request.a()
|
||||||
.b("https://" + getApi() + "/method/" + "catalog.getAudio"
|
.b("https://" + getApi() + "/method/" + "catalog.getAudio"
|
||||||
+ "?v=5.119"
|
+ "?v=5.119"
|
||||||
@@ -291,16 +260,23 @@ public class CatalogJsonInjector {
|
|||||||
+ "&device_id="
|
+ "&device_id="
|
||||||
+ DeviceIdProvider.d(AndroidUtils.getGlobalContext())
|
+ DeviceIdProvider.d(AndroidUtils.getGlobalContext())
|
||||||
+ "&url="
|
+ "&url="
|
||||||
+ section
|
+ sectionUrl
|
||||||
+ "&access_token="
|
+ "&access_token="
|
||||||
+ AccountManagerUtils.getUserToken())
|
+ AccountManagerUtils.getUserToken())
|
||||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
||||||
try {
|
try {
|
||||||
return new JSONObject(mClient.a(request).execute().a().g()).getJSONObject("response");
|
var json = new JSONObject(mClient.a(request).execute().a().g()).getJSONObject("response");
|
||||||
|
var catalogarr = json.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
|
||||||
|
|
||||||
|
var title = catalogarr.optString("title");
|
||||||
|
var id = catalogarr.optString("id");
|
||||||
|
var url = catalogarr.optString("url");
|
||||||
|
|
||||||
|
Log.d("VKMusic", "Added " + title + " in music sections");
|
||||||
|
|
||||||
|
jsonArray.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||||
} catch (JSONException | IOException e) {
|
} catch (JSONException | IOException e) {
|
||||||
Log.d("VTLMusic", "Error: " + e.getMessage());
|
Log.d("VTLMusic", "Error: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,46 +5,63 @@ import org.json.JSONArray;
|
|||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public class ImBanner {
|
public class ImBanner {
|
||||||
private static final String TAG = "ImBanner";
|
private static final String TAG = "ImBanner";
|
||||||
|
|
||||||
public static JSONObject convBar(JSONObject orig) throws JSONException {
|
public static JSONObject convertToBanner(JSONObject original) {
|
||||||
var user_id = orig.getJSONObject("peer").getInt("id");
|
String PEER = "peer";
|
||||||
|
String ID = "id";
|
||||||
|
String PICTURE = "picture";
|
||||||
|
String TEXT = "text";
|
||||||
|
String LINK = "link";
|
||||||
|
String LINK_TEXT = "link_text";
|
||||||
|
String NAME = "name";
|
||||||
|
String BUTTONS = "buttons";
|
||||||
|
String ICON = "icon";
|
||||||
|
|
||||||
if (!UsersList.hasBanner(user_id) || user_id == 0) {
|
Optional<JSONObject> user = Optional.ofNullable(original.optJSONObject(PEER));
|
||||||
|
int userId = user.map(u -> u.optInt(ID)).orElse(0);
|
||||||
|
|
||||||
|
if (userId == 0 || !UsersList.hasBanner(userId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject banner = Handler.getBanner(userId);
|
||||||
|
|
||||||
|
if (banner == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var jsonBanner = Handler.getBanner(user_id);
|
String picture = banner.optString(PICTURE);
|
||||||
var pic = jsonBanner.optString("picture");
|
String text = banner.getString(TEXT);
|
||||||
var text = jsonBanner.getString("text");
|
String link = banner.optString(LINK);
|
||||||
|
String linkText = banner.optString(LINK_TEXT);
|
||||||
|
|
||||||
var link = jsonBanner.optString("link");
|
boolean hasIcon = !picture.isEmpty();
|
||||||
var link_text = jsonBanner.optString("link_text");
|
boolean hasButton = !link.isEmpty();
|
||||||
|
boolean isPicture = picture.endsWith(".png") || picture.endsWith(".jpg") || picture.endsWith(".jpeg") || picture.endsWith(".webp");
|
||||||
|
|
||||||
var hasIcon = !pic.isEmpty();
|
JSONObject json = new JSONObject();
|
||||||
var hasButton = !link.isEmpty();
|
|
||||||
var isPicture = pic.endsWith(".png") || pic.endsWith(".jpg") || pic.endsWith(".jpeg") || pic.endsWith(".webp");
|
|
||||||
|
|
||||||
var json = new JSONObject();
|
JSONObject buttonJson = new JSONObject();
|
||||||
|
buttonJson.put("layout", "tertiary");
|
||||||
|
buttonJson.put("text", linkText);
|
||||||
|
buttonJson.put("type", "link");
|
||||||
|
buttonJson.put("link", link);
|
||||||
|
|
||||||
var buttonsJson = new JSONObject();
|
JSONArray buttons = new JSONArray(); // max 3 buttons in array
|
||||||
buttonsJson.put("layout", "tertiary");
|
|
||||||
buttonsJson.put("text", link_text);
|
|
||||||
buttonsJson.put("type", "link");
|
|
||||||
buttonsJson.put("link", link);
|
|
||||||
|
|
||||||
var buttons = new JSONArray(); // max 3 buttons in array
|
if (hasButton) buttons.put(buttonJson);
|
||||||
|
|
||||||
if (hasButton) buttons.put(buttonsJson);
|
json.put(NAME, "group_admin_welcome");
|
||||||
|
json.put(TEXT, text);
|
||||||
json.put("name", "group_admin_welcome");
|
json.put(BUTTONS, buttons);
|
||||||
json.put("text", text);
|
|
||||||
json.put("buttons", buttons);
|
|
||||||
|
|
||||||
if (hasIcon && isPicture) {
|
if (hasIcon && isPicture) {
|
||||||
json.put("icon", pic);
|
json.put(ICON, picture);
|
||||||
}
|
}
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
|
|||||||
@@ -143,8 +143,11 @@ public class ThemesCore {
|
|||||||
themedColors.put(R.attr.im_reply_separator, accentColor);
|
themedColors.put(R.attr.im_reply_separator, accentColor);
|
||||||
themedColors.put(R.attr.im_text_name, accentColor);
|
themedColors.put(R.attr.im_text_name, accentColor);
|
||||||
|
|
||||||
outgoinging_msg = ThemesUtils.lighten(accentColor, 0.76f);
|
float out = ThemesUtils.isMonetTheme() ? 0.85f : 0.76f;
|
||||||
outgoinging_msg_highlight = ThemesUtils.lighten(accentColor, 0.5f);
|
float outhighlight = ThemesUtils.isMonetTheme() ? 0.75f : 0.5f;
|
||||||
|
|
||||||
|
outgoinging_msg = ThemesUtils.lighten(accentColor, out);
|
||||||
|
outgoinging_msg_highlight = ThemesUtils.lighten(accentColor, outhighlight);
|
||||||
|
|
||||||
themedColors.put(R.attr.im_ic_send_msg, accentColor);
|
themedColors.put(R.attr.im_ic_send_msg, accentColor);
|
||||||
themedColors.put(R.attr.im_bubble_wallpaper_outgoing, accentColor);
|
themedColors.put(R.attr.im_bubble_wallpaper_outgoing, accentColor);
|
||||||
@@ -163,26 +166,25 @@ public class ThemesCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasThemedAttr(Context context, int attrID) {
|
public static boolean hasThemedAttr(Context context, int attrID) {
|
||||||
if (ThemesUtils.isCustomAccentEnabled()) {
|
if (Preferences.getBoolValue("logColors", false)) {
|
||||||
if (Preferences.getBoolValue("logColors", false)) {
|
try {
|
||||||
try {
|
Log.d(TAG, "Requesting color by attr " + context.getResources().getResourceName(attrID));
|
||||||
Log.d(TAG, "Requesting color by attr " + context.getResources().getResourceName(attrID));
|
} catch (Exception ignored) {
|
||||||
} catch (Exception ignored) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ThemesUtils.isMonetTheme() || ThemesManager.canApplyCustomAccent()) {
|
||||||
if (isCachedAccents()) {
|
if (isCachedAccents()) {
|
||||||
if (ThemesUtils.isDarkTheme()) {
|
boolean isDark = ThemesUtils.isDarkTheme();
|
||||||
return (themedColors.get(attrID) != 0 && ACCENT_THEME_ONLY_DARK.get(attrID, true) && (
|
boolean isMilkshake = ThemesUtils.isMilkshake();
|
||||||
ThemesUtils.isMilkshake() ?
|
SparseBooleanArray themeOnlyMap = isDark ? ACCENT_THEME_ONLY_DARK : ACCENT_THEME_ONLY_LIGHT;
|
||||||
ACCENT_THEME_ONLY_MILK_DARK.get(attrID, true) :
|
SparseBooleanArray milkshakeMap = isDark ? ACCENT_THEME_ONLY_MILK_DARK : ACCENT_THEME_ONLY_MILK_LIGHT;
|
||||||
ACCENT_THEME_ONLY_NOMILK_DARK.get(attrID, true)));
|
SparseBooleanArray noMilkshakeMap = isDark ? ACCENT_THEME_ONLY_NOMILK_DARK : ACCENT_THEME_ONLY_NOMILK_LIGHT;
|
||||||
} else {
|
|
||||||
return (themedColors.get(attrID) != 0 && ACCENT_THEME_ONLY_LIGHT.get(attrID, true) && (
|
return (themedColors.get(attrID) != 0 && themeOnlyMap.get(attrID, true) && (
|
||||||
ThemesUtils.isMilkshake() ?
|
isMilkshake ?
|
||||||
ACCENT_THEME_ONLY_MILK_LIGHT.get(attrID, true) :
|
milkshakeMap.get(attrID, true) :
|
||||||
ACCENT_THEME_ONLY_NOMILK_LIGHT.get(attrID, true)));
|
noMilkshakeMap.get(attrID, true)));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return themedColors.get(attrID) != 0;
|
return themedColors.get(attrID) != 0;
|
||||||
}
|
}
|
||||||
@@ -191,7 +193,6 @@ public class ThemesCore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void clear() {
|
public static void clear() {
|
||||||
cachedAccents = false;
|
cachedAccents = false;
|
||||||
themedColors.clear();
|
themedColors.clear();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class ThemesHacks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int getHackedColor(@NonNull Context context, @ColorRes int color) {
|
public static int getHackedColor(@NonNull Context context, @ColorRes int color) {
|
||||||
if (ThemesUtils.isCustomAccentEnabled()) {
|
if (ThemesUtils.isMonetTheme() || ThemesManager.canApplyCustomAccent()) {
|
||||||
if (Preferences.getBoolValue("logColors", false)) {
|
if (Preferences.getBoolValue("logColors", false)) {
|
||||||
try {
|
try {
|
||||||
Log.d("ThemesCore", "Requesting color by color " + context.getResources().getResourceName(color));
|
Log.d("ThemesCore", "Requesting color by color " + context.getResources().getResourceName(color));
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import java.util.zip.ZipOutputStream;
|
|||||||
|
|
||||||
public class ThemesManager {
|
public class ThemesManager {
|
||||||
|
|
||||||
private final static int[] ACCENT_COLORS = {
|
private static final int[] ACCENT_COLORS = {
|
||||||
R.color.vk_sky_300,
|
R.color.vk_sky_300,
|
||||||
R.color.sky_300,
|
R.color.sky_300,
|
||||||
R.color.viewer_retry_button_text_color,
|
R.color.viewer_retry_button_text_color,
|
||||||
@@ -96,7 +96,7 @@ public class ThemesManager {
|
|||||||
R.color.header_blue_opacity40
|
R.color.header_blue_opacity40
|
||||||
};
|
};
|
||||||
// modify it if "doNotCompress" in apktool.yml has been edited
|
// modify it if "doNotCompress" in apktool.yml has been edited
|
||||||
private final static String[] DO_NOT_COMPRESS = {
|
private static final String[] DO_NOT_COMPRESS = {
|
||||||
".png",
|
".png",
|
||||||
".jpg",
|
".jpg",
|
||||||
".mp3",
|
".mp3",
|
||||||
@@ -119,19 +119,18 @@ public class ThemesManager {
|
|||||||
initPaths(app);
|
initPaths(app);
|
||||||
validateModApk();
|
validateModApk();
|
||||||
|
|
||||||
if (!Preferences.isNewBuild() && !ThemesUtils.isMonetTheme() && canApplyCustomAccent() && ThemesUtils.useNewColorEngine()) {
|
if (!Preferences.isNewBuild() && !ThemesUtils.isMonetTheme() && canApplyCustomAccent()) {
|
||||||
ResourcesLoader.init(app);
|
ResourcesLoader.init(app);
|
||||||
ResourcesLoader.load(app, modApk.getAbsolutePath(), false);
|
ResourcesLoader.load(app, modApk.getAbsolutePath(), false);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("ThemesManager", e.getMessage());
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate modded apk before loading
|
// validate modded apk before loading
|
||||||
private static void validateModApk()
|
private static void validateModApk() throws IOException {
|
||||||
throws IOException {
|
var apk = new ZipFile(modApk);
|
||||||
final var apk = new ZipFile(modApk);
|
|
||||||
apk.close();
|
apk.close();
|
||||||
|
|
||||||
validated = true;
|
validated = true;
|
||||||
@@ -153,24 +152,18 @@ public class ThemesManager {
|
|||||||
return validated && modApk.exists() && ThemesUtils.getReservedAccent() != Color.TRANSPARENT;
|
return validated && modApk.exists() && ThemesUtils.getReservedAccent() != Color.TRANSPARENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generateModApk(int accentColor)
|
public static void generateModApk(int accentColor) throws Throwable {
|
||||||
throws Throwable {
|
try (var apk = new ZipFile(baseApkPath)) {
|
||||||
try (
|
var arscEntry = apk.getEntry("resources.arsc");
|
||||||
final var apk = new ZipFile(baseApkPath)
|
var arscBis = new BufferedInputStream(apk.getInputStream(arscEntry));
|
||||||
) {
|
var arsc = BinaryResourceFile.fromInputStream(arscBis);
|
||||||
final var arscEntry = apk.getEntry("resources.arsc");
|
ArscEditor.changeColors(arsc, ACCENT_COLORS, accentColor);
|
||||||
final var arscBis = new BufferedInputStream(apk.getInputStream(arscEntry));
|
|
||||||
final var arsc = BinaryResourceFile.fromInputStream(arscBis);
|
|
||||||
if (!ArscEditor.changeColors(arsc, ACCENT_COLORS, accentColor))
|
|
||||||
throw new IllegalStateException("Not all colors have been changed");
|
|
||||||
|
|
||||||
try (
|
try (var zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(modApk)))) {
|
||||||
final var zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(modApk)))
|
var arscBuff = arsc.toByteArray();
|
||||||
) {
|
var newArscEntry = new ZipEntry("resources.arsc");
|
||||||
final var arscBuff = arsc.toByteArray();
|
|
||||||
final var newArscEntry = new ZipEntry("resources.arsc");
|
|
||||||
|
|
||||||
final var crc = new CRC32();
|
var crc = new CRC32();
|
||||||
crc.update(arscBuff);
|
crc.update(arscBuff);
|
||||||
|
|
||||||
newArscEntry.setSize(arscBuff.length);
|
newArscEntry.setSize(arscBuff.length);
|
||||||
@@ -181,10 +174,10 @@ public class ThemesManager {
|
|||||||
zos.write(arscBuff);
|
zos.write(arscBuff);
|
||||||
zos.closeEntry();
|
zos.closeEntry();
|
||||||
|
|
||||||
final var entries = apk.entries();
|
var entries = apk.entries();
|
||||||
while (entries.hasMoreElements()) {
|
while (entries.hasMoreElements()) {
|
||||||
final var entry = entries.nextElement();
|
var entry = entries.nextElement();
|
||||||
final var name = entry.getName();
|
var name = entry.getName();
|
||||||
|
|
||||||
if (!name.startsWith("res/") && !name.startsWith("assets/") || name.equals("resources.arsc"))
|
if (!name.startsWith("res/") && !name.startsWith("assets/") || name.equals("resources.arsc"))
|
||||||
continue;
|
continue;
|
||||||
@@ -197,8 +190,8 @@ public class ThemesManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final var entryBis = new BufferedInputStream(apk.getInputStream(entry));
|
var entryBis = new BufferedInputStream(apk.getInputStream(entry));
|
||||||
final var newEntry = new ZipEntry(name);
|
var newEntry = new ZipEntry(name);
|
||||||
|
|
||||||
if (doNotCompress) {
|
if (doNotCompress) {
|
||||||
newEntry.setMethod(ZipEntry.STORED);
|
newEntry.setMethod(ZipEntry.STORED);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class ViewInjector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static View inject(View view, int i, boolean z) {
|
public static View inject(View view, int i, boolean z) {
|
||||||
if (ThemesUtils.isCustomAccentEnabled()) {
|
if (ThemesUtils.isMonetTheme()) {
|
||||||
for (BaseHook hook : hooks) {
|
for (BaseHook hook : hooks) {
|
||||||
hook.inject(view, i, z);
|
hook.inject(view, i, z);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,59 +1,44 @@
|
|||||||
package ru.vtosters.lite.themes.loaders;
|
package ru.vtosters.lite.themes.loaders;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
|
import android.util.Log;
|
||||||
import ru.vtosters.lite.utils.ReflectionUtils;
|
import ru.vtosters.lite.utils.ReflectionUtils;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
@SuppressLint("PrivateApi")
|
||||||
public class AssetManagerHelper {
|
public class AssetManagerHelper {
|
||||||
|
public static String getApkPath(Object assetManager, String packagename) throws InvocationTargetException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException {
|
||||||
|
Object[] apkAssetsArr = (Object[]) ReflectionUtils.findMethod(Class.forName("android.content.res.ApkAssets"), "getAssetPath").invoke(assetManager);
|
||||||
// methods
|
|
||||||
private final static Method getAssetPathMtd;
|
|
||||||
private final static Method getApkAssetsMtd;
|
|
||||||
private final static Method addAssetPathMtd;
|
|
||||||
private final static Method addAssetPathAsSharedLibraryMtd;
|
|
||||||
private final static Method addOverlayPathMtd;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
getAssetPathMtd = ReflectionUtils.findMethod(Class.forName("android.content.res.ApkAssets"), "getAssetPath");
|
|
||||||
getApkAssetsMtd = ReflectionUtils.findMethod(AssetManager.class, "getApkAssets");
|
|
||||||
addAssetPathMtd = AssetManager.class.getMethod("addAssetPath", String.class);
|
|
||||||
addAssetPathAsSharedLibraryMtd = AssetManager.class.getMethod("addAssetPathAsSharedLibrary", String.class);
|
|
||||||
addOverlayPathMtd = AssetManager.class.getMethod("addOverlayPath", String.class);
|
|
||||||
} catch (ClassNotFoundException | NoSuchMethodException e) {
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getApkPath(Object assetManager, String packagename)
|
|
||||||
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
|
||||||
Object[] apkAssetsArr = (Object[]) getAssetPathMtd.invoke(assetManager);
|
|
||||||
// By default, base apk is the last element of array if is not, for execution speed, we should iterate array from the end to the beginning
|
// By default, base apk is the last element of array if is not, for execution speed, we should iterate array from the end to the beginning
|
||||||
for (int i = apkAssetsArr.length - 1; i >= 0; i--) {
|
for (int i = apkAssetsArr.length - 1; i >= 0; i--) {
|
||||||
final String pathname = (String) getApkAssetsMtd.invoke(apkAssetsArr[i]);
|
String pathname = (String) ReflectionUtils.findMethod(AssetManager.class, "getApkAssets").invoke(apkAssetsArr[i]);
|
||||||
if (pathname.contains(packagename)) return pathname;
|
if (pathname != null && pathname.contains(packagename)) return pathname;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
}
|
}
|
||||||
|
|
||||||
//region Uses for adding own assets or getting existing cookies
|
//region Uses for adding own assets or getting existing cookies
|
||||||
public static int addAssetPath(AssetManager manager, String path)
|
public static void addAssetPath(AssetManager manager, String path) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||||
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
manager.getClass().getMethod("addAssetPath", String.class).invoke(manager, path);
|
||||||
return (int) addAssetPathMtd.invoke(manager, path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int addAssetPathAsSharedLibrary(AssetManager manager, String path)
|
public static int addAssetPathAsSharedLibrary(AssetManager manager, String path) {
|
||||||
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
try {
|
||||||
return (int) addAssetPathAsSharedLibraryMtd.invoke(manager, path);
|
return (int) AssetManager.class.getMethod("addAssetPathAsSharedLibrary", String.class).invoke(manager, path);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int addOverlayPath(AssetManager manager, String path)
|
public static int addOverlayPath(AssetManager manager, String path) {
|
||||||
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
try {
|
||||||
return (int) addOverlayPathMtd.invoke(manager, path);
|
return (int) AssetManager.class.getMethod("addOverlayPath", String.class).invoke(manager, path);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//endregion
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package ru.vtosters.lite.themes.loaders;
|
package ru.vtosters.lite.themes.loaders;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
@@ -13,17 +14,19 @@ import ru.vtosters.lite.utils.ReflectionUtils;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.lang.reflect.Array;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@SuppressLint("PrivateApi")
|
||||||
public class ResourcesLoader {
|
public class ResourcesLoader {
|
||||||
|
|
||||||
private static Collection<WeakReference<Resources>> sResourceReferences = null;
|
private static Collection<WeakReference<Resources>> sResourceReferences = null;
|
||||||
private static Object sCurrentActivityThread = null;
|
private static Object sCurrentActivityThread = null;
|
||||||
private static AssetManager sAssetManager = null;
|
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
private static Method ensureStringBlocksMtd = null;
|
private static Method ensureStringBlocksMtd = null;
|
||||||
@@ -42,7 +45,7 @@ public class ResourcesLoader {
|
|||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
// API version 8 has PackageInfo, 10 has LoadedApk. Needs to check 9
|
// API version 8 has PackageInfo, 10 has LoadedApk. Needs to check 9
|
||||||
final Class<?> activityThreadClz = Class.forName("android.app.ActivityThread");
|
Class<?> activityThreadClz = Class.forName("android.app.ActivityThread");
|
||||||
Class<?> loadedApkClz;
|
Class<?> loadedApkClz;
|
||||||
try {
|
try {
|
||||||
loadedApkClz = Class.forName("android.app.LoadedApk");
|
loadedApkClz = Class.forName("android.app.LoadedApk");
|
||||||
@@ -87,43 +90,40 @@ public class ResourcesLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init(Context context)
|
public static void init(Context context) throws Exception {
|
||||||
throws Exception {
|
|
||||||
sCurrentActivityThread = ReflectionUtils.getActivityThread(context, null);
|
sCurrentActivityThread = ReflectionUtils.getActivityThread(context, null);
|
||||||
|
|
||||||
//pre-N
|
//pre-N
|
||||||
// Find the singleton instance of ResourcesManager
|
// Find the singleton instance of ResourcesManager
|
||||||
final Class<?> resourcesManagerClass = Class.forName("android.app.ResourcesManager");
|
Class<?> resourcesManagerClass = Class.forName("android.app.ResourcesManager");
|
||||||
final Method mGetInstance = ReflectionUtils.findMethod(resourcesManagerClass, "getInstance");
|
Method mGetInstance = ReflectionUtils.findMethod(resourcesManagerClass, "getInstance");
|
||||||
final Object resourcesManager = mGetInstance.invoke(null);
|
Object resourcesManager = mGetInstance.invoke(null);
|
||||||
try {
|
try {
|
||||||
Field fMActiveResources = ReflectionUtils.findField(resourcesManagerClass, "mActiveResources");
|
Field fMActiveResources = ReflectionUtils.findField(resourcesManagerClass, "mActiveResources");
|
||||||
final ArrayMap<?, WeakReference<Resources>> activeResources19 =
|
ArrayMap<?, WeakReference<Resources>> activeResources19 =
|
||||||
(ArrayMap<?, WeakReference<Resources>>) fMActiveResources.get(resourcesManager);
|
(ArrayMap<?, WeakReference<Resources>>) fMActiveResources.get(resourcesManager);
|
||||||
sResourceReferences = activeResources19.values();
|
sResourceReferences = activeResources19.values();
|
||||||
} catch (NoSuchFieldException ignore) {
|
} catch (NoSuchFieldException ignore) {
|
||||||
// N moved the resources to mResourceReferences
|
// N moved the resources to mResourceReferences
|
||||||
final Field mResourceReferences = ReflectionUtils.findField(resourcesManagerClass, "mResourceReferences");
|
Field mResourceReferences = ReflectionUtils.findField(resourcesManagerClass, "mResourceReferences");
|
||||||
sResourceReferences = (Collection<WeakReference<Resources>>) mResourceReferences.get(resourcesManager);
|
sResourceReferences = (Collection<WeakReference<Resources>>) mResourceReferences.get(resourcesManager);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void load(Context context, String resPath, boolean reinject)
|
public static void load(Context context, String resPath, boolean reinject) throws IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException {
|
||||||
throws Exception {
|
ApplicationInfo appInfo = context.getApplicationInfo();
|
||||||
final ApplicationInfo appInfo = context.getApplicationInfo();
|
|
||||||
|
|
||||||
final Field[] packagesFlds = Build.VERSION.SDK_INT < Build.VERSION_CODES.O_MR1
|
Field[] packagesFlds = Build.VERSION.SDK_INT < Build.VERSION_CODES.O_MR1
|
||||||
? new Field[]{packagesFld, resourcePackagesFld}
|
? new Field[]{packagesFld, resourcePackagesFld}
|
||||||
: new Field[]{packagesFld};
|
: new Field[]{packagesFld};
|
||||||
for (var fld : packagesFlds) {
|
for (var fld : packagesFlds) {
|
||||||
final var value = fld.get(sCurrentActivityThread);
|
var value = fld.get(sCurrentActivityThread);
|
||||||
|
|
||||||
for (var entry
|
for (var entry : ((Map<String, WeakReference<?>>) value).entrySet()) {
|
||||||
: ((Map<String, WeakReference<?>>) value).entrySet()) {
|
var loadedApk = entry.getValue().get();
|
||||||
final var loadedApk = entry.getValue().get();
|
|
||||||
if (loadedApk == null) continue;
|
if (loadedApk == null) continue;
|
||||||
|
|
||||||
final var resDirPath = (String) resDirFld.get(loadedApk);
|
var resDirPath = (String) resDirFld.get(loadedApk);
|
||||||
if (appInfo.sourceDir.equals(resDirPath))
|
if (appInfo.sourceDir.equals(resDirPath))
|
||||||
resDirFld.set(loadedApk, resPath);
|
resDirFld.set(loadedApk, resPath);
|
||||||
}
|
}
|
||||||
@@ -134,10 +134,10 @@ public class ResourcesLoader {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sAssetManager = AssetManager.class.newInstance();
|
|
||||||
// Create a new AssetManager instance and point it to the resources installed under
|
// Create a new AssetManager instance and point it to the resources installed under
|
||||||
if (AssetManagerHelper.addAssetPath(sAssetManager, resPath) == 0)
|
AssetManager sAssetManager = AssetManager.class.newInstance();
|
||||||
throw new IllegalStateException("Could not create new AssetManager");
|
|
||||||
|
AssetManagerHelper.addAssetPath(sAssetManager, resPath);
|
||||||
|
|
||||||
// Add SharedLibraries to AssetManager for resolve system resources not found issue
|
// Add SharedLibraries to AssetManager for resolve system resources not found issue
|
||||||
// This influence SharedLibrary Package ID
|
// This influence SharedLibrary Package ID
|
||||||
@@ -157,7 +157,7 @@ public class ResourcesLoader {
|
|||||||
ensureStringBlocksMtd.invoke(sAssetManager);
|
ensureStringBlocksMtd.invoke(sAssetManager);
|
||||||
}
|
}
|
||||||
for (var wr : sResourceReferences) {
|
for (var wr : sResourceReferences) {
|
||||||
final var resources = wr.get();
|
var resources = wr.get();
|
||||||
if (resources == null) continue;
|
if (resources == null) continue;
|
||||||
|
|
||||||
// Set the AssetManager of the Resources instance to our brand new one
|
// Set the AssetManager of the Resources instance to our brand new one
|
||||||
@@ -166,9 +166,9 @@ public class ResourcesLoader {
|
|||||||
assetsFld.set(resources, sAssetManager);
|
assetsFld.set(resources, sAssetManager);
|
||||||
} catch (Throwable ignore) {
|
} catch (Throwable ignore) {
|
||||||
// N
|
// N
|
||||||
final var resourceImpl = resourcesImplFld.get(resources);
|
var resourceImpl = resourcesImplFld.get(resources);
|
||||||
// for Huawei HwResourcesImpl
|
// for Huawei HwResourcesImpl
|
||||||
final Field implAssets = ReflectionUtils.findField(resourceImpl, "mAssets");
|
Field implAssets = ReflectionUtils.findField(resourceImpl, "mAssets");
|
||||||
implAssets.set(resourceImpl, sAssetManager);
|
implAssets.set(resourceImpl, sAssetManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,13 +196,13 @@ public class ResourcesLoader {
|
|||||||
|
|
||||||
private static void installResourceInsuranceHacks(Context context, String patchedResApkPath) {
|
private static void installResourceInsuranceHacks(Context context, String patchedResApkPath) {
|
||||||
try {
|
try {
|
||||||
final Object activityThread = ReflectionUtils.getActivityThread(context, null);
|
Object activityThread = ReflectionUtils.getActivityThread(context, null);
|
||||||
final Field mHField = ReflectionUtils.findField(activityThread, "mH");
|
Field mHField = ReflectionUtils.findField(activityThread, "mH");
|
||||||
final Handler mH = (Handler) mHField.get(activityThread);
|
Handler mH = (Handler) mHField.get(activityThread);
|
||||||
final Field mCallbackField = ReflectionUtils.findField(Handler.class, "mCallback");
|
Field mCallbackField = ReflectionUtils.findField(Handler.class, "mCallback");
|
||||||
final Handler.Callback originCallback = (Handler.Callback) mCallbackField.get(mH);
|
Handler.Callback originCallback = (Handler.Callback) mCallbackField.get(mH);
|
||||||
if (!(originCallback instanceof ResourceInsuranceHandlerCallback)) {
|
if (!(originCallback instanceof ResourceInsuranceHandlerCallback)) {
|
||||||
final ResourceInsuranceHandlerCallback hackCallback = new ResourceInsuranceHandlerCallback(
|
ResourceInsuranceHandlerCallback hackCallback = new ResourceInsuranceHandlerCallback(
|
||||||
context, patchedResApkPath, originCallback, mH.getClass());
|
context, patchedResApkPath, originCallback, mH.getClass());
|
||||||
mCallbackField.set(mH, hackCallback);
|
mCallbackField.set(mH, hackCallback);
|
||||||
} else {
|
} else {
|
||||||
@@ -250,9 +250,9 @@ public class ResourcesLoader {
|
|||||||
Log.w("ResourcesLoader", "try to clear typedArray cache!");
|
Log.w("ResourcesLoader", "try to clear typedArray cache!");
|
||||||
// Clear typedArray cache.
|
// Clear typedArray cache.
|
||||||
try {
|
try {
|
||||||
final Field typedArrayPoolField = ReflectionUtils.findField(Resources.class, "mTypedArrayPool");
|
Field typedArrayPoolField = ReflectionUtils.findField(Resources.class, "mTypedArrayPool");
|
||||||
final Object origTypedArrayPool = typedArrayPoolField.get(resources);
|
Object origTypedArrayPool = typedArrayPoolField.get(resources);
|
||||||
final Method acquireMethod = ReflectionUtils.findMethod(origTypedArrayPool, "acquire");
|
Method acquireMethod = ReflectionUtils.findMethod(origTypedArrayPool, "acquire");
|
||||||
while (true) {
|
while (true) {
|
||||||
if (acquireMethod.invoke(origTypedArrayPool) == null) {
|
if (acquireMethod.invoke(origTypedArrayPool) == null) {
|
||||||
break;
|
break;
|
||||||
@@ -268,9 +268,8 @@ public class ResourcesLoader {
|
|||||||
applicationInfo.sharedLibraryFiles != null;
|
applicationInfo.sharedLibraryFiles != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class ResourceInsuranceHandlerCallback implements Handler.Callback {
|
private static class ResourceInsuranceHandlerCallback implements Handler.Callback {
|
||||||
private static final String LAUNCH_ACTIVITY_LIFECYCLE_ITEM_CLASSNAME = "android.app.servertransaction.LaunchActivityItem";
|
private static final String LAUNCH_ACTIVITY_LIFECYCLE_ITEM_CLASSNAME = "android.app.servertransaction.LaunchActivityItem";
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final String mPatchResApkPath;
|
private final String mPatchResApkPath;
|
||||||
private final Handler.Callback mOriginalCallback;
|
private final Handler.Callback mOriginalCallback;
|
||||||
@@ -319,48 +318,56 @@ public class ResourcesLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private boolean hackMessage(Message msg) {
|
// A method to check if the message requires re-injecting patched resources
|
||||||
boolean shouldReInjectPatchedResources = false;
|
private boolean shouldReInjectPatchedResources(Message msg) {
|
||||||
if (!isPatchedResModifiedAfterLastLoad(mPatchResApkPath)) {
|
if (!isPatchedResModifiedAfterLastLoad(mPatchResApkPath)) {
|
||||||
shouldReInjectPatchedResources = false;
|
return false;
|
||||||
} else {
|
}
|
||||||
if (msg.what == LAUNCH_ACTIVITY || msg.what == RELAUNCH_ACTIVITY) {
|
if (msg.what == LAUNCH_ACTIVITY || msg.what == RELAUNCH_ACTIVITY) {
|
||||||
shouldReInjectPatchedResources = true;
|
return true;
|
||||||
} else if (msg.what == EXECUTE_TRANSACTION) {
|
}
|
||||||
do {
|
// If the message is executing a transaction, check the callbacks
|
||||||
if (mSkipInterceptExecuteTransaction) {
|
if (msg.what == EXECUTE_TRANSACTION) {
|
||||||
break;
|
// Skip the logic if the method is not found or an error occurs
|
||||||
}
|
if (mSkipInterceptExecuteTransaction) {
|
||||||
final Object transaction = msg.obj;
|
return false;
|
||||||
if (transaction == null) {
|
}
|
||||||
Log.w("ResourcesLoader", "transaction is null, skip rest insurance logic.");
|
// Get the transaction object from the message
|
||||||
break;
|
Object transaction = msg.obj;
|
||||||
}
|
if (transaction == null) {
|
||||||
if (mGetCallbacksMethod == null) {
|
Log.w("ResourcesLoader", "transaction is null, skip rest insurance logic.");
|
||||||
try {
|
return false;
|
||||||
mGetCallbacksMethod = ReflectionUtils.findMethod(transaction, "getCallbacks");
|
}
|
||||||
} catch (Throwable ignored) {
|
// Get the getCallbacks method from the transaction class
|
||||||
// Ignored.
|
if (mGetCallbacksMethod == null) {
|
||||||
}
|
try {
|
||||||
}
|
mGetCallbacksMethod = ReflectionUtils.findMethod(transaction, "getCallbacks");
|
||||||
if (mGetCallbacksMethod == null) {
|
} catch (Throwable ignored) {
|
||||||
Log.e("ResourcesLoader", "fail to find getLifecycleStateRequest method, skip rest insurance logic.");
|
// Ignored.
|
||||||
mSkipInterceptExecuteTransaction = true;
|
}
|
||||||
break;
|
}
|
||||||
}
|
if (mGetCallbacksMethod == null) {
|
||||||
try {
|
Log.e("ResourcesLoader", "fail to find getCallbacks method, skip rest insurance logic.");
|
||||||
final List<Object> req = (List<Object>) mGetCallbacksMethod.invoke(transaction);
|
mSkipInterceptExecuteTransaction = true;
|
||||||
if (req != null && req.size() > 0) {
|
return false;
|
||||||
final Object cb = req.get(0);
|
}
|
||||||
shouldReInjectPatchedResources = cb != null && cb.getClass().getName().equals(LAUNCH_ACTIVITY_LIFECYCLE_ITEM_CLASSNAME);
|
try {
|
||||||
}
|
List<Object> callbacks = (List<Object>) mGetCallbacksMethod.invoke(transaction);
|
||||||
} catch (Throwable ignored) {
|
if (callbacks != null && !callbacks.isEmpty()) {
|
||||||
Log.e("ResourcesLoader", "fail to call getLifecycleStateRequest method, skip rest insurance logic.");
|
Object cb = callbacks.get(0);
|
||||||
}
|
return cb != null && cb.getClass().getName().equals(LAUNCH_ACTIVITY_LIFECYCLE_ITEM_CLASSNAME);
|
||||||
} while (false);
|
}
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
Log.e("ResourcesLoader", "fail to call getCallbacks method, skip rest insurance logic.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (shouldReInjectPatchedResources) {
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A method to hack the message and re-inject patched resources if needed
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private boolean hackMessage(Message msg) {
|
||||||
|
if (shouldReInjectPatchedResources(msg)) {
|
||||||
try {
|
try {
|
||||||
load(mContext, mPatchResApkPath, true);
|
load(mContext, mPatchResApkPath, true);
|
||||||
} catch (Throwable thr) {
|
} catch (Throwable thr) {
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
|||||||
|
|
||||||
public class PalettesManager {
|
public class PalettesManager {
|
||||||
|
|
||||||
private final static File PALETTES_DIR = new File(Environment.getExternalStorageDirectory(), "VTL/palettes");
|
private static final File PALETTES_DIR = new File(Environment.getExternalStorageDirectory(), "VTL/palettes");
|
||||||
private final static String ASSETS_DIR = "vtl_themes/palettes/";
|
private static final String ASSETS_DIR = "vtl_themes/palettes/";
|
||||||
|
|
||||||
private static PalettesManager sInstance;
|
private static PalettesManager sInstance;
|
||||||
|
|
||||||
@@ -51,17 +51,17 @@ public class PalettesManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final var palettes = PALETTES_DIR.listFiles((dir, name) -> name.endsWith(".json"));
|
var palettes = PALETTES_DIR.listFiles((dir, name) -> name.endsWith(".json"));
|
||||||
if (palettes == null || palettes.length == 0)
|
if (palettes == null || palettes.length == 0)
|
||||||
copyPaletteFromAssets();
|
copyPaletteFromAssets();
|
||||||
parsePalettes();
|
parsePalettes();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean copyPaletteFromAssets() {
|
private void copyPaletteFromAssets() {
|
||||||
try {
|
try {
|
||||||
final var manager = AndroidUtils.getGlobalContext().getAssets();
|
var manager = AndroidUtils.getGlobalContext().getAssets();
|
||||||
final var assets = manager.list(ASSETS_DIR);
|
var assets = manager.list(ASSETS_DIR);
|
||||||
if (assets == null || assets.length == 0) return false;
|
if (assets == null || assets.length == 0) return;
|
||||||
for (var asset : assets) {
|
for (var asset : assets) {
|
||||||
try {
|
try {
|
||||||
IOUtils.copy(manager.open(ASSETS_DIR + asset), new File(PALETTES_DIR, asset));
|
IOUtils.copy(manager.open(ASSETS_DIR + asset), new File(PALETTES_DIR, asset));
|
||||||
@@ -69,11 +69,9 @@ public class PalettesManager {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parsePalettes() {
|
private void parsePalettes() {
|
||||||
|
|||||||
@@ -1,37 +1,38 @@
|
|||||||
package ru.vtosters.lite.themes.utils;
|
package ru.vtosters.lite.themes.utils;
|
||||||
|
|
||||||
import com.google.devrel.gmscore.tools.apk.arsc.*;
|
import com.google.devrel.gmscore.tools.apk.arsc.BinaryResourceFile;
|
||||||
|
import com.google.devrel.gmscore.tools.apk.arsc.BinaryResourceValue;
|
||||||
|
import com.google.devrel.gmscore.tools.apk.arsc.ResourceTableChunk;
|
||||||
|
|
||||||
public class ArscEditor {
|
public class ArscEditor {
|
||||||
|
|
||||||
public static boolean changeColors(BinaryResourceFile arsc, int[] colorIds, int color /*int[] colors*/) {
|
public static void changeColors(BinaryResourceFile arsc, int[] colorIds, int color) {
|
||||||
int q = 0;
|
|
||||||
for (var chunk : arsc.getChunks()) {
|
for (var chunk : arsc.getChunks()) {
|
||||||
final var resourceTableChunk = (ResourceTableChunk) chunk;
|
var resTableChunk = (ResourceTableChunk) chunk;
|
||||||
|
for (var packageChunk : resTableChunk.getPackages()) {
|
||||||
for (PackageChunk packageChunk : resourceTableChunk.getPackages()) {
|
for (var typeChunk : packageChunk.getTypeChunks("color")) {
|
||||||
for (TypeSpecChunk typeSpecChunk : packageChunk.getTypeSpecChunks()) {
|
for (var entry : typeChunk.getEntries().entrySet()) {
|
||||||
for (TypeChunk typeChunk : packageChunk.getTypeChunks(typeSpecChunk.getId())) {
|
var value = entry.getValue();
|
||||||
if (!"color".equals(typeChunk.getTypeName())) continue;
|
if (value.isComplex()) continue;
|
||||||
|
var binValue = value.value();
|
||||||
for (var entry : typeChunk.getEntries().entrySet()) {
|
if (!isColorResourceValue(binValue)) continue;
|
||||||
if (entry.getValue().isComplex()) continue;
|
var resId = packageChunk.getId() << 24 | typeChunk.getId() << 16 | entry.getKey();
|
||||||
|
for (var colodId : colorIds) {
|
||||||
final var id = BinaryResourceIdentifier.create(packageChunk.getId(), typeSpecChunk.getId(), entry.getKey());
|
if (resId == colodId) {
|
||||||
|
binValue.data = color;
|
||||||
for (int colorId : colorIds) {
|
break;
|
||||||
if (colorId != id.resId()) continue;
|
|
||||||
|
|
||||||
final var value = entry.getValue();
|
|
||||||
value.updateValue(new BinaryResourceValue(8, value.value().type(), color /*colors[i]*/));
|
|
||||||
++q;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return q == colorIds.length;
|
private static boolean isColorResourceValue(BinaryResourceValue value) {
|
||||||
|
return value.type == BinaryResourceValue.Type.INT_COLOR_ARGB8
|
||||||
|
|| value.type == BinaryResourceValue.Type.INT_COLOR_RGB8
|
||||||
|
|| value.type == BinaryResourceValue.Type.INT_COLOR_ARGB4
|
||||||
|
|| value.type == BinaryResourceValue.Type.INT_COLOR_RGB4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import android.widget.TextView;
|
|||||||
import com.vk.core.drawable.RecoloredDrawable;
|
import com.vk.core.drawable.RecoloredDrawable;
|
||||||
import ru.vtosters.hooks.other.ThemesUtils;
|
import ru.vtosters.hooks.other.ThemesUtils;
|
||||||
import ru.vtosters.lite.themes.ColorReferences;
|
import ru.vtosters.lite.themes.ColorReferences;
|
||||||
|
import ru.vtosters.lite.themes.ThemesManager;
|
||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
|
|
||||||
public class RecolorUtils {
|
public class RecolorUtils {
|
||||||
@@ -43,7 +44,7 @@ public class RecolorUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int recolorHexColor(int i) {
|
public static int recolorHexColor(int i) {
|
||||||
if (!ThemesUtils.isCustomAccentEnabled()) return i;
|
if (!ThemesUtils.isMonetTheme() || !ThemesManager.canApplyCustomAccent()) return i;
|
||||||
var accented = ColorReferences.isAccentedColor(i);
|
var accented = ColorReferences.isAccentedColor(i);
|
||||||
var mutedaccented = ColorReferences.isMutedAccentedColor(i);
|
var mutedaccented = ColorReferences.isMutedAccentedColor(i);
|
||||||
return (accented || mutedaccented) ? (accented ? ThemesUtils.getAccentColor() : ThemesUtils.getMutedAccentColor()) : i;
|
return (accented || mutedaccented) ? (accented ? ThemesUtils.getAccentColor() : ThemesUtils.getMutedAccentColor()) : i;
|
||||||
@@ -57,7 +58,7 @@ public class RecolorUtils {
|
|||||||
|
|
||||||
@SuppressLint("UseCompatLoadingForColorStateLists")
|
@SuppressLint("UseCompatLoadingForColorStateLists")
|
||||||
public static ColorStateList themeCSL(Context context, int color) {
|
public static ColorStateList themeCSL(Context context, int color) {
|
||||||
if (!ThemesUtils.isCustomAccentEnabled()) {
|
if (!ThemesUtils.isMonetTheme()) {
|
||||||
if (Build.VERSION.SDK_INT >= 23) {
|
if (Build.VERSION.SDK_INT >= 23) {
|
||||||
return context.getColorStateList(color);
|
return context.getColorStateList(color);
|
||||||
} else {
|
} else {
|
||||||
@@ -83,7 +84,7 @@ public class RecolorUtils {
|
|||||||
} // Recolor ColorStateList
|
} // Recolor ColorStateList
|
||||||
|
|
||||||
public static ColorStateList themeCSL(ColorStateList csl) {
|
public static ColorStateList themeCSL(ColorStateList csl) {
|
||||||
if (!ThemesUtils.isCustomAccentEnabled()) return csl;
|
if (!ThemesUtils.isMonetTheme()) return csl;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int unsel = csl.getColorForState(new int[]{-android.R.attr.state_selected}, Color.BLACK);
|
int unsel = csl.getColorForState(new int[]{-android.R.attr.state_selected}, Color.BLACK);
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ public class PreferenceFragmentUtils {
|
|||||||
return addPreference(screen, key, title, null, null, preference -> {
|
return addPreference(screen, key, title, null, null, preference -> {
|
||||||
LinearLayout linearLayout = new LinearLayout(screen.getContext());
|
LinearLayout linearLayout = new LinearLayout(screen.getContext());
|
||||||
|
|
||||||
final EditText editText = new EditText(screen.getContext());
|
EditText editText = new EditText(screen.getContext());
|
||||||
editText.setText(PreferenceManager.getDefaultSharedPreferences(screen.getContext()).getString(key, ""));
|
editText.setText(PreferenceManager.getDefaultSharedPreferences(screen.getContext()).getString(key, ""));
|
||||||
editText.setHint(title);
|
editText.setHint(title);
|
||||||
editText.setTextColor(ThemesUtils.getTextAttr());
|
editText.setTextColor(ThemesUtils.getTextAttr());
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import ru.vtosters.lite.utils.AndroidUtils;
|
|||||||
import ru.vtosters.lite.utils.LayoutUtils;
|
import ru.vtosters.lite.utils.LayoutUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ public class CategorizedAdapter<T> extends RecyclerView.Adapter<CategorizedAdapt
|
|||||||
private final List<T> mSelectedItems;
|
private final List<T> mSelectedItems;
|
||||||
private final List<T> mDisabledItems;
|
private final List<T> mDisabledItems;
|
||||||
private final List<T> mUnmovedItems;
|
private final List<T> mUnmovedItems;
|
||||||
|
private final List<T> mExceptions = new ArrayList<>();
|
||||||
private final IViewHolderBinder mBinder;
|
private final IViewHolderBinder mBinder;
|
||||||
|
|
||||||
// Min and max counts
|
// Min and max counts
|
||||||
@@ -48,6 +50,12 @@ public class CategorizedAdapter<T> extends RecyclerView.Adapter<CategorizedAdapt
|
|||||||
this.mBinder = binder;
|
this.mBinder = binder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
public final void setExceptions(T... exceptions) {
|
||||||
|
mExceptions.clear();
|
||||||
|
mExceptions.addAll(Arrays.asList(exceptions));
|
||||||
|
}
|
||||||
|
|
||||||
public void setMinAndMaxCounts(int min, int max) {
|
public void setMinAndMaxCounts(int min, int max) {
|
||||||
this.mMinSelectedItems = min;
|
this.mMinSelectedItems = min;
|
||||||
this.mMaxSelectedItems = max;
|
this.mMaxSelectedItems = max;
|
||||||
@@ -173,16 +181,25 @@ public class CategorizedAdapter<T> extends RecyclerView.Adapter<CategorizedAdapt
|
|||||||
public boolean onItemMove(int fromPosition, int toPosition) {
|
public boolean onItemMove(int fromPosition, int toPosition) {
|
||||||
if (toPosition == 0 || isUnmovedItem(toPosition))
|
if (toPosition == 0 || isUnmovedItem(toPosition))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (getTabType(fromPosition)) {
|
switch (getTabType(fromPosition)) {
|
||||||
case SELECTED_STATE -> {
|
case SELECTED_STATE -> {
|
||||||
if (getTabType(toPosition) == DISABLED_STATE
|
if ((getTabType(toPosition) == DISABLED_STATE
|
||||||
&& mSelectedItems.size() == mMinSelectedItems)
|
&& mSelectedItems.size() == mMinSelectedItems))
|
||||||
return false;
|
return false;
|
||||||
if (getItemViewType(toPosition) == CATEGORY_TITLE)
|
if (getItemViewType(toPosition) == CATEGORY_TITLE) {
|
||||||
|
if (!mExceptions.isEmpty()) {
|
||||||
|
boolean except = false;
|
||||||
|
int q = 0;
|
||||||
|
for (var ex : mExceptions) {
|
||||||
|
var i = mSelectedItems.indexOf(ex);
|
||||||
|
if (i == -1) continue;
|
||||||
|
if (i + 1 == fromPosition) except = true;
|
||||||
|
++q;
|
||||||
|
}
|
||||||
|
if (except && q == 1) return false;
|
||||||
|
}
|
||||||
mDisabledItems.add(0, mSelectedItems.remove(fromPosition - 1));
|
mDisabledItems.add(0, mSelectedItems.remove(fromPosition - 1));
|
||||||
else
|
} else Collections.swap(mSelectedItems, fromPosition - 1, toPosition - 1);
|
||||||
Collections.swap(mSelectedItems, fromPosition - 1, toPosition - 1);
|
|
||||||
}
|
}
|
||||||
case DISABLED_STATE -> {
|
case DISABLED_STATE -> {
|
||||||
if (getTabType(toPosition) == SELECTED_STATE
|
if (getTabType(toPosition) == SELECTED_STATE
|
||||||
@@ -198,7 +215,6 @@ public class CategorizedAdapter<T> extends RecyclerView.Adapter<CategorizedAdapt
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyItemMoved(fromPosition, toPosition);
|
notifyItemMoved(fromPosition, toPosition);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -208,7 +224,6 @@ public class CategorizedAdapter<T> extends RecyclerView.Adapter<CategorizedAdapt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class CategorizedViewHolder extends RecyclerView.ViewHolder {
|
public static class CategorizedViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
private final LinearLayout mMovingItemContainer;
|
private final LinearLayout mMovingItemContainer;
|
||||||
private final ImageView mIcon;
|
private final ImageView mIcon;
|
||||||
private final TextView mName;
|
private final TextView mName;
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import ru.vtosters.hooks.other.ThemesUtils;
|
|||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
|
|
||||||
public class MessagesPreviewAdapter extends RecyclerView.Adapter<MessagesPreviewAdapter.MessagePreviewViewHolder> {
|
public class MessagesPreviewAdapter extends RecyclerView.Adapter<MessagesPreviewAdapter.MessagePreviewViewHolder> {
|
||||||
|
|
||||||
private final String[] mMessages;
|
private final String[] mMessages;
|
||||||
|
|
||||||
public MessagesPreviewAdapter(String... messages) {
|
public MessagesPreviewAdapter(String... messages) {
|
||||||
@@ -35,9 +34,9 @@ public class MessagesPreviewAdapter extends RecyclerView.Adapter<MessagesPreview
|
|||||||
public MessagePreviewViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
|
public MessagePreviewViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
|
||||||
Context context = viewGroup.getContext();
|
Context context = viewGroup.getContext();
|
||||||
|
|
||||||
final var inflater = LayoutInflater.from(context);
|
var inflater = LayoutInflater.from(context);
|
||||||
|
|
||||||
final var bubbleFluidLayout = (BubbleFluidLayout) inflater.inflate(R.layout.vkim_msg_list_item_msg_from_user, viewGroup, false);
|
var bubbleFluidLayout = (BubbleFluidLayout) inflater.inflate(R.layout.vkim_msg_list_item_msg_from_user, viewGroup, false);
|
||||||
bubbleFluidLayout.setPadding(0, AndroidUtils.dp2px(4), 0, 0);
|
bubbleFluidLayout.setPadding(0, AndroidUtils.dp2px(4), 0, 0);
|
||||||
bubbleFluidLayout.setGravity(viewType);
|
bubbleFluidLayout.setGravity(viewType);
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ public class MessagesPreviewAdapter extends RecyclerView.Adapter<MessagesPreview
|
|||||||
bubbleFluidLayout.findViewById(R.id.status).setVisibility(View.GONE);
|
bubbleFluidLayout.findViewById(R.id.status).setVisibility(View.GONE);
|
||||||
bubbleFluidLayout.findViewById(R.id.status_space).setVisibility(View.GONE);
|
bubbleFluidLayout.findViewById(R.id.status_space).setVisibility(View.GONE);
|
||||||
|
|
||||||
final var messageBubbleView = (MsgBubbleView) bubbleFluidLayout.findViewById(R.id.bubble);
|
var messageBubbleView = (MsgBubbleView) bubbleFluidLayout.findViewById(R.id.bubble);
|
||||||
messageBubbleView.setContentPaddingLeft(AndroidUtils.dp2px(10));
|
messageBubbleView.setContentPaddingLeft(AndroidUtils.dp2px(10));
|
||||||
messageBubbleView.setContentPaddingTop(AndroidUtils.dp2px(4));
|
messageBubbleView.setContentPaddingTop(AndroidUtils.dp2px(4));
|
||||||
messageBubbleView.setContentPaddingRight(AndroidUtils.dp2px(4));
|
messageBubbleView.setContentPaddingRight(AndroidUtils.dp2px(4));
|
||||||
@@ -59,10 +58,10 @@ public class MessagesPreviewAdapter extends RecyclerView.Adapter<MessagesPreview
|
|||||||
}
|
}
|
||||||
bubbleFluidLayout.setLayoutDirection(viewType);
|
bubbleFluidLayout.setLayoutDirection(viewType);
|
||||||
|
|
||||||
final var msgTextView = inflater.inflate(R.layout.vkim_msg_part_text, viewGroup, false);
|
var msgTextView = inflater.inflate(R.layout.vkim_msg_part_text, viewGroup, false);
|
||||||
msgTextView.setId(R.id.msg_text);
|
msgTextView.setId(R.id.msg_text);
|
||||||
|
|
||||||
final var msgBubbleView = (MsgBubbleView) bubbleFluidLayout.findViewById(R.id.bubble);
|
var msgBubbleView = (MsgBubbleView) bubbleFluidLayout.findViewById(R.id.bubble);
|
||||||
msgBubbleView.setContentView(msgTextView);
|
msgBubbleView.setContentView(msgTextView);
|
||||||
|
|
||||||
return new MessagePreviewViewHolder(bubbleFluidLayout);
|
return new MessagePreviewViewHolder(bubbleFluidLayout);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package ru.vtosters.lite.ui.adapters;
|
package ru.vtosters.lite.ui.adapters;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -28,6 +29,7 @@ import ru.vtosters.hooks.SwitchHook;
|
|||||||
import ru.vtosters.lite.tgs.TGPref;
|
import ru.vtosters.lite.tgs.TGPref;
|
||||||
import ru.vtosters.lite.tgs.TGRoot;
|
import ru.vtosters.lite.tgs.TGRoot;
|
||||||
import ru.vtosters.lite.ui.components.IItemMovingListener;
|
import ru.vtosters.lite.ui.components.IItemMovingListener;
|
||||||
|
import ru.vtosters.lite.ui.fragments.VTSettings;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -138,7 +140,11 @@ public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.
|
|||||||
});
|
});
|
||||||
mName.setText(pack.title);
|
mName.setText(pack.title);
|
||||||
mSwitch.setChecked(pack.enabled);
|
mSwitch.setChecked(pack.enabled);
|
||||||
mSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> sService.setPackEnabled(pack, isChecked, true));
|
mSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
sService.setPackEnabled(pack, isChecked, false);
|
||||||
|
buttonView.getContext().sendBroadcast(new Intent(VTSettings.ACTION_INVALIDATE_TGS_COUNT));
|
||||||
|
});
|
||||||
|
|
||||||
mStickersCount.setText(pack.stickersCount + " " + mStickersCount.getContext().getString(R.string.stickerscount));
|
mStickersCount.setText(pack.stickersCount + " " + mStickersCount.getContext().getString(R.string.stickerscount));
|
||||||
|
|
||||||
SwitchHook.setSwitchCompatColors(mSwitch, mSwitch.getContext());
|
SwitchHook.setSwitchCompatColors(mSwitch, mSwitch.getContext());
|
||||||
|
|||||||
@@ -59,71 +59,7 @@ public class DockBarEditorManager {
|
|||||||
: sInstance;
|
: sInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
public static DockBarTab getTabByTag(String tag) {
|
||||||
if (vkme()) {
|
|
||||||
mSelectedTabs.add(getTabByTag("tab_settings"));
|
|
||||||
if (vkme_notifs()) {
|
|
||||||
if (milkshake()) {
|
|
||||||
mSelectedTabs.add(getTabByTag("tab_feedback"));
|
|
||||||
} else {
|
|
||||||
mSelectedTabs.add(getTabByTag("tab_friends"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mSelectedTabs.add(getTabByTag("tab_messages"));
|
|
||||||
mSelectedTabs.add(getTabByTag("tab_profile"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
checkOldConfig();
|
|
||||||
|
|
||||||
var selectedTabsTags = getPreferences()
|
|
||||||
.getString("dockbar_tabs",
|
|
||||||
"tab_news,tab_superapps,tab_messages,tab_friends,tab_profile")
|
|
||||||
.split(",");
|
|
||||||
parseSelectedTabs(selectedTabsTags);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkOldConfig() {
|
|
||||||
File config = new File(getGlobalContext().getFilesDir(), "dockbar.json");
|
|
||||||
if (config.exists()) config.deleteOnExit();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parseSelectedTabs(String[] selectedTabsTags) {
|
|
||||||
var allTags = new ArrayList<>(ALL_TAGS);
|
|
||||||
|
|
||||||
for (String tag : selectedTabsTags) {
|
|
||||||
mSelectedTabs.add(getTabByTag(tag));
|
|
||||||
allTags.remove(tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String tag : allTags) {
|
|
||||||
mDisabledTabs.add(getTabByTag(tag));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save() {
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
for (DockBarTab tab : mSelectedTabs)
|
|
||||||
sb.append(tab.tag).append(",");
|
|
||||||
getPreferences().edit().putString("dockbar_tabs", sb.toString()).commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reset() {
|
|
||||||
Preferences.getPreferences()
|
|
||||||
.edit()
|
|
||||||
.putString("dockbar_tabs", "tab_news,tab_superapps,tab_messages,tab_friends,tab_profile")
|
|
||||||
.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DockBarTab> getSelectedTabs() {
|
|
||||||
return mSelectedTabs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DockBarTab> getDisabledTabs() {
|
|
||||||
return mDisabledTabs;
|
|
||||||
}
|
|
||||||
|
|
||||||
private DockBarTab getTabByTag(String tag) {
|
|
||||||
return switch (tag) {
|
return switch (tag) {
|
||||||
case "tab_news" -> DockBarTab.valuesOf(
|
case "tab_news" -> DockBarTab.valuesOf(
|
||||||
"tab_news",
|
"tab_news",
|
||||||
@@ -235,4 +171,68 @@ public class DockBarEditorManager {
|
|||||||
useNewSettings());
|
useNewSettings());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
if (vkme()) {
|
||||||
|
mSelectedTabs.add(getTabByTag("tab_settings"));
|
||||||
|
if (vkme_notifs()) {
|
||||||
|
if (milkshake()) {
|
||||||
|
mSelectedTabs.add(getTabByTag("tab_feedback"));
|
||||||
|
} else {
|
||||||
|
mSelectedTabs.add(getTabByTag("tab_friends"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mSelectedTabs.add(getTabByTag("tab_messages"));
|
||||||
|
mSelectedTabs.add(getTabByTag("tab_profile"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkOldConfig();
|
||||||
|
|
||||||
|
var selectedTabsTags = getPreferences()
|
||||||
|
.getString("dockbar_tabs",
|
||||||
|
"tab_news,tab_superapps,tab_messages,tab_friends,tab_profile")
|
||||||
|
.split(",");
|
||||||
|
parseSelectedTabs(selectedTabsTags);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkOldConfig() {
|
||||||
|
File config = new File(getGlobalContext().getFilesDir(), "dockbar.json");
|
||||||
|
if (config.exists()) config.deleteOnExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseSelectedTabs(String[] selectedTabsTags) {
|
||||||
|
var allTags = new ArrayList<>(ALL_TAGS);
|
||||||
|
|
||||||
|
for (String tag : selectedTabsTags) {
|
||||||
|
mSelectedTabs.add(getTabByTag(tag));
|
||||||
|
allTags.remove(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String tag : allTags) {
|
||||||
|
mDisabledTabs.add(getTabByTag(tag));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save() {
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
for (DockBarTab tab : mSelectedTabs)
|
||||||
|
sb.append(tab.tag).append(",");
|
||||||
|
getPreferences().edit().putString("dockbar_tabs", sb.toString()).commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
Preferences.getPreferences()
|
||||||
|
.edit()
|
||||||
|
.putString("dockbar_tabs", "tab_news,tab_superapps,tab_messages,tab_friends,tab_profile")
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DockBarTab> getSelectedTabs() {
|
||||||
|
return mSelectedTabs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DockBarTab> getDisabledTabs() {
|
||||||
|
return mDisabledTabs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ public class DisableBattery {
|
|||||||
public static void alert(Activity activity) {
|
public static void alert(Activity activity) {
|
||||||
if (!(OEMDetector.isOEM() && Build.VERSION.SDK_INT >= 23 && Preferences.getBoolValue("showDoze", true)))
|
if (!(OEMDetector.isOEM() && Build.VERSION.SDK_INT >= 23 && Preferences.getBoolValue("showDoze", true)))
|
||||||
return;
|
return;
|
||||||
final String packName = activity.getPackageName();
|
String packName = activity.getPackageName();
|
||||||
final PowerManager manager = (PowerManager) activity.getSystemService(Context.POWER_SERVICE);
|
PowerManager manager = (PowerManager) activity.getSystemService(Context.POWER_SERVICE);
|
||||||
if (manager.isIgnoringBatteryOptimizations(packName)) return;
|
if (manager.isIgnoringBatteryOptimizations(packName)) return;
|
||||||
new VkAlertDialog.Builder(activity)
|
new VkAlertDialog.Builder(activity)
|
||||||
.setTitle(R.string.batteryissuetitle)
|
.setTitle(R.string.batteryissuetitle)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package ru.vtosters.lite.ui.dialogs;
|
package ru.vtosters.lite.ui.dialogs;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@@ -41,6 +42,7 @@ public class OTADialog extends ModalBottomSheetWrapper<OTADialog> implements OTA
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetTextI18n")
|
||||||
private View makeUpdateInfoView(String changelog) {
|
private View makeUpdateInfoView(String changelog) {
|
||||||
LinearLayout container = new LinearLayout(mActivity);
|
LinearLayout container = new LinearLayout(mActivity);
|
||||||
TextView changelogView = new TextView(mActivity);
|
TextView changelogView = new TextView(mActivity);
|
||||||
|
|||||||
@@ -1,21 +1,37 @@
|
|||||||
package ru.vtosters.lite.ui.fragments;
|
package ru.vtosters.lite.ui.fragments;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowInsetsController;
|
import android.view.WindowInsetsController;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
import androidx.appcompat.view.ContextThemeWrapper;
|
||||||
|
import b.h.g.m.FileUtils;
|
||||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||||
|
import com.vk.im.engine.ImEngine1;
|
||||||
|
import com.vk.im.engine.ImEngineExt;
|
||||||
|
import com.vk.im.ui.providers.audiomsg.ImAudioMsgPlayerProvider;
|
||||||
|
import com.vk.im.ui.providers.audiomsg.PlayerActionSources;
|
||||||
|
import com.vk.imageloader.VKImageLoader;
|
||||||
|
import com.vk.media.player.cache.AutoPlayCacheHolder;
|
||||||
|
import com.vk.mediastore.MediaStorage;
|
||||||
|
import com.vk.stickers.Stickers;
|
||||||
|
import com.vtosters.lite.im.ImEngineProvider;
|
||||||
|
import ru.vtosters.hooks.SwitchHook;
|
||||||
import ru.vtosters.hooks.other.Preferences;
|
import ru.vtosters.hooks.other.Preferences;
|
||||||
import ru.vtosters.hooks.other.ThemesUtils;
|
import ru.vtosters.hooks.other.ThemesUtils;
|
||||||
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
||||||
import ru.vtosters.lite.ui.components.BackupManager;
|
import ru.vtosters.lite.ui.components.BackupManager;
|
||||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
import ru.vtosters.lite.utils.*;
|
||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
|
||||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
|
||||||
import ru.vtosters.lite.utils.VKAccountDB;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@@ -58,6 +74,114 @@ public class DataSettingsFragment extends TrackedMaterialPreferenceToolbarFragme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), AndroidUtils.getString("data"));
|
||||||
|
|
||||||
|
PreferenceFragmentUtils.addPreference(
|
||||||
|
getPreferenceScreen(),
|
||||||
|
"currcache",
|
||||||
|
getString(com.vtosters.lite.R.string.cache_size),
|
||||||
|
getString(com.vtosters.lite.R.string.cache_size_summ) + ": " + CacheUtils.humanReadableByteCountBin(IOUtils.getDirSize(AndroidUtils.getGlobalContext().getCacheDir())),
|
||||||
|
null,
|
||||||
|
preference -> {
|
||||||
|
new VkAlertDialog.Builder(requireContext())
|
||||||
|
.setTitle(getString(com.vtosters.lite.R.string.clear_all_cache))
|
||||||
|
.setPositiveButton(requireContext().getString(com.vtosters.lite.R.string.yes), (dialogInterface, i) -> {
|
||||||
|
new WebView(requireContext()).clearCache(true);
|
||||||
|
VKImageLoader.e();
|
||||||
|
ImAudioMsgPlayerProvider.b().e(PlayerActionSources.a);
|
||||||
|
ImAudioMsgPlayerProvider.b().d(PlayerActionSources.a);
|
||||||
|
FileUtils.l();
|
||||||
|
AutoPlayCacheHolder.d.a();
|
||||||
|
MediaStorage.a();
|
||||||
|
updateCacheSize();
|
||||||
|
})
|
||||||
|
.setNegativeButton(requireContext().getString(com.vtosters.lite.R.string.cancel), (dialogInterface, i) -> dialogInterface.dismiss())
|
||||||
|
.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
PreferenceFragmentUtils.addPreference(
|
||||||
|
getPreferenceScreen(),
|
||||||
|
"",
|
||||||
|
AndroidUtils.getString("clearcache_other_title"),
|
||||||
|
"",
|
||||||
|
null,
|
||||||
|
preference -> {
|
||||||
|
new VkAlertDialog.Builder(getContext())
|
||||||
|
.setTitle(requireContext().getString(com.vtosters.lite.R.string.select_which_clean))
|
||||||
|
.setItems(AndroidUtils.getArray(com.vtosters.lite.R.array.cache_cleaner), (dialog, which) -> {
|
||||||
|
switch (which) {
|
||||||
|
case 0 -> {
|
||||||
|
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||||
|
prefs2.edit().clear().commit();
|
||||||
|
new WebView(requireContext()).clearCache(true);
|
||||||
|
VKImageLoader.e();
|
||||||
|
ImEngineProvider.b().a();
|
||||||
|
ImAudioMsgPlayerProvider.b().e(PlayerActionSources.a);
|
||||||
|
ImAudioMsgPlayerProvider.b().d(PlayerActionSources.a);
|
||||||
|
FileUtils.l();
|
||||||
|
Stickers.l.c();
|
||||||
|
ImEngineExt.a(ImEngine1.a());
|
||||||
|
AutoPlayCacheHolder.d.a();
|
||||||
|
MediaStorage.a();
|
||||||
|
}
|
||||||
|
case 1 -> {
|
||||||
|
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||||
|
prefs2.edit().clear().commit();
|
||||||
|
Stickers.l.c();
|
||||||
|
}
|
||||||
|
case 2 -> {
|
||||||
|
VKImageLoader.e();
|
||||||
|
ImEngineExt.a(ImEngine1.a());
|
||||||
|
}
|
||||||
|
case 3 -> {
|
||||||
|
AutoPlayCacheHolder.d.a();
|
||||||
|
MediaStorage.a();
|
||||||
|
}
|
||||||
|
case 4 -> {
|
||||||
|
ImEngineProvider.b().a();
|
||||||
|
ImAudioMsgPlayerProvider.b().e(PlayerActionSources.a);
|
||||||
|
ImAudioMsgPlayerProvider.b().d(PlayerActionSources.a);
|
||||||
|
}
|
||||||
|
case 5 -> new WebView(requireContext()).clearCache(true);
|
||||||
|
}
|
||||||
|
Toast.makeText(getContext(), requireContext().getString(com.vtosters.lite.R.string.cache_cleaned), Toast.LENGTH_SHORT).show();
|
||||||
|
updateCacheSize();
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
PreferenceFragmentUtils.addPreference(
|
||||||
|
getPreferenceScreen(),
|
||||||
|
"autoclearcache_btn",
|
||||||
|
AndroidUtils.getString("autoclearcache"),
|
||||||
|
"",
|
||||||
|
null,
|
||||||
|
preference -> {
|
||||||
|
cacheAutoCleanDialog();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
var pref = Preferences.getPreferences().getString("autoclearcache", "Default");
|
||||||
|
switch (pref) {
|
||||||
|
case "Default" ->
|
||||||
|
findPreference("autoclearcache_btn").setSummary(requireContext().getString(com.vtosters.lite.R.string.cache_disabled));
|
||||||
|
case "100mb" ->
|
||||||
|
findPreference("autoclearcache_btn").setSummary(requireContext().getString(com.vtosters.lite.R.string.cache_100mb));
|
||||||
|
case "500mb" ->
|
||||||
|
findPreference("autoclearcache_btn").setSummary(requireContext().getString(com.vtosters.lite.R.string.cache_500mb));
|
||||||
|
case "1gb" ->
|
||||||
|
findPreference("autoclearcache_btn").setSummary(requireContext().getString(com.vtosters.lite.R.string.cache_1gb));
|
||||||
|
case "2gb" ->
|
||||||
|
findPreference("autoclearcache_btn").setSummary(requireContext().getString(com.vtosters.lite.R.string.cache_2gb));
|
||||||
|
case "5gb" ->
|
||||||
|
findPreference("autoclearcache_btn").setSummary(requireContext().getString(com.vtosters.lite.R.string.cache_5gb));
|
||||||
|
}
|
||||||
|
|
||||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), AndroidUtils.getString("accounts"));
|
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), AndroidUtils.getString("accounts"));
|
||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(
|
PreferenceFragmentUtils.addPreference(
|
||||||
@@ -177,4 +301,59 @@ public class DataSettingsFragment extends TrackedMaterialPreferenceToolbarFragme
|
|||||||
|
|
||||||
findPreference("analyticsDisabled").setVisible(Preferences.isValidSignature());
|
findPreference("analyticsDisabled").setVisible(Preferences.isValidSignature());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateCacheSize() {
|
||||||
|
findPreference("currcache").setSummary(getString(com.vtosters.lite.R.string.cache_size_summ) + ": " + CacheUtils.humanReadableByteCountBin(IOUtils.getDirSize(AndroidUtils.getGlobalContext().getCacheDir())));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint({"CommitPrefEdits", "SetTextI18n"})
|
||||||
|
private void cacheAutoCleanDialog() {
|
||||||
|
String[] cacheText = {null, "100 MB", "500 MB", "1 GB", "2 GB", "5 GB"};
|
||||||
|
|
||||||
|
var val = Preferences.getPreferences().getInt("autoclearcache_size", 0);
|
||||||
|
RadioGroup rg = new RadioGroup(getContext());
|
||||||
|
|
||||||
|
rg.setPadding(AndroidUtils.dp2px(18f), AndroidUtils.dp2px(12f), AndroidUtils.dp2px(18f), 0);
|
||||||
|
|
||||||
|
for (int item = 0; item <= 5; item++) {
|
||||||
|
RadioButton rb = new RadioButton(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||||
|
SwitchHook.setCompoundButton(rb);
|
||||||
|
rg.addView(rb);
|
||||||
|
rb.setId(item);
|
||||||
|
rb.setTextSize(TypedValue.COMPLEX_UNIT_PX, AndroidUtils.dp2px(14f));
|
||||||
|
|
||||||
|
var text = cacheText[item];
|
||||||
|
rb.setText(text != null ? text : AndroidUtils.getString("autoclearcachedisabled"));
|
||||||
|
|
||||||
|
rb.setTextColor(ThemesUtils.getTextAttr());
|
||||||
|
rb.setChecked(val == item);
|
||||||
|
}
|
||||||
|
|
||||||
|
new VkAlertDialog.Builder(getContext())
|
||||||
|
.setTitle(requireContext().getString(com.vtosters.lite.R.string.cache_clean_title))
|
||||||
|
.setMessage(requireContext().getString(com.vtosters.lite.R.string.cache_select_size))
|
||||||
|
.setCancelable(true)
|
||||||
|
.setNegativeButton(requireContext().getString(com.vtosters.lite.R.string.cancel), null)
|
||||||
|
.setView(rg)
|
||||||
|
.setPositiveButton(requireContext().getString(com.vtosters.lite.R.string.save), (dialog, which) -> {
|
||||||
|
var sizes = new String[]{"Default", "100mb", "500mb", "1gb", "2gb", "5gb"};
|
||||||
|
var id = rg.getCheckedRadioButtonId();
|
||||||
|
Preferences.getPreferences().edit()
|
||||||
|
.putInt("autoclearcache_size", id)
|
||||||
|
.putString("autoclearcache", sizes[id])
|
||||||
|
.apply();
|
||||||
|
})
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int T4() {
|
||||||
|
return com.vtosters.lite.R.string.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
updateCacheSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ public class DockBarEditorFragment extends BaseToolbarFragment {
|
|||||||
holder.bindMovingItem(tab.iconID, tab.titleID);
|
holder.bindMovingItem(tab.iconID, tab.titleID);
|
||||||
});
|
});
|
||||||
adapter.setMinAndMaxCounts(DockBarEditorManager.MIN_SELECTED_TABS, DockBarEditorManager.MAX_SELECTED_TABS);
|
adapter.setMinAndMaxCounts(DockBarEditorManager.MIN_SELECTED_TABS, DockBarEditorManager.MAX_SELECTED_TABS);
|
||||||
|
adapter.setExceptions(
|
||||||
|
DockBarEditorManager.getTabByTag("tab_profile"),
|
||||||
|
DockBarEditorManager.getTabByTag("")/*settings*/);
|
||||||
|
|
||||||
var recyclerView = new RecyclerView(requireContext());
|
var recyclerView = new RecyclerView(requireContext());
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
|
|||||||
@@ -34,7 +34,9 @@ public class InterfaceFragment extends TrackedMaterialPreferenceToolbarFragment
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
findPreference("superapp").setOnPreferenceClickListener(preference -> {
|
var superapp = findPreference("superapp");
|
||||||
|
superapp.setVisible(Preferences.milkshake());
|
||||||
|
superapp.setOnPreferenceClickListener(preference -> {
|
||||||
LifecycleUtils.restartApplicationWithTimer();
|
LifecycleUtils.restartApplicationWithTimer();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -70,6 +72,8 @@ public class InterfaceFragment extends TrackedMaterialPreferenceToolbarFragment
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
findPreference("friendsblock").setVisible(Preferences.milkshake());
|
||||||
|
|
||||||
if (Preferences.getPreferences().getInt("pic_rounding", 0) == 0) {
|
if (Preferences.getPreferences().getInt("pic_rounding", 0) == 0) {
|
||||||
findPreference("customrounding").setSummary(requireContext().getString(R.string.disabled));
|
findPreference("customrounding").setSummary(requireContext().getString(R.string.disabled));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import okhttp3.Request;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import ru.vtosters.hooks.other.Preferences;
|
import ru.vtosters.hooks.other.Preferences;
|
||||||
import ru.vtosters.hooks.other.ThemesUtils;
|
import ru.vtosters.hooks.other.ThemesUtils;
|
||||||
|
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||||
import ru.vtosters.lite.downloaders.AudioDownloader;
|
import ru.vtosters.lite.downloaders.AudioDownloader;
|
||||||
import ru.vtosters.lite.downloaders.VideoDownloader;
|
import ru.vtosters.lite.downloaders.VideoDownloader;
|
||||||
import ru.vtosters.lite.music.LastFMScrobbler;
|
import ru.vtosters.lite.music.LastFMScrobbler;
|
||||||
@@ -29,8 +30,8 @@ import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
|||||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||||
|
import ru.vtosters.lite.utils.SearchEngine;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
@@ -133,26 +134,26 @@ public class MediaFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
});
|
});
|
||||||
|
|
||||||
findPreference("select_photo_search_engine").setOnPreferenceClickListener(preference -> {
|
findPreference("select_photo_search_engine").setOnPreferenceClickListener(preference -> {
|
||||||
var deficon = ThemesUtils.recolorDrawable(AndroidUtils.getResources().getDrawable(R.drawable.ic_picture_outline_28));
|
var items = new ImagineArrayAdapter.ImagineArrayAdapterItem[SearchEngine.values().length + 1];
|
||||||
var choiceicon = ThemesUtils.recolorDrawable(AndroidUtils.getResources().getDrawable(R.drawable.link_outline_28));
|
items[0] = new ImagineArrayAdapter.ImagineArrayAdapterItem(
|
||||||
|
ThemesUtils.recolorDrawable(AndroidUtils.getResources().getDrawable(R.drawable.link_outline_28)),
|
||||||
|
AndroidUtils.getString("by_choice"));
|
||||||
|
for (int i = 0; i < SearchEngine.values().length; ++i) {
|
||||||
|
var engine = SearchEngine.values()[i];
|
||||||
|
items[i + 1] = engine.mIconRes != R.drawable.ic_picture_outline_28
|
||||||
|
? new ImagineArrayAdapter.ImagineArrayAdapterItem(engine.mIconRes, engine.mTitle)
|
||||||
|
: new ImagineArrayAdapter.ImagineArrayAdapterItem(
|
||||||
|
ThemesUtils.recolorDrawable(AndroidUtils.getResources().getDrawable(R.drawable.ic_picture_outline_28)),
|
||||||
|
engine.mTitle);
|
||||||
|
}
|
||||||
|
|
||||||
var items = Arrays.asList(
|
var adapter = new ImagineArrayAdapter(requireContext(), Arrays.asList(items));
|
||||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(choiceicon, AndroidUtils.getString("by_choice")),
|
adapter.setSelected(SearchEngine.getDefaultSearchEngine() + 1);
|
||||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.yandex, "Yandex"),
|
|
||||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.google, "Google"),
|
|
||||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.microsoft, "Bing"),
|
|
||||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(deficon, "TraceMoe"),
|
|
||||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(deficon, "Ascii2d"),
|
|
||||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(deficon, "Saucenao")
|
|
||||||
);
|
|
||||||
|
|
||||||
var adapter = new ImagineArrayAdapter(requireContext(), items);
|
|
||||||
adapter.setSelected(Preferences.getPreferences().getInt("search_engine", 0));
|
|
||||||
|
|
||||||
new VkAlertDialog.Builder(getActivity())
|
new VkAlertDialog.Builder(getActivity())
|
||||||
.setAdapter(adapter, (dialog, which) -> {
|
.setAdapter(adapter, (di, i) -> {
|
||||||
Preferences.getPreferences().edit().putInt("search_engine", which).apply();
|
SearchEngine.setDefaultSearchEngine(i != 0 ? i - 1 : -1);
|
||||||
dialog.cancel();
|
di.cancel();
|
||||||
})
|
})
|
||||||
.show();
|
.show();
|
||||||
return true;
|
return true;
|
||||||
@@ -239,32 +240,26 @@ public class MediaFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void deleteVideoHistory() {
|
public void deleteVideoHistory() {
|
||||||
Thread thread = new Thread(() -> {
|
VTExecutors.getIoExecutor().execute(() -> {
|
||||||
|
var request = new Request.a()
|
||||||
|
.b("https://" + ProxyUtils.getApi() + "/method/" + "video.clearViewingHistoryRecords" + "?https=1" + "&access_token=" + AccountManagerUtils.getUserToken() + "&v=5.119")
|
||||||
|
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"))
|
||||||
|
.a();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var request = new Request.a()
|
var response = new JSONObject(new OkHttpClient().a(request).execute().a().g());
|
||||||
.b("https://" + ProxyUtils.getApi() + "/method/" + "video.clearViewingHistoryRecords" + "?https=1" + "&access_token=" + AccountManagerUtils.getUserToken() + "&v=5.119")
|
|
||||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"))
|
|
||||||
.a();
|
|
||||||
|
|
||||||
try {
|
if (response.optInt("response") == 1) {
|
||||||
var response = new JSONObject(new OkHttpClient().a(request).execute().a().g());
|
requireActivity().runOnUiThread(() -> AndroidUtils.sendToast(requireContext().getString(R.string.video_history_cleaned)));
|
||||||
|
} else {
|
||||||
if (response.optInt("response") == 1) {
|
requireActivity().runOnUiThread(() -> AndroidUtils.sendToast(requireContext().getString(R.string.delete_video_history_error)));
|
||||||
requireActivity().runOnUiThread(() -> AndroidUtils.sendToast(requireContext().getString(R.string.video_history_cleaned)));
|
|
||||||
} else {
|
|
||||||
requireActivity().runOnUiThread(() -> AndroidUtils.sendToast(requireContext().getString(R.string.delete_video_history_error)));
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.d("VideoHistory", response.toString());
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.d("VideoHistory", response.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
thread.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteVideoHistoryDialog(Context context) {
|
private void deleteVideoHistoryDialog(Context context) {
|
||||||
|
|||||||
@@ -1,35 +1,16 @@
|
|||||||
package ru.vtosters.lite.ui.fragments;
|
package ru.vtosters.lite.ui.fragments;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.*;
|
import android.content.*;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.webkit.WebView;
|
|
||||||
import android.widget.RadioButton;
|
|
||||||
import android.widget.RadioGroup;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import androidx.appcompat.view.ContextThemeWrapper;
|
|
||||||
import b.h.g.m.FileUtils;
|
|
||||||
import com.vk.auth.api.VKAccount;
|
import com.vk.auth.api.VKAccount;
|
||||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
|
||||||
import com.vk.core.util.ToastUtils;
|
import com.vk.core.util.ToastUtils;
|
||||||
import com.vk.im.engine.ImEngine1;
|
|
||||||
import com.vk.im.engine.ImEngineExt;
|
|
||||||
import com.vk.im.ui.providers.audiomsg.ImAudioMsgPlayerProvider;
|
|
||||||
import com.vk.im.ui.providers.audiomsg.PlayerActionSources;
|
|
||||||
import com.vk.imageloader.VKImageLoader;
|
|
||||||
import com.vk.media.player.cache.AutoPlayCacheHolder;
|
|
||||||
import com.vk.mediastore.MediaStorage;
|
|
||||||
import com.vk.pushes.PushSubscriber;
|
import com.vk.pushes.PushSubscriber;
|
||||||
import com.vk.stickers.Stickers;
|
|
||||||
import com.vtosters.lite.R;
|
import com.vtosters.lite.R;
|
||||||
import com.vtosters.lite.auth.VKAccountManager;
|
import com.vtosters.lite.auth.VKAccountManager;
|
||||||
import com.vtosters.lite.im.ImEngineProvider;
|
|
||||||
import ru.vtosters.hooks.GmsHook;
|
import ru.vtosters.hooks.GmsHook;
|
||||||
import ru.vtosters.hooks.SwitchHook;
|
|
||||||
import ru.vtosters.hooks.other.Preferences;
|
import ru.vtosters.hooks.other.Preferences;
|
||||||
import ru.vtosters.hooks.other.ThemesUtils;
|
|
||||||
import ru.vtosters.lite.deviceinfo.DeviceInfoCollector;
|
import ru.vtosters.lite.deviceinfo.DeviceInfoCollector;
|
||||||
import ru.vtosters.lite.ssfs.UsersList;
|
import ru.vtosters.lite.ssfs.UsersList;
|
||||||
import ru.vtosters.lite.ui.activities.VKAdminTokenActivity;
|
import ru.vtosters.lite.ui.activities.VKAdminTokenActivity;
|
||||||
@@ -111,11 +92,6 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
findPreference("clearcache").setOnPreferenceClickListener(preference -> {
|
|
||||||
cacheCleanDialog();
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
findPreference("copyownlink").setOnPreferenceClickListener(preference -> {
|
findPreference("copyownlink").setOnPreferenceClickListener(preference -> {
|
||||||
copyText("https://vk.com/id" + AccountManagerUtils.getUserId());
|
copyText("https://vk.com/id" + AccountManagerUtils.getUserId());
|
||||||
ToastUtils.a(requireContext().getString(R.string.link_copied));
|
ToastUtils.a(requireContext().getString(R.string.link_copied));
|
||||||
@@ -127,11 +103,6 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
findPreference("autoclearcache").setOnPreferenceClickListener(preference -> {
|
|
||||||
cacheAutoCleanDialog();
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
findPreference("datasettings").setOnPreferenceClickListener(preference -> {
|
findPreference("datasettings").setOnPreferenceClickListener(preference -> {
|
||||||
NavigatorUtils.switchFragment(requireContext(), DataSettingsFragment.class);
|
NavigatorUtils.switchFragment(requireContext(), DataSettingsFragment.class);
|
||||||
return true;
|
return true;
|
||||||
@@ -146,19 +117,6 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
var pref = Preferences.getPreferences().getString("autoclearcache", "Default");
|
|
||||||
switch (pref) {
|
|
||||||
case "Default" ->
|
|
||||||
findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_disabled));
|
|
||||||
case "100mb" ->
|
|
||||||
findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_100mb));
|
|
||||||
case "500mb" ->
|
|
||||||
findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_500mb));
|
|
||||||
case "1gb" -> findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_1gb));
|
|
||||||
case "2gb" -> findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_2gb));
|
|
||||||
case "5gb" -> findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_5gb));
|
|
||||||
}
|
|
||||||
|
|
||||||
var vkAdminTokenPref = findPreference("vk_admin_token");
|
var vkAdminTokenPref = findPreference("vk_admin_token");
|
||||||
vkAdminTokenPref.setVisible(Preferences.getPreferences().getBoolean("new_music_downloading_way", false));
|
vkAdminTokenPref.setVisible(Preferences.getPreferences().getBoolean("new_music_downloading_way", false));
|
||||||
if (vkAdminTokenPref.isVisible()) {
|
if (vkAdminTokenPref.isVisible()) {
|
||||||
@@ -170,93 +128,6 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint({"CommitPrefEdits", "SetTextI18n"})
|
|
||||||
private void cacheAutoCleanDialog() {
|
|
||||||
String[] cacheText = {null, "100 MB", "500 MB", "1 GB", "2 GB", "5 GB"};
|
|
||||||
|
|
||||||
var val = Preferences.getPreferences().getInt("autoclearcache_size", 0);
|
|
||||||
RadioGroup rg = new RadioGroup(getContext());
|
|
||||||
|
|
||||||
rg.setPadding(AndroidUtils.dp2px(18f), AndroidUtils.dp2px(12f), AndroidUtils.dp2px(18f), 0);
|
|
||||||
|
|
||||||
for (int item = 0; item <= 5; item++) {
|
|
||||||
RadioButton rb = new RadioButton(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
|
||||||
SwitchHook.setCompoundButton(rb);
|
|
||||||
rg.addView(rb);
|
|
||||||
rb.setId(item);
|
|
||||||
rb.setTextSize(TypedValue.COMPLEX_UNIT_PX, AndroidUtils.dp2px(14f));
|
|
||||||
|
|
||||||
var text = cacheText[item];
|
|
||||||
rb.setText(text != null ? text : AndroidUtils.getString("autoclearcachedisabled"));
|
|
||||||
|
|
||||||
rb.setTextColor(ThemesUtils.getTextAttr());
|
|
||||||
rb.setChecked(val == item);
|
|
||||||
}
|
|
||||||
|
|
||||||
new VkAlertDialog.Builder(getContext())
|
|
||||||
.setTitle(requireContext().getString(R.string.cache_clean_title))
|
|
||||||
.setMessage(requireContext().getString(R.string.cache_select_size))
|
|
||||||
.setCancelable(true)
|
|
||||||
.setNegativeButton(requireContext().getString(R.string.cancel), null)
|
|
||||||
.setView(rg)
|
|
||||||
.setPositiveButton(requireContext().getString(R.string.save), (dialog, which) -> {
|
|
||||||
var sizes = new String[]{"Default", "100mb", "500mb", "1gb", "2gb", "5gb"};
|
|
||||||
var id = rg.getCheckedRadioButtonId();
|
|
||||||
Preferences.getPreferences().edit()
|
|
||||||
.putInt("autoclearcache_size", id)
|
|
||||||
.putString("autoclearcache", sizes[id])
|
|
||||||
.apply();
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cacheCleanDialog() {
|
|
||||||
new VkAlertDialog.Builder(getContext())
|
|
||||||
.setTitle(requireContext().getString(R.string.select_which_clean))
|
|
||||||
.setItems(AndroidUtils.getArray(R.array.cache_cleaner), (dialog, which) -> {
|
|
||||||
switch (which) {
|
|
||||||
case 0 -> {
|
|
||||||
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
|
||||||
prefs2.edit().clear().commit();
|
|
||||||
clearWebViewCache();
|
|
||||||
VKImageLoader.e();
|
|
||||||
ImEngineProvider.b().a();
|
|
||||||
ImAudioMsgPlayerProvider.b().e(PlayerActionSources.a);
|
|
||||||
ImAudioMsgPlayerProvider.b().d(PlayerActionSources.a);
|
|
||||||
FileUtils.l();
|
|
||||||
Stickers.l.c();
|
|
||||||
ImEngineExt.a(ImEngine1.a());
|
|
||||||
AutoPlayCacheHolder.d.a();
|
|
||||||
MediaStorage.a();
|
|
||||||
}
|
|
||||||
case 1 -> {
|
|
||||||
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
|
||||||
prefs2.edit().clear().commit();
|
|
||||||
Stickers.l.c();
|
|
||||||
}
|
|
||||||
case 2 -> {
|
|
||||||
VKImageLoader.e();
|
|
||||||
ImEngineExt.a(ImEngine1.a());
|
|
||||||
}
|
|
||||||
case 3 -> {
|
|
||||||
AutoPlayCacheHolder.d.a();
|
|
||||||
MediaStorage.a();
|
|
||||||
}
|
|
||||||
case 4 -> {
|
|
||||||
ImEngineProvider.b().a();
|
|
||||||
ImAudioMsgPlayerProvider.b().e(PlayerActionSources.a);
|
|
||||||
ImAudioMsgPlayerProvider.b().d(PlayerActionSources.a);
|
|
||||||
}
|
|
||||||
case 5 -> clearWebViewCache();
|
|
||||||
}
|
|
||||||
Toast.makeText(getContext(), requireContext().getString(R.string.cache_cleaned), Toast.LENGTH_SHORT).show();
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearWebViewCache() {
|
|
||||||
new WebView(requireContext()).clearCache(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void copyText(String src) {
|
private void copyText(String src) {
|
||||||
var manager = (ClipboardManager) requireContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
var manager = (ClipboardManager) requireContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
|
|||||||
@@ -43,15 +43,15 @@ public class ThemesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
|
|
||||||
findPreference("systememoji").setSummary(AndroidUtils.getGlobalContext().getString(R.string.systememojisum) + " \uD83D\uDE00\uD83D\uDE01\uD83E\uDD11\uD83E\uDD75\uD83D\uDC4D");
|
findPreference("systememoji").setSummary(AndroidUtils.getGlobalContext().getString(R.string.systememojisum) + " \uD83D\uDE00\uD83D\uDE01\uD83E\uDD11\uD83E\uDD75\uD83D\uDC4D");
|
||||||
|
|
||||||
findPreference("useNewColorEngine").setVisible(Preferences.dev());
|
|
||||||
|
|
||||||
var invalidateThemeCache = findPreference("invalidate_theme_cache");
|
var invalidateThemeCache = findPreference("invalidate_theme_cache");
|
||||||
if (ThemesUtils.getReservedAccent() != Color.TRANSPARENT && Preferences.dev() && ThemesUtils.useNewColorEngine())
|
if (ThemesUtils.getReservedAccent() != Color.TRANSPARENT && Preferences.dev()) {
|
||||||
invalidateThemeCache.setOnPreferenceClickListener(preference -> {
|
invalidateThemeCache.setOnPreferenceClickListener(preference -> {
|
||||||
setAccentColor(ThemesUtils.getReservedAccent());
|
setAccentColor(ThemesUtils.getReservedAccent());
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
else invalidateThemeCache.setVisible(false);
|
} else {
|
||||||
|
invalidateThemeCache.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
var navBarPreference = findPreference("navbar");
|
var navBarPreference = findPreference("navbar");
|
||||||
navBarPreference.setOnPreferenceClickListener(preference -> {
|
navBarPreference.setOnPreferenceClickListener(preference -> {
|
||||||
@@ -156,12 +156,8 @@ public class ThemesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.reset, (dialog, which) -> {
|
.setNegativeButton(R.string.reset, (dialog, which) -> {
|
||||||
if (ThemesUtils.useNewColorEngine()) {
|
ThemesManager.deleteModification();
|
||||||
ThemesManager.deleteModification();
|
ThemesUtils.reserveAccentColor(Color.TRANSPARENT, false);
|
||||||
ThemesUtils.reserveAccentColor(Color.TRANSPARENT, false);
|
|
||||||
} else {
|
|
||||||
ThemesUtils.setCustomAccentColor(0, false);
|
|
||||||
}
|
|
||||||
restart();
|
restart();
|
||||||
})
|
})
|
||||||
.setPositiveButton(R.string.cancel, null)
|
.setPositiveButton(R.string.cancel, null)
|
||||||
@@ -207,35 +203,29 @@ public class ThemesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setAccentColor(int color) {
|
void setAccentColor(int color) {
|
||||||
if (ThemesUtils.useNewColorEngine()) {
|
final VKProgressDialog dialog = new VKProgressDialog(requireContext());
|
||||||
final VKProgressDialog dialog = new VKProgressDialog(requireContext());
|
dialog.setCancelable(false);
|
||||||
dialog.setCancelable(false);
|
dialog.setMessage(AndroidUtils.getString("applying_accent") + "...");
|
||||||
dialog.setMessage(AndroidUtils.getString("applying_accent") + "...");
|
dialog.show();
|
||||||
dialog.show();
|
|
||||||
|
|
||||||
VTExecutors.getIoExecutor().execute(() -> {
|
VTExecutors.getIoExecutor().execute(() -> {
|
||||||
try {
|
try {
|
||||||
ThemesUtils.reserveAccentColor(color, true);
|
ThemesUtils.reserveAccentColor(color, true);
|
||||||
ThemesManager.generateModApk(color);
|
ThemesManager.generateModApk(color);
|
||||||
requireActivity().runOnUiThread(this::restart);
|
requireActivity().runOnUiThread(this::restart);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.e("ThemesFragment", e.getMessage());
|
Log.e("ThemesFragment", e.getMessage());
|
||||||
ThemesManager.deleteModification();
|
ThemesManager.deleteModification();
|
||||||
requireActivity().runOnUiThread(() -> {
|
requireActivity().runOnUiThread(() -> {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
new VkAlertDialog.Builder(requireContext())
|
new VkAlertDialog.Builder(requireContext())
|
||||||
.setTitle(AndroidUtils.getString("error"))
|
.setTitle(AndroidUtils.getString("error"))
|
||||||
.setMessage(AndroidUtils.getString("error_applying_accent") + ":\n" + e)
|
.setMessage(AndroidUtils.getString("error_applying_accent") + ":\n" + e)
|
||||||
.setPositiveButton("OK", null)
|
.setPositiveButton("OK", null)
|
||||||
.show();
|
.show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
ThemesUtils.setCustomAccentColor(color, false);
|
|
||||||
ThemesCore.setThemedColors(color);
|
|
||||||
restart();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void restart() {
|
void restart() {
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
package ru.vtosters.lite.ui.fragments;
|
package ru.vtosters.lite.ui.fragments;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import com.aefyr.tsg.g2.TelegramStickersPack;
|
|
||||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||||
import com.vk.about.AboutAppFragment;
|
import com.vk.about.AboutAppFragment;
|
||||||
import com.vk.balance.BalanceFragment;
|
import com.vk.balance.BalanceFragment;
|
||||||
@@ -33,6 +35,7 @@ import ru.vtosters.hooks.other.ThemesUtils;
|
|||||||
import ru.vtosters.hooks.ui.SystemThemeChangerHook;
|
import ru.vtosters.hooks.ui.SystemThemeChangerHook;
|
||||||
import ru.vtosters.lite.BuildConfig;
|
import ru.vtosters.lite.BuildConfig;
|
||||||
import ru.vtosters.lite.concurrent.VTExecutors;
|
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||||
|
import ru.vtosters.lite.deviceinfo.OEMDetector;
|
||||||
import ru.vtosters.lite.ssfs.Utils;
|
import ru.vtosters.lite.ssfs.Utils;
|
||||||
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
||||||
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
||||||
@@ -41,7 +44,19 @@ import ru.vtosters.lite.utils.*;
|
|||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class VTSettings extends TrackedMaterialPreferenceToolbarFragment implements TelegramStickersService.StickersEventsListener {
|
public class VTSettings extends TrackedMaterialPreferenceToolbarFragment {
|
||||||
|
|
||||||
|
final static public String ACTION_INVALIDATE_TGS_COUNT="com.vtosters.lite.intent.action.INVALIDATE_TGS_COUNT";
|
||||||
|
|
||||||
|
final BroadcastReceiver mTgsReceiver=new BroadcastReceiver()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent)
|
||||||
|
{
|
||||||
|
if(ACTION_INVALIDATE_TGS_COUNT.equals(intent.getAction()))
|
||||||
|
findPreference("tgs_stickers").setSummary(getTGSsumm());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static String getValAsString(@StringRes int strRes, Boolean value) {
|
public static String getValAsString(@StringRes int strRes, Boolean value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
@@ -75,42 +90,12 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
|||||||
ThemesUtils.setTheme(isDarkTheme ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), requireActivity(), true);
|
ThemesUtils.setTheme(isDarkTheme ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), requireActivity(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPackAdded(TelegramStickersPack pack, int atIndex) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPackRemoved(TelegramStickersPack pack, int atIndex) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPackChanged(TelegramStickersPack pack, int atIndex) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPackDownloadError(TelegramStickersPack pack, Exception error) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivePacksListChanged() {
|
|
||||||
findPreference("tgs_stickers").setSummary(getTGSsumm());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInactivePacksListChanged() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle bundle) {
|
public void onCreate(Bundle bundle) {
|
||||||
super.onCreate(bundle);
|
super.onCreate(bundle);
|
||||||
|
|
||||||
TelegramStickersService.getInstance(requireContext()).addStickersEventsListener(this);
|
requireContext().registerReceiver(mTgsReceiver,new IntentFilter(ACTION_INVALIDATE_TGS_COUNT));
|
||||||
|
|
||||||
this.addPreferencesFromResource(R.xml.empty);
|
this.addPreferencesFromResource(R.xml.empty);
|
||||||
|
|
||||||
@@ -487,7 +472,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 33) {
|
if (Build.VERSION.SDK_INT >= 33 && !OEMDetector.isMIUI()) {
|
||||||
PreferenceFragmentUtils.addPreference(
|
PreferenceFragmentUtils.addPreference(
|
||||||
getPreferenceScreen(),
|
getPreferenceScreen(),
|
||||||
"",
|
"",
|
||||||
@@ -571,7 +556,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Preferences.isValidSignature() && BuildConfig.BUILD_TYPE.equals("release")) {
|
if (Preferences.isValidSignature() && !BuildConfig.BUILD_TYPE.equals("dev")) {
|
||||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), requireContext().getString(R.string.updates));
|
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), requireContext().getString(R.string.updates));
|
||||||
|
|
||||||
PreferenceFragmentUtils.addPreference(
|
PreferenceFragmentUtils.addPreference(
|
||||||
@@ -589,18 +574,14 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onDestroy()
|
||||||
super.onResume();
|
{
|
||||||
|
requireContext().unregisterReceiver(mTgsReceiver);
|
||||||
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int T4() {
|
public int T4() {
|
||||||
return R.string.notification_settings;
|
return R.string.notification_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroyView() {
|
|
||||||
super.onDestroyView();
|
|
||||||
TelegramStickersService.getInstance(requireContext()).removeStickersEventsListener(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
||||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||||
import com.vtosters.lite.R;
|
import com.vtosters.lite.R;
|
||||||
import ru.vtosters.hooks.other.ThemesUtils;
|
import ru.vtosters.hooks.other.ThemesUtils;
|
||||||
@@ -36,55 +35,58 @@ import java.io.File;
|
|||||||
public class StickersFragment extends BaseToolbarFragment {
|
public class StickersFragment extends BaseToolbarFragment {
|
||||||
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;
|
final static int TYPE_DIRECT = 0;
|
||||||
public int from;
|
final static int TYPE_SOCKS = 2;
|
||||||
public int to;
|
|
||||||
private TelegramStickersGrabber mGrabber;
|
TelegramStickersGrabber mGrabber;
|
||||||
private TelegramStickersService mService;
|
StickerPackAdapter mAdapter;
|
||||||
private StickerPackAdapter mAdapter;
|
boolean movePending = false;
|
||||||
private boolean movePending = false;
|
int from,to;
|
||||||
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
final BroadcastReceiver mReceiver=new BroadcastReceiver() {
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
if (intent.getAction().equals(ACTION_RELOAD)) {
|
if (!intent.getAction().equals(ACTION_RELOAD)||mAdapter==null)return;
|
||||||
if (mAdapter != null) {
|
try
|
||||||
try {
|
{
|
||||||
if (movePending) {
|
if(movePending)
|
||||||
movePending = false;
|
{
|
||||||
mAdapter.notifyItemMoved(from, to);
|
movePending=false;
|
||||||
from = -1;
|
mAdapter.notifyItemMoved(from, to);
|
||||||
to = -1;
|
from=to=-1;
|
||||||
} else {
|
|
||||||
mAdapter.notifyDataSetChanged();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else mAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{ e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreateMenu(Menu menu) {
|
protected void onCreateMenu(Menu menu)
|
||||||
MenuItem item = menu.add(0, 0, 0, "");
|
{
|
||||||
item.setIcon(ThemesUtils.recolorDrawable(AndroidUtils.getGlobalContext().getDrawable(R.drawable.ic_settings_outline_28)))
|
menu.add(0, 0, 0, "")
|
||||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
.setIcon(ThemesUtils.recolorDrawable(requireContext().getDrawable(R.drawable.ic_add_outline_28)))
|
||||||
|
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
|
menu.add(0,1,0,"")
|
||||||
|
.setIcon(R.drawable.ic_settings_outline_28)
|
||||||
|
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
super.onCreateMenu(menu);
|
super.onCreateMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem arg0) {
|
public boolean onOptionsItemSelected(MenuItem item)
|
||||||
openMenu(null);
|
{
|
||||||
|
switch (item.getItemId())
|
||||||
|
{
|
||||||
|
case 0 -> addTgsPack();
|
||||||
|
case 1 -> openMenu(null);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openMenu(String toast) {
|
private void openMenu(String toast) {
|
||||||
if (toast != null) {
|
if(toast!=null)Toast.makeText(requireContext(),toast,Toast.LENGTH_SHORT).show();
|
||||||
Toast.makeText(requireContext(), toast, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
NavigatorUtils.switchFragment(requireContext(), StickersPreferencesFragment.class);
|
NavigatorUtils.switchFragment(requireContext(), StickersPreferencesFragment.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,41 +95,29 @@ public class StickersFragment extends BaseToolbarFragment {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
requireContext().registerReceiver(mReceiver, new IntentFilter(ACTION_RELOAD));
|
requireContext().registerReceiver(mReceiver, new IntentFilter(ACTION_RELOAD));
|
||||||
|
|
||||||
mGrabber = new TelegramStickersGrabber(TGPref.getTGBotKey());
|
mGrabber=new TelegramStickersGrabber(TGPref.getTGBotKey());
|
||||||
mService = TelegramStickersService.getInstance(requireContext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateContent(@NonNull LayoutInflater inflater, @Nullable Bundle bundle) {
|
public View onCreateContent(@NonNull LayoutInflater inflater, @Nullable Bundle bundle) {
|
||||||
setTitle(R.string.vtltgs);
|
setTitle(R.string.vtltgs);
|
||||||
|
|
||||||
FrameLayout layout = new FrameLayout(requireContext());
|
final var container=new FrameLayout(requireContext());
|
||||||
|
final var recycler=new RecyclerView(requireContext());
|
||||||
|
|
||||||
mAdapter = new StickerPackAdapter();
|
mAdapter=new StickerPackAdapter();
|
||||||
RecyclerView mRecycler = new RecyclerView(requireContext());
|
recycler.setAdapter(mAdapter);
|
||||||
|
|
||||||
StickerTouchHelperCallback callback = new StickerTouchHelperCallback(mAdapter);
|
final var callback=new StickerTouchHelperCallback(mAdapter);
|
||||||
ItemTouchHelper touchHelper = new ItemTouchHelper(callback);
|
final var touchHelper=new ItemTouchHelper(callback);
|
||||||
touchHelper.attachToRecyclerView(mRecycler);
|
touchHelper.attachToRecyclerView(recycler);
|
||||||
|
|
||||||
mRecycler.setAdapter(mAdapter);
|
recycler.setLayoutManager(new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL));
|
||||||
mRecycler.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
|
container.addView(recycler,new ViewGroup.LayoutParams(-1,-1));
|
||||||
layout.addView(mRecycler, new ViewGroup.LayoutParams(-1, -1));
|
|
||||||
|
|
||||||
FloatingActionButton mAddStickerPack = new FloatingActionButton(requireContext());
|
return container;
|
||||||
mAddStickerPack.setImageResource(R.drawable.ic_add_24);
|
|
||||||
mAddStickerPack.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
|
||||||
mAddStickerPack.setOnClickListener(v2 -> fabClick());
|
|
||||||
|
|
||||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(-2, -2);
|
|
||||||
params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
|
|
||||||
params.setMargins(0, 0, 0, AndroidUtils.dp2px(12f));
|
|
||||||
layout.addView(mAddStickerPack, params);
|
|
||||||
|
|
||||||
return layout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View arg0, Bundle arg1) {
|
public void onViewCreated(View arg0, Bundle arg1) {
|
||||||
super.onViewCreated(arg0, arg1);
|
super.onViewCreated(arg0, arg1);
|
||||||
@@ -139,70 +129,79 @@ public class StickersFragment extends BaseToolbarFragment {
|
|||||||
requireContext().unregisterReceiver(mReceiver);
|
requireContext().unregisterReceiver(mReceiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fabClick() {
|
private void addTgsPack()
|
||||||
int method = TGPref.getTGConnectMethod();
|
{
|
||||||
if (method == -1) {
|
final var method=TGPref.getTGConnectMethod();
|
||||||
openMenu(requireContext().getString(R.string.stickersconnection));
|
if(method!=-1)
|
||||||
return;
|
{
|
||||||
}
|
initGrabber();
|
||||||
|
switch(method)
|
||||||
|
{
|
||||||
|
case TYPE_SOCKS ->
|
||||||
|
{
|
||||||
|
if (TGPref.getTGProxyIP()==null)openMenu(requireContext().getString(R.string.stickersproxy1));
|
||||||
|
}
|
||||||
|
case TYPE_DIRECT ->
|
||||||
|
{
|
||||||
|
initGrabber();
|
||||||
|
final Runnable lambda = () ->
|
||||||
|
{
|
||||||
|
final var container=new LinearLayout(requireContext());
|
||||||
|
|
||||||
initGrabber();
|
final var input=new EditText(requireContext());
|
||||||
if (method == TYPE_SOCKS) {
|
final var inputLP = new ViewGroup.MarginLayoutParams(-1,-2);
|
||||||
if (TGPref.getTGProxyIP() == null) {
|
inputLP.setMargins(
|
||||||
openMenu(requireContext().getString(R.string.stickersproxy1));
|
AndroidUtils.dp2px(24.f),
|
||||||
|
0,
|
||||||
|
AndroidUtils.dp2px(24.f),
|
||||||
|
0);
|
||||||
|
container.addView(input,inputLP);
|
||||||
|
|
||||||
|
new VkAlertDialog.Builder(requireContext())
|
||||||
|
.setTitle(R.string.stickershelp1)
|
||||||
|
// .setMessage(R.string.stickershelp2)
|
||||||
|
.setView(container)
|
||||||
|
.setPositiveButton(android.R.string.ok, (dialog, which) ->
|
||||||
|
{
|
||||||
|
var packId=input.getText().toString();
|
||||||
|
if (packId.startsWith("https://"))
|
||||||
|
packId=packId.substring(packId.lastIndexOf('/')+1);
|
||||||
|
TelegramStickersService.getInstance(requireContext())
|
||||||
|
.requestPackDownload(
|
||||||
|
packId,
|
||||||
|
new File(requireContext().getFilesDir(),"VT-Stickers/"+packId));
|
||||||
|
})
|
||||||
|
.setNeutralButton(android.R.string.cancel,(dialog, which) -> dialog.dismiss())
|
||||||
|
.show();
|
||||||
|
};
|
||||||
|
|
||||||
|
if(TGPref.getTGBotKey()==null)enterBotKey(() -> checkApiKey(lambda));
|
||||||
|
else checkApiKey(lambda);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (method == TYPE_DIRECT) {
|
|
||||||
final Runnable callback = () -> {
|
|
||||||
LinearLayout linearLayout = new LinearLayout(requireContext());
|
|
||||||
|
|
||||||
final EditText editText = new EditText(requireContext());
|
|
||||||
editText.setHintTextColor(ThemesUtils.getSTextAttr());
|
|
||||||
editText.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
|
||||||
|
|
||||||
linearLayout.addView(editText);
|
|
||||||
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
|
||||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) editText.getLayoutParams());
|
|
||||||
margin.setMargins(AndroidUtils.dp2px(24f), 0, AndroidUtils.dp2px(24f), 0);
|
|
||||||
editText.setLayoutParams(margin);
|
|
||||||
|
|
||||||
new VkAlertDialog.Builder(requireContext())
|
|
||||||
.setTitle(requireContext().getString(R.string.stickershelp1))
|
|
||||||
.setMessage(requireContext().getString(R.string.stickershelp2))
|
|
||||||
.setView(linearLayout)
|
|
||||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
|
||||||
String pack = editText.getText().toString();
|
|
||||||
if (!pack.startsWith("https://")) {
|
|
||||||
pack = "https://" + pack;
|
|
||||||
} else if (!pack.contains("addstickers")) {
|
|
||||||
AndroidUtils.sendToast(AndroidUtils.getString("invalid_pack_link"));
|
|
||||||
}
|
|
||||||
pack = parsePack(pack);
|
|
||||||
mService.requestPackDownload(pack, new File(requireContext().getFilesDir(), new File("VT-Stickers", pack).getAbsolutePath()));
|
|
||||||
})
|
|
||||||
.setNeutralButton(android.R.string.cancel,
|
|
||||||
(dialog, which) -> dialog.dismiss()
|
|
||||||
)
|
|
||||||
.show();
|
|
||||||
};
|
|
||||||
if (TGPref.getTGBotKey() == null) enterBotKey(() -> checkApiKey(callback));
|
|
||||||
else checkApiKey(callback);
|
|
||||||
}
|
}
|
||||||
|
else openMenu(requireContext().getString(R.string.stickersconnection));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initGrabber() {
|
private void initGrabber() {
|
||||||
int method = TGPref.getTGConnectMethod();
|
switch(TGPref.getTGConnectMethod())
|
||||||
if (method == TYPE_DIRECT) {
|
{
|
||||||
TelegramStickersGrabber.USE_PROXY = false;
|
case TYPE_DIRECT ->
|
||||||
mGrabber.resetProxy();
|
{
|
||||||
} else if (method == TYPE_SOCKS) {
|
TelegramStickersGrabber.USE_PROXY=false;
|
||||||
if (TGPref.getTGProxyIP() != null) {
|
mGrabber.resetProxy();
|
||||||
TelegramStickersGrabber.USE_PROXY = true;
|
}
|
||||||
TelegramStickersGrabber.PROXY_IP = TGPref.getTGProxyIP();
|
case TYPE_SOCKS ->
|
||||||
TelegramStickersGrabber.PROXY_PORT = TGPref.getTGProxyPort();
|
{
|
||||||
if (TGPref.isTGProxyPassEnabled()) {
|
if(TGPref.getTGProxyIP()==null)break;
|
||||||
TelegramStickersGrabber.HAS_PASS = true;
|
TelegramStickersGrabber.USE_PROXY=true;
|
||||||
TelegramStickersGrabber.PROXY_USER = TGPref.getTGProxyUser();
|
TelegramStickersGrabber.PROXY_IP=TGPref.getTGProxyIP();
|
||||||
TelegramStickersGrabber.PROXY_PASS = TGPref.getTGProxyPass();
|
TelegramStickersGrabber.PROXY_PORT=TGPref.getTGProxyPort();
|
||||||
|
if (TGPref.isTGProxyPassEnabled())
|
||||||
|
{
|
||||||
|
TelegramStickersGrabber.HAS_PASS=true;
|
||||||
|
TelegramStickersGrabber.PROXY_USER=TGPref.getTGProxyUser();
|
||||||
|
TelegramStickersGrabber.PROXY_PASS=TGPref.getTGProxyPass();
|
||||||
}
|
}
|
||||||
mGrabber.enableProxy();
|
mGrabber.enableProxy();
|
||||||
}
|
}
|
||||||
@@ -210,42 +209,42 @@ public class StickersFragment extends BaseToolbarFragment {
|
|||||||
TelegramStickersGrabber.updateURLs();
|
TelegramStickersGrabber.updateURLs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enterBotKey(Runnable r) {
|
private void enterBotKey(Runnable callback)
|
||||||
LinearLayout linearLayout = new LinearLayout(requireContext());
|
{
|
||||||
|
final var container=new LinearLayout(requireContext());
|
||||||
|
|
||||||
final EditText editText = new EditText(requireContext());
|
final var input=new EditText(requireContext());
|
||||||
editText.setHintTextColor(ThemesUtils.getSTextAttr());
|
final var inputLP=new ViewGroup.MarginLayoutParams(-1,-2);
|
||||||
editText.setBackgroundTintList(ThemesUtils.getAccenedColorStateList());
|
inputLP.setMargins(
|
||||||
|
AndroidUtils.dp2px(24.f),
|
||||||
linearLayout.addView(editText);
|
0,
|
||||||
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
AndroidUtils.dp2px(24.f),
|
||||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) editText.getLayoutParams());
|
0);
|
||||||
margin.setMargins(AndroidUtils.dp2px(24f), 0, AndroidUtils.dp2px(24f), 0);
|
container.addView(input,inputLP);
|
||||||
editText.setLayoutParams(margin);
|
|
||||||
|
|
||||||
new VkAlertDialog.Builder(requireContext())
|
new VkAlertDialog.Builder(requireContext())
|
||||||
.setTitle(requireContext().getString(R.string.stickersapi5))
|
.setTitle(requireContext().getString(R.string.stickersapi5))
|
||||||
.setMessage(requireContext().getString(R.string.stickersapi6))
|
.setMessage(requireContext().getString(R.string.stickersapi6))
|
||||||
.setView(linearLayout)
|
.setView(container)
|
||||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
.setPositiveButton(android.R.string.ok,(dialog, which) ->
|
||||||
TGPref.setTGBotKey(editText.getText().toString());
|
{
|
||||||
if (r != null) r.run();
|
TGPref.setTGBotKey(input.getText().toString());
|
||||||
|
if(callback!=null)callback.run();
|
||||||
})
|
})
|
||||||
.setNegativeButton(android.R.string.cancel,
|
.setNegativeButton(android.R.string.cancel,(dialog, which) -> dialog.dismiss())
|
||||||
(dialog, which) -> dialog.dismiss()
|
|
||||||
)
|
|
||||||
.setNeutralButton(requireContext().getString(R.string.stickersapi7),
|
.setNeutralButton(requireContext().getString(R.string.stickersapi7),
|
||||||
(dialog, which) -> new VkAlertDialog.Builder(requireContext())
|
(dialog, which) ->
|
||||||
.setTitle(requireContext().getString(R.string.stickersapi8))
|
new VkAlertDialog.Builder(requireContext())
|
||||||
.setMessage(requireContext().getString(R.string.stickersapi9) +
|
.setTitle(requireContext().getString(R.string.stickersapi8))
|
||||||
requireContext().getString(R.string.stickersapi10))
|
.setMessage(requireContext().getString(R.string.stickersapi9) +
|
||||||
.setNeutralButton(AndroidUtils.getString("open_bot"), (dl, i) -> {
|
requireContext().getString(R.string.stickersapi10))
|
||||||
var intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://t.me/botfather"));
|
.setNeutralButton(AndroidUtils.getString("open_bot"),(dl, i) -> {
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
final var intent=new Intent(Intent.ACTION_VIEW,Uri.parse("https://t.me/botfather"))
|
||||||
requireActivity().startActivity(intent);
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
})
|
requireActivity().startActivity(intent);
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
})
|
||||||
.show()
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
|
.show()
|
||||||
)
|
)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
@@ -253,45 +252,39 @@ public class StickersFragment extends BaseToolbarFragment {
|
|||||||
private void checkApiKey(Runnable callback) {
|
private void checkApiKey(Runnable callback) {
|
||||||
mGrabber.setBotApiKey(TGPref.getTGBotKey());
|
mGrabber.setBotApiKey(TGPref.getTGBotKey());
|
||||||
|
|
||||||
var context = requireContext();
|
final var dialog=new ProgressDialog(requireContext());
|
||||||
|
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||||
|
dialog.setMessage(requireContext().getString(R.string.stickersapi1));
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
final ProgressDialog progressDialog = new ProgressDialog(context);
|
mGrabber.checkKey(new TelegramStickersGrabber.KeyCheckListener()
|
||||||
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
{
|
||||||
progressDialog.setMessage(requireContext().getString(R.string.stickersapi1));
|
|
||||||
progressDialog.show();
|
|
||||||
|
|
||||||
mGrabber.checkKey(new TelegramStickersGrabber.KeyCheckListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onKeyChecked(boolean ok) {
|
public void onKeyChecked(boolean ok)
|
||||||
progressDialog.dismiss();
|
{
|
||||||
if (!ok) {
|
dialog.dismiss();
|
||||||
Toast.makeText(context, requireContext().getString(R.string.stickersapi2), Toast.LENGTH_SHORT).show();
|
if (!ok)
|
||||||
|
{
|
||||||
|
Toast.makeText(requireContext(), requireContext().getString(R.string.stickersapi2),Toast.LENGTH_SHORT).show();
|
||||||
TGPref.setTGBotKey(null);
|
TGPref.setTGBotKey(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mService.setBotKey(TGPref.getTGBotKey());
|
TelegramStickersService.getInstance(requireContext())
|
||||||
|
.setBotKey(TGPref.getTGBotKey());
|
||||||
|
|
||||||
if (callback != null) callback.run();
|
if (callback!=null)callback.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNetError() {
|
public void onNetError()
|
||||||
progressDialog.dismiss();
|
{
|
||||||
new VkAlertDialog.Builder(context)
|
dialog.dismiss();
|
||||||
|
new VkAlertDialog.Builder(requireContext())
|
||||||
.setMessage(requireContext().getString(R.string.stickersapi3))
|
.setMessage(requireContext().getString(R.string.stickersapi3))
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.setPositiveButton(requireContext().getString(R.string.stickersapi4), (arg0, arg1) -> checkApiKey(callback))
|
.setPositiveButton(requireContext().getString(R.string.stickersapi4),(di,which) -> checkApiKey(callback))
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private String parsePack(String pack) {
|
|
||||||
if (pack.startsWith("https://t.me/addstickers/")) {
|
|
||||||
pack = pack.substring(25);
|
|
||||||
} else if (pack.startsWith("https://telegram.me/addstickers/")) {
|
|
||||||
pack = pack.substring(32);
|
|
||||||
}
|
|
||||||
return pack;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -31,4 +31,9 @@ public class DockBarTab {
|
|||||||
Class<?> fragmentClass) {
|
Class<?> fragmentClass) {
|
||||||
return new DockBarTab(tag, iconID, titleID, resID, fragmentClass);
|
return new DockBarTab(tag, iconID, titleID, resID, fragmentClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object arg) {
|
||||||
|
return this.id == ((DockBarTab) arg).id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,10 @@ public class SuperAppItem {
|
|||||||
public static SuperAppItem valuesOf(String type, String title) {
|
public static SuperAppItem valuesOf(String type, String title) {
|
||||||
return new SuperAppItem(type, title);
|
return new SuperAppItem(type, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object arg) {
|
||||||
|
var item = (SuperAppItem) arg;
|
||||||
|
return this.type.equals(item.type) && this.title.equals(item.title);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,16 +37,16 @@ public class AlphaView extends SliderViewBase implements ColorObserver {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Bitmap makeBitmap(int w, int h) {
|
protected Bitmap makeBitmap(int w, int h) {
|
||||||
final boolean isWide = w > h;
|
boolean isWide = w > h;
|
||||||
final int n = Math.max(w, h);
|
int n = Math.max(w, h);
|
||||||
int color = observableColor.getColor();
|
int color = observableColor.getColor();
|
||||||
int[] colors = new int[n];
|
int[] colors = new int[n];
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
float alpha = isWide ? (float) i / n : 1 - (float) i / n;
|
float alpha = isWide ? (float) i / n : 1 - (float) i / n;
|
||||||
colors[i] = color & 0xffffff | (int) (alpha * 0xff) << 24;
|
colors[i] = color & 0xffffff | (int) (alpha * 0xff) << 24;
|
||||||
}
|
}
|
||||||
final int bmpWidth = isWide ? w : 1;
|
int bmpWidth = isWide ? w : 1;
|
||||||
final int bmpHeight = isWide ? 1 : h;
|
int bmpHeight = isWide ? 1 : h;
|
||||||
return Bitmap.createBitmap(colors, bmpWidth, bmpHeight, Bitmap.Config.ARGB_8888);
|
return Bitmap.createBitmap(colors, bmpWidth, bmpHeight, Bitmap.Config.ARGB_8888);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,12 @@ class HexEdit {
|
|||||||
new HexFilter()
|
new HexFilter()
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void setUpListeners(final EditText hexEdit, final ObservableColor observableColor) {
|
public static void setUpListeners(EditText hexEdit, ObservableColor observableColor) {
|
||||||
|
|
||||||
class MultiObserver implements ColorObserver, TextWatcher {
|
class MultiObserver implements ColorObserver, TextWatcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateColor(ObservableColor observableColor) {
|
public void updateColor(ObservableColor observableColor) {
|
||||||
final String colorString = formatColor(observableColor.getColor());
|
String colorString = formatColor(observableColor.getColor());
|
||||||
// Prevent onTextChanged getting called when we update text programmatically
|
// Prevent onTextChanged getting called when we update text programmatically
|
||||||
hexEdit.removeTextChangedListener(this);
|
hexEdit.removeTextChangedListener(this);
|
||||||
hexEdit.setText(colorString);
|
hexEdit.setText(colorString);
|
||||||
@@ -57,7 +56,7 @@ class HexEdit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final MultiObserver multiObserver = new MultiObserver();
|
MultiObserver multiObserver = new MultiObserver();
|
||||||
hexEdit.addTextChangedListener(multiObserver);
|
hexEdit.addTextChangedListener(multiObserver);
|
||||||
observableColor.addObserver(multiObserver);
|
observableColor.addObserver(multiObserver);
|
||||||
setShowAlphaDigits(hexEdit, true);
|
setShowAlphaDigits(hexEdit, true);
|
||||||
@@ -71,14 +70,13 @@ class HexEdit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setShowAlphaDigits(final EditText hexEdit, boolean showAlphaDigits) {
|
public static void setShowAlphaDigits(EditText hexEdit, boolean showAlphaDigits) {
|
||||||
hexEdit.setFilters(showAlphaDigits ? withAlphaDigits : withoutAlphaDigits);
|
hexEdit.setFilters(showAlphaDigits ? withAlphaDigits : withoutAlphaDigits);
|
||||||
hexEdit.setText(hexEdit.getText()); // trigger a reformat of text
|
hexEdit.setText(hexEdit.getText()); // trigger a reformat of text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class ColorPasteLengthFilter implements InputFilter {
|
private static class ColorPasteLengthFilter implements InputFilter {
|
||||||
|
|
||||||
private static final int MAX_LENGTH = 6;
|
private static final int MAX_LENGTH = 6;
|
||||||
private static final int PASTED_LEN = 8;
|
private static final int PASTED_LEN = 8;
|
||||||
private final InputFilter sixDigitFilter = new InputFilter.LengthFilter(MAX_LENGTH);
|
private final InputFilter sixDigitFilter = new InputFilter.LengthFilter(MAX_LENGTH);
|
||||||
@@ -86,8 +84,8 @@ class HexEdit {
|
|||||||
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
|
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
|
||||||
// If 8 digits have been pasted, replacing all source, trim alpha digits.
|
// If 8 digits have been pasted, replacing all source, trim alpha digits.
|
||||||
// Otherwise standard LengthFilter behavior.
|
// Otherwise standard LengthFilter behavior.
|
||||||
final int srcLength = end - start;
|
int srcLength = end - start;
|
||||||
final int dstSelLength = dend - dstart;
|
int dstSelLength = dend - dstart;
|
||||||
if (srcLength == PASTED_LEN && dstSelLength == dest.length()) {
|
if (srcLength == PASTED_LEN && dstSelLength == dest.length()) {
|
||||||
// Discard alpha digits:
|
// Discard alpha digits:
|
||||||
return source.subSequence(PASTED_LEN - MAX_LENGTH, PASTED_LEN);
|
return source.subSequence(PASTED_LEN - MAX_LENGTH, PASTED_LEN);
|
||||||
@@ -98,7 +96,6 @@ class HexEdit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static class HexFilter implements InputFilter {
|
private static class HexFilter implements InputFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
|
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
|
||||||
boolean state = true;
|
boolean state = true;
|
||||||
|
|||||||
@@ -57,9 +57,9 @@ public class HueSatView extends SquareView implements ColorObserver {
|
|||||||
float[] hsv = new float[]{0f, 0f, 1f};
|
float[] hsv = new float[]{0f, 0f, 1f};
|
||||||
for (int y = 0; y < radiusPx; ++y) {
|
for (int y = 0; y < radiusPx; ++y) {
|
||||||
for (int x = 0; x < radiusPx; ++x) {
|
for (int x = 0; x < radiusPx; ++x) {
|
||||||
final int i = x + y * radiusPx;
|
int i = x + y * radiusPx;
|
||||||
final float sat = satForPos(x, y, radiusPx);
|
float sat = satForPos(x, y, radiusPx);
|
||||||
final float arcBleed = 2f / radiusPx; // extend curved edge pixels just outside clip area.
|
float arcBleed = 2f / radiusPx; // extend curved edge pixels just outside clip area.
|
||||||
if (sat <= 1 + arcBleed) {
|
if (sat <= 1 + arcBleed) {
|
||||||
hsv[0] = hueForPos(x, y, radiusPx);
|
hsv[0] = hueForPos(x, y, radiusPx);
|
||||||
hsv[1] = sat;
|
hsv[1] = sat;
|
||||||
@@ -71,35 +71,35 @@ public class HueSatView extends SquareView implements ColorObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static float hueForPos(float x, float y, float radiusPx) {
|
private static float hueForPos(float x, float y, float radiusPx) {
|
||||||
final double r = radiusPx - 1; // gives values 0...1 inclusive
|
double r = radiusPx - 1; // gives values 0...1 inclusive
|
||||||
final double dx = (r - x) / r;
|
double dx = (r - x) / r;
|
||||||
final double dy = (r - y) / r;
|
double dy = (r - y) / r;
|
||||||
final double angle = Math.atan2(dy, dx);
|
double angle = Math.atan2(dy, dx);
|
||||||
final double hue = 360 * angle / (Math.PI / 2);
|
double hue = 360 * angle / (Math.PI / 2);
|
||||||
return (float) hue;
|
return (float) hue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float satForPos(float x, float y, float radiusPx) {
|
private static float satForPos(float x, float y, float radiusPx) {
|
||||||
final double r = radiusPx - 1; // gives values 0...1 inclusive
|
double r = radiusPx - 1; // gives values 0...1 inclusive
|
||||||
final double dx = (r - x) / r;
|
double dx = (r - x) / r;
|
||||||
final double dy = (r - y) / r;
|
double dy = (r - y) / r;
|
||||||
final double sat = dx * dx + dy * dy; // leave it squared -- exaggerates pale colors
|
double sat = dx * dx + dy * dy; // leave it squared -- exaggerates pale colors
|
||||||
return (float) sat;
|
return (float) sat;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setPointer(PointF pointer, float hue, float sat, float radiusPx) {
|
private static void setPointer(PointF pointer, float hue, float sat, float radiusPx) {
|
||||||
final float r = radiusPx - 1; // for values 0...1 inclusive
|
float r = radiusPx - 1; // for values 0...1 inclusive
|
||||||
final double distance = r * Math.sqrt(sat);
|
double distance = r * Math.sqrt(sat);
|
||||||
final double angle = hue / 360 * Math.PI / 2;
|
double angle = hue / 360 * Math.PI / 2;
|
||||||
final double dx = distance * Math.cos(angle);
|
double dx = distance * Math.cos(angle);
|
||||||
final double dy = distance * Math.sin(angle);
|
double dy = distance * Math.sin(angle);
|
||||||
pointer.set(r - (float) dx, r - (float) dy);
|
pointer.set(r - (float) dx, r - (float) dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int optimalBitmapSize() {
|
private int optimalBitmapSize() {
|
||||||
final int scale = 2;
|
int scale = 2;
|
||||||
final int maxBitmapSize = 128;
|
int maxBitmapSize = 128;
|
||||||
final DisplayMetrics dm = getResources().getDisplayMetrics();
|
DisplayMetrics dm = getResources().getDisplayMetrics();
|
||||||
return Math.min(maxBitmapSize, Math.min(dm.widthPixels, dm.heightPixels) / scale);
|
return Math.min(maxBitmapSize, Math.min(dm.widthPixels, dm.heightPixels) / scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,9 +159,9 @@ public class HueSatView extends SquareView implements ColorObserver {
|
|||||||
private boolean clamp(PointF pointer, float x, float y, boolean rejectOutside) {
|
private boolean clamp(PointF pointer, float x, float y, boolean rejectOutside) {
|
||||||
x = Math.min(x, w);
|
x = Math.min(x, w);
|
||||||
y = Math.min(y, h);
|
y = Math.min(y, h);
|
||||||
final float dx = w - x;
|
float dx = w - x;
|
||||||
final float dy = h - y;
|
float dy = h - y;
|
||||||
final float r = (float) Math.sqrt(dx * dx + dy * dy);
|
float r = (float) Math.sqrt(dx * dx + dy * dy);
|
||||||
boolean outside = r > w;
|
boolean outside = r > w;
|
||||||
if (!outside || !rejectOutside) {
|
if (!outside || !rejectOutside) {
|
||||||
if (outside) {
|
if (outside) {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import android.view.MotionEvent;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
public abstract class SliderViewBase extends View {
|
public abstract class SliderViewBase extends View {
|
||||||
|
|
||||||
private final Paint borderPaint;
|
private final Paint borderPaint;
|
||||||
private final Paint checkerPaint;
|
private final Paint checkerPaint;
|
||||||
private final Rect viewRect = new Rect();
|
private final Rect viewRect = new Rect();
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ class SquareView extends View {
|
|||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
// Constrain to square
|
// Constrain to square
|
||||||
final int w = MeasureSpec.getSize(widthMeasureSpec);
|
int w = MeasureSpec.getSize(widthMeasureSpec);
|
||||||
final int h = MeasureSpec.getSize(heightMeasureSpec);
|
int h = MeasureSpec.getSize(heightMeasureSpec);
|
||||||
final int modeW = MeasureSpec.getMode(widthMeasureSpec);
|
int modeW = MeasureSpec.getMode(widthMeasureSpec);
|
||||||
final int modeH = MeasureSpec.getMode(heightMeasureSpec);
|
int modeH = MeasureSpec.getMode(heightMeasureSpec);
|
||||||
int size = minSizePx;
|
int size = minSizePx;
|
||||||
if (modeW == MeasureSpec.UNSPECIFIED) {
|
if (modeW == MeasureSpec.UNSPECIFIED) {
|
||||||
size = h;
|
size = h;
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import android.graphics.RectF;
|
|||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
|
|
||||||
public class SwatchView extends SquareView implements ColorObserver {
|
public class SwatchView extends SquareView implements ColorObserver {
|
||||||
|
|
||||||
private final Paint borderPaint;
|
private final Paint borderPaint;
|
||||||
private final Path borderPath;
|
private final Path borderPath;
|
||||||
private final Paint checkerPaint;
|
private final Paint checkerPaint;
|
||||||
@@ -46,14 +45,14 @@ public class SwatchView extends SquareView implements ColorObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void cornerArc(Path path, float cx, float cy, float r, float startAngle, float sweepAngle) {
|
private static void cornerArc(Path path, float cx, float cy, float r, float startAngle, float sweepAngle) {
|
||||||
final RectF ovalRect = new RectF(-r, -r, r, r);
|
RectF ovalRect = new RectF(-r, -r, r, r);
|
||||||
ovalRect.offset(cx, cy);
|
ovalRect.offset(cx, cy);
|
||||||
path.arcTo(ovalRect, startAngle, sweepAngle);
|
path.arcTo(ovalRect, startAngle, sweepAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void mainArc(Path path, float viewSize, float margin, float startAngle, float sweepAngle) {
|
private static void mainArc(Path path, float viewSize, float margin, float startAngle, float sweepAngle) {
|
||||||
float r = viewSize + margin;
|
float r = viewSize + margin;
|
||||||
final RectF ovalRect = new RectF(-r, -r, r, r);
|
RectF ovalRect = new RectF(-r, -r, r, r);
|
||||||
ovalRect.offset(viewSize, viewSize);
|
ovalRect.offset(viewSize, viewSize);
|
||||||
path.arcTo(ovalRect, startAngle, sweepAngle);
|
path.arcTo(ovalRect, startAngle, sweepAngle);
|
||||||
}
|
}
|
||||||
@@ -77,23 +76,23 @@ public class SwatchView extends SquareView implements ColorObserver {
|
|||||||
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
|
||||||
// We expect to be stacked behind a square HueSatView and fill the top left corner.
|
// We expect to be stacked behind a square HueSatView and fill the top left corner.
|
||||||
|
|
||||||
final float inset = borderPaint.getStrokeWidth() / 2;
|
float inset = borderPaint.getStrokeWidth() / 2;
|
||||||
final float r = Math.min(w, h);
|
float r = Math.min(w, h);
|
||||||
|
|
||||||
// Trim the corners of the swatch is where it is radialMarginPx thick.
|
// Trim the corners of the swatch is where it is radialMarginPx thick.
|
||||||
// find how long the outeredges are:
|
// find how long the outeredges are:
|
||||||
final float margin = radialMarginPx;
|
float margin = radialMarginPx;
|
||||||
final float diagonal = r + 2 * margin;
|
float diagonal = r + 2 * margin;
|
||||||
final float opp = (float) Math.sqrt(diagonal * diagonal - r * r);
|
float opp = (float) Math.sqrt(diagonal * diagonal - r * r);
|
||||||
final float edgeLen = r - opp;
|
float edgeLen = r - opp;
|
||||||
|
|
||||||
// Arc angles for drawing CCW
|
// Arc angles for drawing CCW
|
||||||
final float outerAngle = (float) Math.toDegrees(Math.atan2(opp, r));
|
float outerAngle = (float) Math.toDegrees(Math.atan2(opp, r));
|
||||||
final float startAngle = 270 - outerAngle;
|
float startAngle = 270 - outerAngle;
|
||||||
// Sweep angle for each half of the swatch:
|
// Sweep angle for each half of the swatch:
|
||||||
final float sweepAngle = outerAngle - 45;
|
float sweepAngle = outerAngle - 45;
|
||||||
// Sweep angle for the smooth corners:
|
// Sweep angle for the smooth corners:
|
||||||
final float cornerSweepAngle = 90 - outerAngle;
|
float cornerSweepAngle = 90 - outerAngle;
|
||||||
|
|
||||||
// Outer border:
|
// Outer border:
|
||||||
beginBorder(borderPath, inset, edgeLen, margin, cornerSweepAngle);
|
beginBorder(borderPath, inset, edgeLen, margin, cornerSweepAngle);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
|
||||||
public class ValueView extends SliderViewBase implements ColorObserver {
|
public class ValueView extends SliderViewBase implements ColorObserver {
|
||||||
|
|
||||||
private ObservableColor observableColor = new ObservableColor(0);
|
private ObservableColor observableColor = new ObservableColor(0);
|
||||||
|
|
||||||
public ValueView(Context context) {
|
public ValueView(Context context) {
|
||||||
@@ -37,8 +36,8 @@ public class ValueView extends SliderViewBase implements ColorObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Bitmap makeBitmap(int w, int h) {
|
protected Bitmap makeBitmap(int w, int h) {
|
||||||
final boolean isWide = w > h;
|
boolean isWide = w > h;
|
||||||
final int n = Math.max(w, h);
|
int n = Math.max(w, h);
|
||||||
int[] colors = new int[n];
|
int[] colors = new int[n];
|
||||||
|
|
||||||
float[] hsv = new float[]{0, 0, 0};
|
float[] hsv = new float[]{0, 0, 0};
|
||||||
@@ -48,8 +47,8 @@ public class ValueView extends SliderViewBase implements ColorObserver {
|
|||||||
hsv[2] = isWide ? (float) i / n : 1 - (float) i / n;
|
hsv[2] = isWide ? (float) i / n : 1 - (float) i / n;
|
||||||
colors[i] = Color.HSVToColor(hsv);
|
colors[i] = Color.HSVToColor(hsv);
|
||||||
}
|
}
|
||||||
final int bmpWidth = isWide ? w : 1;
|
int bmpWidth = isWide ? w : 1;
|
||||||
final int bmpHeight = isWide ? 1 : h;
|
int bmpHeight = isWide ? 1 : h;
|
||||||
return Bitmap.createBitmap(colors, bmpWidth, bmpHeight, Bitmap.Config.ARGB_8888);
|
return Bitmap.createBitmap(colors, bmpWidth, bmpHeight, Bitmap.Config.ARGB_8888);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import ru.vtosters.hooks.other.Preferences;
|
|||||||
import ru.vtosters.lite.foaf.FoafBase;
|
import ru.vtosters.lite.foaf.FoafBase;
|
||||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
import ru.vtosters.lite.utils.RenameTool;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@@ -46,15 +45,17 @@ public class MenuBuilder {
|
|||||||
cfambObject = CommunityFragmentActionsMenuBuilder.class.getDeclaredField("b");
|
cfambObject = CommunityFragmentActionsMenuBuilder.class.getDeclaredField("b");
|
||||||
cfambObject.setAccessible(true);
|
cfambObject.setAccessible(true);
|
||||||
} catch (NoSuchFieldException | NoSuchMethodException e) {
|
} catch (NoSuchFieldException | NoSuchMethodException e) {
|
||||||
Log.e("VTLite", "Reflection failed");
|
Log.e("MenuBuilder", "Reflection failed");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void injectAP(final ProfileFragmentActionsMenuBuilder mb, final ActionsPopup.b builder) {
|
public static void injectAP(final ProfileFragmentActionsMenuBuilder mb, final ActionsPopup.b builder) {
|
||||||
try {
|
try {
|
||||||
final ExtendedUserProfile eup = (ExtendedUserProfile) pfambObject.get(mb);
|
ExtendedUserProfile eup = (ExtendedUserProfile) pfambObject.get(mb);
|
||||||
final Context ctx = ((View) Objects.requireNonNull(apView.get(builder))).getContext();
|
Context ctx = ((View) Objects.requireNonNull(apView.get(builder))).getContext();
|
||||||
|
boolean isPageWhitelistedFilter = isWhitelistedFilter(eup);
|
||||||
|
boolean isPageWhitelistedAdsStories = isWhitelistedAdStories(eup);
|
||||||
addItem(builder, AndroidUtils.getString(R.string.menu_copy_id), () -> {
|
addItem(builder, AndroidUtils.getString(R.string.menu_copy_id), () -> {
|
||||||
copy(ctx, String.valueOf(AccountManagerUtils.getUserID(eup)));
|
copy(ctx, String.valueOf(AccountManagerUtils.getUserID(eup)));
|
||||||
return Unit.a;
|
return Unit.a;
|
||||||
@@ -65,11 +66,22 @@ public class MenuBuilder {
|
|||||||
return Unit.a;
|
return Unit.a;
|
||||||
});
|
});
|
||||||
|
|
||||||
addItem(builder, AndroidUtils.getString(R.string.menu_change_name), () -> {
|
// addItem(builder, AndroidUtils.getString(R.string.menu_change_name), () -> {
|
||||||
RenameTool.createDialog(eup, ctx);
|
// RenameTool.createDialog(eup, ctx);
|
||||||
|
// return Unit.a;
|
||||||
|
// });
|
||||||
|
|
||||||
|
addItem(builder, AndroidUtils.getString(isPageWhitelistedFilter ? R.string.remove_from_filter_whitelist : R.string.add_to_filter_whitelist), () -> {
|
||||||
|
setWhitelistedFilter(eup, !isPageWhitelistedFilter);
|
||||||
|
AndroidUtils.sendToast(AndroidUtils.getString(isPageWhitelistedFilter ? R.string.removed_from_whitelist_success : R.string.added_to_whitelist_success));
|
||||||
return Unit.a;
|
return Unit.a;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addItem(builder, AndroidUtils.getString(isPageWhitelistedAdsStories ? R.string.remove_from_ads_stories_whitelist : R.string.add_to_ads_stories_whitelist), () -> {
|
||||||
|
setWhitelistedAdStories(eup, !isPageWhitelistedAdsStories);
|
||||||
|
AndroidUtils.sendToast(AndroidUtils.getString(isPageWhitelistedAdsStories ? R.string.removed_from_whitelist_success : R.string.added_to_whitelist_success));
|
||||||
|
return Unit.a;
|
||||||
|
});
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -77,21 +89,21 @@ public class MenuBuilder {
|
|||||||
|
|
||||||
public static void injectAP(final CommunityFragmentActionsMenuBuilder mb, final ActionsPopup.b builder) {
|
public static void injectAP(final CommunityFragmentActionsMenuBuilder mb, final ActionsPopup.b builder) {
|
||||||
try {
|
try {
|
||||||
final ExtendedCommunityProfile ecp = (ExtendedCommunityProfile) cfambObject.get(mb);
|
ExtendedCommunityProfile ecp = (ExtendedCommunityProfile) cfambObject.get(mb);
|
||||||
final Context ctx = ((View) apView.get(builder)).getContext();
|
Context ctx = ((View) apView.get(builder)).getContext();
|
||||||
final boolean isPageWhitelistedFilter = isWhitelistedFilter(ecp);
|
boolean isPageWhitelistedFilter = isWhitelistedFilter(ecp);
|
||||||
final boolean isPageWhitelistedAds = isWhitelistedAd(ecp);
|
boolean isPageWhitelistedAds = isWhitelistedAd(ecp);
|
||||||
final boolean isPageWhitelistedAdsStories = isWhitelistedAdStories(ecp);
|
boolean isPageWhitelistedAdsStories = isWhitelistedAdStories(ecp);
|
||||||
|
|
||||||
addItem(builder, AndroidUtils.getString(R.string.menu_copy_id), () -> {
|
addItem(builder, AndroidUtils.getString(R.string.menu_copy_id), () -> {
|
||||||
copy(ctx, String.valueOf(AccountManagerUtils.getUserID(ecp)));
|
copy(ctx, String.valueOf(AccountManagerUtils.getUserID(ecp)));
|
||||||
return Unit.a;
|
return Unit.a;
|
||||||
});
|
});
|
||||||
|
|
||||||
addItem(builder, AndroidUtils.getString(R.string.menu_change_name), () -> {
|
// addItem(builder, AndroidUtils.getString(R.string.menu_change_name), () -> {
|
||||||
RenameTool.createDialogGroup(ecp, ctx);
|
// RenameTool.createDialogGroup(ecp, ctx);
|
||||||
return Unit.a;
|
// return Unit.a;
|
||||||
});
|
// });
|
||||||
|
|
||||||
addItem(builder, AndroidUtils.getString(isPageWhitelistedFilter ? R.string.remove_from_filter_whitelist : R.string.add_to_filter_whitelist), () -> {
|
addItem(builder, AndroidUtils.getString(isPageWhitelistedFilter ? R.string.remove_from_filter_whitelist : R.string.add_to_filter_whitelist), () -> {
|
||||||
setWhitelistedFilter(ecp, !isPageWhitelistedFilter);
|
setWhitelistedFilter(ecp, !isPageWhitelistedFilter);
|
||||||
@@ -110,7 +122,6 @@ public class MenuBuilder {
|
|||||||
AndroidUtils.sendToast(AndroidUtils.getString(isPageWhitelistedAdsStories ? R.string.removed_from_whitelist_success : R.string.added_to_whitelist_success));
|
AndroidUtils.sendToast(AndroidUtils.getString(isPageWhitelistedAdsStories ? R.string.removed_from_whitelist_success : R.string.added_to_whitelist_success));
|
||||||
return Unit.a;
|
return Unit.a;
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -148,6 +159,19 @@ public class MenuBuilder {
|
|||||||
).contains(String.valueOf(AccountManagerUtils.getUserID(eup)));
|
).contains(String.valueOf(AccountManagerUtils.getUserID(eup)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isWhitelistedFilter(ExtendedUserProfile eup) {
|
||||||
|
return Preferences.getPreferences().getStringSet(
|
||||||
|
"whitelisted_filters_groups", Collections.emptySet()
|
||||||
|
).contains(String.valueOf(AccountManagerUtils.getUserID(eup)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isWhitelistedAdStories(ExtendedUserProfile eup) {
|
||||||
|
return Preferences.getPreferences().getStringSet(
|
||||||
|
"whitelisted_stories_ad",
|
||||||
|
Collections.emptySet()
|
||||||
|
).contains(String.valueOf(AccountManagerUtils.getUserID(eup)));
|
||||||
|
}
|
||||||
|
|
||||||
public static void setWhitelistedFilter(ExtendedCommunityProfile eup, boolean needWhitelist) {
|
public static void setWhitelistedFilter(ExtendedCommunityProfile eup, boolean needWhitelist) {
|
||||||
var id = String.valueOf(AccountManagerUtils.getUserID(eup));
|
var id = String.valueOf(AccountManagerUtils.getUserID(eup));
|
||||||
|
|
||||||
@@ -195,4 +219,36 @@ public class MenuBuilder {
|
|||||||
|
|
||||||
Preferences.getPreferences().edit().putStringSet("whitelisted_stories_ad", mutableAdsSet).apply();
|
Preferences.getPreferences().edit().putStringSet("whitelisted_stories_ad", mutableAdsSet).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setWhitelistedFilter(ExtendedUserProfile eup, boolean needWhitelist) {
|
||||||
|
var id = String.valueOf(AccountManagerUtils.getUserID(eup));
|
||||||
|
|
||||||
|
var mutableAdsSet = new LinkedHashSet<>(Preferences.getPreferences().getStringSet(
|
||||||
|
"whitelisted_filters_groups",
|
||||||
|
Collections.emptySet())
|
||||||
|
);
|
||||||
|
if (needWhitelist) {
|
||||||
|
mutableAdsSet.add(id);
|
||||||
|
} else {
|
||||||
|
mutableAdsSet.remove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Preferences.getPreferences().edit().putStringSet("whitelisted_filters_groups", mutableAdsSet).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setWhitelistedAdStories(ExtendedUserProfile eup, boolean needWhitelist) {
|
||||||
|
var id = String.valueOf(AccountManagerUtils.getUserID(eup));
|
||||||
|
|
||||||
|
var mutableAdsSet = new LinkedHashSet<>(Preferences.getPreferences().getStringSet(
|
||||||
|
"whitelisted_stories_ad",
|
||||||
|
Collections.emptySet()));
|
||||||
|
|
||||||
|
if (needWhitelist) {
|
||||||
|
mutableAdsSet.add(id);
|
||||||
|
} else {
|
||||||
|
mutableAdsSet.remove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Preferences.getPreferences().edit().putStringSet("whitelisted_stories_ad", mutableAdsSet).apply();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,12 +5,8 @@ import android.graphics.BitmapFactory;
|
|||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.View;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import com.vk.im.engine.h;
|
|
||||||
import com.vtosters.lite.R;
|
import com.vtosters.lite.R;
|
||||||
import ru.vtosters.hooks.other.Preferences;
|
import ru.vtosters.hooks.other.Preferences;
|
||||||
import ru.vtosters.hooks.other.ThemesUtils;
|
|
||||||
import ru.vtosters.lite.utils.AndroidUtils;
|
import ru.vtosters.lite.utils.AndroidUtils;
|
||||||
import vigo.sdk.Log;
|
import vigo.sdk.Log;
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class AndroidUtils {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public static Context getGlobalContext() {
|
public static Context getGlobalContext() {
|
||||||
try {
|
try {
|
||||||
final Method getInitialApplicationMtd = ReflectionUtils.findMethod(Class.forName("android.app.AppGlobals"), "getInitialApplication");
|
Method getInitialApplicationMtd = ReflectionUtils.findMethod(Class.forName("android.app.AppGlobals"), "getInitialApplication");
|
||||||
return (Context) getInitialApplicationMtd.invoke(null);
|
return (Context) getInitialApplicationMtd.invoke(null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d("GlobalContext", "Error while fetching context via refl");
|
Log.d("GlobalContext", "Error while fetching context via refl");
|
||||||
@@ -186,8 +186,8 @@ public class AndroidUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getRandomString(int sizeOfRandomString) {
|
private static String getRandomString(int sizeOfRandomString) {
|
||||||
final Random random = new Random();
|
Random random = new Random();
|
||||||
final StringBuilder sb = new StringBuilder(sizeOfRandomString);
|
StringBuilder sb = new StringBuilder(sizeOfRandomString);
|
||||||
for (int i = 0; i < sizeOfRandomString; ++i)
|
for (int i = 0; i < sizeOfRandomString; ++i)
|
||||||
sb.append(ALLOWED_CHARACTERS.charAt(random.nextInt(ALLOWED_CHARACTERS.length())));
|
sb.append(ALLOWED_CHARACTERS.charAt(random.nextInt(ALLOWED_CHARACTERS.length())));
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
@@ -221,7 +221,6 @@ public class AndroidUtils {
|
|||||||
long lastUpdateTime = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).lastUpdateTime;
|
long lastUpdateTime = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).lastUpdateTime;
|
||||||
return firstInstallTime == lastUpdateTime;
|
return firstInstallTime == lastUpdateTime;
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
e.printStackTrace();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class CrashReporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void init(Activity activity) {
|
public static void init(Activity activity) {
|
||||||
final var defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
|
var defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||||
Thread.setDefaultUncaughtExceptionHandler((thread, th) -> CrashReporter.start(defaultUncaughtExceptionHandler, thread, th, activity));
|
Thread.setDefaultUncaughtExceptionHandler((thread, th) -> CrashReporter.start(defaultUncaughtExceptionHandler, thread, th, activity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,9 +76,8 @@ public class CrashReporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isFoxbinInstalled() {
|
private static boolean isFoxbinInstalled() {
|
||||||
var pm = getGlobalContext().getPackageManager();
|
|
||||||
try {
|
try {
|
||||||
pm.getPackageInfo("com.f0x1d.dogbin", 0);
|
getGlobalContext().getPackageManager().getPackageInfo("com.f0x1d.dogbin", 0);
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class IOUtils {
|
public class IOUtils {
|
||||||
public static final int BUFFER_SIZE = 8192;
|
public static int BUFFER_SIZE = 8192;
|
||||||
|
|
||||||
public static byte[] decodeStream(InputStream encIs, byte[] aesKey)
|
public static byte[] decodeStream(InputStream encIs, byte[] aesKey)
|
||||||
throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IOException {
|
throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IOException {
|
||||||
@@ -51,11 +51,11 @@ public class IOUtils {
|
|||||||
return new String(readFully(is), StandardCharsets.UTF_8);
|
return new String(readFully(is), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] readFully(final InputStream is)
|
public static byte[] readFully(InputStream is)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final var bos = new ByteArrayOutputStream();
|
var bos = new ByteArrayOutputStream();
|
||||||
try (bos) {
|
try (bos) {
|
||||||
final byte[] buff = new byte[BUFFER_SIZE];
|
byte[] buff = new byte[BUFFER_SIZE];
|
||||||
int len;
|
int len;
|
||||||
while ((len = is.read(buff)) > 0)
|
while ((len = is.read(buff)) > 0)
|
||||||
bos.write(buff, 0, len);
|
bos.write(buff, 0, len);
|
||||||
@@ -63,7 +63,7 @@ public class IOUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] readFully(final File in)
|
public static byte[] readFully(File in)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return readFully(new FileInputStream(in));
|
return readFully(new FileInputStream(in));
|
||||||
}
|
}
|
||||||
@@ -80,25 +80,25 @@ public class IOUtils {
|
|||||||
fos.close();
|
fos.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copy(final InputStream is, final OutputStream os)
|
public static void copy(InputStream is, OutputStream os)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
final byte[] buff = new byte[BUFFER_SIZE];
|
byte[] buff = new byte[BUFFER_SIZE];
|
||||||
int len;
|
int len;
|
||||||
while ((len = is.read(buff)) > 0)
|
while ((len = is.read(buff)) > 0)
|
||||||
os.write(buff, 0, len);
|
os.write(buff, 0, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copy(final byte[] buffer, final File out)
|
public static void copy(byte[] buffer, File out)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
copy(new ByteArrayInputStream(buffer), new FileOutputStream(out));
|
copy(new ByteArrayInputStream(buffer), new FileOutputStream(out));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copy(final InputStream is, final File out)
|
public static void copy(InputStream is, File out)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
copy(is, new FileOutputStream(out));
|
copy(is, new FileOutputStream(out));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void copy(final File in, final File out)
|
public static void copy(File in, File out)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
copy(new FileInputStream(in), new FileOutputStream(out));
|
copy(new FileInputStream(in), new FileOutputStream(out));
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ public class IOUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static long getDirSize(File dir) {
|
public static long getDirSize(File dir) {
|
||||||
final var arr = dir.listFiles();
|
var arr = dir.listFiles();
|
||||||
if (arr == null || arr.length == 0)
|
if (arr == null || arr.length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
@@ -14,57 +14,46 @@ import static ru.vtosters.hooks.other.Preferences.*;
|
|||||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||||
|
|
||||||
public class NewsFeedFiltersUtils {
|
public class NewsFeedFiltersUtils {
|
||||||
public static List<String> mFilters;
|
public static List<String> mFilters = new ArrayList<>();
|
||||||
public static List<String> mFiltersNames;
|
public static List<String> mFiltersNames = new ArrayList<>();
|
||||||
public static List<String> mFiltersLinks;
|
public static List<String> mFiltersLinks = new ArrayList<>();
|
||||||
|
|
||||||
public static void setupFilters() {
|
public static void setupFilters() {
|
||||||
mFilters = new ArrayList<>();
|
|
||||||
mFiltersNames = new ArrayList<>();
|
|
||||||
mFiltersLinks = new ArrayList<>();
|
|
||||||
|
|
||||||
getFilter("refsfilter", "Referals.txt", mFilters);
|
getFilter("refsfilter", "Referals.txt", mFilters);
|
||||||
getFilter("shortlinkfilter", "LinkShorter.txt", mFilters);
|
getFilter("shortlinkfilter", "LinkShorter.txt", mFilters);
|
||||||
getFilter("default_ad_list", "StandartFilter.txt", mFilters);
|
getFilter("default_ad_list", "StandartFilter.txt", mFilters);
|
||||||
getFilter("shitposting", "IDontWantToReadIt.txt", mFilters);
|
getFilter("shitposting", "IDontWantToReadIt.txt", mFilters);
|
||||||
getFilter("cringecopyright", "CopyrightAds.txt", mFiltersLinks);
|
getFilter("cringecopyright", "CopyrightAds.txt", mFiltersLinks);
|
||||||
|
|
||||||
var customFilters = getString("spamfilters");
|
setCustomFilters(mFilters, getString("spamfilters"));
|
||||||
if (!customFilters.isEmpty()) {
|
setCustomFilters(mFiltersNames, getString("sourcenamefilter"));
|
||||||
mFilters.addAll(Arrays.asList(customFilters.toLowerCase().split(", ")));
|
setCustomFilters(mFiltersLinks, getString("linkfilter"));
|
||||||
}
|
|
||||||
|
|
||||||
var sourceNameFilter = getString("sourcenamefilter");
|
|
||||||
if (!sourceNameFilter.isEmpty()) {
|
|
||||||
mFiltersNames.addAll(Arrays.asList(sourceNameFilter.toLowerCase().split(", ")));
|
|
||||||
}
|
|
||||||
|
|
||||||
var linkFilter = getString("linkfilter");
|
|
||||||
if (!linkFilter.isEmpty()) {
|
|
||||||
mFiltersLinks.addAll(Arrays.asList(linkFilter.toLowerCase().split(", ")));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get needed filter list from assets
|
||||||
public static void getFilter(String boolname, String filename, List<String> list) {
|
public static void getFilter(String boolname, String filename, List<String> list) {
|
||||||
var ctx = getGlobalContext();
|
|
||||||
|
|
||||||
if (getBoolValue(boolname, false)) {
|
if (getBoolValue(boolname, false)) {
|
||||||
try {
|
try (Scanner scanner = new Scanner(getGlobalContext().getAssets().open(filename))) {
|
||||||
Scanner scanner;
|
|
||||||
scanner = new Scanner(ctx.getAssets().open(filename));
|
|
||||||
|
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
var line = scanner.nextLine();
|
addNonEmptyLineToList(scanner.nextLine(), list);
|
||||||
if (!line.isEmpty())
|
|
||||||
list.add(line.toLowerCase());
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.d("NewsFeedFiltersUtils", e.getMessage());
|
Log.d("NewsFeedFiltersUtils", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // Get needed filter list from assets
|
}
|
||||||
|
|
||||||
public static boolean injectFiltersReposts(JSONObject obj) throws JSONException {
|
private static void addNonEmptyLineToList(String line, List<String> list) {
|
||||||
|
if (!line.isEmpty()) {
|
||||||
|
list.add(line.toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setCustomFilters(List<String> list, String filters) {
|
||||||
|
if (!filters.isEmpty()) list.addAll(Arrays.asList(filters.toLowerCase().split(", ")));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean injectFiltersReposts(JSONObject obj) {
|
||||||
if (obj.has("copy_history")) {
|
if (obj.has("copy_history")) {
|
||||||
var copyHistoryNode = obj.optJSONArray("copy_history");
|
var copyHistoryNode = obj.optJSONArray("copy_history");
|
||||||
if (copyHistoryNode != null && copyHistoryNode.length() != 0) {
|
if (copyHistoryNode != null && copyHistoryNode.length() != 0) {
|
||||||
@@ -94,6 +83,7 @@ public class NewsFeedFiltersUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,17 +91,12 @@ public class NewsFeedFiltersUtils {
|
|||||||
if (json.has("copyright")) {
|
if (json.has("copyright")) {
|
||||||
if (copyright_post()) return true;
|
if (copyright_post()) return true;
|
||||||
|
|
||||||
var copyright = json.optJSONObject("copyright");
|
JSONObject copyright = json.optJSONObject("copyright");
|
||||||
|
|
||||||
String copyrightName = null;
|
String copyrightName = null;
|
||||||
|
|
||||||
if (copyright != null) {
|
|
||||||
copyrightName = copyright.getString("name").toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
String copyrightLink = null;
|
String copyrightLink = null;
|
||||||
|
|
||||||
if (copyright != null) {
|
if (copyright != null) {
|
||||||
|
copyrightName = copyright.getString("name").toLowerCase();
|
||||||
copyrightLink = copyright.getString("link").toLowerCase();
|
copyrightLink = copyright.getString("link").toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,8 +111,8 @@ public class NewsFeedFiltersUtils {
|
|||||||
if (copyrightLink != null && copyrightLink.contains(filter)) return true;
|
if (copyrightLink != null && copyrightLink.contains(filter)) return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +129,6 @@ public class NewsFeedFiltersUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,9 +138,8 @@ public class NewsFeedFiltersUtils {
|
|||||||
var caption = postJson.optJSONObject("caption");
|
var caption = postJson.optJSONObject("caption");
|
||||||
if (postsrecomm()) {
|
if (postsrecomm()) {
|
||||||
try {
|
try {
|
||||||
String type;
|
|
||||||
if (caption != null) {
|
if (caption != null) {
|
||||||
type = caption.getString("type");
|
String type = caption.getString("type");
|
||||||
return type.equals("explorebait") || // Может быть интересно
|
return type.equals("explorebait") || // Может быть интересно
|
||||||
type.equals("shared") || // Поделился записью
|
type.equals("shared") || // Поделился записью
|
||||||
type.equals("digest") || // Рекомедации
|
type.equals("digest") || // Рекомедации
|
||||||
@@ -187,7 +170,7 @@ public class NewsFeedFiltersUtils {
|
|||||||
var title = item.optString("title");
|
var title = item.optString("title");
|
||||||
|
|
||||||
if (TextUtils.isEmpty(id) || TextUtils.isEmpty(title)
|
if (TextUtils.isEmpty(id) || TextUtils.isEmpty(title)
|
||||||
// this items not working
|
// these items not working
|
||||||
|| id.equals("kpop") || id.equals("foryou")
|
|| id.equals("kpop") || id.equals("foryou")
|
||||||
|| id.equals("qazaqstan") || id.equals("podcasts"))
|
|| id.equals("qazaqstan") || id.equals("podcasts"))
|
||||||
continue;
|
continue;
|
||||||
@@ -201,8 +184,8 @@ public class NewsFeedFiltersUtils {
|
|||||||
.put("is_unavailable", hide);
|
.put("is_unavailable", hide);
|
||||||
Log.d("NewsfeedListInj", "Unlocked " + id + " in newsfeed list");
|
Log.d("NewsfeedListInj", "Unlocked " + id + " in newsfeed list");
|
||||||
}
|
}
|
||||||
Preferences.getPreferences().edit().putStringSet("news_feed_items_set", mutableFiltersSet)
|
|
||||||
.apply();
|
Preferences.getPreferences().edit().putStringSet("news_feed_items_set", mutableFiltersSet).apply();
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
@@ -259,13 +242,13 @@ public class NewsFeedFiltersUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkCopyright(post) && !isWhitelistedFilters(post)) {
|
if (checkCopyright(post)) {
|
||||||
if (dev())
|
if (dev())
|
||||||
Log.d("NewsfeedAdBlockV2", "Removed post " + post.optInt("post_id") + " from discover, Reason: copyright filters");
|
Log.d("NewsfeedAdBlockV2", "Removed post " + post.optInt("post_id") + " from discover, Reason: copyright filters");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkCaption(post) && !isWhitelistedFilters(post)) {
|
if (checkCaption(post)) {
|
||||||
if (dev())
|
if (dev())
|
||||||
Log.d("NewsfeedAdBlockV2", "Removed post " + post.optInt("post_id") + " from discover, Reason: caption filters");
|
Log.d("NewsfeedAdBlockV2", "Removed post " + post.optInt("post_id") + " from discover, Reason: caption filters");
|
||||||
return false;
|
return false;
|
||||||
@@ -284,45 +267,6 @@ public class NewsFeedFiltersUtils {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSONObject discoverObj() throws JSONException {
|
|
||||||
var mainjson = new JSONObject();
|
|
||||||
|
|
||||||
var info = new JSONObject();
|
|
||||||
info.put("title", "Test Injection");
|
|
||||||
info.put("text_color", "#ffffff");
|
|
||||||
info.put("description", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat");
|
|
||||||
|
|
||||||
var image = new JSONArray();
|
|
||||||
var imageQuality1 = new JSONObject();
|
|
||||||
imageQuality1.put("url", "https://w7.pngwing.com/pngs/505/1021/png-transparent-konata-izumi-lucky-star-desktop-anime-anime-blue-mammal-face.png");
|
|
||||||
imageQuality1.put("width", 72); // 72, 108, 144, 216, 288
|
|
||||||
imageQuality1.put("height", 72); // 72, 108, 144, 216, 288
|
|
||||||
image.put(imageQuality1);
|
|
||||||
|
|
||||||
var background = new JSONArray();
|
|
||||||
var backgroundQuality1 = new JSONObject();
|
|
||||||
backgroundQuality1.put("url", "https://2ch.life/vg/arch/2022-08-22/src/38524739/16440606579870.jpg");
|
|
||||||
backgroundQuality1.put("width", 344); // 344, 516, 680, 1032, 1376
|
|
||||||
backgroundQuality1.put("height", 215); // 215, 323, 426, 645, 860
|
|
||||||
background.put(backgroundQuality1);
|
|
||||||
|
|
||||||
info.put("image", image);
|
|
||||||
info.put("background", background);
|
|
||||||
|
|
||||||
mainjson.put("info", info);
|
|
||||||
mainjson.put("track_code", "info_banner_donut_catalog");
|
|
||||||
mainjson.put("template", "info");
|
|
||||||
|
|
||||||
var action = new JSONObject();
|
|
||||||
action.put("type", "open_url");
|
|
||||||
action.put("url", "vk.com/vtosters_official");
|
|
||||||
action.put("target", "internal");
|
|
||||||
|
|
||||||
mainjson.put("action", action);
|
|
||||||
|
|
||||||
return mainjson;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void parseStoriesItem(JSONObject item) throws JSONException {
|
public static void parseStoriesItem(JSONObject item) throws JSONException {
|
||||||
var stories = item.optJSONArray("stories");
|
var stories = item.optJSONArray("stories");
|
||||||
var newStories = new JSONArray();
|
var newStories = new JSONArray();
|
||||||
@@ -382,7 +326,7 @@ public class NewsFeedFiltersUtils {
|
|||||||
id = String.valueOf(list.optInt("source_id"));
|
id = String.valueOf(list.optInt("source_id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id.equals("-189659924")) {
|
if (id.equals("-189659924") || id.equals(String.valueOf(AccountManagerUtils.getUserId()))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +335,7 @@ public class NewsFeedFiltersUtils {
|
|||||||
Collections.emptySet()
|
Collections.emptySet()
|
||||||
);
|
);
|
||||||
|
|
||||||
return whitelist.contains(id);
|
return Preferences.getBoolValue("invertFilters", false) != whitelist.contains(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean isWhitelistedAd(JSONObject list) {
|
public static Boolean isWhitelistedAd(JSONObject list) {
|
||||||
@@ -425,7 +369,7 @@ public class NewsFeedFiltersUtils {
|
|||||||
|
|
||||||
if (attachments != null && getBoolValue("blockminiapps", false)) {
|
if (attachments != null && getBoolValue("blockminiapps", false)) {
|
||||||
for (int j = 0; j < attachments.length(); j++) {
|
for (int j = 0; j < attachments.length(); j++) {
|
||||||
var type = attachments.optJSONObject(j).optString("type");
|
String type = attachments.optJSONObject(j).optString("type");
|
||||||
if (type.contains("mini_app")) return true;
|
if (type.contains("mini_app")) return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -439,7 +383,7 @@ public class NewsFeedFiltersUtils {
|
|||||||
|
|
||||||
for (int i = 0; i < (items != null ? items.length() : 0); i++) {
|
for (int i = 0; i < (items != null ? items.length() : 0); i++) {
|
||||||
try {
|
try {
|
||||||
var curr = items.getJSONObject(i);
|
JSONObject curr = items.getJSONObject(i);
|
||||||
if (!curr.optString("template").contains("info") && discoverAdBlock(curr)) {
|
if (!curr.optString("template").contains("info") && discoverAdBlock(curr)) {
|
||||||
newObj.put(items.optJSONObject(i));
|
newObj.put(items.optJSONObject(i));
|
||||||
}
|
}
|
||||||
@@ -460,11 +404,11 @@ public class NewsFeedFiltersUtils {
|
|||||||
var newItems = new JSONArray();
|
var newItems = new JSONArray();
|
||||||
|
|
||||||
for (int j = 0; j < items.length(); j++) {
|
for (int j = 0; j < items.length(); j++) {
|
||||||
var list = items.optJSONObject(j);
|
JSONObject list = items.optJSONObject(j);
|
||||||
|
|
||||||
if (list == null) continue;
|
if (list == null) continue;
|
||||||
|
|
||||||
var type = list.optString("type");
|
String type = list.optString("type");
|
||||||
|
|
||||||
if (isAds(list, type)) {
|
if (isAds(list, type)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -504,13 +448,13 @@ public class NewsFeedFiltersUtils {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkCopyright(list) && !isWhitelistedFilters(list)) {
|
if (checkCopyright(list)) {
|
||||||
if (dev())
|
if (dev())
|
||||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: copyright filters");
|
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: copyright filters");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkCaption(list) && !isWhitelistedFilters(list)) {
|
if (checkCaption(list)) {
|
||||||
if (dev())
|
if (dev())
|
||||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: caption filters");
|
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: caption filters");
|
||||||
continue;
|
continue;
|
||||||
@@ -549,7 +493,7 @@ public class NewsFeedFiltersUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (json.has("ads")) {
|
if (json.has("ads")) {
|
||||||
var ad = json.optJSONObject("ads");
|
JSONObject ad = json.optJSONObject("ads");
|
||||||
if (isDeleteFix) {
|
if (isDeleteFix) {
|
||||||
if (ad != null) {
|
if (ad != null) {
|
||||||
ad.optJSONObject("settings")
|
ad.optJSONObject("settings")
|
||||||
@@ -567,10 +511,10 @@ public class NewsFeedFiltersUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var items = json.optJSONArray("items");
|
JSONArray items = json.optJSONArray("items");
|
||||||
if (items != null) {
|
if (items != null) {
|
||||||
for (int i = 0; i < items.length(); i++) {
|
for (int i = 0; i < items.length(); i++) {
|
||||||
var item = items.optJSONObject(i);
|
JSONObject item = items.optJSONObject(i);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
parseStoriesItem(item);
|
parseStoriesItem(item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,19 +27,18 @@ import static ru.vtosters.hooks.other.ThemesUtils.getTextAttr;
|
|||||||
import static ru.vtosters.lite.utils.AndroidUtils.*;
|
import static ru.vtosters.lite.utils.AndroidUtils.*;
|
||||||
|
|
||||||
public class RenameTool {
|
public class RenameTool {
|
||||||
private static final int DB_VERSION = 2;
|
|
||||||
|
|
||||||
private static final String COLUMN_NAME = "name";
|
|
||||||
public static final String COLUMN_FIRSTNAME = "first_name";
|
public static final String COLUMN_FIRSTNAME = "first_name";
|
||||||
public static final String COLUMN_LASTNAME = "last_name";
|
public static final String COLUMN_LASTNAME = "last_name";
|
||||||
|
public static final SparseArray<Pair<String, String>> renamedUsers = new SparseArray<>();
|
||||||
|
public static final SparseArray<String> renamedGroups = new SparseArray<>();
|
||||||
|
private static final int DB_VERSION = 2;
|
||||||
|
private static final String COLUMN_NAME = "name";
|
||||||
private static final String COLUMN_VKID = "vk_id";
|
private static final String COLUMN_VKID = "vk_id";
|
||||||
private static final String DB_NAME = "vt_rename.db";
|
private static final String DB_NAME = "vt_rename.db";
|
||||||
private static final String TABLE_NAME = "renames";
|
private static final String TABLE_NAME = "renames";
|
||||||
private static final String TABLE_NAME_GROUP = "renames_group";
|
private static final String TABLE_NAME_GROUP = "renames_group";
|
||||||
public static final SparseArray<Pair<String, String>> renamedUsers = new SparseArray<>();
|
|
||||||
public static final SparseArray<String> renamedGroups = new SparseArray<>();
|
|
||||||
private static RenameTool.DbHelper helperInstance;
|
|
||||||
public static boolean updateRequested = true;
|
public static boolean updateRequested = true;
|
||||||
|
private static RenameTool.DbHelper helperInstance;
|
||||||
|
|
||||||
protected static RenameTool.DbHelper getHelper() {
|
protected static RenameTool.DbHelper getHelper() {
|
||||||
if (helperInstance == null) {
|
if (helperInstance == null) {
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package ru.vtosters.lite.utils;
|
||||||
|
|
||||||
|
import androidx.annotation.DrawableRes;
|
||||||
|
import com.vtosters.lite.R;
|
||||||
|
import ru.vtosters.hooks.other.Preferences;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
|
public enum SearchEngine {
|
||||||
|
YANDEX(R.drawable.yandex,
|
||||||
|
"Yandex",
|
||||||
|
"https://yandex.com/images/search?rpt=imageview&url="),
|
||||||
|
GOOGLE(R.drawable.google,
|
||||||
|
"Google",
|
||||||
|
"https://www.google.com/searchbyimage?client=app&image_url="),
|
||||||
|
BING(R.drawable.bing,
|
||||||
|
"Bing",
|
||||||
|
"https://www.bing.com/images/search?view=detailv2&iss=SBI&form=SBIIDP&sbisrc=UrlPaste&q=imgurl:"),
|
||||||
|
TRACEMOE(R.drawable.tracemoe,
|
||||||
|
"trace.moe",
|
||||||
|
"https://trace.moe/?url="),
|
||||||
|
ASCII2D(R.drawable.ic_picture_outline_28,
|
||||||
|
"Ascii2d",
|
||||||
|
"https://ascii2d.net/search/url/"),
|
||||||
|
SAUCENAO(R.drawable.sauceNAO,
|
||||||
|
"SauceNAO",
|
||||||
|
"https://saucenao.com/search.php?url=");
|
||||||
|
|
||||||
|
@DrawableRes
|
||||||
|
public final int mIconRes;
|
||||||
|
public final String mTitle;
|
||||||
|
private final String mBaseUrl;
|
||||||
|
|
||||||
|
SearchEngine(@DrawableRes int iconRes, String title, String baseUrl) {
|
||||||
|
this.mIconRes = iconRes;
|
||||||
|
this.mTitle = title;
|
||||||
|
this.mBaseUrl = baseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getDefaultSearchEngine() {
|
||||||
|
return Preferences.getPreferences().getInt("search_engine", -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDefaultSearchEngine(int i) {
|
||||||
|
Preferences.getPreferences().edit().putInt("search_engine", i).apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String buildSearchUrl(String targetUrl) {
|
||||||
|
return this.mBaseUrl + URLEncoder.encode(targetUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,9 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static android.os.Environment.DIRECTORY_DOWNLOADS;
|
||||||
|
import static android.os.Environment.getExternalStoragePublicDirectory;
|
||||||
|
|
||||||
public class VKAccountDB {
|
public class VKAccountDB {
|
||||||
private static SQLiteOpenHelper getDatabase() {
|
private static SQLiteOpenHelper getDatabase() {
|
||||||
return new UsersDbHelper(AndroidUtils.getGlobalContext());
|
return new UsersDbHelper(AndroidUtils.getGlobalContext());
|
||||||
@@ -70,11 +73,11 @@ public class VKAccountDB {
|
|||||||
|
|
||||||
var db = getDatabase().getReadableDatabase();
|
var db = getDatabase().getReadableDatabase();
|
||||||
var dateFormat = new SimpleDateFormat("yyyy-MM-dd.HH-mm-ss", Locale.getDefault());
|
var dateFormat = new SimpleDateFormat("yyyy-MM-dd.HH-mm-ss", Locale.getDefault());
|
||||||
var file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/VTLBackups/saved_accounts_" + dateFormat.format(new Date()) + ".vtl");
|
var dir = new File(getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS), "/VTLBackups/");
|
||||||
|
var file = new File(dir, "saved_accounts_" + dateFormat.format(new Date()) + ".vtl");
|
||||||
|
|
||||||
InputStream inputStream;
|
try (InputStream inputStream = new FileInputStream(db.getPath())){
|
||||||
try {
|
dir.mkdirs();
|
||||||
inputStream = new FileInputStream(db.getPath());
|
|
||||||
|
|
||||||
FileOutputStream outputStream = new FileOutputStream(file);
|
FileOutputStream outputStream = new FileOutputStream(file);
|
||||||
byte[] buff = new byte[1024];
|
byte[] buff = new byte[1024];
|
||||||
@@ -86,7 +89,6 @@ public class VKAccountDB {
|
|||||||
|
|
||||||
AndroidUtils.sendToast(AndroidUtils.getString("accounts_saved_by_path") + " " + file.getPath());
|
AndroidUtils.sendToast(AndroidUtils.getString("accounts_saved_by_path") + " " + file.getPath());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
|
||||||
AndroidUtils.sendToast(AndroidUtils.getString("error_saving_file"));
|
AndroidUtils.sendToast(AndroidUtils.getString("error_saving_file"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,7 @@ public class VTVerifications {
|
|||||||
.apply();
|
.apply();
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
Log.d("VTVerifications", "load from network");
|
Log.d("VTVerifications", "load from network");
|
||||||
} catch (Exception e) {
|
} catch (Exception ignored) {
|
||||||
e.printStackTrace();
|
|
||||||
if (prefs.contains("ids")) {
|
if (prefs.contains("ids")) {
|
||||||
parseJson(prefs.getString("ids", "[]"));
|
parseJson(prefs.getString("ids", "[]"));
|
||||||
Log.d("VTVerifications", "load from memory. Something went wrong with parsing");
|
Log.d("VTVerifications", "load from memory. Something went wrong with parsing");
|
||||||
@@ -92,7 +91,7 @@ public class VTVerifications {
|
|||||||
processIds(json.optJSONArray("404"), sDevelopers);
|
processIds(json.optJSONArray("404"), sDevelopers);
|
||||||
processIds(json.optJSONArray("1337"), sServiceAccounts);
|
processIds(json.optJSONArray("1337"), sServiceAccounts);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,8 +99,13 @@ public class VTVerifications {
|
|||||||
if (jsonIds == null || jsonIds.length() == 0)
|
if (jsonIds == null || jsonIds.length() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < jsonIds.length(); i++)
|
for (int i = 0; i < jsonIds.length(); i++) {
|
||||||
member.add(jsonIds.optInt(i));
|
try {
|
||||||
|
member.add(jsonIds.optInt(i));
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPrometheus(int id) {
|
public static boolean isPrometheus(int id) {
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ package ru.vtosters.lite.utils;
|
|||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.Reader;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
import static ru.vtosters.hooks.other.ThemesUtils.*;
|
import static ru.vtosters.hooks.other.ThemesUtils.*;
|
||||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||||
@@ -16,30 +12,27 @@ public class WebViewColoringUtils {
|
|||||||
public static String loadedCSS = "";
|
public static String loadedCSS = "";
|
||||||
public static String loadedCSSAmoled = "";
|
public static String loadedCSSAmoled = "";
|
||||||
|
|
||||||
private static String load(String str) {
|
private static String readCSS(String str) {
|
||||||
try (var is = getGlobalContext().getAssets().open(str)) {
|
try (var is = getGlobalContext().getAssets().open(str)) {
|
||||||
return IOUtils.readAllLines(is);
|
return IOUtils.readAllLines(is)
|
||||||
|
.replace("%header_background%", hex(getHeaderBackground()))
|
||||||
|
.replace("%background_content%", hex(getBackgroundContent()))
|
||||||
|
.replace("%header_text%", hex(getHeaderText()))
|
||||||
|
.replace("%accent%", hex(getAccentColor()))
|
||||||
|
.replace("%background_page%", hex(getBackgroundPage()))
|
||||||
|
.replace("%content_tint_background%", hex(getColorFromAttr(com.vtosters.lite.R.attr.content_tint_background)))
|
||||||
|
.replace("%button_primary_background%", hex(getColorFromAttr(com.vtosters.lite.R.attr.button_primary_background)))
|
||||||
|
.replace("%button_outline_foreground%", hex(getColorFromAttr(com.vtosters.lite.R.attr.button_outline_foreground)))
|
||||||
|
.replace("%button_outline_border%", hex(getColorFromAttr(com.vtosters.lite.R.attr.button_outline_border)))
|
||||||
|
.replace("%text_primary%", hex(getTextAttr()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
loadedCSS = load("vt_ui_accent.css")
|
loadedCSS = readCSS("vt_ui_accent.css");
|
||||||
.replace("%header_background%", hex(getHeaderBackground()))
|
loadedCSSAmoled = readCSS("vt_ui_oled.css");
|
||||||
.replace("%background_content%", hex(getBackgroundContent()))
|
|
||||||
.replace("%header_text%", hex(getHeaderText()))
|
|
||||||
.replace("%accent%", hex(getAccentColor()))
|
|
||||||
.replace("%background_page%", hex(getBackgroundPage()))
|
|
||||||
.replace("%content_tint_background%", hex(getColorFromAttr(com.vtosters.lite.R.attr.content_tint_background)))
|
|
||||||
.replace("%button_primary_background%", hex(getColorFromAttr(com.vtosters.lite.R.attr.button_primary_background)))
|
|
||||||
.replace("%button_outline_foreground%", hex(getColorFromAttr(com.vtosters.lite.R.attr.button_outline_foreground)))
|
|
||||||
.replace("%button_outline_border%", hex(getColorFromAttr(com.vtosters.lite.R.attr.button_outline_border)))
|
|
||||||
.replace("%text_primary%", hex(getTextAttr()));
|
|
||||||
|
|
||||||
|
|
||||||
loadedCSSAmoled = load("vt_ui_oled.css");
|
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,3 +14,6 @@
|
|||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=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
|
android.jetifier.ignorelist=classes-dex2jar.jar, classes2-dex2jar.jar, classes3-dex2jar.jar, classes4-dex2jar.jar, classes5-dex2jar.jar, classes6-dex2jar.jar, classes7-dex2jar.jar
|
||||||
|
android.defaults.buildfeatures.buildconfig=true
|
||||||
|
android.nonTransitiveRClass=false
|
||||||
|
android.nonFinalResIds=false
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ if "%ERRORLEVEL%" == "0" (
|
|||||||
echo %ESC%[31mFailed%ESC%[0m
|
echo %ESC%[31mFailed%ESC%[0m
|
||||||
exit /B 1
|
exit /B 1
|
||||||
)
|
)
|
||||||
del classes6.dex
|
|
||||||
del classes7.dex
|
|
||||||
del assets\version.properties
|
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo %ESC%[1;4mSign apk...%ESC%[0m
|
echo %ESC%[1;4mSign apk...%ESC%[0m
|
||||||
|
|||||||
@@ -33,8 +33,4 @@ cd ../scripts
|
|||||||
./apksigner sign --ks debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android ../scripts/VTLite.apk
|
./apksigner sign --ks debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android ../scripts/VTLite.apk
|
||||||
check_result
|
check_result
|
||||||
|
|
||||||
echo -e "${BOLD}VTosters Lite успешно собран! APK находится в папке scripts${NC}"
|
echo -e "${BOLD}VTosters Lite успешно собран! APK находится в папке scripts${NC}"
|
||||||
|
|
||||||
cd ../smali
|
|
||||||
rm classes6.dex
|
|
||||||
rm classes7.dex
|
|
||||||
@@ -57,6 +57,7 @@ cпocоб зaрaбoтать
|
|||||||
В закрепленном комментарии
|
В закрепленном комментарии
|
||||||
В Закрепленном комментарии
|
В Закрепленном комментарии
|
||||||
В закрепленном Комментарии
|
В закрепленном Комментарии
|
||||||
|
в комментариях
|
||||||
Успей подать заявку
|
Успей подать заявку
|
||||||
Успей Подать Заявку
|
Успей Подать Заявку
|
||||||
Успей подать Заявку
|
Успей подать Заявку
|
||||||
@@ -94,6 +95,6 @@ cкорее подписывайся
|
|||||||
Подписывайтесь👇
|
Подписывайтесь👇
|
||||||
Подписывайся👇
|
Подписывайся👇
|
||||||
ссылка в комментариях
|
ссылка в комментариях
|
||||||
в комментариях👇
|
|
||||||
👉https://
|
👉https://
|
||||||
👉http://
|
👉http://
|
||||||
|
Ссылка удалится через часов
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
/* vkui.css V2 by iTaysonLab */
|
/* vkui coloring V2 by iTaysonLab */
|
||||||
|
/* rewrited by vtosters team */
|
||||||
/* Generic VKUI */
|
/* Generic VKUI */
|
||||||
/* additional fixes for various VKUI */
|
/* additional fixes for various VKUI */
|
||||||
.Tooltip__content {
|
.Tooltip__content {
|
||||||
background-color: %accent% !important;
|
background-color: %accent% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vkuibright_light, [scheme=bright_light], body[scheme=bright_light] {
|
.vkuibright_light, [scheme=bright_light], body[scheme=bright_light], .vkui--vkBase--light, .vkui--vkIOS--light, .vkui--vkCom--light {
|
||||||
--accent: %accent% !important;
|
--accent: %accent% !important;
|
||||||
|
--vkui--color_icon_accent: %accent% !important;
|
||||||
--action_sheet_action_foreground: %accent% !important;
|
--action_sheet_action_foreground: %accent% !important;
|
||||||
--attach_picker_tab_active_background: %accent% !important;
|
--attach_picker_tab_active_background: %accent% !important;
|
||||||
--attach_picker_tab_active_text: %accent% !important;
|
--attach_picker_tab_active_text: %accent% !important;
|
||||||
@@ -29,22 +31,33 @@
|
|||||||
--landing_text_title: %accent% !important;
|
--landing_text_title: %accent% !important;
|
||||||
--landing_secondary_button_foreground: %accent% !important;
|
--landing_secondary_button_foreground: %accent% !important;
|
||||||
--link_alternate: %accent% !important;
|
--link_alternate: %accent% !important;
|
||||||
|
--vkui--color_text_link_themed: %accent% !important;
|
||||||
--loader_track_value_fill: %accent% !important;
|
--loader_track_value_fill: %accent% !important;
|
||||||
|
--vkui--color_track_buffer: %accent% !important;
|
||||||
--feed_recommended_friend_promo_background: %accent% !important;
|
--feed_recommended_friend_promo_background: %accent% !important;
|
||||||
--tabbar_active_icon: %accent% !important;
|
--tabbar_active_icon: %accent% !important;
|
||||||
--tabbar_tablet_active_icon: %accent% !important;
|
--tabbar_tablet_active_icon: %accent% !important;
|
||||||
--text_link: %accent% !important;
|
--text_link: %accent% !important;
|
||||||
--text_name: %accent% !important;
|
--text_name: %accent% !important;
|
||||||
|
--vkui--color_text_link: %accent% !important;
|
||||||
|
--vkui--color_text_name: %accent% !important;
|
||||||
--writebar_icon: %accent% !important;
|
--writebar_icon: %accent% !important;
|
||||||
|
--vkui--color_write_bar_icon: %accent% !important;
|
||||||
--dynamic_blue: %accent% !important;
|
--dynamic_blue: %accent% !important;
|
||||||
/* backgrounds */
|
/* backgrounds */
|
||||||
--background_content: %background_content% !important;
|
--background_content: %background_content% !important;
|
||||||
|
--vkui--color_background_content: %background_content% !important;
|
||||||
--background_page: %background_page% !important;
|
--background_page: %background_page% !important;
|
||||||
|
--vkui--color_background: %background_page% !important;
|
||||||
--content_tint_background: %content_tint_background% !important;
|
--content_tint_background: %content_tint_background% !important;
|
||||||
|
--vkui--color_background_secondary: %content_tint_background% !important;
|
||||||
--loader_background: %background_page% !important;
|
--loader_background: %background_page% !important;
|
||||||
--header_background: %header_background% !important;
|
--header_background: %header_background% !important;
|
||||||
--header_background_before_blur: %header_background% !important;
|
--header_background_before_blur: %header_background% !important;
|
||||||
--header_background_before_blur_alternate: %header_background% !important;
|
--header_background_before_blur_alternate: %header_background% !important;
|
||||||
|
--vkui--color_header_background: %header_background% !important;
|
||||||
|
--vkui--color_header_background_before_blur: %header_background% !important;
|
||||||
|
--vkui--color_header_background_before_blur_alternate: %header_background% !important;
|
||||||
--header_alternate_background: %header_background% !important;
|
--header_alternate_background: %header_background% !important;
|
||||||
|
|
||||||
--header_text_alternate: %header_text% !important;
|
--header_text_alternate: %header_text% !important;
|
||||||
@@ -52,12 +65,14 @@
|
|||||||
--header_text_secondary: %header_text% !important;
|
--header_text_secondary: %header_text% !important;
|
||||||
--header_tint: %header_text% !important;
|
--header_tint: %header_text% !important;
|
||||||
--header_tint_alternate: %header_text% !important;
|
--header_tint_alternate: %header_text% !important;
|
||||||
|
--vkui--color_icon_accent_themed: %header_text% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.vkuispace_gray, [scheme=space_gray], body[scheme=space_gray] {
|
.vkuispace_gray, [scheme=space_gray], body[scheme=space_gray], .vkui--vkBase--dark, .vkui--vkIOS--dark, .vkui--vkCom--dark {
|
||||||
--accent: %accent% !important;
|
--accent: %accent% !important;
|
||||||
|
--vkui--color_icon_accent: %accent% !important;
|
||||||
--action_sheet_action_foreground: %accent% !important;
|
--action_sheet_action_foreground: %accent% !important;
|
||||||
--attach_picker_tab_active_background: %accent% !important;
|
--attach_picker_tab_active_background: %accent% !important;
|
||||||
--attach_picker_tab_active_text: %accent% !important;
|
--attach_picker_tab_active_text: %accent% !important;
|
||||||
@@ -80,25 +95,36 @@
|
|||||||
--landing_text_title: %accent% !important;
|
--landing_text_title: %accent% !important;
|
||||||
--landing_secondary_button_foreground: %accent% !important;
|
--landing_secondary_button_foreground: %accent% !important;
|
||||||
--link_alternate: %accent% !important;
|
--link_alternate: %accent% !important;
|
||||||
|
--vkui--color_text_link_themed: %accent% !important;
|
||||||
--loader_track_value_fill: %accent% !important;
|
--loader_track_value_fill: %accent% !important;
|
||||||
|
--vkui--color_track_buffer: %accent% !important;
|
||||||
--feed_recommended_friend_promo_background: %accent% !important;
|
--feed_recommended_friend_promo_background: %accent% !important;
|
||||||
--tabbar_active_icon: %accent% !important;
|
--tabbar_active_icon: %accent% !important;
|
||||||
--tabbar_tablet_active_icon: %accent% !important;
|
--tabbar_tablet_active_icon: %accent% !important;
|
||||||
--text_link: %accent% !important;
|
--text_link: %accent% !important;
|
||||||
--text_name: %accent% !important;
|
--text_name: %accent% !important;
|
||||||
|
--vkui--color_text_link: %accent% !important;
|
||||||
|
--vkui--color_text_name: %accent% !important;
|
||||||
--writebar_icon: %accent% !important;
|
--writebar_icon: %accent% !important;
|
||||||
|
--vkui--color_write_bar_icon: %accent% !important;
|
||||||
--dynamic_blue: %accent% !important;
|
--dynamic_blue: %accent% !important;
|
||||||
--background_content: %background_content% !important;
|
--background_content: %background_content% !important;
|
||||||
|
--vkui--color_background_content: %background_content% !important;
|
||||||
--background_page: %background_page% !important;
|
--background_page: %background_page% !important;
|
||||||
|
--vkui--color_background: %background_page% !important;
|
||||||
--content_tint_background: %content_tint_background% !important;
|
--content_tint_background: %content_tint_background% !important;
|
||||||
|
--vkui--color_background_secondary: %content_tint_background% !important;
|
||||||
--loader_background: %background_page% !important;
|
--loader_background: %background_page% !important;
|
||||||
--header_background: %header_background% !important;
|
--header_background: %header_background% !important;
|
||||||
--header_background_before_blur: %header_background% !important;
|
--header_background_before_blur: %header_background% !important;
|
||||||
--header_background_before_blur_alternate: %header_background% !important;
|
--header_background_before_blur_alternate: %header_background% !important;
|
||||||
|
--vkui--color_header_background: %header_background% !important;
|
||||||
|
--vkui--color_header_background_before_blur: %header_background% !important;
|
||||||
|
--vkui--color_header_background_before_blur_alternate: %header_background% !important;
|
||||||
--header_alternate_background: %header_background% !important;
|
--header_alternate_background: %header_background% !important;
|
||||||
--header_tint: %header_text% !important;
|
--header_tint: %header_text% !important;
|
||||||
--header_tint_alternate: %header_text% !important;
|
--header_tint_alternate: %header_text% !important;
|
||||||
|
--vkui--color_icon_accent_themed: %header_text% !important;
|
||||||
--header_text_alternate: %header_text% !important;
|
--header_text_alternate: %header_text% !important;
|
||||||
--header_text: %header_text% !important;
|
--header_text: %header_text% !important;
|
||||||
--header_text_secondary: %header_text% !important;
|
--header_text_secondary: %header_text% !important;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
/* vkui.css V2 by iTaysonLab */
|
/* vkui coloring V2 by iTaysonLab */
|
||||||
|
/* rewrited by vtosters team */
|
||||||
/* Articles */
|
/* Articles */
|
||||||
body.article_body.article_dark {
|
body.article_body.article_dark {
|
||||||
background-color: #000000 !important;
|
background-color: #000000 !important;
|
||||||
@@ -19,7 +20,7 @@ body.article_body.article_dark {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.article_dark .article>h1 {
|
.article_dark .article>h1 {
|
||||||
color: %textColorPrimary% !important;
|
color: %text_primary% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article__info_line {
|
.article__info_line {
|
||||||
@@ -48,45 +49,60 @@ body.article_body.article_dark {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Generic VKUI */
|
/* Generic VKUI */
|
||||||
.vkuispace_gray, [scheme=space_gray], body[scheme=space_gray] {
|
.vkuispace_gray, [scheme=space_gray], body[scheme=space_gray], .vkui--vkBase--dark, .vkui--vkIOS--dark, .vkui--vkCom--dark {
|
||||||
/* light background */
|
/* light background */
|
||||||
--attach_picker_tab_active_icon: #000000 !important;
|
--attach_picker_tab_active_icon: #000000 !important;
|
||||||
--background_content: #000000 !important;
|
--background_content: #000000 !important;
|
||||||
|
--vkui--color_background_content: %background_content% !important;
|
||||||
--button_bot_shadow: #000000 !important;
|
--button_bot_shadow: #000000 !important;
|
||||||
--button_primary_foreground: #000000 !important;
|
--button_primary_foreground: #000000 !important;
|
||||||
--content_tint_background: #000000 !important;
|
--content_tint_background: #000000 !important;
|
||||||
|
--vkui--color_background_secondary: %content_tint_background% !important;
|
||||||
--counter_secondary_text: #000000 !important;
|
--counter_secondary_text: #000000 !important;
|
||||||
--loader_background: #000000 !important;
|
--loader_background: #000000 !important;
|
||||||
--overlay_status_background: #000000 !important;
|
--overlay_status_background: #000000 !important;
|
||||||
--header_background: #000000 !important;
|
--header_background: #000000 !important;
|
||||||
--header_alternate_background: #000000 !important;
|
--header_alternate_background: #000000 !important;
|
||||||
|
--header_alternate_background: #000000 !important;
|
||||||
|
--vkui--color_header_background: #000000 !important;
|
||||||
--separator_alternate: #000000 !important;
|
--separator_alternate: #000000 !important;
|
||||||
--segmented_control_bar_background: #000000 !important;
|
--segmented_control_bar_background: #000000 !important;
|
||||||
--search_bar_background: #000000 !important;
|
--search_bar_background: #000000 !important;
|
||||||
/* background */
|
/* background */
|
||||||
--background_page: #000000 !important;
|
--background_page: #000000 !important;
|
||||||
|
--vkui--color_background: #000000 !important;
|
||||||
--header_background_before_blur: #000000 !important;
|
--header_background_before_blur: #000000 !important;
|
||||||
--header_background_before_blur_alternate: #000000 !important;
|
--header_background_before_blur_alternate: #000000 !important;
|
||||||
|
--vkui--color_header_background_before_blur: #000000 !important;
|
||||||
|
--vkui--color_header_background_before_blur_alternate: #000000 !important;
|
||||||
/* lighter BG (text fields) */
|
/* lighter BG (text fields) */
|
||||||
--attach_picker_tab_inactive_background: #121212 !important;
|
--attach_picker_tab_inactive_background: #121212 !important;
|
||||||
--background_keyboard: #121212 !important;
|
--background_keyboard: #121212 !important;
|
||||||
--background_suggestions: #121212 !important;
|
--background_suggestions: #121212 !important;
|
||||||
|
--vkui--color_background_modal: #121212 !important;
|
||||||
--field_background: #121212 !important;
|
--field_background: #121212 !important;
|
||||||
--im_bubble_incoming: #121212 !important;
|
--im_bubble_incoming: #121212 !important;
|
||||||
--input_border: #121212 !important;
|
--input_border: #121212 !important;
|
||||||
|
--vkui--color_write_bar_input_background: #121212 !important;
|
||||||
--modal_card_background: #121212 !important;
|
--modal_card_background: #121212 !important;
|
||||||
--separator_common: #121212 !important;
|
--separator_common: #121212 !important;
|
||||||
|
--vkui--color_separator_primary: #121212 !important;
|
||||||
--snippet_background: #121212 !important;
|
--snippet_background: #121212 !important;
|
||||||
--android_active_color: #121212 !important;
|
--android_active_color: #121212 !important;
|
||||||
--switch_ios_off_border: #121212 !important;
|
--switch_ios_off_border: #121212 !important;
|
||||||
/* third BG (buttons) */
|
/* third BG (buttons) */
|
||||||
--button_secondary_background: #212121 !important;
|
--button_secondary_background: #212121 !important;
|
||||||
|
--vkui--color_background_secondary_alpha: #212121 !important;
|
||||||
--header_search_field_background: #212121 !important;
|
--header_search_field_background: #212121 !important;
|
||||||
--icon_tertiary: #212121 !important;
|
--icon_tertiary: #212121 !important;
|
||||||
|
--vkui--color_icon_tertiary: #212121 !important;
|
||||||
--im_bubble_outgoing: #212121 !important;
|
--im_bubble_outgoing: #212121 !important;
|
||||||
--input_background: #212121 !important;
|
--input_background: #212121 !important;
|
||||||
|
--vkui--color_write_bar_input_background: #212121 !important;
|
||||||
--loader_track_fill: #212121 !important;
|
--loader_track_fill: #212121 !important;
|
||||||
|
--vkui--color_track_background: #212121 !important;
|
||||||
--search_bar_field_background: #212121 !important;
|
--search_bar_field_background: #212121 !important;
|
||||||
|
--vkui--color_search_field_background: #212121 !important;
|
||||||
--selection_off_icon: #212121 !important;
|
--selection_off_icon: #212121 !important;
|
||||||
--panel_tab_active_background: #212121 !important;
|
--panel_tab_active_background: #212121 !important;
|
||||||
}
|
}
|
||||||
|
|||||||
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -6327,8 +6327,8 @@
|
|||||||
<string name="globalUsersOnline_summ">Можа выклікаць доўгія загрузкі раздзелаў і вялікае спажыванне трафіку \n\nНе
|
<string name="globalUsersOnline_summ">Можа выклікаць доўгія загрузкі раздзелаў і вялікае спажыванне трафіку \n\nНе
|
||||||
рэкамендуецца ўключаць дадзеную функцыю
|
рэкамендуецца ўключаць дадзеную функцыю
|
||||||
</string>
|
</string>
|
||||||
<string name="savemsgsett_title">Захоўваць налады паведамленняў</string>
|
<string name="savemsgsett_title">Захоўваць параметры адпраўкі паведамленняў</string>
|
||||||
<string name="savemsgsett_summ">Захоўваць становішча тумблераў у наладах паведамленняў</string>
|
<string name="savemsgsett_summ">Захоўваць выбраныя параметры статусу выходных паведамленняў як знікненне паведамленняў і бясшумная адпраўка</string>
|
||||||
<string name="screenshotdetect_title">Адключыць дэтэкт скрыншотаў</string>
|
<string name="screenshotdetect_title">Адключыць дэтэкт скрыншотаў</string>
|
||||||
<string name="screenshotdetect_summ">Адключыць апавяшчэнне аб тым, што вы зрабілі скрыншот</string>
|
<string name="screenshotdetect_summ">Адключыць апавяшчэнне аб тым, што вы зрабілі скрыншот</string>
|
||||||
<string name="hideDeviceInfo_title">Адключыць адпраўку метрыкі</string>
|
<string name="hideDeviceInfo_title">Адключыць адпраўку метрыкі</string>
|
||||||
@@ -6823,8 +6823,8 @@
|
|||||||
<string name="remove_from_ads_whitelist">Выдаліць з вайтліста рэкламы</string>
|
<string name="remove_from_ads_whitelist">Выдаліць з вайтліста рэкламы</string>
|
||||||
<string name="add_to_ads_stories_whitelist">Дадаць у вайтліст гісторый</string>
|
<string name="add_to_ads_stories_whitelist">Дадаць у вайтліст гісторый</string>
|
||||||
<string name="remove_from_ads_stories_whitelist">Выдаліць з вайтліста гісторый</string>
|
<string name="remove_from_ads_stories_whitelist">Выдаліць з вайтліста гісторый</string>
|
||||||
<string name="removed_from_whitelist_success">Група выдалена з вайтліста</string>
|
<string name="removed_from_whitelist_success">Выдаленая з вайтлиста</string>
|
||||||
<string name="added_to_whitelist_success">Група дададзена ў вайтліст</string>
|
<string name="added_to_whitelist_success">Дададзена ў вайтліст</string>
|
||||||
<string name="whitelisted_ad_groups_title">Вайтліст рэкламы</string>
|
<string name="whitelisted_ad_groups_title">Вайтліст рэкламы</string>
|
||||||
|
|
||||||
<string name="whitelisted_ad_groups_stories_title">Вайтліст рэкламы гісторый</string>
|
<string name="whitelisted_ad_groups_stories_title">Вайтліст рэкламы гісторый</string>
|
||||||
@@ -6942,6 +6942,8 @@
|
|||||||
<string name="promotedstickers_title">Не атрымліваць промостикеры</string>
|
<string name="promotedstickers_title">Не атрымліваць промостикеры</string>
|
||||||
<string name="useOldAppVer_title">Выкарыстоўваць стары дызайн</string>
|
<string name="useOldAppVer_title">Выкарыстоўваць стары дызайн</string>
|
||||||
<string name="useOldAppVer_summ">Працуе \"як ёсць\". Могуць быць памылкі</string>
|
<string name="useOldAppVer_summ">Працуе \"як ёсць\". Могуць быць памылкі</string>
|
||||||
|
<string name="invertFilters">Інвертаваць выключэння</string>
|
||||||
|
<string name="invertFilters_summ">Дададзеныя ў выключэння групы будуць фільтраваць</string>
|
||||||
<string name="downloading_update">Спампоўка абнаўлення</string>
|
<string name="downloading_update">Спампоўка абнаўлення</string>
|
||||||
<string name="sources">Крыніцы</string>
|
<string name="sources">Крыніцы</string>
|
||||||
<string name="businessDisabler_title">Адключыць бізнес-паведамлення</string>
|
<string name="businessDisabler_title">Адключыць бізнес-паведамлення</string>
|
||||||
@@ -7010,6 +7012,7 @@
|
|||||||
|
|
||||||
<string name="datasettings_title">Налады дадзеных прыкладання</string>
|
<string name="datasettings_title">Налады дадзеных прыкладання</string>
|
||||||
<string name="invalidate_theme_cache_title">Інвалідацыя кэша тэмы</string>
|
<string name="invalidate_theme_cache_title">Інвалідацыя кэша тэмы</string>
|
||||||
|
<string name="invalidate_theme_cache_each_update_title">Ачыстка кэша тэмы пасля абнаўлення для прадухілення праблем з акцэнтамі</string>
|
||||||
|
|
||||||
<string name="useCustomPrefsStyle_title">Выкарыстоўваць новыя тумблеры</string>
|
<string name="useCustomPrefsStyle_title">Выкарыстоўваць новыя тумблеры</string>
|
||||||
<string name="useCustomPrefsStyle_summ">Больш сучасны і стыльны выгляд тумблераў у наладах</string>
|
<string name="useCustomPrefsStyle_summ">Больш сучасны і стыльны выгляд тумблераў у наладах</string>
|
||||||
@@ -7025,4 +7028,8 @@
|
|||||||
|
|
||||||
<string name="compression_types">Спосаб кампрэсіі фота</string>
|
<string name="compression_types">Спосаб кампрэсіі фота</string>
|
||||||
<string name="compression_types_selection">Выберыце спосаб кампрэсіі</string>
|
<string name="compression_types_selection">Выберыце спосаб кампрэсіі</string>
|
||||||
|
|
||||||
|
<string name="clear_all_cache">Ачысціць ўвесь кэш?</string>
|
||||||
|
<string name="cache_size">Памер прыкладання</string>
|
||||||
|
<string name="cache_size_summ">Вага кэша прыкладання</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -5649,8 +5649,8 @@
|
|||||||
<string name="onlinefix_title">Обходить онлайн</string>
|
<string name="onlinefix_title">Обходить онлайн</string>
|
||||||
<string name="globalUsersOnline_title">Глобальный обход онлайна</string>
|
<string name="globalUsersOnline_title">Глобальный обход онлайна</string>
|
||||||
<string name="globalUsersOnline_summ">Может вызывать долгие загрузки разделов и большое потребление трафика \n\nНе рекомендуется включать данную функцию</string>
|
<string name="globalUsersOnline_summ">Может вызывать долгие загрузки разделов и большое потребление трафика \n\nНе рекомендуется включать данную функцию</string>
|
||||||
<string name="savemsgsett_title">Сохранять настройки сообщений</string>
|
<string name="savemsgsett_title">Сохранять параметры отправки сообщений</string>
|
||||||
<string name="savemsgsett_summ">Сохранять положение тумблеров в настройках сообщений</string>
|
<string name="savemsgsett_summ">Сохранять выбранные параметры статуса исходящих сообщений как исчезновение сообщений и бесшумная отправка</string>
|
||||||
<string name="screenshotdetect_title">Отключить детект скриншотов</string>
|
<string name="screenshotdetect_title">Отключить детект скриншотов</string>
|
||||||
<string name="screenshotdetect_summ">Отключить уведомление о том, что вы сделали скриншот</string>
|
<string name="screenshotdetect_summ">Отключить уведомление о том, что вы сделали скриншот</string>
|
||||||
<string name="hideDeviceInfo_title">Отключить отправку метрики</string>
|
<string name="hideDeviceInfo_title">Отключить отправку метрики</string>
|
||||||
@@ -6191,8 +6191,8 @@
|
|||||||
<string name="remove_from_ads_whitelist">Удалить из вайтлиста рекламы</string>
|
<string name="remove_from_ads_whitelist">Удалить из вайтлиста рекламы</string>
|
||||||
<string name="add_to_ads_stories_whitelist">Добавить в вайтлист историй</string>
|
<string name="add_to_ads_stories_whitelist">Добавить в вайтлист историй</string>
|
||||||
<string name="remove_from_ads_stories_whitelist">Удалить из вайтлиста историй</string>
|
<string name="remove_from_ads_stories_whitelist">Удалить из вайтлиста историй</string>
|
||||||
<string name="removed_from_whitelist_success">Группа удалена из вайтлиста</string>
|
<string name="removed_from_whitelist_success">Удалено из вайтлиста</string>
|
||||||
<string name="added_to_whitelist_success">Группа добавлена в вайтлист</string>
|
<string name="added_to_whitelist_success">Добавлено в вайтлист</string>
|
||||||
|
|
||||||
<string name="whitelisted_ad_groups_title">Вайтлист рекламы</string>
|
<string name="whitelisted_ad_groups_title">Вайтлист рекламы</string>
|
||||||
<string name="whitelisted_filters_groups_title">Вайтлист фильтров и источников</string>
|
<string name="whitelisted_filters_groups_title">Вайтлист фильтров и источников</string>
|
||||||
@@ -6330,6 +6330,8 @@
|
|||||||
<string name="promotedstickers_title">Не получать промостикеры</string>
|
<string name="promotedstickers_title">Не получать промостикеры</string>
|
||||||
<string name="useOldAppVer_title">Использовать старый дизайн</string>
|
<string name="useOldAppVer_title">Использовать старый дизайн</string>
|
||||||
<string name="useOldAppVer_summ">Работает \"как есть\". Могут быть ошибки</string>
|
<string name="useOldAppVer_summ">Работает \"как есть\". Могут быть ошибки</string>
|
||||||
|
<string name="invertFilters">Инвертировать исключения</string>
|
||||||
|
<string name="invertFilters_summ">Добавленные в исключения группы будут фильтроваться</string>
|
||||||
|
|
||||||
<string name="downloading_update">Скачивание обновления</string>
|
<string name="downloading_update">Скачивание обновления</string>
|
||||||
<string name="sources">Источники</string>
|
<string name="sources">Источники</string>
|
||||||
@@ -6392,6 +6394,7 @@
|
|||||||
|
|
||||||
<string name="datasettings_title">Настройки данных приложения</string>
|
<string name="datasettings_title">Настройки данных приложения</string>
|
||||||
<string name="invalidate_theme_cache_title">Инвалидация кэша темы</string>
|
<string name="invalidate_theme_cache_title">Инвалидация кэша темы</string>
|
||||||
|
<string name="invalidate_theme_cache_each_update_title">Очистка кэша темы после обновления для предотвращения проблем с акцентами</string>
|
||||||
|
|
||||||
<string name="useCustomPrefsStyle_title">Использовать новые переключатели</string>
|
<string name="useCustomPrefsStyle_title">Использовать новые переключатели</string>
|
||||||
<string name="useCustomPrefsStyle_summ">Более современный и стильный вид тумблеров в настройках</string>
|
<string name="useCustomPrefsStyle_summ">Более современный и стильный вид тумблеров в настройках</string>
|
||||||
@@ -6407,4 +6410,8 @@
|
|||||||
|
|
||||||
<string name="compression_types">Способ компрессии фото</string>
|
<string name="compression_types">Способ компрессии фото</string>
|
||||||
<string name="compression_types_selection">Выберите способ компрессии</string>
|
<string name="compression_types_selection">Выберите способ компрессии</string>
|
||||||
|
|
||||||
|
<string name="clear_all_cache">Очистить весь кеш?</string>
|
||||||
|
<string name="cache_size">Размер приложения</string>
|
||||||
|
<string name="cache_size_summ">Вес кеша приложения</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -5576,8 +5576,8 @@
|
|||||||
<string name="onlinefix_title">Обходити онлайн</string>
|
<string name="onlinefix_title">Обходити онлайн</string>
|
||||||
<string name="globalUsersOnline_title">Глобальний обхід онлайну</string>
|
<string name="globalUsersOnline_title">Глобальний обхід онлайну</string>
|
||||||
<string name="globalUsersOnline_summ">Може викликати тривале завантаження розділів і велике споживання трафіку \n\nНе рекомендується включати цю функцію</string>
|
<string name="globalUsersOnline_summ">Може викликати тривале завантаження розділів і велике споживання трафіку \n\nНе рекомендується включати цю функцію</string>
|
||||||
<string name="savemsgsett_title">Зберігати налаштування повідомлень</string>
|
<string name="savemsgsett_title">Зберігати параметри відправки повідомлень</string>
|
||||||
<string name="savemsgsett_summ">Зберігати положення тумблерів у налаштуваннях повідомлень</string>
|
<string name="savemsgsett_summ">Зберігати вибрані параметри статусу вихідних повідомлень як зникнення повідомлень і безшумна відправка</string>
|
||||||
<string name="screenshotdetect_title">Вимкнути виявлення скріншотів</string>
|
<string name="screenshotdetect_title">Вимкнути виявлення скріншотів</string>
|
||||||
<string name="screenshotdetect_summ">Відключити повідомлення про те, що ви зробили скриншот</string>
|
<string name="screenshotdetect_summ">Відключити повідомлення про те, що ви зробили скриншот</string>
|
||||||
<string name="hideDeviceInfo_title">Вимкнути відправку метрики</string>
|
<string name="hideDeviceInfo_title">Вимкнути відправку метрики</string>
|
||||||
@@ -6116,8 +6116,8 @@
|
|||||||
<string name="remove_from_ads_whitelist">Видалити з вайтліста реклами</string>
|
<string name="remove_from_ads_whitelist">Видалити з вайтліста реклами</string>
|
||||||
<string name="add_to_ads_stories_whitelist">Додати до вайтліста історій</string>
|
<string name="add_to_ads_stories_whitelist">Додати до вайтліста історій</string>
|
||||||
<string name="remove_from_ads_stories_whitelist">Видалити з вайтліста історій</string>
|
<string name="remove_from_ads_stories_whitelist">Видалити з вайтліста історій</string>
|
||||||
<string name="removed_from_whitelist_success">Група видалена з вайтліста</string>
|
<string name="removed_from_whitelist_success">Видалена з вайтліста</string>
|
||||||
<string name="added_to_whitelist_success">Група додана до вайтліста</string>
|
<string name="added_to_whitelist_success">Додана до вайтліста</string>
|
||||||
|
|
||||||
<string name="whitelisted_ad_groups_title">Вайтліст реклами</string>
|
<string name="whitelisted_ad_groups_title">Вайтліст реклами</string>
|
||||||
<string name="whitelisted_filters_groups_title">Вайтліст фільтрів та джерел</string>
|
<string name="whitelisted_filters_groups_title">Вайтліст фільтрів та джерел</string>
|
||||||
@@ -6255,6 +6255,8 @@
|
|||||||
<string name="promotedstickers_title">Не отримувати промостикери</string>
|
<string name="promotedstickers_title">Не отримувати промостикери</string>
|
||||||
<string name="useOldAppVer_title">Використовувати старий дизайн</string>
|
<string name="useOldAppVer_title">Використовувати старий дизайн</string>
|
||||||
<string name="useOldAppVer_summ">Працює \"як є\". Можливі помилки</string>
|
<string name="useOldAppVer_summ">Працює \"як є\". Можливі помилки</string>
|
||||||
|
<string name="invertFilters">Інвертувати винятки</string>
|
||||||
|
<string name="invertFilters_summ">Додані в виключення групи будуть фільтруватися</string>
|
||||||
|
|
||||||
<string name="downloading_update">Завантаження оновлення</string>
|
<string name="downloading_update">Завантаження оновлення</string>
|
||||||
<string name="sources">Джерела</string>
|
<string name="sources">Джерела</string>
|
||||||
@@ -6317,6 +6319,7 @@
|
|||||||
|
|
||||||
<string name="datasettings_title">Налаштування даних додатку</string>
|
<string name="datasettings_title">Налаштування даних додатку</string>
|
||||||
<string name="invalidate_theme_cache_title">Інвалідація кешу теми</string>
|
<string name="invalidate_theme_cache_title">Інвалідація кешу теми</string>
|
||||||
|
<string name="invalidate_theme_cache_each_update_title">Очищення кешу теми після оновлення для запобігання проблем з акцентами</string>
|
||||||
|
|
||||||
<string name="useCustomPrefsStyle_title">Використовувати нові перемикачі</string>
|
<string name="useCustomPrefsStyle_title">Використовувати нові перемикачі</string>
|
||||||
<string name="useCustomPrefsStyle_summ">Більш сучасний і стильний вигляд тумблерів у налаштуваннях</string>
|
<string name="useCustomPrefsStyle_summ">Більш сучасний і стильний вигляд тумблерів у налаштуваннях</string>
|
||||||
@@ -6332,4 +6335,8 @@
|
|||||||
|
|
||||||
<string name="compression_types">Спосіб компресії фото</string>
|
<string name="compression_types">Спосіб компресії фото</string>
|
||||||
<string name="compression_types_selection">Виберіть спосіб компресії</string>
|
<string name="compression_types_selection">Виберіть спосіб компресії</string>
|
||||||
|
|
||||||
|
<string name="clear_all_cache">Очистити весь кеш?</string>
|
||||||
|
<string name="cache_size">Розмір програми</string>
|
||||||
|
<string name="cache_size_summ">Вага кеша додатки</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -212,6 +212,11 @@
|
|||||||
<public type="array" name="targetlang_value" id="0x7f030074" />
|
<public type="array" name="targetlang_value" id="0x7f030074" />
|
||||||
<public type="array" name="undel_value" id="0x7f030075" />
|
<public type="array" name="undel_value" id="0x7f030075" />
|
||||||
<public type="array" name="wallpaper_change_dialog" id="0x7f030076" />
|
<public type="array" name="wallpaper_change_dialog" id="0x7f030076" />
|
||||||
|
<public type="array" name="accent_select_type" id="0x7f030077" />
|
||||||
|
<public type="array" name="compression" id="0x7f030078" />
|
||||||
|
<public type="array" name="compression_value" id="0x7f030079" />
|
||||||
|
<public type="array" name="theme_type_name" id="0x7f03007a" />
|
||||||
|
<public type="array" name="theme_type_name_checkbox" id="0x7f03007b" />
|
||||||
<public type="attr" name="BMSB_error_text_color" id="0x7f040000" />
|
<public type="attr" name="BMSB_error_text_color" id="0x7f040000" />
|
||||||
<public type="attr" name="BuyMusicSubscriptionButtonStyle" id="0x7f040001" />
|
<public type="attr" name="BuyMusicSubscriptionButtonStyle" id="0x7f040001" />
|
||||||
<public type="attr" name="PIAlphaNormal" id="0x7f040002" />
|
<public type="attr" name="PIAlphaNormal" id="0x7f040002" />
|
||||||
@@ -2122,6 +2127,7 @@
|
|||||||
<public type="attr" name="zOrderOnTop" id="0x7f040773" />
|
<public type="attr" name="zOrderOnTop" id="0x7f040773" />
|
||||||
<public type="attr" name="im_ic_msgdl" id="0x7f040774" />
|
<public type="attr" name="im_ic_msgdl" id="0x7f040774" />
|
||||||
<public type="attr" name="im_ic_msgreload" id="0x7f040775" />
|
<public type="attr" name="im_ic_msgreload" id="0x7f040775" />
|
||||||
|
<public type="attr" name="im_ic_stats" id="0x7f040776" />
|
||||||
<public type="bool" name="abc_action_bar_embed_tabs" id="0x7f050000" />
|
<public type="bool" name="abc_action_bar_embed_tabs" id="0x7f050000" />
|
||||||
<public type="bool" name="abc_allow_stacked_button_bar" id="0x7f050001" />
|
<public type="bool" name="abc_allow_stacked_button_bar" id="0x7f050001" />
|
||||||
<public type="bool" name="abc_config_actionMenuItemAllCaps" id="0x7f050002" />
|
<public type="bool" name="abc_config_actionMenuItemAllCaps" id="0x7f050002" />
|
||||||
@@ -2138,6 +2144,7 @@
|
|||||||
<public type="bool" name="spb_default_progressiveStart_activated" id="0x7f05000d" />
|
<public type="bool" name="spb_default_progressiveStart_activated" id="0x7f05000d" />
|
||||||
<public type="bool" name="spb_default_reversed" id="0x7f05000e" />
|
<public type="bool" name="spb_default_reversed" id="0x7f05000e" />
|
||||||
<public type="bool" name="vk_is_tablet" id="0x7f05000f" />
|
<public type="bool" name="vk_is_tablet" id="0x7f05000f" />
|
||||||
|
<public type="bool" name="com_samsung_android_icon_container_has_icon_container" id="0x7f050010" />
|
||||||
<public type="color" name="abc_background_cache_hint_selector_material_dark" id="0x7f060000" />
|
<public type="color" name="abc_background_cache_hint_selector_material_dark" id="0x7f060000" />
|
||||||
<public type="color" name="abc_background_cache_hint_selector_material_light" id="0x7f060001" />
|
<public type="color" name="abc_background_cache_hint_selector_material_light" id="0x7f060001" />
|
||||||
<public type="color" name="abc_btn_colored_borderless_text_material" id="0x7f060002" />
|
<public type="color" name="abc_btn_colored_borderless_text_material" id="0x7f060002" />
|
||||||
@@ -2944,6 +2951,7 @@
|
|||||||
<public type="color" name="yellow_sunflower" id="0x7f060324" />
|
<public type="color" name="yellow_sunflower" id="0x7f060324" />
|
||||||
<public type="color" name="iclauncher" id="0x7f060325" />
|
<public type="color" name="iclauncher" id="0x7f060325" />
|
||||||
<public type="color" name="abc_color_highlight_material" id="0x7f060004" />
|
<public type="color" name="abc_color_highlight_material" id="0x7f060004" />
|
||||||
|
<public type="color" name="alpha05" id="0x7f060326" />
|
||||||
<public type="dimen" name="_post_side_padding" id="0x7f070000" />
|
<public type="dimen" name="_post_side_padding" id="0x7f070000" />
|
||||||
<public type="dimen" name="abc_action_bar_content_inset_material" id="0x7f070001" />
|
<public type="dimen" name="abc_action_bar_content_inset_material" id="0x7f070001" />
|
||||||
<public type="dimen" name="abc_action_bar_content_inset_with_nav" id="0x7f070002" />
|
<public type="dimen" name="abc_action_bar_content_inset_with_nav" id="0x7f070002" />
|
||||||
@@ -4944,10 +4952,29 @@
|
|||||||
<public type="drawable" name="ic_deepl_logo_icon" id="0x7f080bcb" />
|
<public type="drawable" name="ic_deepl_logo_icon" id="0x7f080bcb" />
|
||||||
<public type="drawable" name="ic_google_translate_logo" id="0x7f080bcc" />
|
<public type="drawable" name="ic_google_translate_logo" id="0x7f080bcc" />
|
||||||
<public type="drawable" name="ic_yandex_translate_icon" id="0x7f080bd1" />
|
<public type="drawable" name="ic_yandex_translate_icon" id="0x7f080bd1" />
|
||||||
<public type="drawable" name="microsoft" id="0x7f080bd2" />
|
<public type="drawable" name="$splash__0" id="0x7f080bd2" />
|
||||||
<public type="drawable" name="roundmsg" id="0x7f080bd3" />
|
<public type="drawable" name="roundmsg" id="0x7f080bd3" />
|
||||||
<public type="drawable" name="tgs_entry_background" id="0x7f080bd4" />
|
<public type="drawable" name="tgs_entry_background" id="0x7f080bd4" />
|
||||||
<public type="drawable" name="yandex" id="0x7f080bd7" />
|
<public type="drawable" name="yandex" id="0x7f080bd7" />
|
||||||
|
<public type="drawable" name="$splash__1" id="0x7f080bd8" />
|
||||||
|
<public type="drawable" name="$splash__10" id="0x7f080bd9" />
|
||||||
|
<public type="drawable" name="$splash__11" id="0x7f080bda" />
|
||||||
|
<public type="drawable" name="$splash__12" id="0x7f080bdb" />
|
||||||
|
<public type="drawable" name="$splash__13" id="0x7f080bdc" />
|
||||||
|
<public type="drawable" name="$splash__14" id="0x7f080bdd" />
|
||||||
|
<public type="drawable" name="$splash__15" id="0x7f080bde" />
|
||||||
|
<public type="drawable" name="$splash__2" id="0x7f080bdf" />
|
||||||
|
<public type="drawable" name="$splash__3" id="0x7f080be0" />
|
||||||
|
<public type="drawable" name="$splash__4" id="0x7f080be1" />
|
||||||
|
<public type="drawable" name="$splash__5" id="0x7f080be2" />
|
||||||
|
<public type="drawable" name="$splash__6" id="0x7f080be3" />
|
||||||
|
<public type="drawable" name="$splash__7" id="0x7f080be4" />
|
||||||
|
<public type="drawable" name="$splash__8" id="0x7f080be5" />
|
||||||
|
<public type="drawable" name="$splash__9" id="0x7f080be6" />
|
||||||
|
<public type="drawable" name="checker_background" id="0x7f080be8" />
|
||||||
|
<public type="drawable" name="custom_thumb_selector" id="0x7f080be9" />
|
||||||
|
<public type="drawable" name="custom_track_selector" id="0x7f080bea" />
|
||||||
|
<public type="drawable" name="splash" id="0x7f080bec" />
|
||||||
<public type="drawable" name="abc_control_background_material" id="0x7f080032" />
|
<public type="drawable" name="abc_control_background_material" id="0x7f080032" />
|
||||||
<public type="drawable" name="ic_action_close" id="0x7f080322" />
|
<public type="drawable" name="ic_action_close" id="0x7f080322" />
|
||||||
<public type="drawable" name="ic_camera_outline_28_new" id="0x7f0803a0" />
|
<public type="drawable" name="ic_camera_outline_28_new" id="0x7f0803a0" />
|
||||||
@@ -6745,6 +6772,9 @@
|
|||||||
<public type="drawable" name="ic_telegram_24" id="0x7f080bcf" />
|
<public type="drawable" name="ic_telegram_24" id="0x7f080bcf" />
|
||||||
<public type="drawable" name="ic_telegram_outline_28" id="0x7f080bd0" />
|
<public type="drawable" name="ic_telegram_outline_28" id="0x7f080bd0" />
|
||||||
<public type="drawable" name="vtlogo" id="0x7f080bd6" />
|
<public type="drawable" name="vtlogo" id="0x7f080bd6" />
|
||||||
|
<public type="drawable" name="bing" id="0x7f080be7" />
|
||||||
|
<public type="drawable" name="sauceNAO" id="0x7f080beb" />
|
||||||
|
<public type="drawable" name="tracemoe" id="0x7f080bed" />
|
||||||
<public type="drawable" name="bg_music_play_button_white" id="0x7f08015e" />
|
<public type="drawable" name="bg_music_play_button_white" id="0x7f08015e" />
|
||||||
<public type="drawable" name="bg_poll_bg_thumb" id="0x7f080181" />
|
<public type="drawable" name="bg_poll_bg_thumb" id="0x7f080181" />
|
||||||
<public type="drawable" name="bg_stickers_suggestions_left" id="0x7f0801ad" />
|
<public type="drawable" name="bg_stickers_suggestions_left" id="0x7f0801ad" />
|
||||||
@@ -6867,10 +6897,6 @@
|
|||||||
<public type="font" name="vk_sans_text_light" id="0x7f09001a" />
|
<public type="font" name="vk_sans_text_light" id="0x7f09001a" />
|
||||||
<public type="font" name="vk_sans_text_medium" id="0x7f09001b" />
|
<public type="font" name="vk_sans_text_medium" id="0x7f09001b" />
|
||||||
<public type="font" name="vk_sans_text_regular" id="0x7f09001c" />
|
<public type="font" name="vk_sans_text_regular" id="0x7f09001c" />
|
||||||
<public name="color_preview" id="0x7f0a1021" type="id" />
|
|
||||||
<public name="color_name" id="0x7f0a1022" type="id" />
|
|
||||||
<public name="color_value" id="0x7f0a1023" type="id" />
|
|
||||||
<public name="color_preview_border" id="0x7f0a1024" type="id" />
|
|
||||||
<public type="id" name="ALT" id="0x7f0a0000" />
|
<public type="id" name="ALT" id="0x7f0a0000" />
|
||||||
<public type="id" name="CIRCLE" id="0x7f0a0001" />
|
<public type="id" name="CIRCLE" id="0x7f0a0001" />
|
||||||
<public type="id" name="CTRL" id="0x7f0a0002" />
|
<public type="id" name="CTRL" id="0x7f0a0002" />
|
||||||
@@ -11000,6 +11026,12 @@
|
|||||||
<public type="id" name="savedmsg" id="0x7f0a101e" />
|
<public type="id" name="savedmsg" id="0x7f0a101e" />
|
||||||
<public type="id" name="search_photo" id="0x7f0a101f" />
|
<public type="id" name="search_photo" id="0x7f0a101f" />
|
||||||
<public type="id" name="text_hex_wrapper" id="0x7f0a1020" />
|
<public type="id" name="text_hex_wrapper" id="0x7f0a1020" />
|
||||||
|
<public type="id" name="color_preview" id="0x7f0a1021" />
|
||||||
|
<public type="id" name="color_name" id="0x7f0a1022" />
|
||||||
|
<public type="id" name="color_value" id="0x7f0a1023" />
|
||||||
|
<public type="id" name="color_preview_border" id="0x7f0a1024" />
|
||||||
|
<public type="id" name="account_backup_view" id="0x7f0a1025" />
|
||||||
|
<public type="id" name="copy_image" id="0x7f0a1026" />
|
||||||
<public type="integer" name="abc_config_activityDefaultDur" id="0x7f0b0000" />
|
<public type="integer" name="abc_config_activityDefaultDur" id="0x7f0b0000" />
|
||||||
<public type="integer" name="abc_config_activityShortDur" id="0x7f0b0001" />
|
<public type="integer" name="abc_config_activityShortDur" id="0x7f0b0001" />
|
||||||
<public type="integer" name="angle_rtl_180" id="0x7f0b0002" />
|
<public type="integer" name="angle_rtl_180" id="0x7f0b0002" />
|
||||||
@@ -12811,6 +12843,7 @@
|
|||||||
<public type="layout" name="tgs_entry" id="0x7f0d06de" />
|
<public type="layout" name="tgs_entry" id="0x7f0d06de" />
|
||||||
<public type="layout" name="wppreview" id="0x7f0d06df" />
|
<public type="layout" name="wppreview" id="0x7f0d06df" />
|
||||||
<public type="layout" name="write_bar_i" id="0x7f0d06e0" />
|
<public type="layout" name="write_bar_i" id="0x7f0d06e0" />
|
||||||
|
<public type="layout" name="color_picker_item" id="0x7f0d06e1" />
|
||||||
<public type="menu" name="add" id="0x7f0e0000" />
|
<public type="menu" name="add" id="0x7f0e0000" />
|
||||||
<public type="menu" name="attach_item" id="0x7f0e0001" />
|
<public type="menu" name="attach_item" id="0x7f0e0001" />
|
||||||
<public type="menu" name="audio" id="0x7f0e0002" />
|
<public type="menu" name="audio" id="0x7f0e0002" />
|
||||||
@@ -12923,6 +12956,30 @@
|
|||||||
<public type="mipmap" name="vt_changeable_foreground" id="0x7f0f0044" />
|
<public type="mipmap" name="vt_changeable_foreground" id="0x7f0f0044" />
|
||||||
<public type="mipmap" name="vt_launcher" id="0x7f0f0045" />
|
<public type="mipmap" name="vt_launcher" id="0x7f0f0045" />
|
||||||
<public type="mipmap" name="vt_party_foreground" id="0x7f0f0047" />
|
<public type="mipmap" name="vt_party_foreground" id="0x7f0f0047" />
|
||||||
|
<public type="mipmap" name="ic_launcher_balloon_pink" id="0x7f0f0048" />
|
||||||
|
<public type="mipmap" name="ic_launcher_balloon_pink_background" id="0x7f0f0049" />
|
||||||
|
<public type="mipmap" name="ic_launcher_balloon_pink_foreground" id="0x7f0f004a" />
|
||||||
|
<public type="mipmap" name="ic_launcher_bubble_gum" id="0x7f0f004b" />
|
||||||
|
<public type="mipmap" name="ic_launcher_bubble_gum_background" id="0x7f0f004c" />
|
||||||
|
<public type="mipmap" name="ic_launcher_bubble_gum_foreground" id="0x7f0f004d" />
|
||||||
|
<public type="mipmap" name="ic_launcher_comics" id="0x7f0f004e" />
|
||||||
|
<public type="mipmap" name="ic_launcher_comics_background" id="0x7f0f004f" />
|
||||||
|
<public type="mipmap" name="ic_launcher_comics_foreground" id="0x7f0f0050" />
|
||||||
|
<public type="mipmap" name="ic_launcher_flowers" id="0x7f0f0051" />
|
||||||
|
<public type="mipmap" name="ic_launcher_flowers_background" id="0x7f0f0052" />
|
||||||
|
<public type="mipmap" name="ic_launcher_flowers_foreground" id="0x7f0f0053" />
|
||||||
|
<public type="mipmap" name="ic_launcher_metal_dark" id="0x7f0f0054" />
|
||||||
|
<public type="mipmap" name="ic_launcher_metal_dark_background" id="0x7f0f0055" />
|
||||||
|
<public type="mipmap" name="ic_launcher_metal_dark_foreground" id="0x7f0f0056" />
|
||||||
|
<public type="mipmap" name="ic_launcher_pin_blue" id="0x7f0f0057" />
|
||||||
|
<public type="mipmap" name="ic_launcher_pin_blue_background" id="0x7f0f0058" />
|
||||||
|
<public type="mipmap" name="ic_launcher_pin_blue_foreground" id="0x7f0f0059" />
|
||||||
|
<public type="mipmap" name="ic_launcher_rabbit" id="0x7f0f005a" />
|
||||||
|
<public type="mipmap" name="ic_launcher_rabbit_background" id="0x7f0f005b" />
|
||||||
|
<public type="mipmap" name="ic_launcher_rabbit_foreground" id="0x7f0f005c" />
|
||||||
|
<public type="mipmap" name="ic_launcher_shine" id="0x7f0f005d" />
|
||||||
|
<public type="mipmap" name="ic_launcher_shine_background" id="0x7f0f005e" />
|
||||||
|
<public type="mipmap" name="ic_launcher_shine_foreground" id="0x7f0f005f" />
|
||||||
<public type="mipmap" name="vt_adaptive_launcher_foneground" id="0x7f0f0043" />
|
<public type="mipmap" name="vt_adaptive_launcher_foneground" id="0x7f0f0043" />
|
||||||
<public type="mipmap" name="vt_launcher_round" id="0x7f0f0046" />
|
<public type="mipmap" name="vt_launcher_round" id="0x7f0f0046" />
|
||||||
<public type="mipmap" name="ic_logo_facebook_28" id="0x7f0f0003" />
|
<public type="mipmap" name="ic_logo_facebook_28" id="0x7f0f0003" />
|
||||||
@@ -19465,6 +19522,88 @@
|
|||||||
<public type="string" name="whitelisted_filters_groups_title" id="0x7f121838" />
|
<public type="string" name="whitelisted_filters_groups_title" id="0x7f121838" />
|
||||||
<public type="string" name="why_news_not_updated_summ" id="0x7f121839" />
|
<public type="string" name="why_news_not_updated_summ" id="0x7f121839" />
|
||||||
<public type="string" name="why_news_not_updated_title" id="0x7f12183a" />
|
<public type="string" name="why_news_not_updated_title" id="0x7f12183a" />
|
||||||
|
<public type="string" name="accent_color_summ" id="0x7f12183b" />
|
||||||
|
<public type="string" name="accent_color_title" id="0x7f12183c" />
|
||||||
|
<public type="string" name="accents" id="0x7f12183d" />
|
||||||
|
<public type="string" name="accounts_saved_by_path" id="0x7f12183e" />
|
||||||
|
<public type="string" name="add_to_ads_stories_whitelist" id="0x7f12183f" />
|
||||||
|
<public type="string" name="amoledtheme_summ" id="0x7f121840" />
|
||||||
|
<public type="string" name="amoledtheme_title" id="0x7f121841" />
|
||||||
|
<public type="string" name="appLanguage" id="0x7f121842" />
|
||||||
|
<public type="string" name="app_open_by_default_settings" id="0x7f121843" />
|
||||||
|
<public type="string" name="applying_accent" id="0x7f121844" />
|
||||||
|
<public type="string" name="audio_deleted_from_cache" id="0x7f121845" />
|
||||||
|
<public type="string" name="blockminiapps_summ" id="0x7f121846" />
|
||||||
|
<public type="string" name="blockminiapps_title" id="0x7f121847" />
|
||||||
|
<public type="string" name="businessDisabler_title" id="0x7f121848" />
|
||||||
|
<public type="string" name="by_choice" id="0x7f121849" />
|
||||||
|
<public type="string" name="calls_not_available" id="0x7f12184a" />
|
||||||
|
<public type="string" name="cannot_write" id="0x7f12184b" />
|
||||||
|
<public type="string" name="change_accent_color" id="0x7f12184c" />
|
||||||
|
<public type="string" name="compression_types" id="0x7f12184d" />
|
||||||
|
<public type="string" name="compression_types_selection" id="0x7f12184e" />
|
||||||
|
<public type="string" name="copydebuginfo_summ" id="0x7f12184f" />
|
||||||
|
<public type="string" name="copydebuginfo_title" id="0x7f121850" />
|
||||||
|
<public type="string" name="copyownlink_summ" id="0x7f121851" />
|
||||||
|
<public type="string" name="copyownlink_title" id="0x7f121852" />
|
||||||
|
<public type="string" name="crash_service_name" id="0x7f121853" />
|
||||||
|
<public type="string" name="currentLanguage" id="0x7f121854" />
|
||||||
|
<public type="string" name="current_theme" id="0x7f121855" />
|
||||||
|
<public type="string" name="custom_links_warning" id="0x7f121856" />
|
||||||
|
<public type="string" name="data" id="0x7f121857" />
|
||||||
|
<public type="string" name="data_updated" id="0x7f121858" />
|
||||||
|
<public type="string" name="datasettings_title" id="0x7f121859" />
|
||||||
|
<public type="string" name="device_info" id="0x7f12185a" />
|
||||||
|
<public type="string" name="device_info_copied" id="0x7f12185b" />
|
||||||
|
<public type="string" name="dialogstats" id="0x7f12185c" />
|
||||||
|
<public type="string" name="disable_analytics" id="0x7f12185d" />
|
||||||
|
<public type="string" name="disable_analytics_summ" id="0x7f12185e" />
|
||||||
|
<public type="string" name="downloading_update" id="0x7f12185f" />
|
||||||
|
<public type="string" name="error_applying_accent" id="0x7f121860" />
|
||||||
|
<public type="string" name="error_no_text" id="0x7f121861" />
|
||||||
|
<public type="string" name="error_saving_file" id="0x7f121862" />
|
||||||
|
<public type="string" name="failed_to_get_text" id="0x7f121863" />
|
||||||
|
<public type="string" name="invalid_pack_link" id="0x7f121864" />
|
||||||
|
<public type="string" name="invalidate_theme_cache_title" id="0x7f121865" />
|
||||||
|
<public type="string" name="logColors_title" id="0x7f121866" />
|
||||||
|
<public type="string" name="maxquality_summ" id="0x7f121867" />
|
||||||
|
<public type="string" name="maxquality_title" id="0x7f121868" />
|
||||||
|
<public type="string" name="microgsett" id="0x7f121869" />
|
||||||
|
<public type="string" name="monettheme_summ" id="0x7f12186a" />
|
||||||
|
<public type="string" name="monettheme_title" id="0x7f12186b" />
|
||||||
|
<public type="string" name="newsfeed_notif_summ" id="0x7f12186c" />
|
||||||
|
<public type="string" name="newsfeed_notif_title" id="0x7f12186d" />
|
||||||
|
<public type="string" name="open_bot" id="0x7f12186e" />
|
||||||
|
<public type="string" name="promotedstickers_title" id="0x7f12186f" />
|
||||||
|
<public type="string" name="remove_encryption_key" id="0x7f121870" />
|
||||||
|
<public type="string" name="remove_from_ads_stories_whitelist" id="0x7f121871" />
|
||||||
|
<public type="string" name="reset_accounts" id="0x7f121872" />
|
||||||
|
<public type="string" name="reset_all_settings" id="0x7f121873" />
|
||||||
|
<public type="string" name="restore_accounts" id="0x7f121874" />
|
||||||
|
<public type="string" name="restore_settings" id="0x7f121875" />
|
||||||
|
<public type="string" name="save_accounts" id="0x7f121876" />
|
||||||
|
<public type="string" name="save_online_data" id="0x7f121877" />
|
||||||
|
<public type="string" name="select_color" id="0x7f121878" />
|
||||||
|
<public type="string" name="select_palette" id="0x7f121879" />
|
||||||
|
<public type="string" name="sources" id="0x7f12187a" />
|
||||||
|
<public type="string" name="storiesGroupsAdBlock" id="0x7f12187b" />
|
||||||
|
<public type="string" name="storiesGroupsAdBlocksummary" id="0x7f12187c" />
|
||||||
|
<public type="string" name="systemtheme" id="0x7f12187d" />
|
||||||
|
<public type="string" name="systemtheme_enabled" id="0x7f12187e" />
|
||||||
|
<public type="string" name="systemtheme_summ" id="0x7f12187f" />
|
||||||
|
<public type="string" name="updateverifdata_summ" id="0x7f121880" />
|
||||||
|
<public type="string" name="updateverifdata_title" id="0x7f121881" />
|
||||||
|
<public type="string" name="useCustomPrefsStyle_summ" id="0x7f121882" />
|
||||||
|
<public type="string" name="useCustomPrefsStyle_title" id="0x7f121883" />
|
||||||
|
<public type="string" name="useGenius_summ" id="0x7f121884" />
|
||||||
|
<public type="string" name="useGenius_title" id="0x7f121885" />
|
||||||
|
<public type="string" name="useNewColorEngine_summ" id="0x7f121886" />
|
||||||
|
<public type="string" name="useNewColorEngine_title" id="0x7f121887" />
|
||||||
|
<public type="string" name="useOldAppVer_summ" id="0x7f121888" />
|
||||||
|
<public type="string" name="useOldAppVer_title" id="0x7f121889" />
|
||||||
|
<public type="string" name="vkx_integration_enabled_info" id="0x7f12188a" />
|
||||||
|
<public type="string" name="whitelisted_ad_groups_stories_title" id="0x7f12188b" />
|
||||||
|
<public type="string" name="writebar_ios_title" id="0x7f12188c" />
|
||||||
<public type="style" name="ActionBarGrayTheme" id="0x7f130000" />
|
<public type="style" name="ActionBarGrayTheme" id="0x7f130000" />
|
||||||
<public type="style" name="ActionBarProgress" id="0x7f130001" />
|
<public type="style" name="ActionBarProgress" id="0x7f130001" />
|
||||||
<public type="style" name="ActionBarSpinner" id="0x7f130002" />
|
<public type="style" name="ActionBarSpinner" id="0x7f130002" />
|
||||||
@@ -20606,6 +20745,24 @@
|
|||||||
<public type="style" name="Base.V26.Widget.AppCompat.Toolbar" id="0x7f1300a1" />
|
<public type="style" name="Base.V26.Widget.AppCompat.Toolbar" id="0x7f1300a1" />
|
||||||
<public type="style" name="Base.V28.Theme.AppCompat" id="0x7f1300a2" />
|
<public type="style" name="Base.V28.Theme.AppCompat" id="0x7f1300a2" />
|
||||||
<public type="style" name="Base.V28.Theme.AppCompat.Light" id="0x7f1300a3" />
|
<public type="style" name="Base.V28.Theme.AppCompat.Light" id="0x7f1300a3" />
|
||||||
|
<public type="style" name="Vk.Theme.VkApp.amoled_monet_generated" id="0x7f130475" />
|
||||||
|
<public type="style" name="Vk.Theme.VkApp.amoled_monet_old_generated" id="0x7f130476" />
|
||||||
|
<public type="style" name="Vk.Theme.VkApp.bright_light_monet_generated" id="0x7f130477" />
|
||||||
|
<public type="style" name="Vk.Theme.VkApp.client_dark_monet_generated" id="0x7f130478" />
|
||||||
|
<public type="style" name="Vk.Theme.VkApp.client_light_monet_generated" id="0x7f130479" />
|
||||||
|
<public type="style" name="Vk.Theme.VkApp.space_gray_monet_generated" id="0x7f13047a" />
|
||||||
|
<public type="style" name="VkAmoledMonetStyle" id="0x7f13047b" />
|
||||||
|
<public type="style" name="VkAmoledMonetTheme" id="0x7f13047c" />
|
||||||
|
<public type="style" name="VkDarkMonetStyle" id="0x7f13047d" />
|
||||||
|
<public type="style" name="VkDarkMonetTheme" id="0x7f13047e" />
|
||||||
|
<public type="style" name="VkLightMonetStyle" id="0x7f13047f" />
|
||||||
|
<public type="style" name="VkLightMonetTheme" id="0x7f130480" />
|
||||||
|
<public type="style" name="VkMilkAmoledMonetStyle" id="0x7f130481" />
|
||||||
|
<public type="style" name="VkMilkAmoledMonetTheme" id="0x7f130482" />
|
||||||
|
<public type="style" name="VkMilkDarkMonetStyle" id="0x7f130483" />
|
||||||
|
<public type="style" name="VkMilkDarkMonetTheme" id="0x7f130484" />
|
||||||
|
<public type="style" name="VkMilkLightMonetStyle" id="0x7f130485" />
|
||||||
|
<public type="style" name="VkMilkLightMonetTheme" id="0x7f130486" />
|
||||||
<public type="xml" name="account_preferences" id="0x7f150000" />
|
<public type="xml" name="account_preferences" id="0x7f150000" />
|
||||||
<public type="xml" name="authenticator" id="0x7f150001" />
|
<public type="xml" name="authenticator" id="0x7f150001" />
|
||||||
<public type="xml" name="contacts_custom_type" id="0x7f150002" />
|
<public type="xml" name="contacts_custom_type" id="0x7f150002" />
|
||||||
@@ -20637,4 +20794,5 @@
|
|||||||
<public type="xml" name="preferences_proxy" id="0x7f15001c" />
|
<public type="xml" name="preferences_proxy" id="0x7f15001c" />
|
||||||
<public type="xml" name="preferences_tgs" id="0x7f15001d" />
|
<public type="xml" name="preferences_tgs" id="0x7f15001d" />
|
||||||
<public type="xml" name="preferences_themes" id="0x7f15001e" />
|
<public type="xml" name="preferences_themes" id="0x7f15001e" />
|
||||||
|
<public type="xml" name="locales_config" id="0x7f15001f" />
|
||||||
</resources>
|
</resources>
|
||||||
@@ -5783,8 +5783,8 @@ You need to restart the application to apply proxy settings"</string>
|
|||||||
<string name="onlinefix_title">Bypass online indicator</string>
|
<string name="onlinefix_title">Bypass online indicator</string>
|
||||||
<string name="globalUsersOnline_title">Global online bypass</string>
|
<string name="globalUsersOnline_title">Global online bypass</string>
|
||||||
<string name="globalUsersOnline_summ">May cause slow partition loading and high traffic consumption \n\nIt is not recommended to enable this feature</string>
|
<string name="globalUsersOnline_summ">May cause slow partition loading and high traffic consumption \n\nIt is not recommended to enable this feature</string>
|
||||||
<string name="savemsgsett_title">Save message settings</string>
|
<string name="savemsgsett_title">Save message sending parameters</string>
|
||||||
<string name="savemsgsett_summ">Save the position of the toggle switches in the message settings</string>
|
<string name="savemsgsett_summ">Save selected outgoing message status parameters like message disappearing and silent sending</string>
|
||||||
<string name="screenshotdetect_title">Disable screenshot detection</string>
|
<string name="screenshotdetect_title">Disable screenshot detection</string>
|
||||||
<string name="screenshotdetect_summ">Turn off the notification that you took a screenshot</string>
|
<string name="screenshotdetect_summ">Turn off the notification that you took a screenshot</string>
|
||||||
<string name="hideDeviceInfo_title">Disable sending metric</string>
|
<string name="hideDeviceInfo_title">Disable sending metric</string>
|
||||||
@@ -6329,8 +6329,8 @@ May look like a fake leaving the online"</string>
|
|||||||
<string name="remove_from_ads_stories_whitelist">Remove from stories whitelist</string>
|
<string name="remove_from_ads_stories_whitelist">Remove from stories whitelist</string>
|
||||||
<string name="add_to_ads_whitelist">Add to ads stories whitelist</string>
|
<string name="add_to_ads_whitelist">Add to ads stories whitelist</string>
|
||||||
<string name="remove_from_ads_whitelist">Remove from ads stories whitelist</string>
|
<string name="remove_from_ads_whitelist">Remove from ads stories whitelist</string>
|
||||||
<string name="removed_from_whitelist_success">Group removed from whitelist</string>
|
<string name="removed_from_whitelist_success">Removed from whitelist</string>
|
||||||
<string name="added_to_whitelist_success">Group added to whitelist</string>
|
<string name="added_to_whitelist_success">Added to whitelist</string>
|
||||||
|
|
||||||
<string name="whitelisted_ad_groups_title">Ads whitelist</string>
|
<string name="whitelisted_ad_groups_title">Ads whitelist</string>
|
||||||
<string name="whitelisted_filters_groups_title">Filters whitelist and copyrights</string>
|
<string name="whitelisted_filters_groups_title">Filters whitelist and copyrights</string>
|
||||||
@@ -6468,6 +6468,8 @@ May look like a fake leaving the online"</string>
|
|||||||
<string name="promotedstickers_title">Don\'t receive promoted stickers</string>
|
<string name="promotedstickers_title">Don\'t receive promoted stickers</string>
|
||||||
<string name="useOldAppVer_title">Use old music catalog</string>
|
<string name="useOldAppVer_title">Use old music catalog</string>
|
||||||
<string name="useOldAppVer_summ">Works \"as is\". There may be errors</string>
|
<string name="useOldAppVer_summ">Works \"as is\". There may be errors</string>
|
||||||
|
<string name="invertFilters">Invert exceptions</string>
|
||||||
|
<string name="invertFilters_summ">Groups added to exceptions will be filtered</string>
|
||||||
|
|
||||||
<string name="downloading_update">Downloading update</string>
|
<string name="downloading_update">Downloading update</string>
|
||||||
<string name="sources">Sources</string>
|
<string name="sources">Sources</string>
|
||||||
@@ -6530,6 +6532,7 @@ May look like a fake leaving the online"</string>
|
|||||||
|
|
||||||
<string name="datasettings_title">Application data settings</string>
|
<string name="datasettings_title">Application data settings</string>
|
||||||
<string name="invalidate_theme_cache_title">Invalidate theme cache</string>
|
<string name="invalidate_theme_cache_title">Invalidate theme cache</string>
|
||||||
|
<string name="invalidate_theme_cache_each_update_title">Clear theme cache after update to prevent problems with accents</string>
|
||||||
|
|
||||||
<string name="useCustomPrefsStyle_title">Use new switches</string>
|
<string name="useCustomPrefsStyle_title">Use new switches</string>
|
||||||
<string name="useCustomPrefsStyle_summ">More modern and stylish toggle switches in settings</string>
|
<string name="useCustomPrefsStyle_summ">More modern and stylish toggle switches in settings</string>
|
||||||
@@ -6545,4 +6548,8 @@ May look like a fake leaving the online"</string>
|
|||||||
|
|
||||||
<string name="compression_types">Photo compression method</string>
|
<string name="compression_types">Photo compression method</string>
|
||||||
<string name="compression_types_selection">Choose the compression method</string>
|
<string name="compression_types_selection">Choose the compression method</string>
|
||||||
|
|
||||||
|
<string name="clear_all_cache">Clear all cache?</string>
|
||||||
|
<string name="cache_size">App size</string>
|
||||||
|
<string name="cache_size_summ">Cache size</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -89,6 +89,16 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:key="whitelisted_filters_groups"
|
android:key="whitelisted_filters_groups"
|
||||||
android:title="@string/whitelisted_filters_groups_title"/>
|
android:title="@string/whitelisted_filters_groups_title"/>
|
||||||
|
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="invertFilters"
|
||||||
|
android:summary="@string/invertFilters_summ"
|
||||||
|
android:title="@string/invertFilters"/>
|
||||||
|
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="blockminiapps"
|
||||||
|
android:summary="@string/blockminiapps_summ"
|
||||||
|
android:title="@string/blockminiapps_title"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/sources">
|
<PreferenceCategory android:title="@string/sources">
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
@@ -141,20 +151,15 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:key="newsfeedlistmanager_reset"
|
android:key="newsfeedlistmanager_reset"
|
||||||
android:title="@string/newsfeedlistmanager_reset_title"/>
|
android:title="@string/newsfeedlistmanager_reset_title"/>
|
||||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
<!-- <com.vtosters.lite.ui.MaterialSwitchPreference-->
|
||||||
android:defaultValue="false"
|
<!-- android:defaultValue="false"-->
|
||||||
android:key="force_disable_psm"
|
<!-- android:key="force_disable_psm"-->
|
||||||
android:summary="@string/force_disable_psm_summ"
|
<!-- android:summary="@string/force_disable_psm_summ"-->
|
||||||
android:title="@string/force_disable_psm_title"/>
|
<!-- android:title="@string/force_disable_psm_title"/>-->
|
||||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="feedcache"
|
android:key="feedcache"
|
||||||
android:summary="@string/feed_other_cache_summary"
|
android:summary="@string/feed_other_cache_summary"
|
||||||
android:title="@string/vtlfeedcache"/>
|
android:title="@string/vtlfeedcache"/>
|
||||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="blockminiapps"
|
|
||||||
android:summary="@string/blockminiapps_summ"
|
|
||||||
android:title="@string/blockminiapps_title"/>
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -4,12 +4,6 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:key="datasettings"
|
android:key="datasettings"
|
||||||
android:title="@string/datasettings_title"/>
|
android:title="@string/datasettings_title"/>
|
||||||
<Preference
|
|
||||||
android:key="clearcache"
|
|
||||||
android:title="@string/clearcache_other_title"/>
|
|
||||||
<Preference
|
|
||||||
android:key="autoclearcache"
|
|
||||||
android:title="@string/autoclearcache"/>
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/other_fix_app">
|
<PreferenceCategory android:title="@string/other_fix_app">
|
||||||
<Preference
|
<Preference
|
||||||
|
|||||||
@@ -7,6 +7,11 @@
|
|||||||
android:summary="@string/accent_color_summ"
|
android:summary="@string/accent_color_summ"
|
||||||
android:icon="@drawable/bg_accent_circle"
|
android:icon="@drawable/bg_accent_circle"
|
||||||
android:title="@string/accent_color_title"/>
|
android:title="@string/accent_color_title"/>
|
||||||
|
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="invalidate_theme_cache_each_update"
|
||||||
|
android:summary="@string/invalidate_theme_cache_each_update_title"
|
||||||
|
android:title="@string/invalidate_theme_cache_title"/>
|
||||||
<Preference
|
<Preference
|
||||||
android:key="invalidate_theme_cache"
|
android:key="invalidate_theme_cache"
|
||||||
android:title="@string/invalidate_theme_cache_title" />
|
android:title="@string/invalidate_theme_cache_title" />
|
||||||
@@ -84,10 +89,5 @@
|
|||||||
android:key="VKUI_INJ"
|
android:key="VKUI_INJ"
|
||||||
android:summary="@string/appearance_other_color_webview_summary"
|
android:summary="@string/appearance_other_color_webview_summary"
|
||||||
android:title="@string/vkuiinj"/>
|
android:title="@string/vkuiinj"/>
|
||||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="useNewColorEngine"
|
|
||||||
android:summary="@string/useNewColorEngine_summ"
|
|
||||||
android:title="@string/useNewColorEngine_title"/>
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
@@ -43,9 +43,9 @@
|
|||||||
# .line 4
|
# .line 4
|
||||||
# array-length v1, p1
|
# array-length v1, p1
|
||||||
#
|
#
|
||||||
# const/4 v2, 0x0
|
const/4 v2, 0x0
|
||||||
#
|
|
||||||
# const/4 v3, 0x0
|
const/4 v3, 0x0
|
||||||
#
|
#
|
||||||
# :goto_0
|
# :goto_0
|
||||||
# if-ge v3, v1, :cond_0
|
# if-ge v3, v1, :cond_0
|
||||||
|
|||||||