mirror of
				https://github.com/house-of-abbey/GarminHomeAssistant.git
				synced 2025-11-04 08:58:13 +00:00 
			
		
		
		
	Set showing icons for types as default
This commit is contained in:
		@@ -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"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user