diff --git a/app/src/main/java/ru/vtosters/lite/utils/About.java b/app/src/main/java/ru/vtosters/lite/utils/About.java index d2c2a58e7..f8e1d5f20 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/About.java +++ b/app/src/main/java/ru/vtosters/lite/utils/About.java @@ -19,6 +19,7 @@ public class About { public static void injectAbout(List list) { list.clear(); list.add(new Items1()); + if (!oldabout()) { list.add(new Items(21, com.vtosters.lite.R.string.opencommit)); list.add(new Items(8, com.vtosters.lite.R.string.tgchannel)); @@ -30,6 +31,7 @@ public class About { list.add(new Items(18, com.vtosters.lite.R.string.sett_debug)); return; } + list.add(new Items(0, com.vtosters.lite.R.string.about_app_feedback)); list.add(new Items(1, com.vtosters.lite.R.string.about_app_estimate)); list.add(new Items(2, com.vtosters.lite.R.string.about_app_privacy)); diff --git a/app/src/main/java/ru/vtosters/lite/utils/Preferences.java b/app/src/main/java/ru/vtosters/lite/utils/Preferences.java index 0fa5d8c3d..f3785a41d 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/Preferences.java +++ b/app/src/main/java/ru/vtosters/lite/utils/Preferences.java @@ -352,9 +352,11 @@ public class Preferences { public static String getLocale() { String string = getPrefsValue("lang_value"); + if (string.equals("system")) { return Locale.getDefault().getLanguage(); } + return string.isEmpty() ? Locale.getDefault().getLanguage() : string; } } diff --git a/app/src/main/java/ru/vtosters/lite/utils/Proxy.java b/app/src/main/java/ru/vtosters/lite/utils/Proxy.java index 6a1d1116f..1bb57b771 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/Proxy.java +++ b/app/src/main/java/ru/vtosters/lite/utils/Proxy.java @@ -38,48 +38,41 @@ public class Proxy { public static String getApiCom() { String string = getPrefsValue("proxyapi"); - if (!proxy() & string.isEmpty()) { - return "api.vk.com"; - } + if (!proxy() & string.isEmpty()) return "api.vk.com"; return string; } public static String getAwayPhpCom() { String string = getPrefsValue("proxyapi"); - if (!proxy() & string.isEmpty()) { - return "m.vk.com"; - } + if (!proxy() & string.isEmpty()) return "m.vk.com"; return string; } public static String getOauthCom() { String string = getPrefsValue("proxyoauth"); - if (!proxy() & string.isEmpty()) { - return "oauth.vk.com"; - } + if (!proxy() & string.isEmpty()) return "oauth.vk.com"; return string; } public static String getStaticCom() { String string = getPrefsValue("proxystatic"); - if (!proxy() & string.isEmpty()) { - return "static.vk.com"; - } + if (!proxy() & string.isEmpty()) return "static.vk.com"; return string; } public static String staticFix(String str) { String str2; String string = getPrefsValue("proxystatic"); - if (!proxy() & string.isEmpty()) { - return str; - } + + if (!proxy() & string.isEmpty()) return str; + str2 = string; return str.replace(str2, "static.vk.com"); } public static void setProxy() { Properties properties = getProperties(); + switch (getPrefsValue("proxy")) { case "zaborona": properties.setProperty("socksProxyHost", "socks.zaboronahelp.pp.ua"); diff --git a/app/src/main/java/ru/vtosters/lite/utils/SSFS.java b/app/src/main/java/ru/vtosters/lite/utils/SSFS.java index b19c7dab6..2d09ed7e2 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/SSFS.java +++ b/app/src/main/java/ru/vtosters/lite/utils/SSFS.java @@ -18,9 +18,9 @@ public class SSFS { public static String SSFSDomain() { String string = getPrefsValue("ssfscustom"); - if (!string.isEmpty()) { - return string; - } + + if (!string.isEmpty()) return string; + return "https://vtsf.vknext.net"; } diff --git a/app/src/main/java/ru/vtosters/lite/utils/Themes.java b/app/src/main/java/ru/vtosters/lite/utils/Themes.java index e98cb71d2..af78a60d1 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/Themes.java +++ b/app/src/main/java/ru/vtosters/lite/utils/Themes.java @@ -1,6 +1,7 @@ package ru.vtosters.lite.utils; import static android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; +import static java.util.Arrays.asList; import static ru.vtosters.lite.utils.Globals.getContext; import static ru.vtosters.lite.utils.Globals.getPrefsValue; import static ru.vtosters.lite.utils.Preferences.color_grishka; @@ -29,11 +30,10 @@ import com.vk.im.ui.themes.ImTheme; import com.vk.im.ui.themes.ImThemeHelper; import com.vtosters.lite.R; -import java.util.Arrays; import java.util.List; public class Themes { - public static List accentColors = Arrays.asList( + public static List accentColors = asList( "71AAEB", "3F8AE0", "528BCC", "4986CC", "5181B8", "74A2D6", "518BCC" ); @@ -191,8 +191,10 @@ public class Themes { new int[]{android.R.attr.state_selected}, new int[]{-android.R.attr.state_selected} }, new int[] {isSelAccent ? getAccentColor() : sel, isUnselAccent ? getAccentColor() : unsel}); } + return csl; } catch (Exception e) { + e.printStackTrace(); return null; } diff --git a/app/src/main/java/ru/vtosters/lite/utils/VKUIInjector.java b/app/src/main/java/ru/vtosters/lite/utils/VKUIInjector.java index f62f4b183..4e6cf26eb 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/VKUIInjector.java +++ b/app/src/main/java/ru/vtosters/lite/utils/VKUIInjector.java @@ -1,12 +1,12 @@ package ru.vtosters.lite.utils; +import static android.util.Base64.encodeToString; import static ru.vtosters.lite.utils.Globals.getContext; import static ru.vtosters.lite.utils.Globals.getPrefsValue; import static ru.vtosters.lite.utils.Preferences.getBoolValue; import static ru.vtosters.lite.utils.Themes.getColorFromAttr; import static ru.vtosters.lite.utils.Themes.hex; -import android.util.Base64; import android.webkit.WebView; import com.vtosters.lite.R; @@ -22,17 +22,13 @@ public class VKUIInjector { private static String loadedCSS = ""; private static String loadedCSSAmoled = ""; - static { - } - - public VKUIInjector() { - } - private static String load(String str) { try { InputStream open = getContext().getAssets().open(str); StringBuilder sb = new StringBuilder(); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(open, StandardCharsets.UTF_8)); + while (true) { String readLine = bufferedReader.readLine(); if (readLine != null) { @@ -42,7 +38,9 @@ public class VKUIInjector { return sb.toString(); } } + } catch (IOException e) { + e.printStackTrace(); return ""; } @@ -68,20 +66,26 @@ public class VKUIInjector { public static void inject(WebView webView) { String string = getPrefsValue("darktheme"); + if (getBoolValue("VKUI_INJ", true)) { + if (!isLoaded) { load(); } + StringBuilder sb = new StringBuilder(); + if (true/*Themes.isAccentedCache()*/) { sb.append("\n\n"); sb.append(loadedCSS); } + if (string.equals("amoled")) { sb.append("\n\n"); sb.append(loadedCSSAmoled); } - inject(webView, Base64.encodeToString(sb.toString().getBytes(), 2)); + + inject(webView, encodeToString(sb.toString().getBytes(), 2)); } } } diff --git a/smali/res/xml/preferences_feed.xml b/smali/res/xml/preferences_feed.xml index 407ba5e68..83ff543ba 100644 --- a/smali/res/xml/preferences_feed.xml +++ b/smali/res/xml/preferences_feed.xml @@ -83,6 +83,10 @@ + - \ No newline at end of file