This commit is contained in:
gdlbo
2022-06-07 17:50:02 +03:00
parent 06ce8a7e6f
commit 8aee5a78a4
7 changed files with 35 additions and 32 deletions
@@ -19,6 +19,7 @@ public class About {
public static void injectAbout(List<Items2> list) {
list.clear();
list.add(new Items1());
if (!oldabout()) {
list.add(new Items(21, com.vtosters.lite.R.string.opencommit));
list.add(new Items(8, com.vtosters.lite.R.string.tgchannel));
@@ -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));
@@ -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;
}
}
@@ -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");
@@ -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";
}
@@ -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<String> accentColors = Arrays.asList(
public static List<String> 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;
}
@@ -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));
}
}
}
+4 -4
View File
@@ -83,6 +83,10 @@
<com.vtosters.lite.ui.MaterialSectionDividerPreference />
</PreferenceCategory>
<PreferenceCategory android:title="@string/vtlfeedwork">
<Preference
android:key="officialnewssett"
android:summary="Официальные настройки новостей встроенные в клиент"
android:title="Встроенные настройки новостей" />
<com.vtosters.lite.ui.SummaryListPreference
android:defaultValue="default"
android:dialogTitle="@string/feed_other_update_dialog_title"
@@ -100,9 +104,5 @@
android:key="feedcache"
android:summary="@string/feed_other_cache_summary"
android:title="@string/vtlfeedcache" />
<Preference
android:key="officialnewssett"
android:summary="Официальные настройки новостей встроенные в клиент"
android:title="Встроенные настройки новостей" />
</PreferenceCategory>
</PreferenceScreen>