From a1317fc7bbba9b26bb65d207bd48f7f79b7e98fd Mon Sep 17 00:00:00 2001 From: Captain Throwback Date: Sat, 29 Jan 2022 12:45:35 -0500 Subject: [PATCH] theme: move TW_THEME_VERSION to variables.h Automatically add the current theme version to the splash and ui xmls during the build Change-Id: I52f8cb41fabe34a8849ecc54ece3c0fb645dcd74 --- Android.mk | 6 ++++++ gui/pages.cpp | 4 +--- gui/theme/landscape_hdpi/splash.xml | 2 +- gui/theme/landscape_hdpi/ui.xml | 2 +- gui/theme/landscape_mdpi/splash.xml | 2 +- gui/theme/landscape_mdpi/ui.xml | 2 +- gui/theme/portrait_hdpi/splash.xml | 2 +- gui/theme/portrait_hdpi/ui.xml | 2 +- gui/theme/portrait_mdpi/splash.xml | 2 +- gui/theme/portrait_mdpi/ui.xml | 2 +- gui/theme/watch_mdpi/splash.xml | 2 +- gui/theme/watch_mdpi/ui.xml | 2 +- variables.h | 6 ++++++ 13 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Android.mk b/Android.mk index 5f2916a6..d3cd3b0a 100755 --- a/Android.mk +++ b/Android.mk @@ -560,6 +560,12 @@ endif LOCAL_REQUIRED_MODULES += $(TWRP_REQUIRED_MODULES) +TW_THEME_VERSION := $(shell echo "`grep TW_THEME_VERSION bootable/recovery/variables.h | cut -d ' ' -f 3`") + +LOCAL_POST_INSTALL_CMD += \ + sed -i "s/{themeversion}/$(TW_THEME_VERSION)/" $(TARGET_RECOVERY_ROOT_OUT)/twres/splash.xml; \ + sed -i "s/{themeversion}/$(TW_THEME_VERSION)/" $(TARGET_RECOVERY_ROOT_OUT)/twres/ui.xml; + include $(BUILD_EXECUTABLE) # Symlink for file_contexts diff --git a/gui/pages.cpp b/gui/pages.cpp index bc4a9360..8b9ce464 100755 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -53,9 +53,7 @@ extern "C" { #include "objects.hpp" #include "blanktimer.hpp" -// version 2 requires theme to handle power button as action togglebacklight -// version 4 adds fastbootd support -#define TW_THEME_VERSION 4 +#include "../variables.h" #define TW_THEME_VER_ERR -2 diff --git a/gui/theme/landscape_hdpi/splash.xml b/gui/theme/landscape_hdpi/splash.xml index b9d78536..56391bde 100644 --- a/gui/theme/landscape_hdpi/splash.xml +++ b/gui/theme/landscape_hdpi/splash.xml @@ -5,7 +5,7 @@ TeamWin TWRP splash screen - 4 + {themeversion} diff --git a/gui/theme/landscape_hdpi/ui.xml b/gui/theme/landscape_hdpi/ui.xml index da3c5fca..bd055bd5 100755 --- a/gui/theme/landscape_hdpi/ui.xml +++ b/gui/theme/landscape_hdpi/ui.xml @@ -6,7 +6,7 @@ Backup Naowz Default basic theme preview.png - 4 + {themeversion} diff --git a/gui/theme/landscape_mdpi/splash.xml b/gui/theme/landscape_mdpi/splash.xml index a2098fbb..ea87310d 100644 --- a/gui/theme/landscape_mdpi/splash.xml +++ b/gui/theme/landscape_mdpi/splash.xml @@ -5,7 +5,7 @@ TeamWin TWRP splash screen - 4 + {themeversion} diff --git a/gui/theme/landscape_mdpi/ui.xml b/gui/theme/landscape_mdpi/ui.xml index e29aa6bf..9ab8863d 100755 --- a/gui/theme/landscape_mdpi/ui.xml +++ b/gui/theme/landscape_mdpi/ui.xml @@ -6,7 +6,7 @@ Backup Naowz Default basic theme preview.png - 4 + {themeversion} diff --git a/gui/theme/portrait_hdpi/splash.xml b/gui/theme/portrait_hdpi/splash.xml index f0b07568..f793afaa 100644 --- a/gui/theme/portrait_hdpi/splash.xml +++ b/gui/theme/portrait_hdpi/splash.xml @@ -5,7 +5,7 @@ TeamWin TWRP splash screen - 4 + {themeversion} diff --git a/gui/theme/portrait_hdpi/ui.xml b/gui/theme/portrait_hdpi/ui.xml index 70df4e88..f7d21da3 100755 --- a/gui/theme/portrait_hdpi/ui.xml +++ b/gui/theme/portrait_hdpi/ui.xml @@ -6,7 +6,7 @@ Backup Naowz Default basic theme preview.png - 4 + {themeversion} diff --git a/gui/theme/portrait_mdpi/splash.xml b/gui/theme/portrait_mdpi/splash.xml index 4ce64b35..b0b97ee5 100644 --- a/gui/theme/portrait_mdpi/splash.xml +++ b/gui/theme/portrait_mdpi/splash.xml @@ -5,7 +5,7 @@ TeamWin TWRP splash screen - 4 + {themeversion} diff --git a/gui/theme/portrait_mdpi/ui.xml b/gui/theme/portrait_mdpi/ui.xml index 9ed1a20a..9189df0c 100755 --- a/gui/theme/portrait_mdpi/ui.xml +++ b/gui/theme/portrait_mdpi/ui.xml @@ -6,7 +6,7 @@ Backup Naowz Default basic theme preview.png - 4 + {themeversion} diff --git a/gui/theme/watch_mdpi/splash.xml b/gui/theme/watch_mdpi/splash.xml index 62e8dc37..2ce71b38 100644 --- a/gui/theme/watch_mdpi/splash.xml +++ b/gui/theme/watch_mdpi/splash.xml @@ -5,7 +5,7 @@ TeamWin TWRP splash screen - 3 + {themeversion} diff --git a/gui/theme/watch_mdpi/ui.xml b/gui/theme/watch_mdpi/ui.xml index 8ec73dff..ed7ac825 100644 --- a/gui/theme/watch_mdpi/ui.xml +++ b/gui/theme/watch_mdpi/ui.xml @@ -7,7 +7,7 @@ Backup Naowz Default basic theme preview.png - 4 + {themeversion} diff --git a/variables.h b/variables.h index aeb26693..8da69e94 100755 --- a/variables.h +++ b/variables.h @@ -149,6 +149,12 @@ #define TW_IS_SUPER "tw_is_super" #define TW_AUTO_REFLASHTWRP_VAR "tw_auto_reflashtwrp" +// Theme versioning +// version 2 requires theme to handle power button as action togglebacklight +// version 4 adds listbox support to reboot page +// version 5 adds File Manager options, nano & Flash Current TWRP +#define TW_THEME_VERSION 5 + // Also used: // tw_boot_is_mountable // tw_system_is_mountable