Amoled Theme feature

This commit is contained in:
gdlbo
2022-04-22 18:51:42 +03:00
parent 82d45915c6
commit 3806a05f4a
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));
}
}
+92
View File
@@ -0,0 +1,92 @@
/* vkui.css V2 by iTaysonLab */
/* Articles */
body.article_body.article_dark {
background-color: #000000 !important;
}
.article_dark .articleView__content {
border-top: #000000 !important;
background-color: #000000 !important;
}
.article_dark .article {
background-color: #000000 !important;
color: #FFFFFF !important;
}
.articleView__content_misc_block .articleView__content_views_info {
color: #FFFFFF !important;
}
.article_dark .article>h1 {
color: %textColorPrimary% !important;
}
.article__info_line {
color: #FFFFFF !important;
}
.Audio__duration, .r .ai_dur {
color: #FFFFFF !important;
}
.Audio__texts, .r .ai_label {
color: #FFFFFF !important;
}
.article_dark .ai_title {
color: #FFFFFF !important;
}
.article>figure figcaption:not(.article_ed__figcaption) {
color: #FFFFFF !important;
}
/* VK Support fixes */
[scheme="client_dark"] .CatalogSearch__input, [scheme="space_gray"] .CatalogSearch__input {
background: #000000 !important;
}
/* Generic VKUI */
body[scheme=space_gray] {
/* light background */
--attach_picker_tab_active_icon: #000000 !important;
--background_content: #000000 !important;
--button_bot_shadow: #000000 !important;
--button_primary_foreground: #000000 !important;
--content_tint_background: #000000 !important;
--counter_secondary_text: #000000 !important;
--loader_background: #000000 !important;
--overlay_status_background: #000000 !important;
--header_background: #19191a !important;
--header_alternate_background: #19191a !important;
--separator_alternate: #000000 !important;
--segmented_control_bar_background: #000000 !important;
--search_bar_background: #000000 !important;
/* background */
--background_page: #000000 !important;
--header_background_before_blur: #19191a !important;
--header_background_before_blur_alternate: #19191a !important;
/* lighter BG (text fields) */
--attach_picker_tab_inactive_background: #121212 !important;
--background_keyboard: #121212 !important;
--background_suggestions: #121212 !important;
--field_background: #121212 !important;
--im_bubble_incoming: #121212 !important;
--input_border: #121212 !important;
--modal_card_background: #121212 !important;
--separator_common: #121212 !important;
--snippet_background: #121212 !important;
--android_active_color: #121212 !important;
--switch_ios_off_border: #121212 !important;
/* third BG (buttons) */
--button_secondary_background: #212121 !important;
--header_search_field_background: #212121 !important;
--icon_tertiary: #212121 !important;
--im_bubble_outgoing: #212121 !important;
--input_background: #212121 !important;
--loader_track_fill: #212121 !important;
--search_bar_field_background: #212121 !important;
--selection_off_icon: #212121 !important;
--panel_tab_active_background: #212121 !important;
}
-1
View File
@@ -4,7 +4,6 @@
<Preference android:enabled="false" android:title="Внимание!" android:summary="Данное меню предназначено только для тестирования работоспособности приложения. Если вы являетесь рядовым юзером, то вам не следует ничего не трогать в данных настройках, что бы не было проблем с работой приложения!" />
<com.vtosters.lite.ui.MaterialSwitchPreference android:title="Показывать пункт дебага в настройках" android:key="devmenu" android:defaultValue="false" />
<PreferenceCategory android:title="Experimental">
<com.vtosters.lite.ui.MaterialSwitchPreference android:title="Amoled Test" android:key="amoled" android:defaultValue="false" />
<EditTextPreference android:title="Изменение версии вк" android:key="vkversion" android:summary="Требуется перезапуск" android:defaultValue="" />
<com.vtosters.lite.ui.MaterialSwitchPreference android:title="@string/vtlusevkui" android:key="usevkui" android:summary="Редактирование страницы?" android:defaultValue="true" />
<com.vtosters.lite.ui.MaterialSwitchPreference android:title="Статистика страницы" android:key="unlockstats" android:summary="Вкшники вроде перестали отдавать инфу" android:defaultValue="false" />
+1
View File
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
<com.vtosters.lite.ui.MaterialSwitchPreference android:title="Amoled тема" android:summary="Для примненения изменений поменяйте тему" android:key="amoled" android:defaultValue="false" />
<PreferenceCategory android:title="@string/vticon">
<com.vtosters.lite.ui.MaterialSwitchPreference android:title="@string/vticonbtn" android:key="iconvk" android:summary="@string/vticonsummary" android:defaultValue="false" />
<com.vtosters.lite.ui.MaterialSectionDividerPreference />