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 <setting
propertyKey="@Properties.types_representation" 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 <settingConfig
type="boolean" type="boolean"

View File

@ -27,7 +27,7 @@ class HomeAssistantMenuItemFactory {
private var mMenuItemAlignment; private var mMenuItemAlignment;
private var mLabelToggle; private var mLabelToggle;
private var strMenuItemTap; private var strMenuItemTap;
private var bRepresentTypesWithIcons; private var bRepresentTypesWithLabels;
private var mTapTypeIcon; private var mTapTypeIcon;
@ -41,7 +41,7 @@ class HomeAssistantMenuItemFactory {
:disabled => WatchUi.loadResource($.Rez.Strings.MenuItemOff) as Lang.String :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; 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{ function toggle(label as Lang.String or Lang.Symbol, identifier as Lang.Object or Null) as WatchUi.MenuItem{
var subLabel = null; var subLabel = null;
if (bRepresentTypesWithIcons == false){ if (bRepresentTypesWithLabels == true){
subLabel=mLabelToggle; 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{ 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( return new HomeAssistantIconMenuItem(
label, label,
null, null,
@ -99,23 +107,14 @@ class HomeAssistantMenuItemFactory {
mTapTypeIcon, mTapTypeIcon,
mMenuItemAlignment mMenuItemAlignment
); );
} else {
return new HomeAssistantMenuItem(
label,
strMenuItemTap,
identifier,
service,
mMenuItemAlignment
);
} }
} }
function group(definition as Lang.Dictionary) as WatchUi.MenuItem{ function group(definition as Lang.Dictionary) as WatchUi.MenuItem{
if (bRepresentTypesWithIcons) { if (bRepresentTypesWithLabels) {
return new HomeAssistantViewIconMenuItem(definition, mGroupTypeIcon, mMenuItemAlignment);
} else {
return new HomeAssistantViewMenuItem(definition); return new HomeAssistantViewMenuItem(definition);
} else {
return new HomeAssistantViewIconMenuItem(definition, mGroupTypeIcon, mMenuItemAlignment);
} }
} }
} }