From fcbaf814f3d46e21ac7ffa77f4883228468c1d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yilli=C3=A9?= Date: Mon, 11 Jul 2022 14:30:43 +0500 Subject: [PATCH] gui : Allow changing vertical alignment of status bar icons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - If the var TW_STATUS_ICONS_ALIGN can be set to: 1) 'center' or '2' to center-align the icons/text (vertically) 2) 'bottom' or '3' to bottom-align the icons/text (vertically) ( Value calculated by utilizing statusbar height & size of font_m ). - If set to anything else or not set at all, it falls back to twrp's old behaviour of top-aligning the status bar icons. Change-Id: I1b292221f3c34bbac20233595fbc0958d4aa4cc1 Signed-off-by: Yillié Signed-off-by: Mohd Faraz --- gui/libguitwrp_defaults.go | 7 +++++++ gui/theme/landscape_hdpi/ui.xml | 5 ++++- gui/theme/landscape_mdpi/ui.xml | 5 ++++- gui/theme/portrait_hdpi/ui.xml | 5 ++++- gui/theme/portrait_mdpi/ui.xml | 5 ++++- gui/theme/watch_mdpi/ui.xml | 5 ++++- 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/gui/libguitwrp_defaults.go b/gui/libguitwrp_defaults.go index 4ba6491f..290be250 100644 --- a/gui/libguitwrp_defaults.go +++ b/gui/libguitwrp_defaults.go @@ -150,10 +150,17 @@ func copyThemeResources(ctx android.BaseContext, dirs []string, files []string) } } + alignProp := "%status_topalign_header_y%" + if strings.Trim(getMakeVars(ctx, "TW_STATUS_ICONS_ALIGN"), "\"") == "center" || strings.Trim(getMakeVars(ctx, "TW_STATUS_ICONS_ALIGN"), "\"") == "2" { + alignProp = "%status_centeralign_header_y%" + } else if strings.Trim(getMakeVars(ctx, "TW_STATUS_ICONS_ALIGN"), "\"") == "bottom" || strings.Trim(getMakeVars(ctx, "TW_STATUS_ICONS_ALIGN"), "\"") == "3" { + alignProp = "%status_bottomalign_header_y%" + } newFile = strings.Replace(newFile, "{battery_pos}", props[0], -1) newFile = strings.Replace(newFile, "{cpu_pos}", props[1], -1) newFile = strings.Replace(newFile, "{clock_12_pos}", props[2], -1) newFile = strings.Replace(newFile, "{clock_24_pos}", pos_clock_24, -1) + newFile = strings.Replace(newFile, "{statusicons_align}", alignProp, -1) } // Custom position for status bar items - end diff --git a/gui/theme/landscape_hdpi/ui.xml b/gui/theme/landscape_hdpi/ui.xml index 5f29e096..a71387f3 100755 --- a/gui/theme/landscape_hdpi/ui.xml +++ b/gui/theme/landscape_hdpi/ui.xml @@ -119,7 +119,10 @@ - + + + + diff --git a/gui/theme/landscape_mdpi/ui.xml b/gui/theme/landscape_mdpi/ui.xml index e6c58b25..dadfbb9f 100755 --- a/gui/theme/landscape_mdpi/ui.xml +++ b/gui/theme/landscape_mdpi/ui.xml @@ -119,7 +119,10 @@ - + + + + diff --git a/gui/theme/portrait_hdpi/ui.xml b/gui/theme/portrait_hdpi/ui.xml index 7c4d2aa0..104c3f66 100755 --- a/gui/theme/portrait_hdpi/ui.xml +++ b/gui/theme/portrait_hdpi/ui.xml @@ -113,7 +113,10 @@ - + + + + diff --git a/gui/theme/portrait_mdpi/ui.xml b/gui/theme/portrait_mdpi/ui.xml index 4566dc7d..d81a9a9a 100755 --- a/gui/theme/portrait_mdpi/ui.xml +++ b/gui/theme/portrait_mdpi/ui.xml @@ -113,7 +113,10 @@ - + + + + diff --git a/gui/theme/watch_mdpi/ui.xml b/gui/theme/watch_mdpi/ui.xml index 24a4d466..83966396 100644 --- a/gui/theme/watch_mdpi/ui.xml +++ b/gui/theme/watch_mdpi/ui.xml @@ -96,7 +96,10 @@ - + + + +