Set showing icons for types as default

This commit is contained in:
SomeoneOnEarth
2023-11-19 17:04:22 +01:00
parent 440980a96f
commit bcdcfdc66c
2 changed files with 17 additions and 18 deletions

View File

@ -45,7 +45,7 @@
<setting
propertyKey="@Properties.types_representation"
title="Representing types with labels (off) or with icons (on)"
title="Representing types with icons (off) or with labels (on)"
>
<settingConfig
type="boolean"

View File

@ -27,7 +27,7 @@ class HomeAssistantMenuItemFactory {
private var mMenuItemAlignment;
private var mLabelToggle;
private var strMenuItemTap;
private var bRepresentTypesWithIcons;
private var bRepresentTypesWithLabels;
private var mTapTypeIcon;
@ -41,7 +41,7 @@ class HomeAssistantMenuItemFactory {
:disabled => WatchUi.loadResource($.Rez.Strings.MenuItemOff) as Lang.String
};
bRepresentTypesWithIcons = Application.Properties.getValue("types_representation") as Lang.Boolean;
bRepresentTypesWithLabels = Application.Properties.getValue("types_representation") as Lang.Boolean;
var menuItemAlignment = Application.Properties.getValue("menu_alignment") as Lang.Boolean;
@ -76,7 +76,7 @@ class HomeAssistantMenuItemFactory {
function toggle(label as Lang.String or Lang.Symbol, identifier as Lang.Object or Null) as WatchUi.MenuItem{
var subLabel = null;
if (bRepresentTypesWithIcons == false){
if (bRepresentTypesWithLabels == true){
subLabel=mLabelToggle;
}
@ -90,7 +90,15 @@ class HomeAssistantMenuItemFactory {
}
function tap(label as Lang.String or Lang.Symbol, identifier as Lang.Object or Null, service as Lang.String or Null) as WatchUi.MenuItem{
if (bRepresentTypesWithIcons) {
if (bRepresentTypesWithLabels) {
return new HomeAssistantMenuItem(
label,
strMenuItemTap,
identifier,
service,
mMenuItemAlignment
);
} else {
return new HomeAssistantIconMenuItem(
label,
null,
@ -99,23 +107,14 @@ class HomeAssistantMenuItemFactory {
mTapTypeIcon,
mMenuItemAlignment
);
} else {
return new HomeAssistantMenuItem(
label,
strMenuItemTap,
identifier,
service,
mMenuItemAlignment
);
}
}
function group(definition as Lang.Dictionary) as WatchUi.MenuItem{
if (bRepresentTypesWithIcons) {
return new HomeAssistantViewIconMenuItem(definition, mGroupTypeIcon, mMenuItemAlignment);
} else {
if (bRepresentTypesWithLabels) {
return new HomeAssistantViewMenuItem(definition);
} else {
return new HomeAssistantViewIconMenuItem(definition, mGroupTypeIcon, mMenuItemAlignment);
}
}
}