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