Skip to content

Commit 6107030

Browse files
committed
Refined settings menu item styling and switched Edge 550/850 to settings menu. (#253)
1 parent e401e1e commit 6107030

15 files changed

Lines changed: 108 additions & 47 deletions

File tree

monkey.jungle

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ annotCiq510Plus=exclForCiq510Plus;exclForCiq400Plus
3030
# - Button-based: all devices with buttons for up/down/enter/back,
3131
# even if they also have a touch screen. Such
3232
# devices include: Fenix, Epix, Forerunner, Edge 540/840
33-
# Note: Although the Edge 850 is button-based,
34-
# they are affected by two firmware bugs: one prevents the delegate
35-
# functions required to reach the settings menu from working
36-
# correctly, and another causes the menu focus to be displayed
37-
# incorrectly. Therefore, these two devices are treated as touch
38-
# devices.
3933
annotTouch=exclForTouch;exclForSettingsMenuItem
4034
annotButton=exclForButton;exclForSettingsFooter
4135

@@ -44,7 +38,9 @@ annotButton=exclForButton;exclForSettingsFooter
4438
# menu boundaries from working correctly.
4539
# Therefore, on these devices, the settings are shown as a regular
4640
# menu item instead. All other button-based controls remain unchanged.
47-
# This applies to Edge 540, Edge MTB, and Edge 550.
41+
# This applies to Edge 540 / 840, Edge MTB, and Edge 550 / 850.
42+
# https://github.com/openhab/openhab-garmin/issues/253
43+
# https://github.com/openhab/openhab-garmin/issues/260
4844
annotButtonWithSettingsMenuItem=exclForButton;exclForSettingsMenuItem
4945

5046
# Either on of these should be assigned, depending
@@ -361,21 +357,11 @@ edgemtb.resourcePath=$(resEdgeShort);$(resLauncherIcons)/36x36-dark
361357
edgemtb.excludeAnnotations = $(edge540.excludeAnnotations)
362358
edgemtb.sourcePath = $(srcEdgeButtonX40)
363359
edge550.resourcePath=$(resEdgeShort);$(resLauncherIcons)/56x56-dark
364-
edge550.excludeAnnotations = $(annotCiq510Plus);$(annotButton);$(annotScreenRectangular);$(annotFullMenu)
360+
edge550.excludeAnnotations = $(annotCiq510Plus);$(annotButtonWithSettingsMenuItem);$(annotScreenRectangular);$(annotFullMenu)
365361
edge550.sourcePath = $(srcEdgeButtonX50)
366362
edge850.resourcePath=$(edge550.resourcePath)
367-
368-
# The Edge 850 is a button-based device, with touch,
369-
# However Garmin bugs prevent the button control to work
370-
# properly, so we treat them as touch devices
371-
# https://github.com/openhab/openhab-garmin/issues/260
372-
# https://github.com/openhab/openhab-garmin/issues/267
373-
374-
# edge850.excludeAnnotations = $(edge550.excludeAnnotations)
375-
# edge850.sourcePath = $(srcEdgeButtonX50)
376-
edge850.excludeAnnotations = $(annotCiq510Plus);$(annotButton);$(annotScreenRectangular);$(annotFullMenu)
377-
edge850.sourcePath = $(srcEdgeX50Touch)
378-
363+
edge850.excludeAnnotations = $(edge550.excludeAnnotations)
364+
edge850.sourcePath = $(srcEdgeButtonX50)
379365

380366
# Touch-based, CIQ >= 5.1.0
381367
edge1040.resourcePath=$(resEdgeTall);$(resLauncherIcons)/40x40-dark

resources/edge/icons-widgets/icons-widgets.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@
9494
<bitmap id="menuScreenOff" scaleX="13%" filename="../../icons-widgets/screen-off.svg" dithering="none"/>
9595
<bitmap id="menuScreenOn" scaleX="13%" filename="../../icons-widgets/screen-on.svg" dithering="none"/>
9696

97-
<bitmap id="menuSettings" scaleX="11%" filename="../../icons-widgets/settings.svg" dithering="none" />
97+
<bitmap id="menuSettingsLightGray" scaleX="11%" filename="../../icons-widgets/settings-lt-gray.svg" dithering="none" />
98+
<bitmap id="menuSettingsDarkGray" scaleX="11%" filename="../../icons-widgets/settings-dk-gray.svg" dithering="none" />
9899

99100
<bitmap id="menuSoundVolume00" scaleX="13%" filename="../../icons-widgets/soundvolume-00.svg" dithering="none"/>
100101
<bitmap id="menuSoundVolume04" scaleX="13%" filename="../../icons-widgets/soundvolume-04.svg" dithering="none"/>

resources/icons-widgets/_icons-widgets.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<bitmap id="menuScreenOff" scaleY="11%" filename="screen-off.svg" dithering="none"/>
8888
<bitmap id="menuScreenOn" scaleY="11%" filename="screen-on.svg" dithering="none"/>
8989

90-
<bitmap id="menuSettings" scaleY="10%" filename="settings.svg" dithering="none" />
90+
<bitmap id="menuSettingsLightGray" scaleY="10%" filename="settings-lt-gray.svg" dithering="none" />
9191

9292
<bitmap id="menuSoundVolume00" scaleY="12%" filename="soundvolume-00.svg" dithering="none"/>
9393
<bitmap id="menuSoundVolume04" scaleY="12%" filename="soundvolume-04.svg" dithering="none"/>
Lines changed: 49 additions & 0 deletions
Loading

resources/icons-widgets/settings.svg renamed to resources/icons-widgets/settings-lt-gray.svg

Lines changed: 2 additions & 2 deletions
Loading

source-themes/theme-definitions/base/Theme.mc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ typedef Theme as interface {
4545
// openHAB logo for the menu footer
4646
var logoOpenhabText as ResourceId;
4747

48+
// The icon shown for the settings menu item
49+
var menuSettings as ResourceId;
50+
4851
// The icon shown on the loading screen
4952
var iconHourglass as ResourceId;
5053

source-themes/theme-definitions/device-default/DefaultTheme.mc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class DefaultTheme extends BaseTheme {
2828

2929
public var logoOpenhabText as ResourceId = Rez.Drawables.logoOpenhabTextWhite;
3030

31+
public var menuSettings as ResourceId = Rez.Drawables.menuSettingsLightGray;
32+
3133
public var iconHourglass as ResourceId = Rez.Drawables.iconHourglassWhite;
3234

3335
public var iconPlayButton as ResourceId = Rez.Drawables.iconPlayButtonLightGrey;

source-themes/theme-definitions/device-night-mode/dark/DarkTheme.mc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import Rez.Styles;
1414
*/
1515
class DarkTheme extends DefaultTheme {
1616

17-
//public var textColor as ColorType = 0xFFFBFF;
1817
public var backgroundColor as ColorType = 0x31353A;
1918
public var menuTitleBackgroundColor as ColorType = 0x212429;
2019
public var menuTitleDividerColor as ColorType = 0xC5C2C5;

source-themes/theme-definitions/device-night-mode/light/LightTheme.mc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class LightTheme extends BaseTheme {
2424

2525
public var logoOpenhabText as ResourceId = Rez.Drawables.logoOpenhabTextBlack;
2626

27+
public var menuSettings as ResourceId = Rez.Drawables.menuSettingsDarkGray;
28+
2729
public var iconHourglass as ResourceId = Rez.Drawables.iconHourglassBlack;
2830

2931
public var iconPlayButton as ResourceId = Rez.Drawables.iconPlayButtonDarkGrey;

source/user-interface/menu-views/base/BaseMenuItem.mc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@ class BaseMenuItem extends CustomMenuItem {
2727
CustomMenuItem.initialize( id, {} );
2828
}
2929

30+
// Draw the menu item.
31+
//
32+
// This method draws the divider and delegates further layout
33+
// and drawing to subclass implementations.
3034
public function draw( dc as Dc ) as Void {
3135
try {
3236
if( ! _hasLayout ) {
3337
_hasLayout = true;
3438
onLayout( dc );
3539
}
3640

37-
var theme = isFocused() ? ThemeManager.focused : ThemeManager.current;
41+
var theme = getCurrentTheme();
3842

3943
dc.setColor( theme.textColor, theme.menuItemBackgroundColor );
4044
dc.clear();
@@ -56,6 +60,16 @@ class BaseMenuItem extends CustomMenuItem {
5660
}
5761
}
5862

63+
// Returns the theme to apply when drawing.
64+
//
65+
// Subclasses should use this method to retrieve the theme and
66+
// apply colors on every onUpdate() call, as the theme may change at any time.
67+
public function getCurrentTheme() as Theme {
68+
return isFocused()
69+
? ThemeManager.focused
70+
: ThemeManager.current;
71+
}
72+
5973
// May be implemented by subclasses to perform layout calculations
6074
public function onLayout( dc as Dc ) as Void;
6175

0 commit comments

Comments
 (0)