gui : Allow changing vertical alignment of status bar icons

- 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é <yilliee@protonmail.com>
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
(cherry picked from commit fcbaf814f3d46e21ac7ffa77f4883228468c1d2a)
diff --git a/gui/libguitwrp_defaults.go b/gui/libguitwrp_defaults.go
index 4ba6491..290be25 100644
--- a/gui/libguitwrp_defaults.go
+++ b/gui/libguitwrp_defaults.go
@@ -150,10 +150,17 @@
 				}
 			}
 
+			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 5f29e09..a71387f 100755
--- a/gui/theme/landscape_hdpi/ui.xml
+++ b/gui/theme/landscape_hdpi/ui.xml
@@ -119,7 +119,10 @@
 		<variable name="btn4_col2_x_right" value="1218"/>
 		<variable name="btn4_col3_x_right" value="1452"/>
 		<variable name="btn4_col4_x_right" value="1686"/>
-		<variable name="row1_header_y" value="0"/>
+		<variable name="status_topalign_header_y" value="0"/>
+		<variable name="status_centeralign_header_y" value="7"/>
+		<variable name="status_bottomalign_header_y" value="14"/>
+		<variable name="row1_header_y" value="{statusicons_align}"/>
 		<variable name="row2_header_y" value="48"/>
 		<variable name="row3_header_y" value="60"/>
 		<variable name="row4_header_y" value="126"/>
diff --git a/gui/theme/landscape_mdpi/ui.xml b/gui/theme/landscape_mdpi/ui.xml
index e6c58b2..dadfbb9 100755
--- a/gui/theme/landscape_mdpi/ui.xml
+++ b/gui/theme/landscape_mdpi/ui.xml
@@ -119,7 +119,10 @@
 		<variable name="btn4_col2_x_right" value="507"/>
 		<variable name="btn4_col3_x_right" value="606"/>
 		<variable name="btn4_col4_x_right" value="703"/>
-		<variable name="row1_header_y" value="0"/>
+		<variable name="status_topalign_header_y" value="0"/>
+		<variable name="status_centeralign_header_y" value="2"/>
+		<variable name="status_bottomalign_header_y" value="4"/>
+		<variable name="row1_header_y" value="{statusicons_align}"/>
 		<variable name="row2_header_y" value="20"/>
 		<variable name="row3_header_y" value="24"/>
 		<variable name="row4_header_y" value="52"/>
diff --git a/gui/theme/portrait_hdpi/ui.xml b/gui/theme/portrait_hdpi/ui.xml
index 7c4d2aa..104c3f6 100755
--- a/gui/theme/portrait_hdpi/ui.xml
+++ b/gui/theme/portrait_hdpi/ui.xml
@@ -113,7 +113,10 @@
 		<variable name="btn4_col2_x" value="297"/>
 		<variable name="btn4_col3_x" value="558"/>
 		<variable name="btn4_col4_x" value="819"/>
-		<variable name="row1_header_y" value="4"/>
+		<variable name="status_topalign_header_y" value="4"/>
+		<variable name="status_centeralign_header_y" value="15"/>
+		<variable name="status_bottomalign_header_y" value="30"/>
+		<variable name="row1_header_y" value="{statusicons_align}"/>
 		<variable name="row2_header_y" value="72"/>
 		<variable name="row3_header_y" value="90"/>
 		<variable name="row4_header_y" value="168"/>
diff --git a/gui/theme/portrait_mdpi/ui.xml b/gui/theme/portrait_mdpi/ui.xml
index 4566dc7..d81a9a9 100755
--- a/gui/theme/portrait_mdpi/ui.xml
+++ b/gui/theme/portrait_mdpi/ui.xml
@@ -113,7 +113,10 @@
 		<variable name="btn4_col2_x" value="131"/>
 		<variable name="btn4_col3_x" value="247"/>
 		<variable name="btn4_col4_x" value="363"/>
-		<variable name="row1_header_y" value="2"/>
+		<variable name="status_topalign_header_y" value="2"/>
+		<variable name="status_centeralign_header_y" value="6"/>
+		<variable name="status_bottomalign_header_y" value="12"/>
+		<variable name="row1_header_y" value="{statusicons_align}"/>
 		<variable name="row2_header_y" value="30"/>
 		<variable name="row3_header_y" value="40"/>
 		<variable name="row4_header_y" value="74"/>
diff --git a/gui/theme/watch_mdpi/ui.xml b/gui/theme/watch_mdpi/ui.xml
index 24a4d46..8396639 100644
--- a/gui/theme/watch_mdpi/ui.xml
+++ b/gui/theme/watch_mdpi/ui.xml
@@ -96,7 +96,10 @@
 		<variable name="btn4_col2_x" value="86"/>
 		<variable name="btn4_col3_x" value="164"/>
 		<variable name="btn4_col4_x" value="242"/>
-		<variable name="row1_header_y" value="0"/>
+		<variable name="status_topalign_header_y" value="0"/>
+		<variable name="status_centeralign_header_y" value="3"/>
+		<variable name="status_bottomalign_header_y" value="6"/>
+		<variable name="row1_header_y" value="{statusicons_align}"/>
 		<variable name="row2_header_y" value="20"/>
 		<variable name="row1_y" value="28"/>
 		<variable name="row1a_y" value="36"/>