mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-04-30 20:52:27 +00:00
Added app setting for left - right menu alignment
This commit is contained in:
@ -25,4 +25,6 @@
|
||||
<property id="config_url" type="string"></property>
|
||||
|
||||
<property id="lean_ui" type="boolean"></property>
|
||||
|
||||
<property id="menu_alignment" type="boolean"></property>
|
||||
</properties>
|
||||
|
@ -51,4 +51,13 @@
|
||||
type="boolean"
|
||||
/>
|
||||
</setting>
|
||||
|
||||
<setting
|
||||
propertyKey="@Properties.menu_alignment"
|
||||
title="Left (off) or Right (on) Menu Alignment"
|
||||
>
|
||||
<settingConfig
|
||||
type="boolean"
|
||||
/>
|
||||
</setting>
|
||||
</settings>
|
||||
|
@ -24,7 +24,7 @@ using Toybox.WatchUi;
|
||||
|
||||
class HomeAssistantMenuItemFactory {
|
||||
|
||||
private var mRightLabelAlignement;
|
||||
private var mMenuItemAlignment;
|
||||
private var mLabelToggle;
|
||||
private var strMenuItemTap;
|
||||
private var bLeanDesign;
|
||||
@ -43,11 +43,20 @@ class HomeAssistantMenuItemFactory {
|
||||
|
||||
bLeanDesign = Application.Properties.getValue("lean_ui") as Lang.Boolean;
|
||||
|
||||
mRightLabelAlignement = {:alignment => WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_RIGHT};
|
||||
var menuItemAlignment = Application.Properties.getValue("menu_alignment") as Lang.Boolean;
|
||||
|
||||
if(menuItemAlignment == true){
|
||||
mMenuItemAlignment = {:alignment => WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_RIGHT};
|
||||
} else {
|
||||
mMenuItemAlignment = {:alignment => WatchUi.MenuItem.MENU_ITEM_LABEL_ALIGN_LEFT};
|
||||
}
|
||||
|
||||
|
||||
strMenuItemTap = WatchUi.loadResource($.Rez.Strings.MenuItemTap);
|
||||
mTapIcon = new WatchUi.Bitmap({
|
||||
:rezId=>$.Rez.Drawables.TapIcon
|
||||
:rezId=>$.Rez.Drawables.TapIcon,
|
||||
:locX=>WatchUi.LAYOUT_HALIGN_CENTER,
|
||||
:locY=>WatchUi.LAYOUT_VALIGN_CENTER
|
||||
});
|
||||
|
||||
mMenuIcon = new WatchUi.Bitmap({
|
||||
@ -55,9 +64,6 @@ class HomeAssistantMenuItemFactory {
|
||||
:locX=>WatchUi.LAYOUT_HALIGN_CENTER,
|
||||
:locY=>WatchUi.LAYOUT_VALIGN_CENTER
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static function create() {
|
||||
@ -79,7 +85,7 @@ class HomeAssistantMenuItemFactory {
|
||||
subLabel,
|
||||
identifier,
|
||||
false,
|
||||
null
|
||||
mMenuItemAlignment
|
||||
);
|
||||
}
|
||||
|
||||
@ -91,7 +97,7 @@ class HomeAssistantMenuItemFactory {
|
||||
identifier,
|
||||
service,
|
||||
mTapIcon,
|
||||
mRightLabelAlignement
|
||||
mMenuItemAlignment
|
||||
);
|
||||
|
||||
} else {
|
||||
@ -100,14 +106,14 @@ class HomeAssistantMenuItemFactory {
|
||||
strMenuItemTap,
|
||||
identifier,
|
||||
service,
|
||||
null
|
||||
mMenuItemAlignment
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function group(definition as Lang.Dictionary) as WatchUi.MenuItem{
|
||||
if (bLeanDesign) {
|
||||
return new HomeAssistantViewIconMenuItem(definition, mMenuIcon, mRightLabelAlignement);
|
||||
return new HomeAssistantViewIconMenuItem(definition, mMenuIcon, mMenuItemAlignment);
|
||||
} else {
|
||||
return new HomeAssistantViewMenuItem(definition);
|
||||
}
|
||||
|
Reference in New Issue
Block a user