Reworked some cringe code
This commit is contained in:
@@ -27,7 +27,6 @@ import java.util.regex.Pattern;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.f0x1d.net.F0x1dRequest;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
public class FoafBase {
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.BooleanFalse;
|
||||
|
||||
import android.content.ContentValues;
|
||||
@@ -76,7 +76,7 @@ public class DeletedMessagesHandler {
|
||||
}
|
||||
|
||||
private static String getPreifxUndelete() {
|
||||
String string = getPreferences().getString("undeletemsg_prefix", "");
|
||||
String string = getPrefsValue("undeletemsg_prefix");
|
||||
if (string.isEmpty()) {
|
||||
return "[Удалено] ";
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ public class Globals {
|
||||
return prefs;
|
||||
}
|
||||
|
||||
public static String getPrefsValue(String pref) {
|
||||
return getPreferences().getString(pref, "");
|
||||
}
|
||||
|
||||
// Current UserId
|
||||
public static int getUserId() {
|
||||
return VKAccountManager.b().a();
|
||||
@@ -162,14 +166,14 @@ public class Globals {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
NotificationManager notificationManager = (NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
boolean z = false;
|
||||
boolean hasMusicChannel = false;
|
||||
try {
|
||||
if (notificationManager.getNotificationChannel("audio_playback_channel") != null) {
|
||||
z = true;
|
||||
hasMusicChannel = true;
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
if (!z) {
|
||||
if (!hasMusicChannel) {
|
||||
notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", getResources().getString(com.vtosters.lite.R.string.audio_message_play_error), NotificationManager.IMPORTANCE_LOW));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package ru.vtosters.lite.utils;
|
||||
import static java.lang.Long.MAX_VALUE;
|
||||
import static ru.vtosters.lite.ui.fragments.dockbar.DockBarManager.getInstance;
|
||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.BooleanTrue;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsgroup;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsstories;
|
||||
@@ -65,10 +65,10 @@ public class Newsfeed {
|
||||
getFilter("default_ad_list", "StandartFilter.txt");
|
||||
getFilter("shitposting", "IDontWantToReadIt.txt");
|
||||
|
||||
String string = getPreferences().getString("spamfilters", "");
|
||||
String customfilters = getPrefsValue("spamfilters");
|
||||
|
||||
if (!string.isEmpty()) {
|
||||
mFilters.addAll(Arrays.asList(string.split(", ")));
|
||||
if (!getPrefsValue("spamfilters").isEmpty()) {
|
||||
mFilters.addAll(Arrays.asList(customfilters.split(", ")));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public class Newsfeed {
|
||||
}
|
||||
|
||||
public static String getCommentsSort(String def) {
|
||||
switch (getPreferences().getString("commentssort", "")) {
|
||||
switch (getPrefsValue("commentssort")) {
|
||||
case "new":
|
||||
return "desc";
|
||||
case "old":
|
||||
@@ -182,7 +182,7 @@ public class Newsfeed {
|
||||
}
|
||||
|
||||
public static long getUpdateNewsfeed(boolean refresh_timeout) {
|
||||
switch (getPreferences().getString("newsupdate", "")) {
|
||||
switch (getPrefsValue("newsupdate")) {
|
||||
case "no_update":
|
||||
return MAX_VALUE;
|
||||
case "imd_update":
|
||||
@@ -193,7 +193,7 @@ public class Newsfeed {
|
||||
}
|
||||
|
||||
public static Class getStartFragment() {
|
||||
switch (getPreferences().getString("start_values", "")) {
|
||||
switch (getPrefsValue("start_values")) {
|
||||
case "newsfeed":
|
||||
return newfeed() ? HomeFragment.class : NewsfeedFragment.class;
|
||||
case "messenger":
|
||||
|
||||
@@ -37,18 +37,15 @@ public class OEMDetector {
|
||||
|
||||
private static String getSystemProperty(String str) {
|
||||
BufferedReader bufferedReader;
|
||||
Throwable th;
|
||||
BufferedReader bufferedReader2 = null;
|
||||
try {
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec("getprop " + str).getInputStream()), 1024);
|
||||
try {
|
||||
String readLine = bufferedReader.readLine();
|
||||
try {
|
||||
bufferedReader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return readLine;
|
||||
return bufferedReader.readLine();
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import static ru.vtosters.lite.ui.fragments.multiaccount.MultiAccountManager.mig
|
||||
import static ru.vtosters.lite.utils.DeletedMessagesHandler.reloadMessagesList;
|
||||
import static ru.vtosters.lite.utils.Globals.fixGapps;
|
||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Globals.registerActivities;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.setupFilters;
|
||||
import static ru.vtosters.lite.utils.OpusLoader.LoadLibrary;
|
||||
@@ -298,7 +298,7 @@ public class Preferences {
|
||||
}
|
||||
|
||||
public static int getMsgCount() {
|
||||
String customvalue = getPreferences().getString("msgcount", "");
|
||||
String customvalue = getPrefsValue("msgcount");
|
||||
return customvalue.isEmpty() ? 30 : Integer.parseInt(customvalue);
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ public class Preferences {
|
||||
}
|
||||
|
||||
public static String getLocale() {
|
||||
String string = getPreferences().getString("lang_value", "");
|
||||
String string = getPrefsValue("lang_value");
|
||||
if (string.equals("system")) {
|
||||
return Locale.getDefault().getLanguage();
|
||||
}
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static java.lang.System.*;
|
||||
import static ru.vtosters.lite.utils.Globals.*;
|
||||
import static ru.vtosters.lite.utils.Preferences.*;
|
||||
import static java.lang.System.clearProperty;
|
||||
import static java.lang.System.getProperties;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.BooleanFalse;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
public class Proxy {
|
||||
public static String getOauthComAuth() {
|
||||
String oauthComHttps = getOauthComHttps();
|
||||
return oauthComHttps + "/authorize";
|
||||
return getOauthComHttps() + "/authorize";
|
||||
}
|
||||
|
||||
public static String getOauthComAuthClient() {
|
||||
String oauthComAuth = getOauthComAuth();
|
||||
return oauthComAuth + "?client_id=";
|
||||
return getOauthComAuth() + "?client_id=";
|
||||
}
|
||||
|
||||
public static String getOauthComBlank() {
|
||||
String oauthComHttps = getOauthComHttps();
|
||||
return oauthComHttps + "/blank.html";
|
||||
return getOauthComHttps() + "/blank.html";
|
||||
}
|
||||
|
||||
public static String getOauthComBlankRedirect() {
|
||||
@@ -31,8 +29,7 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static String getStaticComSupport() {
|
||||
String staticCom = getStaticCom();
|
||||
return staticCom + "/support";
|
||||
return getStaticCom() + "/support";
|
||||
}
|
||||
|
||||
public static String oauthFix() {
|
||||
@@ -40,7 +37,7 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static String getApiCom() {
|
||||
String string = getPreferences().getString("proxyapi", "");
|
||||
String string = getPrefsValue("proxyapi");
|
||||
if (!proxy() & string.isEmpty()) {
|
||||
return "api.vk.com";
|
||||
}
|
||||
@@ -48,7 +45,7 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static String getAwayPhpCom() {
|
||||
String string = getPreferences().getString("proxyapi", "");
|
||||
String string = getPrefsValue("proxyapi");
|
||||
if (!proxy() & string.isEmpty()) {
|
||||
return "m.vk.com";
|
||||
}
|
||||
@@ -56,7 +53,7 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static String getOauthCom() {
|
||||
String string = getPreferences().getString("proxyoauth", "");
|
||||
String string = getPrefsValue("proxyoauth");
|
||||
if (!proxy() & string.isEmpty()) {
|
||||
return "oauth.vk.com";
|
||||
}
|
||||
@@ -64,7 +61,7 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static String getStaticCom() {
|
||||
String string = getPreferences().getString("proxystatic", "");
|
||||
String string = getPrefsValue("proxystatic");
|
||||
if (!proxy() & string.isEmpty()) {
|
||||
return "static.vk.com";
|
||||
}
|
||||
@@ -73,7 +70,7 @@ public class Proxy {
|
||||
|
||||
public static String staticFix(String str) {
|
||||
String str2;
|
||||
String string = getPreferences().getString("proxystatic", "");
|
||||
String string = getPrefsValue("proxystatic");
|
||||
if (!proxy() & string.isEmpty()) {
|
||||
return str;
|
||||
}
|
||||
@@ -83,7 +80,7 @@ public class Proxy {
|
||||
|
||||
public static void setProxy() {
|
||||
Properties properties = getProperties();
|
||||
switch (getPreferences().getString("proxy", "")) {
|
||||
switch (getPrefsValue("proxy")) {
|
||||
case "zaborona":
|
||||
properties.setProperty("socksProxyHost", "socks.zaboronahelp.pp.ua");
|
||||
properties.setProperty("socksProxyPort", "1488");
|
||||
@@ -157,57 +154,57 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static String proxyHostHTTP() {
|
||||
String string = getPreferences().getString("proxyHostHTTP", "");
|
||||
String string = getPrefsValue("proxyHostHTTP");
|
||||
return string.isEmpty() ? "192.168.0.1" : string;
|
||||
}
|
||||
|
||||
public static String proxyHostHTTPS() {
|
||||
String string = getPreferences().getString("proxyHostHTTPS", "");
|
||||
String string = getPrefsValue("proxyHostHTTPS");
|
||||
return string.isEmpty() ? "192.168.0.1" : string;
|
||||
}
|
||||
|
||||
public static String proxyHostSocks() {
|
||||
String string = getPreferences().getString("proxyHostSocks", "");
|
||||
String string = getPrefsValue("proxyHostSocks");
|
||||
return string.isEmpty() ? "192.168.0.1" : string;
|
||||
}
|
||||
|
||||
public static String proxyPortHTTP() {
|
||||
String string = getPreferences().getString("proxyPortHTTP", "");
|
||||
String string = getPrefsValue("proxyPortHTTP");
|
||||
return string.isEmpty() ? "8888" : string;
|
||||
}
|
||||
|
||||
public static String proxyPortHTTPS() {
|
||||
String string = getPreferences().getString("proxyPortHTTPS", "");
|
||||
String string = getPrefsValue("proxyPortHTTPS");
|
||||
return string.isEmpty() ? "8888" : string;
|
||||
}
|
||||
|
||||
public static String proxyPortSocks() {
|
||||
String string = getPreferences().getString("proxyPortSocks", "");
|
||||
String string = getPrefsValue("proxyPortSocks");
|
||||
return string.isEmpty() ? "8888" : string;
|
||||
}
|
||||
|
||||
public static String proxyUserHTTP() {
|
||||
String string = getPreferences().getString("proxyUserHTTP", "");
|
||||
String string = getPrefsValue("proxyUserHTTP");
|
||||
return string.isEmpty() ? "" : string;
|
||||
}
|
||||
|
||||
public static String proxyUserHTTPS() {
|
||||
String string = getPreferences().getString("proxyUserHTTPS", "");
|
||||
String string = getPrefsValue("proxyUserHTTPS");
|
||||
return string.isEmpty() ? "" : string;
|
||||
}
|
||||
|
||||
public static String proxyPassHTTP() {
|
||||
String string = getPreferences().getString("proxyPassHTTP", "");
|
||||
String string = getPrefsValue("proxyPassHTTP");
|
||||
return string.isEmpty() ? "" : string;
|
||||
}
|
||||
|
||||
public static String proxyPassHTTPS() {
|
||||
String string = getPreferences().getString("proxyPassHTTPS", "");
|
||||
String string = getPrefsValue("proxyPassHTTPS");
|
||||
return string.isEmpty() ? "" : string;
|
||||
}
|
||||
|
||||
public static boolean proxy() {
|
||||
return getPreferences().getString("proxy", "").equals("apiproxy");
|
||||
return getPrefsValue("proxy").equals("apiproxy");
|
||||
}
|
||||
|
||||
// Official vk proxy enforcer
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.About.getBuildNumber;
|
||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Globals.getUserSecret;
|
||||
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
@@ -17,7 +17,7 @@ public class SSFS {
|
||||
}
|
||||
|
||||
public static String SSFSDomain() {
|
||||
String string = getPreferences().getString("ssfscustom", "");
|
||||
String string = getPrefsValue("ssfscustom");
|
||||
if (!string.isEmpty()) {
|
||||
return string;
|
||||
}
|
||||
@@ -29,8 +29,7 @@ public class SSFS {
|
||||
}
|
||||
|
||||
public static String getAmoledVKUI() {
|
||||
String string = getPreferences().getString("darktheme", "");
|
||||
return string.equals("amoled") ? "1" : "0";
|
||||
return getPrefsValue("darktheme").equals("amoled") ? "1" : "0";
|
||||
}
|
||||
|
||||
public static String getUserProxy() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.color_grishka;
|
||||
import static ru.vtosters.lite.utils.Preferences.isBGStickersEnabled;
|
||||
import static ru.vtosters.lite.utils.Preferences.navbar;
|
||||
@@ -58,7 +58,7 @@ public class Themes {
|
||||
}
|
||||
|
||||
public static VKTheme getDarkTheme() {
|
||||
switch (getPreferences().getString("darktheme", "")) {
|
||||
switch (getPrefsValue("darktheme")) {
|
||||
case "amoled":
|
||||
return VKTheme.AMOLED;
|
||||
default:
|
||||
@@ -67,7 +67,7 @@ public class Themes {
|
||||
}
|
||||
|
||||
public static ImTheme getImDarkTheme() {
|
||||
switch (getPreferences().getString("darktheme", "")) {
|
||||
switch (getPrefsValue("darktheme")) {
|
||||
case "amoled":
|
||||
return ImTheme.VKAPP_AMOLED;
|
||||
default:
|
||||
@@ -76,14 +76,14 @@ public class Themes {
|
||||
}
|
||||
|
||||
public static VKTheme getLightTheme() {
|
||||
switch (getPreferences().getString("lighttheme", "")) {
|
||||
switch (getPrefsValue("lighttheme")) {
|
||||
default:
|
||||
return VKTheme.DEFAULT_LIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
public static ImTheme getImLightTheme() {
|
||||
switch (getPreferences().getString("lighttheme", "")) {
|
||||
switch (getPrefsValue("lighttheme")) {
|
||||
default:
|
||||
return ImTheme.VKAPP_LIGHT;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
||||
import static ru.vtosters.lite.utils.Globals.getPreferences;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Themes.getColorFromAttr;
|
||||
import static ru.vtosters.lite.utils.Themes.hex;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class VKUIInjector {
|
||||
}
|
||||
|
||||
public static void inject(WebView webView) {
|
||||
String string = getPreferences().getString("darktheme", "");
|
||||
String string = getPrefsValue("darktheme");
|
||||
if (Preferences.BooleanTrue("VKUI_INJ")) {
|
||||
if (!isLoaded) {
|
||||
load();
|
||||
|
||||
Reference in New Issue
Block a user