mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-26 22:42:50 -05:00
lockscreen/greetd: add 0 in front of single digit hours for 12 hour format. greetd: add option to hide profile image (#1247)
* greetd: add lockScreenShowProfileImage option * lockscreen/greetd: for non 24 hour formats, add 0 in front of single digit hours to ensure that everything is always centered properly - previously, it would only appear centered if on a double digit hour. also add getEffectiveTimeFormat function to GreetdSettings. * clock: made pad 12 hour formats optional --------- Co-authored-by: bbedward <bbedward@gmail.com>
This commit is contained in:
@@ -30,13 +30,13 @@ BasePill {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (SettingsData.use24HourClock) {
|
||||
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(0);
|
||||
} else {
|
||||
const hours = systemClock?.date?.getHours();
|
||||
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
|
||||
const hours = systemClock?.date?.getHours();
|
||||
if (SettingsData.use24HourClock)
|
||||
return String(hours).padStart(2, '0').charAt(0);
|
||||
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
|
||||
if (SettingsData.padHours12Hour)
|
||||
return String(display).padStart(2, '0').charAt(0);
|
||||
}
|
||||
return display >= 10 ? String(display).charAt(0) : "";
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
@@ -47,13 +47,13 @@ BasePill {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
if (SettingsData.use24HourClock) {
|
||||
return String(systemClock?.date?.getHours()).padStart(2, '0').charAt(1);
|
||||
} else {
|
||||
const hours = systemClock?.date?.getHours();
|
||||
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
|
||||
const hours = systemClock?.date?.getHours();
|
||||
if (SettingsData.use24HourClock)
|
||||
return String(hours).padStart(2, '0').charAt(1);
|
||||
const display = hours === 0 ? 12 : hours > 12 ? hours - 12 : hours;
|
||||
if (SettingsData.padHours12Hour)
|
||||
return String(display).padStart(2, '0').charAt(1);
|
||||
}
|
||||
return display >= 10 ? String(display).charAt(1) : String(display);
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
|
||||
Reference in New Issue
Block a user