@@ -24,9 +24,7 @@ public class VKUIHook {
|
||||
|
||||
private static void applyVKUIStyles(WebView webView) {
|
||||
if (getBoolValue("VKUI_INJ", true) && webView != null && webView.getUrl() != null && !webView.getUrl().contains("static.vk.com/memories")) {
|
||||
if (!WebViewColoringUtils.isLoaded) {
|
||||
WebViewColoringUtils.load();
|
||||
}
|
||||
WebViewColoringUtils.load();
|
||||
loadAndApplyCSS(webView);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import com.vk.core.drawable.RecoloredDrawable;
|
||||
import com.vk.core.ui.themes.MilkshakeHelper;
|
||||
import com.vk.core.ui.themes.VKTheme;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.im.engine.models.dialogs.DialogTheme;
|
||||
import com.vk.im.ui.themes.DefaultThemeProvider;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.data.ThemeTracker;
|
||||
import ru.vtosters.lite.deviceinfo.OEMDetector;
|
||||
@@ -31,9 +33,7 @@ import ru.vtosters.lite.themes.ThemesCore;
|
||||
import ru.vtosters.lite.themes.ThemesHacks;
|
||||
import ru.vtosters.lite.themes.ThemesManager;
|
||||
import ru.vtosters.lite.ui.wallpapers.WallpapersHooks;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
import ru.vtosters.lite.utils.WebViewColoringUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ThemesUtils {
|
||||
try {
|
||||
setTheme(theme, LifecycleUtils.getCurrentActivity(), restartActivity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
} // Apply VKTheme and ImTheme (hard applying without dynamic theme changing)
|
||||
|
||||
@@ -62,14 +62,27 @@ public class ThemesUtils {
|
||||
activity = LifecycleUtils.getCurrentActivity();
|
||||
}
|
||||
VKThemeHelper.theme(theme, activity, fl);
|
||||
if (isMonetTheme() || ThemesManager.canApplyCustomAccent()) ThemesCore.clear();
|
||||
if (restartActivity) activity.recreate();
|
||||
if (isMonetTheme() || ThemesManager.canApplyCustomAccent()) {
|
||||
ThemesCore.clear();
|
||||
ThemesCore.init();
|
||||
DialogTheme.d.a(new DefaultThemeProvider(VKThemeHelper.k).b()); // reset dialog attrs cache
|
||||
}
|
||||
ThemeTracker.a();
|
||||
WebViewColoringUtils.isLoaded = false;
|
||||
if (restartActivity) {
|
||||
activity.recreate();
|
||||
}
|
||||
new WebView(activity).clearCache(true);
|
||||
WebCachePreloader.e();
|
||||
}
|
||||
|
||||
public static DialogTheme getDialogTheme() {
|
||||
if (isMonetTheme()) {
|
||||
return new DefaultThemeProvider(VKThemeHelper.k).b(); // get directly from theme cuz monet issue
|
||||
} else {
|
||||
return DialogTheme.d.a(); // get cached theme
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDarkTheme() {
|
||||
return VKThemeHelper.r();
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ public class ThemesCore {
|
||||
private static int darken_color;
|
||||
|
||||
static {
|
||||
setExceptions();
|
||||
setThemedColors(ThemesUtils.getAccentColor());
|
||||
init();
|
||||
}
|
||||
|
||||
public static void setExceptions() {
|
||||
@@ -201,4 +200,9 @@ public class ThemesCore {
|
||||
public static boolean isCachedAccents() {
|
||||
return cachedAccents;
|
||||
}
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
setExceptions();
|
||||
setThemedColors(ThemesUtils.getAccentColor());
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import static ru.vtosters.hooks.other.ThemesUtils.*;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
|
||||
public class WebViewColoringUtils {
|
||||
public static boolean isLoaded = false;
|
||||
public static String loadedCSS = "";
|
||||
public static String loadedCSSAmoled = "";
|
||||
|
||||
@@ -53,7 +52,6 @@ public class WebViewColoringUtils {
|
||||
public static void load() {
|
||||
loadedCSS = readCSS("vt_ui_accent.css");
|
||||
loadedCSSAmoled = readCSS("vt_ui_oled.css");
|
||||
isLoaded = true;
|
||||
}
|
||||
|
||||
public static void inject(WebView webView, String str) {
|
||||
|
||||
@@ -1196,7 +1196,9 @@
|
||||
.locals 1
|
||||
|
||||
.line 1
|
||||
iget-object v0, p0, Lcom/vk/im/engine/models/dialogs/Dialog;->theme:Lcom/vk/im/engine/models/dialogs/DialogTheme;
|
||||
invoke-static {}, Lru/vtosters/hooks/other/ThemesUtils;->getDialogTheme()Lcom/vk/im/engine/models/dialogs/DialogTheme;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
return-object v0
|
||||
.end method
|
||||
|
||||
Reference in New Issue
Block a user