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>
This commit is contained in:
Yillié
2022-07-11 14:30:43 +05:00
committed by bigbiff
parent 09badaed48
commit fcbaf814f3
6 changed files with 27 additions and 5 deletions
+7
View File
@@ -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
+4 -1
View File
@@ -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"/>
+4 -1
View File
@@ -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"/>
+4 -1
View File
@@ -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"/>
+4 -1
View File
@@ -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"/>
+4 -1
View File
@@ -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"/>