Amoled Theme feature

This commit is contained in:
gdlbo
2022-04-22 18:51:42 +03:00
parent 515f90105c
commit 24571ea22f
4 changed files with 100 additions and 4 deletions
@@ -1,5 +1,7 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Themes.amoled;
import android.util.Base64;
import android.util.Log;
import android.webkit.WebView;
@@ -50,7 +52,7 @@ public class VKUIInjector {
.replace("%background_content%", Themes.hex(Themes.getColorFromAttr(R.attr.background_content)))
.replace("%text_primary%", Themes.hex(Themes.getColorFromAttr(R.attr.text_primary)));
// loadedCSSAmoled = load("vt_ui_oled.css");
loadedCSSAmoled = load("vt_ui_oled.css");
isLoaded = true;
}
@@ -65,11 +67,13 @@ public class VKUIInjector {
}
StringBuilder sb = new StringBuilder();
if (true/*Themes.isAccentedCache()*/) {
Log.d("VKUI", "Injecting Accent");
sb.append("\n\n");
sb.append(loadedCSS);
}
Log.d("VKUI", "Final CSS: " + sb.toString());
if (amoled() == true) {
sb.append("\n\n");
sb.append(loadedCSSAmoled);
}
inject(webView, Base64.encodeToString(sb.toString().getBytes(), 2));
}
}