Merge branch 'main' into feat/app_pin

This commit is contained in:
gdlbo
2023-03-25 22:08:20 +03:00
committed by GitHub
223 changed files with 2463 additions and 2883 deletions
+2 -1
View File
@@ -42,7 +42,8 @@ jobs:
- name: Build VTLite
run: |
gradle prepareDexForMerge
gradle generateBuildTasks
gradle prepareDexForMergeDev
java -jar scripts/apktool.jar b smali -o smali/VTLite.apk --use-aapt2 -p scripts/framework/
zipalign -p -f 4 smali/VTLite.apk smali/VTLite.apk_aligned
mv smali/VTLite.apk_aligned smali/VTLite.apk
+136 -110
View File
@@ -30,61 +30,6 @@ task cleanVersionFile {
projectDir.toPath().resolve("src/main/assets/version.properties").toFile().delete()
}
task exportDex {
doLast {
try {
File moduleDir = projectDir
ZipInputStream inputStream = new ZipInputStream(new FileInputStream(moduleDir.getAbsolutePath() + "/build/outputs/apk/release/app-release-unsigned.apk"))
ZipFile file = new ZipFile(moduleDir.getAbsolutePath() + "/build/outputs/apk/release/app-release-unsigned.apk");
ZipEntry entry
while ((entry = inputStream.nextEntry) != null) {
if (entry.getName().equals("classes.dex")) {
print('classes.dex found!')
FileOutputStream output = new FileOutputStream(new File(moduleDir.getAbsoluteFile(), "classes6.dex"))
byte[] buffer = new byte[1024]
int len = 0
while ((len = inputStream.read(buffer)) > 0) {
output.write(buffer, 0, len)
}
output.close()
}
if (entry.getName().equals("classes2.dex")) {
print('\nclasses2.dex found!')
FileOutputStream output = new FileOutputStream(new File(moduleDir.getAbsoluteFile(), "classes7.dex"))
byte[] buffer = new byte[1024]
int len = 0
while ((len = inputStream.read(buffer)) > 0) {
output.write(buffer, 0, len)
}
output.close()
}
}
for (ZipEntry e : Collections.list(file.entries())) {
if (e.getName().endsWith("assets/version.properties")) {
var is = file.getInputStream(e)
FileOutputStream output = new FileOutputStream(new File(moduleDir.getAbsoluteFile(), "version.properties"))
byte[] buffer = new byte[1024]
int len = 0
while ((len = is.read(buffer)) > 0) {
output.write(buffer, 0, len)
}
output.close()
print('\nversion.properties found!')
}
}
} catch (Exception e) {
e.printStackTrace()
}
}
}
android {
compileSdkVersion 32
buildToolsVersion '32.0.0'
@@ -104,6 +49,20 @@ android {
multiDexEnabled true
}
buildTypes {
dev {
initWith release
buildConfigField 'String', 'APPCENTER_KEY', '""'
}
beta {
initWith release
buildConfigField 'String', 'APPCENTER_KEY', '""'
}
release {
buildConfigField 'String', 'APPCENTER_KEY', '""'
}
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_14
@@ -114,6 +73,8 @@ android {
}
dependencies {
implementation "com.microsoft.appcenter:appcenter-analytics:5.0.0"
implementation "com.microsoft.appcenter:appcenter-crashes:5.0.0"
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation 'net.sourceforge.streamsupport:streamsupport-minifuture:1.7.4'
implementation fileTree(dir: 'libs', include: ['*.aar'])
@@ -121,63 +82,129 @@ dependencies {
implementation 'com.google.guava:guava:23.3-android'
}
task prepareDexForMerge(type: Copy) {
dependsOn('exportDex')
// Remove comment for native lib build
dependsOn('cargoBuild')
into smaliFolder.toString()
from(projectDir) {
include 'classes6.dex'
include 'classes7.dex'
}
from(projectDir) {
include 'version.properties'
into 'assets'
}
// Remove comment for native lib build
from('../native-effects/target/aarch64-linux-android/release'){
include 'libnative_effects.so'
into 'lib/arm64-v8a'
}
from('../native-effects/target/armv7-linux-androideabi/release'){
include 'libnative_effects.so'
into 'lib/armeabi-v7a'
}
doLast {
new File(projectDir, "classes6.dex").delete()
new File(projectDir, "classes7.dex").delete()
new File(projectDir, "version.properties").delete()
task generateBuildTasks() {
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def buildType = output.name.toString().capitalize()
def lowerBuildType = buildType.toLowerCase()
task "exportDex$buildType"() {
dependsOn('assemble' + buildType)
doLast {
try {
var z = ""
if (lowerBuildType != "debug") {
z = "-unsigned"
}
File moduleDir = projectDir
ZipInputStream inputStream = new ZipInputStream(new FileInputStream(moduleDir.getAbsolutePath() + "/build/outputs/apk/$lowerBuildType/app-$lowerBuildType${z}.apk"))
ZipFile file = new ZipFile(moduleDir.getAbsolutePath() + "/build/outputs/apk/$lowerBuildType/app-$lowerBuildType${z}.apk");
ZipEntry entry
while ((entry = inputStream.nextEntry) != null) {
if (entry.getName().equals("classes.dex")) {
print('classes.dex found!')
FileOutputStream outputStream = new FileOutputStream(new File(moduleDir.getAbsoluteFile(), "classes6.dex"))
byte[] buffer = new byte[1024]
int len = 0
while ((len = inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, len)
}
outputStream.close()
}
if (entry.getName().equals("classes2.dex")) {
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) {
e.printStackTrace()
}
}
}
task "prepareDexForMerge$buildType"(type: Copy) {
dependsOn('exportDex' + buildType)
// Remove comment for native lib build
dependsOn('cargoBuild')
into smaliFolder.toString()
from(projectDir) {
include 'classes6.dex'
include 'classes7.dex'
}
from(projectDir) {
include 'version.properties'
into 'assets'
}
// Remove comment for native lib build
from('../native-effects/target/aarch64-linux-android/release'){
include 'libnative_effects.so'
into 'lib/arm64-v8a'
}
from('../native-effects/target/armv7-linux-androideabi/release'){
include 'libnative_effects.so'
into 'lib/armeabi-v7a'
}
doLast {
new File(projectDir, "classes6.dex").delete()
new File(projectDir, "classes7.dex").delete()
new File(projectDir, "version.properties").delete()
}
}
task "buildVTL$buildType"(type: Exec) {
dependsOn('prepareDexForMerge' + buildType)
workingDir(projectDir.parentFile)
if (Os.isFamily("unix") || Os.isFamily("mac")) {
commandLine 'bash', '-c', './scripts/build.sh'
} else {
commandLine 'cmd', '/C', '.\\scripts\\build.bat'
}
}
task "buildAndInstallVTL$buildType"(type: Exec) {
dependsOn('buildVTL' + buildType)
workingDir(scriptsFolder.toString())
ignoreExitValue true
if (Os.isFamily("unix") || Os.isFamily("mac")) {
commandLine 'bash', '-c', 'adb install VTLite.apk'
} else {
commandLine 'adb', 'install', 'VTLite.apk'
}
}
task "buildAndLaunchVTL$buildType"(type: Exec) {
dependsOn('buildAndInstallVTL' + buildType)
if (Os.isFamily("unix") || Os.isFamily("mac"))
commandLine 'bash', '-c', 'adb shell monkey -p com.vtosters.lite -c android.intent.category.LAUNCHER 1'
else
commandLine 'adb', 'shell', 'monkey', '-p', 'com.vtosters.lite', '-c', 'android.intent.category.LAUNCHER', '1'
}
}
}
}
task buildVTL(type: Exec) {
dependsOn('prepareDexForMerge')
workingDir(projectDir.parentFile)
if (Os.isFamily("unix") || Os.isFamily("mac")) {
commandLine 'bash', '-c', './scripts/build.sh'
} else {
commandLine 'cmd', '/C', '.\\scripts\\build.bat'
}
}
task buildAndInstallVTL(type: Exec) {
dependsOn('buildVTL')
workingDir(scriptsFolder.toString())
ignoreExitValue true
if (Os.isFamily("unix") || Os.isFamily("mac")) {
commandLine 'bash', '-c', 'adb install VTLite.apk'
} else {
commandLine 'adb', 'install', 'VTLite.apk'
}
}
task buildAndLaunchVTL(type: Exec) {
dependsOn('buildAndInstallVTL')
if (Os.isFamily("unix") || Os.isFamily("mac"))
commandLine 'bash', '-c', 'adb shell monkey -p com.vtosters.lite -c android.intent.category.LAUNCHER 1'
else
commandLine 'adb', 'shell', 'monkey', '-p', 'com.vtosters.lite', '-c', 'android.intent.category.LAUNCHER', '1'
}
task generateRjava(type: Exec) {
workingDir(projectDir.parentFile)
@@ -187,7 +214,6 @@ task generateRjava(type: Exec) {
commandLine "cmd", "/C", ".\\scripts\\rclass_regenerator.sh"
}
exportDex.dependsOn('assembleRelease')
clean.dependsOn('cleanVersionFile')
versionFile.dependsOn('cleanVersionFile')
preBuild.dependsOn('versionFile')
@@ -0,0 +1,128 @@
package com.vk.core.extensions;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.AttrRes;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import b.h.v.InitialValueObservable;
import b.h.v.TextViewTextChangeEvent;
import b.h.v.TextViewTextChangeEventObservable;
import com.vk.core.util.ContextExtKt;
import ru.vtosters.lite.utils.ThemesUtils;
public final class TextViewExt {
public static void a(TextView textView, Drawable drawable) {
a(textView, null, drawable);
}
public static boolean b(TextView textView) {
return textView == null || TextUtils.isEmpty(textView.getEditableText());
}
public static InitialValueObservable<TextViewTextChangeEvent> c(TextView textView) {
return new TextViewTextChangeEventObservable(textView);
}
public static void d(TextView textView, @DrawableRes int i, @AttrRes int i2) {
b(textView, ThemesUtils.recolorDrawable(ContextExtKt.a(textView.getContext(), i, ContextExtKt.h(textView.getContext(), i2))));
}
public static void a(TextView textView, Drawable drawable, ColorStateList colorStateList) {
a(textView, null, a(drawable, colorStateList));
}
public static void b(TextView textView, Drawable drawable) {
a(textView, drawable, (Drawable) null);
}
public static void c(TextView textView, @DrawableRes int i, @ColorRes int i2) {
if (i == 0) {
b(textView, null);
} else if (i2 == 0) {
b(textView, ContextCompat.getDrawable(textView.getContext(), i));
} else {
b(textView, ContextCompat.getDrawable(textView.getContext(), i), ContextCompat.getColorStateList(textView.getContext(), i2));
}
}
public static void d(TextView textView, int i) {
textView.setTextSize(0, i);
}
public static void a(TextView textView, @DrawableRes int i) {
a(textView, i, 0);
}
public static void b(TextView textView, Drawable drawable, ColorStateList colorStateList) {
a(textView, a(drawable, colorStateList), (Drawable) null);
}
public static void a(TextView textView, @DrawableRes int i, @ColorRes int i2) {
if (i == 0) {
a(textView, (Drawable) null);
} else if (i2 == 0) {
a(textView, ContextCompat.getDrawable(textView.getContext(), i));
} else {
a(textView, ContextCompat.getDrawable(textView.getContext(), i), ContextCompat.getColorStateList(textView.getContext(), i2));
}
}
public static void b(TextView textView, @DrawableRes int i) {
c(textView, i, 0);
}
public static void b(TextView textView, @DrawableRes int i, @AttrRes int i2) {
if (i == 0) {
a(textView, (Drawable) null);
} else if (i2 == 0) {
a(textView, ContextCompat.getDrawable(textView.getContext(), i));
} else {
Drawable drawable = ContextCompat.getDrawable(textView.getContext(), i);
a(textView, drawable, ColorStateList.valueOf(ContextExtKt.h(textView.getContext(), i2)));
}
}
public static void c(TextView textView, @ColorRes int i) {
textView.setTextColor(ContextExtKt.a(textView.getContext(), i));
}
private static void a(TextView textView, Drawable drawable, Drawable drawable2) {
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, null, drawable2, null);
}
public static void a(TextView textView) {
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, null, null);
}
public static Drawable a(Drawable drawable, ColorStateList colorStateList) {
if (colorStateList == null) return drawable;
if (drawable != null) {
Drawable wrap = DrawableCompat.wrap(drawable.mutate());
DrawableCompat.setTintList(wrap, colorStateList);
return wrap;
}
return null;
}
public static void a(TextView textView, CharSequence charSequence) {
if (TextUtils.isEmpty(charSequence)) {
textView.setVisibility(View.GONE);
return;
}
textView.setVisibility(View.VISIBLE);
textView.setText(charSequence);
}
public static void a(TextView textView, float f) {
textView.setTextSize(0, f);
}
}
@@ -0,0 +1,270 @@
package com.vk.core.utils;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import b.h.z.e;
import com.vk.core.drawable.RecoloredDrawable;
import com.vk.core.extensions.TextViewExt;
import com.vk.core.ui.themes.MilkshakeHelper;
import com.vk.core.ui.themes.VKThemeHelper;
import com.vk.dto.common.VerifyInfo;
import com.vk.extensions.ViewExtKt;
import com.vtosters.lite.R;
import ru.vtosters.lite.utils.ThemesUtils;
public final class VerifyInfoHelper {
public static final VerifyInfoHelper h;
public static int devIcon = R.drawable.ic_favorite_16;
public static Integer enumSwitchMapping(VerifyInfoHelper.ColorTheme color) {
return switch (color) {
case normal -> 1;
case light -> 2;
case ultraLight -> 3;
case white -> 4;
};
}
public enum ColorTheme {
white,
normal,
light,
ultraLight
}
static {
h = new VerifyInfoHelper();
}
private VerifyInfoHelper() {
}
private int a() {
return ThemesUtils.getAccentColor();
}
private int b() {
return ThemesUtils.getAccentColor();
}
private int c() {
return ThemesUtils.getColor(R.color.fire_orange);
}
private int d() {
return ThemesUtils.getColor(R.color.light_blue);
}
private int e() {
return ThemesUtils.getColor(R.color.white_alpha60);
}
private int f() {
return ThemesUtils.getColor(R.color.white);
}
public int a(ColorTheme colorTheme) {
return switch (enumSwitchMapping(colorTheme)) {
case 1, 2 -> c();
case 3 -> e();
case 4 -> d();
default -> 0;
};
}
public Drawable a(VerifyInfo verifyInfo, Context context) {
return a(this, verifyInfo, context, null, 4, null);
}
public Drawable a(boolean z, boolean z2, boolean dev, Context context) {
return b(this, z, z2, dev, context, null, 8, null);
}
public Drawable a(boolean z, boolean z2, Context context) {
return b(this, z, z2, false, context, null, 8, null);
}
public int b(ColorTheme colorTheme) {
return a(colorTheme);
}
public int c(ColorTheme colorTheme) {
return switch (enumSwitchMapping(colorTheme)) {
case 1 -> MilkshakeHelper.e() ? b() : a();
case 2 -> d();
case 3 -> e();
case 4 -> f();
default -> 0;
};
}
public Drawable b(Context context, VerifyInfo verifyInfo) {
if (verifyInfo.dev()) {
return new RecoloredDrawable(ContextCompat.getDrawable(context, devIcon), c(ColorTheme.normal));
} else if (verifyInfo.t1() && verifyInfo.u1()) {
return ContextCompat.getDrawable(context, e.ic_fire_verified_border_composite_20_xml);
} else if (verifyInfo.t1()) {
return ContextCompat.getDrawable(context, e.ic_fire_border_composite_20_xml);
} else if (verifyInfo.u1()) {
return new RecoloredDrawable(ContextCompat.getDrawable(context, e.verified_16), c(ColorTheme.normal));
}
return null;
}
public Drawable b(VerifyInfo verifyInfo, Context context, ColorTheme colorTheme) {
return b(verifyInfo.u1(), verifyInfo.t1(), verifyInfo.dev(), context, colorTheme);
}
public static Drawable b(VerifyInfoHelper verifyInfoHelper, boolean z, boolean z2, boolean dev, Context context, ColorTheme colorTheme, int i, Object obj) {
if ((i & 8) != 0) {
colorTheme = ColorTheme.normal;
}
return verifyInfoHelper.b(z, z2, dev, context, colorTheme);
}
public static Drawable b(VerifyInfoHelper verifyInfoHelper, VerifyInfo verifyInfo, Context context, ColorTheme colorTheme, int i, Object obj) {
return b(verifyInfoHelper, verifyInfo.u1(), verifyInfo.t1(), verifyInfo.dev(), context, colorTheme, i, obj);
}
public static Drawable b(VerifyInfoHelper verifyInfoHelper, boolean z, boolean z2, Context context, ColorTheme colorTheme, int i, Object obj) {
return b(verifyInfoHelper, z, z2, false, context, colorTheme, i, obj);
}
public Drawable a(Context context, VerifyInfo verifyInfo) {
if (verifyInfo.dev()) {
return new RecoloredDrawable(ContextCompat.getDrawable(context, devIcon), c(ColorTheme.normal));
} else if (verifyInfo.t1() && verifyInfo.u1()) {
return ContextCompat.getDrawable(context, e.ic_fire_verified_border_composite_20_xml);
} else if (verifyInfo.t1()) {
return ContextCompat.getDrawable(context, e.ic_fire_border_composite_20_xml);
} else if (verifyInfo.u1() && VKThemeHelper.s()) {
return ContextCompat.getDrawable(context, e.verified_badge_light_24);
} else if (verifyInfo.u1() && VKThemeHelper.r()) {
return ContextCompat.getDrawable(context, e.verified_badge_dark_24);
}
return null;
}
public Drawable b(boolean z, boolean z2, Context context, ColorTheme colorTheme) {
return b(z, z2, false, context, colorTheme);
}
public Drawable b(boolean z, boolean z2, boolean dev, Context context, ColorTheme colorTheme) {
int i = 0;
int c2 = 0;
if (dev) {
i = devIcon;
c2 = c(colorTheme);
} else if (z2 && z) {
i = e.ic_fire_verified_16;
c2 = b(colorTheme);
} else if (z2) {
i = e.ic_fire_16;
c2 = a(colorTheme);
} else if (z) {
i = e.verified_16;
c2 = c(colorTheme);
} else {
Log.d("VerifyInfoHelper", "Use VerifyInfo.has()");
}
return new RecoloredDrawable(ContextCompat.getDrawable(context, i), c2);
}
public static Drawable a(VerifyInfoHelper verifyInfoHelper, VerifyInfo verifyInfo, Context context, ColorTheme colorTheme, int i, Object obj) {
if ((i & 4) != 0) {
colorTheme = ColorTheme.normal;
}
return verifyInfoHelper.b(verifyInfo, context, colorTheme);
}
public Drawable a(VerifyInfo verifyInfo, Context context, ColorTheme colorTheme) {
return a(verifyInfo.u1(), verifyInfo.t1(), verifyInfo.dev(), context, colorTheme);
}
public static Drawable a(VerifyInfoHelper verifyInfoHelper, boolean z, boolean z2, boolean dev, Context context, ColorTheme colorTheme, int i, Object obj) {
if ((i & 8) != 0) {
colorTheme = ColorTheme.normal;
}
return verifyInfoHelper.a(z, z2, dev, context, colorTheme);
}
public static Drawable a(VerifyInfoHelper verifyInfoHelper, boolean z, boolean z2, Context context, ColorTheme colorTheme, int i, Object obj) {
return a(verifyInfoHelper, z, z2, false, context, colorTheme, i, obj);
}
public Drawable a(boolean z, boolean z2, Context context, ColorTheme colorTheme) {
return a(z, z2, false, context, colorTheme);
}
public Drawable a(boolean z, boolean z2, boolean dev, Context context, ColorTheme colorTheme) {
int i = 0;
int c2 = 0;
if (dev) {
i = devIcon;
c2 = c(colorTheme);
} else if (z2 && z) {
i = e.ic_fire_verified_12;
c2 = b(colorTheme);
} else if (z2) {
i = e.ic_fire_12;
c2 = a(colorTheme);
} else if (z) {
i = e.verified_12;
c2 = c(colorTheme);
} else {
Log.d("VerifyInfoHelper", "Use VerifyInfo.has()");
}
return new RecoloredDrawable(ContextCompat.getDrawable(context, i), c2);
}
public static void a(VerifyInfoHelper verifyInfoHelper, TextView textView, VerifyInfo verifyInfo, boolean z, ColorTheme colorTheme, int i, Object obj) {
if ((i & 4) != 0) {
z = false;
}
if ((i & 8) != 0) {
colorTheme = ColorTheme.normal;
}
verifyInfoHelper.a(textView, verifyInfo, z, colorTheme);
}
public void a(TextView textView, VerifyInfo verifyInfo, boolean z, ColorTheme colorTheme) {
Drawable drawable;
Context context = textView.getContext();
if (verifyInfo == null || !verifyInfo.v1() || context == null) {
drawable = null;
} else {
drawable = z ? a(verifyInfo, context, colorTheme) : b(verifyInfo, context, colorTheme);
}
TextViewExt.a(textView, drawable);
}
public void a(ImageView imageView, boolean z, VerifyInfo verifyInfo) {
Drawable b2;
if (verifyInfo != null && verifyInfo.v1()) {
if (z) {
Context context = imageView.getContext();
b2 = a(context, verifyInfo);
} else {
Context context2 = imageView.getContext();
b2 = b(context2, verifyInfo);
}
imageView.setImageDrawable(b2);
ViewExtKt.r(imageView);
return;
}
ViewExtKt.p(imageView);
}
}
@@ -0,0 +1,11 @@
package com.vk.extensions;
import android.widget.TextView;
import androidx.annotation.AttrRes;
import com.vk.core.ui.themes.VKThemeHelper;
public final class TextViewExt {
public static void a(TextView textView, @AttrRes int i) {
VKThemeHelper.a(textView, i);
}
}
@@ -5,7 +5,6 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
public abstract class IMProcessor {
@@ -84,4 +83,8 @@ public abstract class IMProcessor {
public String getEncryptionKeyFor(int id) {
return Preferences.getPreferences().getString("VT_IMEncodeKey_" + getPrefKey() + "_" + id, null);
}
public void removeEncryptionKeyFor(int id) {
Preferences.getPreferences().edit().remove("VT_IMEncodeKey_" + getPrefKey() + "_" + id).apply();
}
}
@@ -100,7 +100,7 @@ public class CryptImHook {
key = enabled.getEncryptionKeyFor(peerId);
}
if (key.equals("VTAesDefault")) {
if (Objects.equals(key, "VTAesDefault")) {
key = null;
}
@@ -128,6 +128,9 @@ public class CryptImHook {
Editable edit = editText.getText();
finalEnabled.setEncryptionKeyFor(peerId, edit == null ? null : edit.toString());
}).setNegativeButton(android.R.string.cancel, null)
.setNeutralButton("Удалить ключ", (dialog, which) -> {
finalEnabled.removeEncryptionKeyFor(peerId);
})
.show();
}
}
@@ -8,6 +8,7 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.R;
import ru.vtosters.lite.concurrent.VTExecutors;
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
import ru.vtosters.lite.ssfs.UsersList;
import ru.vtosters.lite.themes.ThemesManager;
import ru.vtosters.lite.ui.dialogs.DisableBattery;
@@ -20,11 +21,9 @@ import static ru.vtosters.lite.ui.dialogs.ServerDialog.sendRequest;
import static ru.vtosters.lite.utils.CacheUtils.getInstance;
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
import static ru.vtosters.lite.utils.Preferences.checkupdates;
import static ru.vtosters.lite.utils.ThemesUtils.setNeededTheme;
public class MainActivityInjector {
public static void inject(Activity activity) {
setNeededTheme(activity);
sendRequest();
UsersList.getUsersList();
@@ -1,6 +1,5 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.ui.dialogs.MessageSettings.argDialog;
import static ru.vtosters.lite.ui.dialogs.MessageSettings.bombCount;
import static ru.vtosters.lite.ui.dialogs.MessageSettings.isSilentEnabled;
import static ru.vtosters.lite.utils.Preferences.autoalltranslate;
@@ -17,6 +16,7 @@ import java.util.ArrayList;
import java.util.regex.Pattern;
import ru.vtosters.lite.translators.BaseTranslator;
import ru.vtosters.lite.ui.dialogs.MessageSettings;
import ru.vtosters.lite.utils.LifecycleUtils;
public class MessagesHook {
@@ -70,7 +70,7 @@ public class MessagesHook {
public static void onLongClick(View view) {
view.setOnLongClickListener(v -> {
argDialog(v.getContext());
MessageSettings.argDialog(v.getContext());
return true;
});
}
@@ -35,6 +35,11 @@ public class ProxyHook {
RadioButton rgRandomProxy = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
RadioButton rgVika = new RadioButton(new ContextThemeWrapper(ctx, com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
SwitchHook.setCompoundButton(rgDefault);
SwitchHook.setCompoundButton(rgZaborona);
SwitchHook.setCompoundButton(rgRandomProxy);
SwitchHook.setCompoundButton(rgVika);
rg.addView(rgDefault);
rg.addView(rgVika);
rg.addView(rgZaborona);
@@ -0,0 +1,93 @@
package ru.vtosters.lite.hooks;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.widget.CompoundButton;
import android.widget.Switch;
import androidx.appcompat.widget.SwitchCompat;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.widget.CompoundButtonCompat;
import com.vk.core.util.ColorUtils;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.ThemesUtils;
import static com.vtosters.lite.R.color.*;
public class SwitchHook {
private static int[] getSwitchColors(Context ctx) {
return new int[] {
ContextCompat.getColor(ctx, ThemesUtils.isDarkTheme() ? gray_800 : white),
ContextCompat.getColor(ctx, ThemesUtils.isDarkTheme() ? switch_disabled_on_dark : switch_disabled_on_light),
ContextCompat.getColor(ctx, gray_20),
ThemesUtils.getAccentColor()
};
}
private static int[] getTrackColors() {
return new int[] {
ColorUtils.b(ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.loader_track_fill), 0.4f),
ColorUtils.b(ThemesUtils.getAccentColor(), 0.12f),
ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.loader_track_fill),
ColorUtils.b(ThemesUtils.getAccentColor(), 0.48f)
};
}
public static void setSwitchCompatColors(SwitchCompat switchCompat, Context ctx) {
if (Preferences.getBoolValue("useCustomPrefsStyle", true)) {
switchCompat.setThumbDrawable(setTintList(getCustomThumb(), new ColorStateList(createColorStateList(), getSwitchColors(ctx))));
switchCompat.setTrackDrawable(setTintList(getCustomTrack(), new ColorStateList(createColorStateList(), getTrackColors())));
} else {
setTintList(switchCompat.getThumbDrawable(), new ColorStateList(createColorStateList(), getSwitchColors(ctx)));
setTintList(switchCompat.getTrackDrawable(), new ColorStateList(createColorStateList(), getTrackColors()));
}
}
public static void setSwitchColors(Switch drawableCompat, Context ctx) {
if (Preferences.getBoolValue("useCustomPrefsStyle", true)) {
drawableCompat.setThumbDrawable(setTintList(getCustomThumb(), new ColorStateList(createColorStateList(), getSwitchColors(ctx))));
drawableCompat.setTrackDrawable(setTintList(getCustomTrack(), new ColorStateList(createColorStateList(), getTrackColors())));
} else {
setTintList(drawableCompat.getThumbDrawable(), new ColorStateList(createColorStateList(), getSwitchColors(ctx)));
setTintList(drawableCompat.getTrackDrawable(), new ColorStateList(createColorStateList(), getTrackColors()));
}
}
public static void setCompoundButton(CompoundButton compoundButton) {
CompoundButtonCompat.setButtonTintList(
compoundButton,
new ColorStateList(
createColorStateList(),
new int[]{
ColorUtils.b(ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.selection_off_icon), 0.4f),
ColorUtils.b(ThemesUtils.getAccentColor(), 0.4f),
ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.selection_off_icon),
ThemesUtils.getAccentColor()}));
}
private static int[][] createColorStateList() {
return new int[][]{
new int[]{-android.R.attr.state_enabled, -android.R.attr.state_checked},
new int[]{-android.R.attr.state_enabled, android.R.attr.state_checked},
new int[]{-android.R.attr.state_checked},
new int[]{android.R.attr.state_checked}
};
}
public static Drawable setTintList(Drawable d, ColorStateList color) {
Drawable wrappedDrawable = DrawableCompat.wrap(d);
DrawableCompat.setTintList(wrappedDrawable, color);
return wrappedDrawable;
}
private static Drawable getCustomTrack() {
return AndroidUtils.getGlobalContext().getDrawable(AndroidUtils.getIdentifier("custom_track_selector", "drawable"));
}
private static Drawable getCustomThumb() {
return AndroidUtils.getGlobalContext().getDrawable(AndroidUtils.getIdentifier("custom_thumb_selector", "drawable"));
}
}
@@ -5,6 +5,7 @@ import com.vk.articles.preload.WebCachePreloader;
import com.vtosters.lite.R;
import com.vtosters.lite.data.ThemeTracker;
import ru.vtosters.lite.themes.ThemesCore;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.ThemesUtils;
import java.io.BufferedReader;
@@ -66,10 +67,15 @@ public class VKUIHook {
}
private static void inject(WebView webView, String str) {
webView.loadUrl("javascript:(function() {var parent = document.getElementsByTagName('head').item(0);var style = document.createElement('style');style.type = 'text/css';style.innerHTML = window.atob('" + str + "');parent.appendChild(style)})()");
webView.loadUrl("javascript:(function() {let parent = document.head || document.documentElement; parent.appendChild(document.createElement('style')).innerText = window.atob('" + str + "');})()");
}
public static void inject(WebView webView) {
if (Preferences.getBoolValue("__dbg_webview", false)) {
WebView.setWebContentsDebuggingEnabled(true);
webView.loadUrl("javascript:(function() {let parent = document.head || document.documentElement; let script = parent.appendChild(document.createElement('script')); script.src = 'https://cdn.jsdelivr.net/npm/eruda'; script.onload = () => eruda.init();})()");
}
if (getBoolValue("VKUI_INJ", true)) {
if (!isLoaded) {
load();
@@ -1,19 +1,26 @@
package ru.vtosters.lite.hooks.ui;
import android.app.Activity;
import android.content.res.Configuration;
import com.vk.core.ui.themes.VKTheme;
import com.vk.core.ui.themes.VKThemeHelper;
import com.vtosters.lite.data.ThemeTracker;
import ru.vtosters.lite.utils.LifecycleUtils;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.ThemesUtils;
public class SystemThemeChangerHook {
private static int sPrevUiMode = 0;
import static ru.vtosters.lite.utils.AndroidUtils.getCenterScreenCoords;
public class SystemThemeChangerHook {
public static void onThemeChanged(Configuration configuration) {
onThemeChanged(configuration, true);
}
public static void onThemeChanged(Configuration configuration, Boolean restartActivity) {
if (Preferences.systemtheme()) {
var uiMode = configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (uiMode == sPrevUiMode) return;
VKTheme theme = null;
if (uiMode == Configuration.UI_MODE_NIGHT_YES)
@@ -22,10 +29,15 @@ public class SystemThemeChangerHook {
|| uiMode == Configuration.UI_MODE_NIGHT_NO)
theme = ThemesUtils.getLightTheme();
if (theme != null) {
ThemesUtils.applyTheme(theme);
sPrevUiMode = uiMode;
if (theme != null && theme != ThemesUtils.getCurrentTheme()) {
ThemesUtils.applyTheme(theme, restartActivity);
}
}
}
public static void themeOnStart(Activity activity) {
if (activity == null) activity = LifecycleUtils.getCurrentActivity();
onThemeChanged(activity.getResources().getConfiguration(), false);
}
}
@@ -2,19 +2,6 @@ package ru.vtosters.lite.music;
import android.util.Log;
import com.vk.dto.music.MusicTrack;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import javax.crypto.NoSuchPaddingException;
import java8.util.concurrent.CompletableFuture;
import okhttp3.OkHttpClient;
import okhttp3.Request;
@@ -26,6 +13,19 @@ import ru.vtosters.lite.music.interfaces.ITrackDownloader;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.IOUtils;
import javax.crypto.NoSuchPaddingException;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class M3UDownloader implements ITrackDownloader {
private static final OkHttpClient client = VtOkHttpClient.getInstance();
@@ -50,7 +50,7 @@ public class M3UDownloader implements ITrackDownloader {
}
}
private void parse(String payload, File outDir, Callback callback, MusicTrack track, boolean cache) {
private void parse(String payload, File outDir, Callback callback, MusicTrack track, boolean cache) throws UnsupportedEncodingException {
if (cache) try {
ThumbnailDownloader.downloadThumbnails(track);
} catch (IOException e) {
@@ -72,7 +72,7 @@ public class M3UDownloader implements ITrackDownloader {
callback.onProgress(5);
for (TransportStream ts : tses) {
String tsURL = parser.getBaseUrl() + ts.getName();
String tsURL = parser.getBaseUrl() + URLEncoder.encode(ts.getName(), "UTF-8");
futures.add(CompletableFuture.runAsync(() -> {
try {
@@ -36,6 +36,8 @@ public class ColorReferences {
Color.parseColor("#45678f"),
Color.parseColor("#6645678f"),
Color.parseColor("#0099cc"),
Color.parseColor("#ff485f79"),
Color.parseColor("#ffbad1eb"),
Color.parseColor("#664986cc")
);
@@ -120,7 +122,9 @@ public class ColorReferences {
muted_blue_opacity40,
muted_blue_old,
darker_blue,
header_blue_opacity40
header_blue_opacity40,
switch_disabled_on_dark,
switch_disabled_on_light
);
public static boolean isAccentedColor(ColorStateList target) {
@@ -164,7 +164,7 @@ public class ThemesCore {
public static boolean hasThemedAttr(Context context, int attrID) {
if (ThemesUtils.isCustomAccentEnabled()) {
if (Preferences.dev()) {
if (Preferences.getBoolValue("logColors", false)) {
try {
Log.d(TAG, "Requesting color by attr " + context.getResources().getResourceName(attrID));
} catch (Exception ignored) {}
@@ -3,12 +3,14 @@ package ru.vtosters.lite.themes;
import android.content.Context;
import android.graphics.drawable.*;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.ColorRes;
import androidx.annotation.NonNull;
import com.vtosters.lite.R;
import ru.vtosters.lite.themes.utils.RecolorUtils;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.ThemesUtils;
public class ThemesHacks {
@@ -23,6 +25,12 @@ public class ThemesHacks {
public static int getHackedColor(@NonNull Context context, @ColorRes int color) {
if (ThemesUtils.isCustomAccentEnabled()) {
if (Preferences.getBoolValue("logColors", false)) {
try {
Log.d("ThemesCore", "Requesting color by color " + context.getResources().getResourceName(color));
} catch (Exception ignored) {}
}
if (ThemesCore.isCachedAccents() && ColorReferences.isAccentedColor(context.getResources().getColor(color))) {
return ThemesUtils.getAccentColor();
}
@@ -34,4 +42,24 @@ public class ThemesHacks {
return Build.VERSION.SDK_INT > 23 ? context.getColor(color) : context.getResources().getColor(color);
}
// Фиксит селектор (все/свои/архив) в профиле
public static void fixProfileSelector(View view) {
if (!ThemesUtils.isMilkshake()) return;
var id = view.getId();
if (id == R.id.profile_wall_owner_posts || id == R.id.profile_wall_all_posts || id == R.id.profile_wall_archived_posts) {
StateListDrawable states = (StateListDrawable) ((LayerDrawable) view.getBackground()).getDrawable(0);
LayerDrawable selected = (LayerDrawable) ((DrawableContainer.DrawableContainerState) states.getConstantState()).getChildren()[0];
((ColorDrawable) selected.getDrawable(0)).setColor(ThemesUtils.getAccentColor());
}
}
public static void fixThemedFeed(TextView textView, int i) {
if (i != R.layout.themed_feed_tab_2) {
return;
}
textView.setTextColor(RecolorUtils.recolorCSL(textView.getTextColors()));
((InsetDrawable) ((DrawableContainer.DrawableContainerState) textView.getBackground().getConstantState()).getChildren()[0]).getDrawable().setTint(ThemesUtils.lighten(ThemesUtils.getAccentColor(), 0.15f));
}
}
@@ -0,0 +1,46 @@
package ru.vtosters.lite.themes;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import ru.vtosters.lite.themes.hooks.BaseHook;
import ru.vtosters.lite.themes.hooks.ButtonHook;
import ru.vtosters.lite.themes.hooks.ImageViewHook;
import ru.vtosters.lite.themes.hooks.ProgressWheelHook;
import ru.vtosters.lite.themes.hooks.TabLayoutHook;
import ru.vtosters.lite.themes.hooks.TextViewHook;
import ru.vtosters.lite.themes.hooks.ToolbarHook;
import ru.vtosters.lite.themes.hooks.VKImageViewHook;
import ru.vtosters.lite.utils.ThemesUtils;
public class ViewInjector {
public static ArrayList<BaseHook> hooks = new ArrayList<>();
static {
hooks.add(new ButtonHook());
hooks.add(new ImageViewHook());
hooks.add(new TabLayoutHook());
hooks.add(new TextViewHook());
hooks.add(new ToolbarHook());
hooks.add(new VKImageViewHook());
hooks.add(new ProgressWheelHook());
}
public static View inject(View view, int i, boolean z) {
if (ThemesUtils.isMonetTheme()) {
for (BaseHook hook : hooks) {
hook.inject(view, i, z);
}
if (view instanceof ViewGroup) {
var viewGroup = (ViewGroup) view;
for (int i2 = 0; i2 < viewGroup.getChildCount(); i2++) {
inject(viewGroup.getChildAt(i2), i, false);
}
}
}
return view;
}
}
@@ -0,0 +1,7 @@
package ru.vtosters.lite.themes.hooks;
import android.view.View;
public interface BaseHook {
void inject(View view, int i, boolean z);
}
@@ -0,0 +1,29 @@
package ru.vtosters.lite.themes.hooks;
import android.content.res.ColorStateList;
import android.view.View;
import android.widget.Button;
import ru.vtosters.lite.themes.ColorReferences;
import ru.vtosters.lite.utils.ThemesUtils;
public class ButtonHook implements BaseHook {
@Override
public void inject(View view, int i, boolean z) {
if (view instanceof Button) {
var button = (Button) view;
if (button.getBackgroundTintList() != null && ColorReferences.isMutedAccentedColor(button.getBackgroundTintList())) {
button.setBackgroundTintList(ColorStateList.valueOf(ThemesUtils.getMutedAccentColor()));
}
if (button.getBackgroundTintList() != null && ColorReferences.isAccentedColor(button.getBackgroundTintList())) {
button.setBackgroundTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
}
if (TextViewHook.isPositiveButton(button) || TextViewHook.isVkUiButton(view)) {
button.setBackgroundTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
}
}
}
}
@@ -0,0 +1,24 @@
package ru.vtosters.lite.themes.hooks;
import android.content.res.ColorStateList;
import android.view.View;
import android.widget.ImageView;
import ru.vtosters.lite.themes.ColorReferences;
import ru.vtosters.lite.themes.ThemesCore;
import ru.vtosters.lite.utils.ThemesUtils;
public class ImageViewHook implements BaseHook {
@Override
public void inject(View view, int i, boolean z) {
if (view instanceof ImageView) {
if (ThemesCore.isCachedAccents()) {
var imageView = (ImageView) view;
if (imageView.getImageTintList() == null) return;
if (ColorReferences.isCslNeedToBeThemed(imageView.getImageTintList())) {
imageView.setImageTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
}
}
}
}
}
@@ -0,0 +1,21 @@
package ru.vtosters.lite.themes.hooks;
import android.view.View;
import com.pnikosis.materialishprogress.ProgressWheel;
import ru.vtosters.lite.themes.ThemesCore;
import ru.vtosters.lite.utils.ThemesUtils;
public class ProgressWheelHook implements BaseHook {
@Override
public void inject(View view, int i, boolean z) {
if (view instanceof ProgressWheel) {
if (ThemesCore.isCachedAccents()) {
var progressWheel = (ProgressWheel) view;
progressWheel.setBarColor(ThemesUtils.getAccentColor());
}
}
}
}
@@ -0,0 +1,21 @@
package ru.vtosters.lite.themes.hooks;
import android.content.res.ColorStateList;
import android.view.View;
import com.vk.core.view.VKTabLayout;
import ru.vtosters.lite.utils.ThemesUtils;
public class TabLayoutHook implements BaseHook {
@Override
public void inject(View view, int i, boolean z) {
if (view instanceof VKTabLayout) {
var tabLayout = (VKTabLayout) view;
tabLayout.setSelectedTabIndicatorColor(ThemesUtils.getAccentColor());
tabLayout.setTabRippleColor(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
}
}
}
@@ -0,0 +1,136 @@
package ru.vtosters.lite.themes.hooks;
import android.annotation.SuppressLint;
import android.content.res.ColorStateList;
import android.os.Build;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatCheckedTextView;
import com.vk.core.extensions.EditTextExt;
import com.vk.core.view.OverlayTextView;
import com.vk.core.view.TintTextView;
import com.vk.core.view.links.LinkedTextView;
import com.vtosters.lite.R;
import ru.vtosters.lite.themes.ColorReferences;
import ru.vtosters.lite.themes.ThemesHacks;
import ru.vtosters.lite.themes.utils.VkUiThemer;
import ru.vtosters.lite.utils.ThemesUtils;
public class TextViewHook implements BaseHook {
private static final String TAG = "TextViewHook";
@SuppressLint("RestrictedApi")
@Override
public void inject(View view, int i, boolean z) {
if (view instanceof TextView) {
var textView = (TextView) view;
if (ColorReferences.isAccentedColor(textView.getCurrentTextColor())) {
textView.setTextColor(ThemesUtils.getAccentColor());
}
if (ColorReferences.isMutedAccentedColor(textView.getCurrentTextColor())) {
textView.setTextColor(ThemesUtils.getMutedAccentColor());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && textView.getCompoundDrawableTintList() != null) {
if (ColorReferences.isAccentedColor(textView.getCompoundDrawableTintList())) {
textView.setCompoundDrawableTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
}
if (ColorReferences.isMutedAccentedColor(textView.getCompoundDrawableTintList())) {
textView.setCompoundDrawableTintList(ColorStateList.valueOf(ThemesUtils.getMutedAccentColor()));
}
}
if (textView.getLinkTextColors() != null && ColorReferences.isAccentedColor(textView.getLinkTextColors())) {
textView.setLinkTextColor(ThemesUtils.getAccentColor());
}
if (textView.getLinkTextColors() != null && ColorReferences.isMutedAccentedColor(textView.getLinkTextColors())) {
textView.setLinkTextColor(ThemesUtils.getMutedAccentColor());
}
if (isPositiveButton(textView) || isVkUiButton(textView)) {
view.setBackgroundTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
}
if (view instanceof OverlayTextView) {
if (view.getId() == android.R.id.button1) {
view.setBackground(ThemesUtils.recolorDrawable(view.getBackground()));
}
if (ColorReferences.isAccentedColor(((OverlayTextView) view).getTextColors().getDefaultColor())) {
((OverlayTextView) view).setTextColor(ThemesUtils.getAccentColor());
}
}
if (view instanceof TintTextView) {
if (eligibleForStartTinting((TintTextView) view)) {
((TintTextView) view).setDrawableStartTint(ThemesUtils.getAccentColor());
}
if (eligibleForStartTintingMuted((TintTextView) view)) {
((TintTextView) view).setDrawableStartTint(ThemesUtils.getMutedAccentColor());
}
if (eligibleForTinting(view.getId())) {
((TintTextView) view).setDrawableTint(ThemesUtils.getAccentColor());
}
if (eligibleForTinting(view.getId())) {
((TintTextView) view).setDrawableStartTint(ThemesUtils.getAccentColor());
}
}
if (view instanceof LinkedTextView) {
((LinkedTextView) view).setLinkTextColor(ThemesUtils.getAccentColor());
}
if (view instanceof AppCompatCheckedTextView) {
var check = (AppCompatCheckedTextView) view;
if (ColorReferences.isAccentedColor(check.getCheckMarkTintList())) {
check.setCheckMarkTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
}
if (ColorReferences.isMutedAccentedColor(check.getCheckMarkTintList())) {
check.setCheckMarkTintList(ColorStateList.valueOf(ThemesUtils.getMutedAccentColor()));
}
}
if (view instanceof EditText) {
ThemesUtils.setCursorColor((EditText) view);
}
ThemesUtils.colorTextView(textView);
VkUiThemer.autoThemeVkuiButtons(textView);
ThemesHacks.fixProfileSelector(textView);
ThemesHacks.fixThemedFeed(textView, i);
}
}
public static boolean eligibleForStartTinting(TintTextView view) {
return ColorReferences.isAccentedColor(view.getTextColors()) || view.getTextColors().getDefaultColor() == ThemesUtils.getAccentColor();
}
public static boolean eligibleForStartTintingMuted(TintTextView view) {
return ColorReferences.isMutedAccentedColor(view.getTextColors()) || view.getTextColors().getDefaultColor() == ThemesUtils.getMutedAccentColor();
}
public static boolean eligibleForTinting(int id) {
return !ThemesUtils.isDarkTheme() && (id == R.id.attach_title || id == R.id.post_retweet_name);
}
public static boolean isPositiveButton(View view) {
return !ThemesUtils.isDarkTheme() && (view.getId() == R.id.positive || view.getId() == R.id.positive_button);
}
public static boolean isVkUiButton(View view) {
return !ThemesUtils.isDarkTheme() && (view.getId() == R.id.empty_button || view.getId() == R.id.button);
}
}
@@ -0,0 +1,29 @@
package ru.vtosters.lite.themes.hooks;
import android.view.View;
import androidx.appcompat.widget.Toolbar;
import com.vk.core.drawable.RecoloredDrawable;
import ru.vtosters.lite.utils.ThemesUtils;
public class ToolbarHook implements BaseHook {
@Override
public void inject(View view, int i, boolean z) {
if (view instanceof Toolbar) {
var color = (ThemesUtils.isMilkshake() && !ThemesUtils.isDarkTheme()) ? ThemesUtils.getAccentColor() : ThemesUtils.getHeaderText();
var menu = ((Toolbar) view).getMenu();
for (int j = 0; j < menu.size(); ++j) {
var item = menu.getItem(j);
var icon = item.getIcon();
if (icon != null) {
if (icon instanceof RecoloredDrawable)
((RecoloredDrawable) icon).a(color);
else
icon = new RecoloredDrawable(icon, color);
item.setIcon(icon);
}
}
}
}
}
@@ -0,0 +1,30 @@
package ru.vtosters.lite.themes.hooks;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.view.View;
import com.vk.imageloader.view.VKImageView;
import ru.vtosters.lite.themes.utils.RecolorUtils;
import ru.vtosters.lite.utils.ThemesUtils;
public class VKImageViewHook implements BaseHook {
private static Paint paint = new Paint();
static {
paint.setColorFilter(new PorterDuffColorFilter(ThemesUtils.getAccentColor(), PorterDuff.Mode.SRC_IN));
}
@Override
public void inject(View view, int i, boolean z) {
if (view instanceof VKImageView) {
var imageView = (VKImageView) view;
if (imageView.getImageTintList() != null) {
imageView.setImageTintList(RecolorUtils.recolorCSL(imageView.getImageTintList()));
imageView.setColorFilter(ThemesUtils.getAccentColor(), PorterDuff.Mode.SRC_IN);
}
}
}
}
@@ -3,10 +3,13 @@ package ru.vtosters.lite.themes.utils;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.widget.TextView;
import com.vk.core.drawable.RecoloredDrawable;
import ru.vtosters.lite.R;
import ru.vtosters.lite.themes.ColorReferences;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.ThemesUtils;
@@ -18,13 +21,28 @@ public class RecolorUtils {
return new RecoloredDrawable(drawable, ThemesUtils.getHeaderText());
} // Recolor toolbar drawable to accent color
@SuppressLint("UseCompatLoadingForDrawables")
public static Drawable recolorDrawableInt(int drawable) {
@SuppressLint("UseCompatLoadingForDrawables") Drawable res = AndroidUtils.getResources().getDrawable(drawable);
return new RecoloredDrawable(res, ThemesUtils.getAccentColor());
return recolorDrawable(drawable, ThemesUtils.getAccentColor());
} // Get res drawable via id and coloring to accent
public static Drawable recolorDrawable(int drawable, int color) {
return new RecoloredDrawable(AndroidUtils.getResources().getDrawable(drawable), color);
} // Get res drawable via id and coloring to accent
public static Drawable fixActionMenuIcons(int drawable) {
return recolorDrawable(drawable, ThemesUtils.isDarkTheme() ? ThemesUtils.getColor(com.vtosters.lite.R.color.gray_100) : ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.header_tint));
}
public static int getColor(TypedArray ta, int index, int defval) {
return recolorHexColor(ta.getColor(index, defval));
}
public static void recolorTextView(TextView tw) {
if (ColorReferences.isAccentedColor(tw.getTextColors())) {
tw.setTextColor(ThemesUtils.getAccentColor());
}
}
public static int recolorHexColor(int i) {
if (!ThemesUtils.isCustomAccentEnabled()) return i;
var accented = ColorReferences.isAccentedColor(i);
@@ -0,0 +1,85 @@
package ru.vtosters.lite.themes.utils;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableContainer;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Build;
import android.widget.TextView;
import ru.vtosters.lite.themes.ColorReferences;
import ru.vtosters.lite.utils.ThemesUtils;
public class VkUiThemer {
public static void autoThemeVkuiButtons(TextView view) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) return;
if (ThemesUtils.isDarkTheme())
return; // no need to theme b/w buttons, well it should skip, but I do it for extra performance
try {
if (!(view.getBackground() instanceof StateListDrawable)) return;
StateListDrawable states = ((StateListDrawable) view.getBackground());
if (states.getConstantState() == null) return;
DrawableContainer.DrawableContainerState dStates = (DrawableContainer.DrawableContainerState) states.getConstantState();
if (dStates.getChildCount() == 2) {
Drawable target = dStates.getChildren()[0];
if (!(target instanceof RippleDrawable)) return;
RippleDrawable ripple = (RippleDrawable) target;
for (int i = 0; i < ripple.getNumberOfLayers(); i++) {
if (ripple.getId(i) == android.R.id.mask) continue;
Drawable currentTarget = ripple.getDrawable(i);
if (!(currentTarget instanceof GradientDrawable)) continue;
//if (TSColorRefs.TS_DEBUG_MODE) Log.d("TSCore", "[tsh] finally, obamium = ["+currentTarget.toString()+"]");
GradientDrawable spd = (GradientDrawable) currentTarget;
if (spd.getShape() != GradientDrawable.RECTANGLE) continue;
// Log.d("TSCore", "[tsh] got a color!");
ColorStateList csl = spd.getColor();
// if (csl != null) {
// Log.d("TSCore", "[tsh] csl2 <def: " + csl.getDefaultColor() + " = " + ThemesUtils.hex(csl.getDefaultColor()) + "> | " + csl);
// }
if (ColorReferences.isAccentedColor(spd.getColor())) {
// Log.d("TSCore", "[tsh] theming CSL");
spd.setTint(ThemesUtils.getAccentColor());
}
}
Drawable draw2 = dStates.getChildren()[0];
if (!(draw2 instanceof GradientDrawable)) return;
GradientDrawable spd = (GradientDrawable) draw2;
if (spd.getShape() != GradientDrawable.RECTANGLE) return;
// Log.d("TSCore", "[tsh:disabled] got a color!");
ColorStateList csl = spd.getColor();
// if (csl != null) {
// Log.d("TSCore", "[tsh:disabled] csl2 <def: " + csl.getDefaultColor() + " = " + ThemesUtils.hex(csl.getDefaultColor()) + "> | " + csl);
// }
if (ColorReferences.isAccentedColor(spd.getColor())) {
// Log.d("TSCore", "[tsh:disabled] theming CSL");
spd.setTint(ThemesUtils.getAccentColor());
}
if (ColorReferences.isMutedAccentedColor(spd.getColor())) {
// Log.d("TSCore", "[tsh:disabled] theming CSL");
spd.setTint(ThemesUtils.getMutedAccentColor());
}
}
} catch (Exception e) {
// This must go wrong, so we ignore any exceptions that may occur
e.printStackTrace(); // REMOVE THIS!
}
}
}
@@ -24,6 +24,7 @@ import com.vk.stickers.details.StickerDetailsAdapter;
import com.vk.stickers.details.StickerDetailsView;
import com.vtosters.lite.R;
import org.json.JSONException;
import ru.vtosters.lite.hooks.SwitchHook;
import ru.vtosters.lite.tgs.TGPref;
import ru.vtosters.lite.tgs.TGRoot;
import ru.vtosters.lite.ui.components.IItemMovingListener;
@@ -140,6 +141,8 @@ public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.
mSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> sService.setPackEnabled(pack, isChecked, true));
mStickersCount.setText(pack.stickersCount + " " + mStickersCount.getContext().getString(R.string.stickerscount));
SwitchHook.setSwitchCompatColors(mSwitch, mSwitch.getContext());
// Color костыль
int color = getTextAttr();
int secondary = getSTextAttr();
@@ -21,6 +21,7 @@ import java.io.StringWriter;
import ru.vtosters.lite.deviceinfo.DeviceInfoCollector;
import ru.vtosters.lite.services.LogWriterService;
import ru.vtosters.lite.utils.AnalyticsHelper;
import ru.vtosters.lite.utils.AndroidUtils;
public class CrashReporter {
@@ -31,11 +31,11 @@ public class IconManager {
// available icons list for verified users
public static List<String> sIconsPlus = Arrays.asList(
"standard", "vt", "navy", "tiger", "spring", "sea", "sakura", "party", "paint", "flamingo", "old", "vt_navy", "vt_tiger", "vt_spring", "vt_sea", "vt_sakura", "vt_party", "vt_paint", "vt_flamingo"
"standard", "vt", "navy", "tiger", "spring", "sea", "sakura", "party", "paint", "flamingo", "old", "vt_navy", "vt_tiger", "vt_spring", "vt_sea", "vt_sakura", "vt_party", "vt_paint", "vt_flamingo", "balloon_pink", "bubble_gum", "comics", "flowers", "metal_dark", "pin_blue", "rabbit", "shine"
);
public static List<String> sIconsPlusNames = Arrays.asList(
"VK", "VTLite", "Navy", "Tiger", "Spring", "Sea", "Sakura", "Party", "Paint", "Flamingo", "Old Logo", "Navy alter", "Tiger alter", "Spring alter", "Sea alter", "Sakura alter", "Party alter", "Paint alter", "Flamingo alter"
"VK", "VTLite", "Navy", "Tiger", "Spring", "Sea", "Sakura", "Party", "Paint", "Flamingo", "Old Logo", "Navy alter", "Tiger alter", "Spring alter", "Sea alter", "Sakura alter", "Party alter", "Paint alter", "Flamingo alter", "Balloon Pink", "Bubble Gum", "Comics", "Flowers", "Metal Dark", "Pin Blue", "Rabbit", "Shine"
);
public static List<String> icons() {
@@ -16,6 +16,7 @@ import androidx.appcompat.widget.SwitchCompat;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.R;
import ru.vtosters.lite.hooks.SwitchHook;
import ru.vtosters.lite.utils.LayoutUtils;
public class MessageSettings {
@@ -37,6 +38,13 @@ public class MessageSettings {
RadioButton four = new RadioButton(new ContextThemeWrapper(context, R.style.Widget_AppCompat_CompoundButton_RadioButton));
RadioButton five = new RadioButton(new ContextThemeWrapper(context, R.style.Widget_AppCompat_CompoundButton_RadioButton));
SwitchHook.setCompoundButton(zero);
SwitchHook.setCompoundButton(one);
SwitchHook.setCompoundButton(two);
SwitchHook.setCompoundButton(three);
SwitchHook.setCompoundButton(four);
SwitchHook.setCompoundButton(five);
rg.addView(zero);
rg.addView(one);
rg.addView(two);
@@ -86,6 +94,8 @@ public class MessageSettings {
silentSwitch.setPadding(dp2px(24f), dp2px(12f), dp2px(18f), dp2px(12f));
SwitchHook.setSwitchCompatColors(silentSwitch, silentSwitch.getContext());
mContainer.setLayoutParams(LayoutUtils.createLinear(-1, -1));
mContainer.setOrientation(LinearLayout.VERTICAL);
@@ -2,12 +2,9 @@ package ru.vtosters.lite.ui.dialogs;
import android.app.Activity;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vk.core.ui.themes.VKThemeHelper;
import com.vtosters.lite.R;
import ru.vtosters.lite.hooks.VKUIHook;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.utils.ThemesUtils.isDarkTheme;
import ru.vtosters.lite.utils.ThemesUtils;
public class ThemeChanging {
public static void changeTheme(Activity activity, float[] f) {
@@ -17,16 +14,13 @@ public class ThemeChanging {
.setMessage(R.string.system_theme_warning)
.setCancelable(false)
.setPositiveButton(R.string.proxy_disable, (dialogInterface, i) -> { // Отключить
Preferences.getPreferences().edit().putString("currsystemtheme", !isDarkTheme() ? "dark" : "light").commit();
VKThemeHelper.b(activity, f);
VKUIHook.clearWebCache();
ThemesUtils.setThemeFL(!ThemesUtils.isDarkTheme() ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), activity, f, true);
Preferences.getPreferences().edit().putBoolean("system_theme", false).commit();
})
.setNeutralButton(R.string.cancel, null)
.show();
} else {
VKThemeHelper.b(activity, f);
Preferences.getPreferences().edit().putString("currsystemtheme", isDarkTheme() ? "dark" : "light").commit();
VKUIHook.clearWebCache();
ThemesUtils.setThemeFL(!ThemesUtils.isDarkTheme() ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), activity, f, true);
}
}
}
@@ -7,9 +7,8 @@ import android.os.Bundle;
import androidx.preference.Preference;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
public class ActivityFragment extends MaterialPreferenceToolbarFragment {
public class ActivityFragment extends TrackedMaterialPreferenceToolbarFragment {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
@@ -1,25 +1,27 @@
package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.preference.Preference;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vk.newsfeed.NewsfeedSettingsFragment;
import com.vk.newsfeed.controllers.NewsfeedController;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import com.vtosters.lite.ui.SummaryListPreference;
import java.util.Objects;
import ru.vtosters.lite.ui.components.NewsfeedListManager;
import ru.vtosters.lite.utils.NavigatorUtils;
import ru.vtosters.lite.utils.NewsFeedFiltersUtils;
import ru.vtosters.lite.utils.Preferences;
import java.util.Objects;
import static ru.vtosters.lite.utils.AndroidUtils.*;
public class FeedFragment extends MaterialPreferenceToolbarFragment {
public class FeedFragment extends TrackedMaterialPreferenceToolbarFragment {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
@@ -9,18 +9,21 @@ import android.os.Bundle;
import android.util.TypedValue;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.core.content.res.ResourcesCompat;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.hooks.SwitchHook;
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
import ru.vtosters.lite.ui.components.IconManager;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.ThemesUtils;
public class IconsFragment extends MaterialPreferenceToolbarFragment {
public class IconsFragment extends TrackedMaterialPreferenceToolbarFragment {
@SuppressLint("SetTextI18n")
public static void callSelectDialog(Context ctx, String appicon) {
var defname = Preferences.getPreferences().getString("appname", "vt");
@@ -32,6 +35,10 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment {
RadioButton rgVK = new RadioButton(new ContextThemeWrapper(ctx, R.style.Widget_AppCompat_CompoundButton_RadioButton));
RadioButton rgVKontakte = new RadioButton(new ContextThemeWrapper(ctx, R.style.Widget_AppCompat_CompoundButton_RadioButton));
SwitchHook.setCompoundButton(rgDefault);
SwitchHook.setCompoundButton(rgVK);
SwitchHook.setCompoundButton(rgVKontakte);
rg.addView(rgDefault);
rg.addView(rgVK);
rg.addView(rgVKontakte);
@@ -3,9 +3,8 @@ package ru.vtosters.lite.ui.fragments;
import android.os.Bundle;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
public class InstallGMSFragment extends MaterialPreferenceToolbarFragment {
public class InstallGMSFragment extends TrackedMaterialPreferenceToolbarFragment {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
@@ -1,9 +1,13 @@
package ru.vtosters.lite.ui.fragments;
import android.os.Build;
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
import android.os.Bundle;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.ui.components.DockBarEditorManager;
import ru.vtosters.lite.ui.components.SuperAppEditorManager;
import ru.vtosters.lite.ui.dialogs.RoundingSeekbarDialog;
import ru.vtosters.lite.utils.AndroidUtils;
@@ -11,10 +15,7 @@ import ru.vtosters.lite.utils.NavigatorUtils;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.ThemesUtils;
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
public class InterfaceFragment extends TrackedMaterialPreferenceToolbarFragment {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
@@ -63,6 +64,17 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
findPreference("swipe").setVisible(false);
}
if (Preferences.vkme() || isTablet()) {
findPreference("dockbareditor").setVisible(false);
}
var dockbarEditor = findPreference("dockbareditor");
dockbarEditor.setSummary(AndroidUtils.getString(R.string.vtldocksumm) + ": " + DockBarEditorManager.getInstance().getSelectedTabs().size());
dockbarEditor.setOnPreferenceClickListener(preference -> {
NavigatorUtils.switchFragment(requireContext(), DockBarEditorFragment.class);
return true;
});
if (ThemesUtils.isMilkshake() && Preferences.superapp()) {
findPreference("miniapps").setVisible(false);
@@ -74,10 +86,6 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
return true;
});
if (Build.VERSION.SDK_INT >= 33) {
findPreference("anim_rtrn_type").setVisible(false);
}
if (Preferences.getPreferences().getInt("pic_rounding", 0) == 0) {
findPreference("customrounding").setSummary(requireContext().getString(R.string.disabled));
} else {
@@ -1,5 +1,17 @@
package ru.vtosters.lite.ui.fragments;
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.isVkxInstalled;
import static ru.vtosters.lite.music.LastFMScrobbler.isLoggedIn;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.isEnableExternalOpening;
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@@ -9,16 +21,24 @@ import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import androidx.preference.Preference;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vk.core.network.Network;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import org.json.JSONObject;
import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import org.json.JSONObject;
import ru.vtosters.lite.downloaders.AudioDownloader;
import ru.vtosters.lite.downloaders.VideoDownloader;
import ru.vtosters.lite.music.LastFMScrobbler;
@@ -28,23 +48,7 @@ import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.ThemesUtils;
import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.isVkxInstalled;
import static ru.vtosters.lite.music.LastFMScrobbler.isLoggedIn;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
import static ru.vtosters.lite.utils.AndroidUtils.*;
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.isEnableExternalOpening;
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
public class MediaFragment extends MaterialPreferenceToolbarFragment {
public class MediaFragment extends TrackedMaterialPreferenceToolbarFragment {
private static final ExecutorService executor = Executors.newCachedThreadPool();
public static void download(Context ctx) {
@@ -142,14 +146,17 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
});
findPreference("select_photo_search_engine").setOnPreferenceClickListener(preference -> {
var deficon = ThemesUtils.recolorDrawable(AndroidUtils.getResources().getDrawable(R.drawable.ic_picture_outline_28));
var choiceicon = ThemesUtils.recolorDrawable(AndroidUtils.getResources().getDrawable(R.drawable.link_outline_28));
var items = Arrays.asList(
new ImagineArrayAdapter.ImagineArrayAdapterItem(null, AndroidUtils.getString("by_choice")),
new ImagineArrayAdapter.ImagineArrayAdapterItem(choiceicon, AndroidUtils.getString("by_choice")),
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.yandex, "Yandex"),
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.google, "Google"),
new ImagineArrayAdapter.ImagineArrayAdapterItem(R.drawable.microsoft, "Bing"),
new ImagineArrayAdapter.ImagineArrayAdapterItem(null, "TraceMoe"),
new ImagineArrayAdapter.ImagineArrayAdapterItem(null, "Ascii2d"),
new ImagineArrayAdapter.ImagineArrayAdapterItem(null, "Saucenao")
new ImagineArrayAdapter.ImagineArrayAdapterItem(deficon, "TraceMoe"),
new ImagineArrayAdapter.ImagineArrayAdapterItem(deficon, "Ascii2d"),
new ImagineArrayAdapter.ImagineArrayAdapterItem(deficon, "Saucenao")
);
var adapter = new ImagineArrayAdapter(requireContext(), items);
@@ -1,22 +1,24 @@
package ru.vtosters.lite.ui.fragments;
import android.annotation.SuppressLint;
import android.os.Bundle;
import androidx.preference.Preference;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
import ru.vtosters.lite.utils.Preferences;
import java.util.Arrays;
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
import static ru.vtosters.lite.utils.Preferences.autoalltranslate;
import static ru.vtosters.lite.utils.Preferences.vkme;
public class MessagesFragment extends MaterialPreferenceToolbarFragment {
import android.annotation.SuppressLint;
import android.os.Bundle;
import androidx.preference.Preference;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.R;
import java.util.Arrays;
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
import ru.vtosters.lite.utils.Preferences;
public class MessagesFragment extends TrackedMaterialPreferenceToolbarFragment {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
@@ -49,13 +49,13 @@ import com.vk.pushes.PushSubscriber;
import com.vk.stickers.Stickers;
import com.vtosters.lite.R;
import com.vtosters.lite.auth.VKAccountManager;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import com.vtosters.lite.im.ImEngineProvider;
import java.io.IOException;
import b.h.g.m.FileUtils;
import ru.vtosters.lite.deviceinfo.DeviceInfoCollector;
import ru.vtosters.lite.hooks.SwitchHook;
import ru.vtosters.lite.ssfs.UsersList;
import ru.vtosters.lite.ui.activities.VKAdminTokenActivity;
import ru.vtosters.lite.ui.components.BackupManager;
@@ -65,7 +65,7 @@ import ru.vtosters.lite.utils.NavigatorUtils;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.VTVerifications;
public class OtherFragment extends MaterialPreferenceToolbarFragment {
public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
private static final int VK_ADMIN_TOKEN_REQUEST_CODE = 1;
@Override
@@ -242,6 +242,12 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
return true;
});
}
findPreference("analyticsDisabled").setVisible(Preferences.isValidSignature());
findPreference("analyticsDisabled").setOnPreferenceClickListener(preference -> {
restartApplicationWithTimer();
return true;
});
}
@SuppressLint({"CommitPrefEdits", "SetTextI18n"})
@@ -255,6 +261,7 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
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, dp2px(14f));
@@ -6,11 +6,10 @@ import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
import android.os.Bundle;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import java.io.IOException;
public class ProxySettingsFragment extends MaterialPreferenceToolbarFragment {
public class ProxySettingsFragment extends TrackedMaterialPreferenceToolbarFragment {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
@@ -5,15 +5,16 @@ import android.content.ClipboardManager;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.deviceinfo.OEMDetector;
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
import ru.vtosters.lite.utils.About;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
public class SystemInfo extends MaterialPreferenceToolbarFragment {
public class SystemInfo extends TrackedMaterialPreferenceToolbarFragment {
@Override
public void onCreate(Bundle bundle) {
@@ -47,6 +48,7 @@ public class SystemInfo extends MaterialPreferenceToolbarFragment {
var isValidSignature = Preferences.isValidSignature();
var isTablet = AndroidUtils.isTablet();
var isDebuggable = AndroidUtils.isDebuggable();
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), "App information");
@@ -66,6 +68,8 @@ public class SystemInfo extends MaterialPreferenceToolbarFragment {
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isTablet", "Value: " + isTablet, 0, null);
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "isDebuggable", "Value: " + isDebuggable, 0, null);
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), "System information");
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", "SDK Version", sdkVersion, 0, preference -> {
@@ -1,29 +1,34 @@
package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.ThemesUtils.recolorDrawable;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;
import androidx.preference.PreferenceCategory;
import b.h.g.k.VKProgressDialog;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import b.h.g.k.VKProgressDialog;
import ru.vtosters.lite.concurrent.VTExecutors;
import ru.vtosters.lite.themes.ThemesManager;
import ru.vtosters.lite.themes.palettes.PalettesManager;
import ru.vtosters.lite.ui.components.DockBarEditorManager;
import ru.vtosters.lite.ui.dialogs.PalettesBottomSheetDialog;
import ru.vtosters.lite.ui.views.rarepebble.ColorPickerView;
import ru.vtosters.lite.ui.wallpapers.WallpaperMenuFragment;
import ru.vtosters.lite.utils.*;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.LifecycleUtils;
import ru.vtosters.lite.utils.NavigatorUtils;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.ThemesUtils;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.ThemesUtils.recolorDrawable;
public class ThemesFragment extends MaterialPreferenceToolbarFragment {
public class ThemesFragment extends TrackedMaterialPreferenceToolbarFragment {
@Override
public void onCreate(Bundle bundle) {
@@ -43,15 +48,8 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
findPreference("systememoji").setSummary(getGlobalContext().getString(R.string.systememojisum) + " \uD83D\uDE00\uD83D\uDE01\uD83E\uDD11\uD83E\uDD75\uD83D\uDC4D");
var dockbarEditor = findPreference("dockbareditor");
dockbarEditor.setSummary(AndroidUtils.getString(R.string.vtldocksumm) + ": " + DockBarEditorManager.getInstance().getSelectedTabs().size());
dockbarEditor.setOnPreferenceClickListener(preference -> {
NavigatorUtils.switchFragment(requireContext(), DockBarEditorFragment.class);
return true;
});
var invalidateThemeCache = findPreference("invalidate_theme_cache");
if(ThemesUtils.getReservedAccent() != Color.TRANSPARENT)
if (ThemesUtils.getReservedAccent() != Color.TRANSPARENT && Preferences.dev())
invalidateThemeCache.setOnPreferenceClickListener(preference -> {
setAccentColor(ThemesUtils.getReservedAccent());
return true;
@@ -130,16 +128,16 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
return true;
});
if (Preferences.vkme()) {
findPreference("dockbareditor").setVisible(false);
}
if(AndroidUtils.isTablet()) {
if (AndroidUtils.isTablet()) {
PreferenceCategory dockbarSettingsPreferenceCategory = (PreferenceCategory) findPreference("dockbarsett");
dockbarSettingsPreferenceCategory.setVisible(false);
findPreference("alteremoji").setVisible(false);
findPreference("dockbareditor").setVisible(false);
}
findPreference("useCustomPrefsStyle").setOnPreferenceClickListener(preference -> {
restart();
return true;
});
}
@Override
@@ -190,8 +188,8 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
void showPalettesDialog() {
final var manager = PalettesManager.getInstance();
final var titles = new String[manager.getPalettesCount()];
if(titles.length > 0) {
for(int i = 0; i < titles.length; ++i)
if (titles.length > 0) {
for (int i = 0; i < titles.length; ++i)
titles[i] = manager.getPalette(i).name;
new VkAlertDialog.Builder(requireContext())
.setTitle(AndroidUtils.getString("select_palette"))
@@ -215,8 +213,8 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
ThemesUtils.reserveAccentColor(color, true);
ThemesManager.generateModApk(color);
requireActivity().runOnUiThread(this::restart);
} catch(Throwable e) {
Log.e("ThemesFragment", e+"");
} catch (Throwable e) {
Log.e("ThemesFragment", e + "");
ThemesManager.deleteModification();
requireActivity().runOnUiThread(() -> {
dialog.dismiss();
@@ -0,0 +1,16 @@
package ru.vtosters.lite.ui.fragments;
import android.os.Bundle;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.utils.AnalyticsHelper;
public class TrackedMaterialPreferenceToolbarFragment extends MaterialPreferenceToolbarFragment {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
AnalyticsHelper.trackSettingsFragment(this.getClass());
}
}
@@ -9,6 +9,7 @@ import com.aefyr.tsg.g2.TelegramStickersPack;
import com.aefyr.tsg.g2.TelegramStickersService;
import com.vk.about.AboutAppFragment;
import com.vk.balance.BalanceFragment;
import com.vk.identity.fragments.IdentityListFragment;
import com.vk.notifications.settings.NotificationsSettingsFragment;
import com.vk.webapp.fragments.PrivacyFragment;
import com.vtosters.lite.MainActivity;
@@ -18,10 +19,10 @@ import com.vtosters.lite.auth.VKAuth;
import com.vtosters.lite.fragments.money.music.control.subscription.MusicSubscriptionControlFragment;
import com.vtosters.lite.fragments.n2.SettingsDebugFragment;
import com.vtosters.lite.fragments.w2.BlacklistFragment;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import com.vtosters.lite.general.fragments.SettingsAccountFragment;
import com.vtosters.lite.general.fragments.SettingsGeneralFragment;
import com.vtosters.lite.ui.MaterialSwitchPreference;
import ru.vtosters.lite.BuildConfig;
import ru.vtosters.lite.concurrent.VTExecutors;
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
import ru.vtosters.lite.ssfs.Utils;
@@ -30,13 +31,10 @@ import ru.vtosters.lite.ui.dialogs.OTADialog;
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
import ru.vtosters.lite.utils.*;
import static ru.vtosters.lite.utils.Preferences.VERSIONNAME;
import static ru.vtosters.lite.utils.Preferences.isValidSignature;
public class VTSettings extends MaterialPreferenceToolbarFragment implements TelegramStickersService.StickersEventsListener {
public class VTSettings extends TrackedMaterialPreferenceToolbarFragment implements TelegramStickersService.StickersEventsListener {
public static String getValAsString(@StringRes int strRes, Boolean value) {
if(value) {
if (value) {
return AndroidUtils.getString(strRes) + ": " + AndroidUtils.getString(R.string.vtlsettenabled);
}
@@ -44,7 +42,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
}
public static String getSSFSsumm() {
if(Preferences.hasSpecialVerif())
if (Preferences.hasSpecialVerif())
return AndroidUtils.getString(R.string.vtlssfssumm) + ": " + AndroidUtils.getString(R.string.vtlsettverifyes);
return AndroidUtils.getString(R.string.vtlssfssumm) + ": " + AndroidUtils.getString(R.string.vtlsettverifno);
@@ -57,25 +55,14 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
public static String getProxysumm() {
var type = Preferences.getString("proxy");
if(type.equals("noproxy") || type.isEmpty())
if (type.equals("noproxy") || type.isEmpty())
type = AndroidUtils.getString(R.string.vtlsettdisabled);
return AndroidUtils.getString(R.string.vtlproxysumm) + ": " + type;
}
public static String getThemesumm() {
String[] themeTypeName = AndroidUtils.getArray("theme_type_name");
return AndroidUtils.getString("current_theme") + ": " + switch (Preferences.getString("currsystemtheme")) {
case "system" -> themeTypeName[0];
case "dark" -> themeTypeName[1];
case "light" -> themeTypeName[2];
default -> ThemesUtils.isDarkTheme() ? themeTypeName[1] : themeTypeName[2];
};
}
private void switchTheme(boolean isDarkTheme) {
ThemesUtils.setTheme(isDarkTheme ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), requireActivity());
ThemesUtils.setTheme(isDarkTheme ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), requireActivity(), true);
}
@Override
@@ -108,6 +95,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
}
@SuppressWarnings("ConstantConditions")
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
@@ -128,7 +116,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
preference -> {
try {
VKAuth.a("logout", false);
} catch(Exception ignored) {
} catch (Exception ignored) {
}
var intent = new Intent(requireContext(), MainActivity.class)
@@ -142,7 +130,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
VTExecutors.getIoScheduler().a(() -> {
var icon = ImageUtils.getDrawableFromUrl(AccountManagerUtils.getUserPhoto(), 0, true, true);
if(icon == null) return;
if (icon == null) return;
requireActivity().runOnUiThread(() -> {
accountSwitcher.setIcon(icon);
});
@@ -164,44 +152,42 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), R.string.appearance_theme_use_system);
if(Build.VERSION.SDK_INT >= 28 && Preferences.milkshake()) {
PreferenceFragmentUtils.addListPreference(
getPreferenceScreen(),
"currsystemtheme",
"system",
requireContext().getString(R.string.appearance_theme_use_system),
R.drawable.ic_palette_outline_28,
getThemesumm(),
AndroidUtils.getArray("theme_type_name_checkbox"),
new String[] { "system", "dark", "light" },
(preference, o) -> {
String value = (String) o;
if(!value.equals("system")) {
var theme = value.equals("dark") ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme();
ThemesUtils.applyTheme(theme);
}
Preferences.getPreferences().edit().putString("currsystemtheme", value).commit();
SystemThemeChangerHook.onThemeChanged(getResources().getConfiguration());
return true;
});
} else {
PreferenceFragmentUtils.addMaterialSwitchPreference(
getPreferenceScreen(),
"",
requireContext().getString(R.string.vtsettdarktheme),
"",
R.drawable.ic_palette_outline_28,
ThemesUtils.isDarkTheme(),
(preference, o) -> {
if (Preferences.systemtheme()) {
AndroidUtils.sendToast("Включена установка темы как на устройстве");
return false;
}
final var switchPreference = (MaterialSwitchPreference) preference;
final var isDarkTheme = !switchPreference.isChecked();
switchTheme(isDarkTheme);
return true;
}
);
if (Build.VERSION.SDK_INT >= 28 && Preferences.milkshake()) {
PreferenceFragmentUtils.addMaterialSwitchPreference(
getPreferenceScreen(),
"",
requireContext().getString(R.string.vtsettdarktheme),
"",
"system_theme",
"Системная тема",
"Использовать тему установленную на устройстве",
R.drawable.ic_palette_outline_28,
ThemesUtils.isDarkTheme(),
Preferences.systemtheme(),
(preference, o) -> {
final var switchPreference = (MaterialSwitchPreference) preference;
final var isDarkTheme = !switchPreference.isChecked();
switchTheme(isDarkTheme);
Preferences.getPreferences().edit().putBoolean("system_theme", (boolean) o).commit();
SystemThemeChangerHook.onThemeChanged(requireActivity().getResources().getConfiguration());
return true;
}
);
}
if(!GmsUtils.isGmsInstalled()) {
if (!GmsUtils.isGmsInstalled()) {
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), R.string.gmsname);
PreferenceFragmentUtils.addPreference(
@@ -217,7 +203,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
);
}
if(Preferences.devmenu()) {
if (Preferences.devmenu()) {
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), R.string.sett_debug);
PreferenceFragmentUtils.addPreference(
@@ -244,22 +230,6 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
return true;
}
);
if(Preferences.dev() && Preferences.isValidSignature()) {
PreferenceFragmentUtils.addMaterialSwitchPreference(
getPreferenceScreen(),
"autoupdates",
requireContext().getString(R.string.checkupdates),
"",
R.drawable.ic_bug_outline_28,
true,
(preference, o) -> {
boolean value = (boolean) o;
Preferences.getPreferences().edit().putBoolean("autoupdates", value).commit();
return true;
}
);
}
}
if (AccountManagerUtils.isLogin()) {
@@ -302,7 +272,21 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
}
);
if(AccountManagerUtils.isVKTester()) {
if (VKAccountManager.d().N0()) {
PreferenceFragmentUtils.addPreference(
getPreferenceScreen(),
"",
requireContext().getString(R.string.identity_title),
"",
R.drawable.ic_services_outline_28,
preference -> {
NavigatorUtils.switchFragmentNavigator(requireContext(), new IdentityListFragment.a("menu").e());
return false;
}
);
}
if (AccountManagerUtils.isVKTester()) {
PreferenceFragmentUtils.addPreference(
getPreferenceScreen(),
"",
@@ -356,7 +340,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
}
);
if(VKAccountManager.d().isMusicSubs()) {
if (VKAccountManager.d().isMusicSubs()) {
PreferenceFragmentUtils.addPreference(
getPreferenceScreen(),
"",
@@ -384,7 +368,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), requireContext().getString(R.string.vtsettmod));
if(Preferences.vkme()) {
if (Preferences.vkme()) {
PreferenceFragmentUtils.addPreference(
getPreferenceScreen(),
"",
@@ -511,7 +495,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
getPreferenceScreen(),
"",
requireContext().getString(R.string.menu_about),
(isValidSignature() ? VERSIONNAME : "Dev") + " | " + About.getBuildNumber(),
Preferences.getBuildName() + " | " + About.getBuildNumber(),
R.drawable.ic_about_outline_28,
preference -> {
NavigatorUtils.switchFragment(requireContext(), AboutAppFragment.class);
@@ -530,7 +514,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
return false;
}
);
PreferenceFragmentUtils.addPreference(
getPreferenceScreen(),
@@ -556,7 +540,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment implements Tel
}
);
if(Preferences.isValidSignature()) {
if (Preferences.isValidSignature() && BuildConfig.BUILD_TYPE.equals("release")) {
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), requireContext().getString(R.string.updates));
PreferenceFragmentUtils.addPreference(
@@ -1,15 +1,17 @@
package ru.vtosters.lite.ui.fragments.tgstickers;
import android.os.Bundle;
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
import com.vk.core.util.ToastUtils;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.tgs.TGPref;
import ru.vtosters.lite.tgs.TGRoot;
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
import ru.vtosters.lite.ui.fragments.TrackedMaterialPreferenceToolbarFragment;
public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragment {
public class StickersPreferencesFragment extends TrackedMaterialPreferenceToolbarFragment {
@Override
public void onCreate(Bundle bundle) {
@@ -48,6 +48,6 @@ public class About {
}
public static String getAppVersion() {
return getApplicationName() + " " + (isValidSignature() ? VERSIONNAME : "Dev") + " | " + getBuildNumber();
return getApplicationName() + " " + getBuildName() + " | " + getBuildNumber();
}
}
@@ -14,11 +14,19 @@ public class AccountManagerUtils {
} // Current UserId
public static boolean isVKTester() {
return VKAccountManager.d().k0().equals("tester");
return role("tester");
} // is vk tester
public static boolean isVKWorker() {
return VKAccountManager.d().k0().equals("worker");
return role("worker");
}
public static boolean role(String role) {
try {
return VKAccountManager.d().k0().equals(role);
} catch (Exception e) {
return false;
}
}
public static String getUserSecret() {
@@ -0,0 +1,101 @@
package ru.vtosters.lite.utils;
import android.app.Application;
import android.os.Handler;
import androidx.annotation.NonNull;
import com.microsoft.appcenter.AppCenter;
import com.microsoft.appcenter.analytics.Analytics;
import com.microsoft.appcenter.channel.AbstractChannelListener;
import com.microsoft.appcenter.channel.Channel;
import com.microsoft.appcenter.crashes.Crashes;
import com.microsoft.appcenter.ingestion.models.Log;
import java.util.HashMap;
import ru.vtosters.lite.BuildConfig;
import ru.vtosters.lite.ui.fragments.TrackedMaterialPreferenceToolbarFragment;
public class AnalyticsHelper {
private static final boolean analyticsDisabled = Preferences.getBoolValue("analyticsDisabled", false);
private static final String key = BuildConfig.APPCENTER_KEY;
private static final Channel.Listener patchDeviceListener = new AbstractChannelListener() {
@Override
public void onPreparedLog(@NonNull Log log, @NonNull String groupName, int flags) {
var device = log.getDevice();
device.setAppVersion(About.getBuildNumber());
device.setAppBuild(About.getBuildNumber());
}
};
private static void addPatchDeviceListener() {
try {
var channelField = AppCenter.class.getDeclaredField("mChannel");
channelField.setAccessible(true);
var channel = (Channel) channelField.get(AppCenter.getInstance());
assert channel != null;
channel.addListener(patchDeviceListener);
} catch (ReflectiveOperationException e) {
e.printStackTrace();
}
}
private static void patchDevice() {
try {
var handlerField = AppCenter.class.getDeclaredField("mHandler");
handlerField.setAccessible(true);
var handler = ((Handler) handlerField.get(AppCenter.getInstance()));
assert handler != null;
handler.post(AnalyticsHelper::addPatchDeviceListener);
} catch (ReflectiveOperationException e) {
e.printStackTrace();
}
}
@SuppressWarnings("ConstantConditions")
public static void start(Application application) {
if (analyticsDisabled || key.isEmpty()) {
setAnalyticsStatus(false);
return;
}
AppCenter.start(application, AnalyticsHelper.key, Analytics.class, Crashes.class);
patchDevice();
setAnalyticsStatus(true);
}
public static void trackEvent(String event) {
if (analyticsDisabled) return;
Analytics.trackEvent(event);
}
public static void trackEvent(String event, HashMap<String, String> map) {
if (analyticsDisabled) return;
Analytics.trackEvent(event, map);
}
public static void trackSettingsFragment(Class<? extends TrackedMaterialPreferenceToolbarFragment> fragment) {
if (analyticsDisabled) return;
var props = new HashMap<String, String>();
props.put("fragment", fragment.getSimpleName());
AnalyticsHelper.trackEvent("Opened settings", props);
}
public static void trackError(Throwable th) {
if (analyticsDisabled) return;
Crashes.trackError(th);
}
public static void setAnalyticsStatus(Boolean bool) {
Analytics.setEnabled(bool && Preferences.isValidSignature());
Crashes.setEnabled(bool && !AndroidUtils.isDebuggable() && Preferences.isValidSignature());
}
}
@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.verify.domain.DomainVerificationManager;
import android.content.pm.verify.domain.DomainVerificationUserState;
@@ -31,6 +32,9 @@ import java.util.Objects;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
public class AndroidUtils {
public static boolean isDebuggable() {
return 0 != (AndroidUtils.getGlobalContext().getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE);
}
public static boolean isTablet() {
return Screen.l(getGlobalContext());
@@ -15,6 +15,12 @@ public class NavigatorUtils {
context.startActivity(intent);
}
public static void switchFragmentNavigator(Context context, Navigator fragmentClz) {
var intent = fragmentClz
.b(context)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
/**
* switch to settings for {@link Intent.ACTION_APPLICATION_PREFERENCES}*/
public static void switchToSettings(Context context) {
@@ -11,6 +11,7 @@ import com.guardanis.applock.AppLock;
import com.guardanis.applock.activities.UnlockActivity;
import com.vtosters.lite.data.Users;
import com.vtosters.lite.fragments.SettingsListFragment;
import ru.vtosters.lite.BuildConfig;
import ru.vtosters.lite.ui.fragments.VTSettings;
import java.security.NoSuchAlgorithmException;
@@ -24,7 +25,6 @@ import static ru.vtosters.lite.utils.VTVerifications.isPrometheus;
import static ru.vtosters.lite.utils.VTVerifications.isVerified;
public class Preferences {
public static String VERSIONNAME = "Beta";
public static void init(Application application) throws Exception {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
@@ -39,8 +39,17 @@ public class Preferences {
if (AppLock.isEnrolled(AndroidUtils.getGlobalContext())) {
AppLock.setAuthenticationRequired(AndroidUtils.getGlobalContext());
}
AnalyticsHelper.start(application);
if (AppLock.isEnrolled(AndroidUtils.getGlobalContext())) {
AppLock.setAuthenticationRequired(AndroidUtils.getGlobalContext());
}
} // VK Init
public static String getBuildName() {
return BuildConfig.BUILD_TYPE.substring(0,1).toUpperCase() + BuildConfig.BUILD_TYPE.substring(1).toLowerCase();
}
public static SharedPreferences getPreferences() {
return getGlobalContext().getSharedPreferences("com.vtosters.lite_preferences", Context.MODE_PRIVATE);
}
@@ -50,8 +59,6 @@ public class Preferences {
}
public static void forceOffline() {
setupFilters();
if (setoffline() && offline()) {
Users.a();
}
@@ -66,7 +73,7 @@ public class Preferences {
}
public static boolean systemtheme() {
return Build.VERSION.SDK_INT >= 28 && milkshake() && (getPreferences().getString("currsystemtheme", "system").equals("system") || getPreferences().getString("currsystemtheme", "system").isEmpty());
return Build.VERSION.SDK_INT >= 28 && milkshake() && getBoolValue("system_theme", true);
}
public static boolean authorsrecomm() {
@@ -142,17 +149,14 @@ public class Preferences {
return getBoolValue("VKUI_INJ", true);
}
public static boolean calls() {
// return getBoolValue("calls", false);
return true;
}
@SuppressWarnings("ConstantConditions")
public static boolean dev() {
return getBoolValue("dev", false);
return getBoolValue("dev", false) || BuildConfig.BUILD_TYPE.equals("dev");
}
@SuppressWarnings("ConstantConditions")
public static boolean devmenu() {
return getBoolValue("devmenu", false);
return getBoolValue("devmenu", false) || !BuildConfig.BUILD_TYPE.equals("release");
}
public static boolean dnr() {
@@ -292,8 +296,9 @@ public class Preferences {
return getBoolValue("screenshotdetect", true);
}
@SuppressWarnings("ConstantConditions")
public static boolean checkupdates() {
return !getBoolValue("isRoamingState", false) && isValidSignature() && (!dev() || getBoolValue("autoupdates", true));
return !getBoolValue("isRoamingState", false) && isValidSignature() && BuildConfig.BUILD_TYPE.equals("release");
}
public static boolean isNewBuild() {
@@ -29,6 +29,7 @@ import com.vtosters.lite.R;
import com.vtosters.lite.data.ThemeTracker;
import ru.vtosters.lite.deviceinfo.OEMDetector;
import ru.vtosters.lite.hooks.VKUIHook;
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
import ru.vtosters.lite.themes.ThemesHacks;
import ru.vtosters.lite.themes.ThemesManager;
import ru.vtosters.lite.ui.wallpapers.WallpapersHooks;
@@ -39,9 +40,9 @@ import static ru.vtosters.lite.utils.AndroidUtils.*;
import static ru.vtosters.lite.utils.Preferences.*;
public class ThemesUtils {
public static void applyTheme(VKTheme theme) {
public static void applyTheme(VKTheme theme, Boolean restartActivity) {
try {
VKThemeHelper.theme(theme, LifecycleUtils.getCurrentActivity(), getCenterScreenCoords());
setTheme(theme, LifecycleUtils.getCurrentActivity(), restartActivity);
} catch (Exception e) {
e.printStackTrace();
}
@@ -63,22 +64,16 @@ public class ThemesUtils {
AppCompatDelegate.setDefaultNightMode(theme);
}
public static void setTheme(VKTheme theme, Activity activity) {
if (activity == null) {
activity = LifecycleUtils.getCurrentActivity();
}
VKThemeHelper.theme(theme, activity, getCenterScreenCoords());
ThemeTracker.a();
VKUIHook.isLoaded = false;
new WebView(activity).clearCache(true);
WebCachePreloader.e();
public static void setTheme(VKTheme theme, Activity activity, Boolean restartActivity) {
setThemeFL(theme, activity, getCenterScreenCoords(), restartActivity);
} // apply changed theme
public static void setThemeFL(VKTheme theme, Activity activity, float[] fl) {
public static void setThemeFL(VKTheme theme, Activity activity, float[] fl, Boolean restartActivity) {
if (activity == null) {
activity = LifecycleUtils.getCurrentActivity();
}
VKThemeHelper.theme(theme, activity, fl);
if (restartActivity) activity.recreate();
ThemeTracker.a();
VKUIHook.isLoaded = false;
new WebView(activity).clearCache(true);
@@ -120,6 +115,13 @@ public class ThemesUtils {
return getMutedColor(getAccentColor());
}
public static void colorTextView(TextView view) {
try {
ThemesUtils.colorHandles(view);
ThemesUtils.setCursorColor((EditText) view);
} catch (Exception ignored) {}
}
@SuppressLint("DiscouragedPrivateApi")
public static void setCursorColor(EditText view) {
try {
@@ -371,27 +373,6 @@ public class ThemesUtils {
return VKThemeHelper.l();
}
public static void setNeededTheme(Activity activity) {
var currentTheme = getCurrentTheme();
if (milkshake()) {
if (currentTheme == VKTheme.VKAPP_LIGHT) {
setTheme(VKTheme.VKAPP_MILK_LIGHT, activity);
}
if (currentTheme == VKTheme.VKAPP_DARK) {
setTheme(VKTheme.VKAPP_MILK_DARK, activity);
}
} else {
if (currentTheme == VKTheme.VKAPP_MILK_LIGHT) {
setTheme(VKTheme.VKAPP_LIGHT, activity);
}
if (currentTheme == VKTheme.VKAPP_MILK_DARK) {
setTheme(VKTheme.VKAPP_DARK, activity);
}
}
}
public static void setNavbarColor(Window window, int i) {
if (navbar()) {
window.setNavigationBarColor(getTabbarBackground());
@@ -0,0 +1,24 @@
package ru.vtosters.lite.utils;
import org.json.JSONObject;
import org.json.JSONException;
import com.vk.core.ui.themes.VKThemeHelper;
import com.vk.api.base.ApiConfig;
import com.vk.core.preference.Preference;
import b.h.g.g.BuildInfo;
import ru.vtosters.lite.proxy.api.ApiProxy;
public class WebAppUtils {
public static JSONObject getWebAppConfig() throws JSONException {
JSONObject jSONObject = new JSONObject()
.put("scheme", VKThemeHelper.l().b())
.put("app", "vkclient")
.put("app_id", ApiConfig.a)
.put("appearance", VKThemeHelper.l().a() ? "light" : "dark")
.put("api_host", ApiProxy.linkReplacer(Preference.a().getString("apiHost", "api.vk.com")));
return jSONObject;
}
}
Regular → Executable
BIN
View File
Binary file not shown.
Executable → Regular
BIN
View File
Binary file not shown.
+289
View File
@@ -146,6 +146,7 @@
android:allowBackup="true"
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:debuggable="false"
android:localeConfig="@xml/locales_config"
android:hardwareAccelerated="true"
android:icon="@mipmap/vt_launcher"
android:label="@string/app_name"
@@ -903,6 +904,294 @@
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_balloon_pink"
android:name=".id190"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_balloon_pink"
android:name=".id191"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_balloon_pink"
android:name=".id192"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_bubble_gum"
android:name=".id200"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_bubble_gum"
android:name=".id201"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_bubble_gum"
android:name=".id202"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_comics"
android:name=".id210"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_comics"
android:name=".id211"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_comics"
android:name=".id212"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_flowers"
android:name=".id220"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_flowers"
android:name=".id221"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_flowers"
android:name=".id222"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_metal_dark"
android:name=".id230"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_metal_dark"
android:name=".id231"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_metal_dark"
android:name=".id232"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_pin_blue"
android:name=".id240"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_pin_blue"
android:name=".id241"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_pin_blue"
android:name=".id242"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_rabbit"
android:name=".id250"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_rabbit"
android:name=".id251"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_rabbit"
android:name=".id252"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_shine"
android:name=".id260"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_shine"
android:name=".id261"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_shine"
android:name=".id262"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity
android:name="com.vtosters.lite.FragmentWrapperActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
+3 -3
View File
@@ -5,7 +5,7 @@
background-color: %accent% !important;
}
body[scheme=bright_light] {
.vkuibright_light, [scheme=bright_light], body[scheme=bright_light] {
--accent: %accent% !important;
--action_sheet_action_foreground: %accent% !important;
--attach_picker_tab_active_background: %accent% !important;
@@ -56,7 +56,7 @@ body[scheme=bright_light] {
body[scheme=space_gray] {
.vkuispace_gray, [scheme=space_gray], body[scheme=space_gray] {
--accent: %accent% !important;
--action_sheet_action_foreground: %accent% !important;
--attach_picker_tab_active_background: %accent% !important;
@@ -132,4 +132,4 @@ h1, h2, h3 {
.articleView__content_misc_block {
background-color: %background_content% !important;
color: %text_primary% !important;
}
}
+3 -3
View File
@@ -43,12 +43,12 @@ body.article_body.article_dark {
}
/* VK Support fixes */
[scheme="client_dark"] .CatalogSearch__input, [scheme="space_gray"] .CatalogSearch__input {
[scheme="client_dark"] .CatalogSearch__input, [scheme="space_gray"] .CatalogSearch__input, .vkuispace_gray .CatalogSearch__input{
background: #000000 !important;
}
/* Generic VKUI */
body[scheme=space_gray] {
.vkuispace_gray, [scheme=space_gray], body[scheme=space_gray] {
/* light background */
--attach_picker_tab_active_icon: #000000 !important;
--background_content: #000000 !important;
@@ -89,4 +89,4 @@ body[scheme=space_gray] {
--search_bar_field_background: #212121 !important;
--selection_off_icon: #212121 !important;
--panel_tab_active_background: #212121 !important;
}
}
+14 -15
View File
@@ -1,33 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="108dp"
android:width="108dp"
android:viewportWidth="108.0"
android:viewportHeight="108.0">
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#FF000000"
android:pathData="M33.86,71.39V73.05C33.86,73.65 34.3,74.14 34.83,74.14H37.93C38.46,74.14 38.9,73.65 38.9,73.05V71.39H33.86Z" />
android:pathData="M35.14 70.63v1.2c0 0.57 0.4 1.03 0.91 1.03h2.9c0.5 0 0.9-0.46 0.9-1.02V70.7h-3.94c-0.26 0-0.52-0.02-0.77-0.07Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M43.47,71.39V73.05C43.47,73.65 43.91,74.14 44.44,74.14H47.54C48.08,74.14 48.51,73.65 48.51,73.05V71.39H43.47Z" />
android:pathData="M44.14 70.7v1.14c0 0.56 0.4 1.02 0.91 1.02h2.9c0.5 0 0.9-0.46 0.9-1.02V70.7h-4.7Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M59.49,71.39V73.05C59.49,73.65 59.92,74.14 60.46,74.14H63.56C64.09,74.14 64.53,73.65 64.53,73.05V71.39H59.49Z" />
android:pathData="M59.14 70.7v1.14c0 0.56 0.4 1.02 0.91 1.02h2.9c0.5 0 0.9-0.46 0.9-1.02V70.7h-4.7Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M69.1,71.39H74.14V73.05C74.14,73.65 73.7,74.14 73.17,74.14H70.07C69.54,74.14 69.1,73.65 69.1,73.05V71.39Z" />
android:pathData="M68.14 70.7h3.95c0.26 0 0.52-0.02 0.77-0.07v1.2c0 0.57-0.4 1.03-0.9 1.03h-2.91c-0.5 0-0.9-0.46-0.9-1.02V70.7Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M45.31,34.77L42.46,34.77C41,34.77 39.81,35.96 39.81,37.42V39.81H45.31V34.77Z" />
android:pathData="M45.86 36H43.2c-1.38 0-2.49 1.1-2.49 2.47v2.24h5.15V36Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M47.59,39.81H69.56V34.22C69.56,33.67 69.39,33.16 69.11,32.74C68.63,32.04 67.82,31.58 66.91,31.58L50.24,31.58C49.05,31.58 48.05,32.36 47.71,33.44C47.63,33.68 47.59,33.95 47.59,34.22V39.81Z" />
android:pathData="M48 40.71h20.57v-5.23c0-0.52-0.15-1-0.42-1.39-0.45-0.66-1.2-1.09-2.06-1.09H50.5c-1.12 0-2.07 0.73-2.38 1.74-0.07 0.23-0.11 0.48-0.11 0.74v5.23Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M47.59,42.1H38.13C34.85,42.1 32.17,44.68 32.04,47.91C32.04,47.99 32.03,48.07 32.03,48.16V66.91C32.03,68.37 33.23,69.56 34.7,69.56H45.74C45.25,68.79 44.94,67.89 44.94,66.91V48.16C44.94,45.77 45.97,43.62 47.59,42.1ZM37.14,49.42V49.88H39.74V49.42C39.74,48.7 39.16,48.12 38.44,48.12C37.72,48.12 37.14,48.7 37.14,49.42ZM37.14,54.46H39.74V62.77C39.74,63.49 39.16,64.07 38.44,64.07C37.72,64.07 37.14,63.49 37.14,62.77V54.46ZM36.33,51.03C35.73,51.03 35.24,51.54 35.24,52.17C35.24,52.8 35.73,53.31 36.33,53.31H39.63C40.24,53.31 40.73,52.8 40.73,52.17C40.73,51.54 40.24,51.03 39.63,51.03H36.33Z"
android:fillType="evenOdd" />
android:fillType="evenOdd"
android:pathData="M48 42.86h-8.86c-3.08 0-5.58 2.41-5.7 5.43l-0.01 0.24v17.56c0 1.37 1.12 2.48 2.5 2.48h10.34c-0.47-0.71-0.75-1.57-0.75-2.48V48.53c0-2.24 0.96-4.25 2.48-5.67Zm-9.79 6.85v0.86h2.44v-0.86c0-0.67-0.55-1.21-1.22-1.21-0.67 0-1.22 0.54-1.22 1.21Zm0 6.79h2.44v5.71c0 0.68-0.55 1.22-1.22 1.22-0.67 0-1.22-0.54-1.22-1.22V56.5Zm-0.49-4c-0.56 0-1.02 0.48-1.02 1.07 0 0.6 0.46 1.07 1.02 1.07h3.45c0.57 0 1.03-0.48 1.03-1.07 0-0.59-0.46-1.07-1.03-1.07h-3.45Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M49.77,69.56L73.32,69.56C74.78,69.56 75.97,68.37 75.97,66.91V48.16C75.97,46.01 74.85,44.13 73.18,43.06C72.23,42.45 71.11,42.1 69.91,42.1H53.19C49.85,42.1 47.14,44.81 47.14,48.16V66.91C47.14,68.37 48.31,69.55 49.77,69.56ZM53.54,49.88C53.68,57.03 56.89,61.32 62.52,61.32H62.83V57.23C64.9,57.46 66.47,59.15 67.09,61.32H70.02C69.21,58.07 67.1,56.27 65.79,55.58C67.1,54.74 68.96,52.68 69.4,49.88H66.74C66.17,52.15 64.46,54.21 62.83,54.4V49.88H60.18V57.81C58.53,57.35 56.45,55.13 56.36,49.88H53.54Z"
android:fillType="evenOdd" />
</vector>
android:fillType="evenOdd"
android:pathData="M50.04 68.57H72.1c1.37 0 2.48-1.1 2.48-2.48V48.53c0-2-1.04-3.77-2.61-4.78-0.88-0.56-1.93-0.9-3.06-0.9H53.24c-3.13 0-5.67 2.55-5.67 5.68v17.56c0 1.37 1.1 2.48 2.47 2.48Zm3.53-18.07c0.13 6.7 3.13 10.71 8.4 10.71h0.3V57.4c1.94 0.21 3.4 1.79 4 3.82H69c-0.75-3.04-2.73-4.73-3.96-5.37 1.23-0.8 2.97-2.72 3.38-5.34h-2.48c-0.54 2.12-2.14 4.05-3.67 4.24V50.5H59.8v7.42c-1.54-0.43-3.5-2.5-3.58-7.42h-2.64Z"/>
</vector>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape android:dither="true" android:shape="rectangle" android:useLevel="false" android:visible="true">
<corners android:radius="20dp" />
<solid android:color="@color/white" />
<size android:width="20dp" android:height="20dp" />
<stroke android:width="5.5dp" android:color="@android:color/transparent" />
</shape>
</item>
<item android:state_checked="false">
<shape android:dither="true" android:shape="rectangle" android:useLevel="false" android:visible="true">
<corners android:radius="20dp" />
<solid android:color="@color/white" />
<size android:width="20dp" android:height="20dp" />
<stroke android:width="5.5dp" android:color="@android:color/transparent" />
</shape>
</item>
</selector>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape android:dither="true" android:shape="rectangle" android:useLevel="false" android:visible="true">
<solid android:color="@color/black" />
<corners android:radius="20dp" />
<size android:width="35dp" android:height="20dp" />
</shape>
</item>
<item android:state_checked="false">
<shape android:dither="true" android:shape="rectangle" android:useLevel="false" android:visible="true">
<solid android:color="#cdcdcd" />
<corners android:radius="20dp" />
<size android:width="35dp" android:height="20dp" />
</shape>
</item>
</selector>
+1 -1
View File
@@ -17,7 +17,7 @@
android:paddingRight="16.0dip"
android:text="@string/cancel"
android:textAllCaps="true"
android:textColor="@color/header_blue"
android:textColor="?accent"
android:textSize="14.0sp"
android:visibility="gone" />
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

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