Skip to content

Commit d19c9fb

Browse files
committed
Deactivated workaround for Edge 850 (#268)
1 parent c987ffa commit d19c9fb

13 files changed

Lines changed: 149 additions & 62 deletions

File tree

monkey.jungle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ srcConstantsVenux1=$(srcConstantsBase);source-constants/device-venux1
109109

110110
# Edge devices
111111
# Base path for all Edge devices
112-
srcConstantsEdgeBase=$(srcConstantsBase);source-constants/device-edge/widget/base;source-constants/device-edge/glance
112+
srcConstantsEdgeBase=$(srcConstantsBase);source-constants/device-edge/base;source-constants/device-edge/glance
113113
# Edge x40 touch-based devices
114-
srcConstantsEdgeX40Touch=$(srcConstantsEdgeBase);source-constants/device-edge/widget/device-x40-touch
114+
srcConstantsEdgeX40Touch=$(srcConstantsEdgeBase);source-constants/device-edge/device-x40-touch
115115
# Edge x40 button-based devices
116-
srcConstantsEdgeX40Button=$(srcConstantsEdgeBase);source-constants/device-edge/widget/device-x40-button
116+
srcConstantsEdgeX40Button=$(srcConstantsEdgeBase);source-constants/device-edge/device-x40-button
117117
# Edge x50 touch-based devices
118-
srcConstantsEdgeX50Touch=$(srcConstantsEdgeBase);source-constants/device-edge/widget/device-x50-touch
118+
srcConstantsEdgeX50Touch=$(srcConstantsEdgeBase);source-constants/device-edge/device-x50-touch
119119
# Edge x50 button-based devices
120-
srcConstantsEdgeX50Button=$(srcConstantsEdgeBase);source-constants/device-edge/widget/device-x50-button
120+
srcConstantsEdgeX50Button=$(srcConstantsEdgeBase);source-constants/device-edge/device-x50-button/base
121121

122122
# SOURCE PATH - THEMES
123123

@@ -358,10 +358,10 @@ edgemtb.excludeAnnotations = $(edge540.excludeAnnotations)
358358
edgemtb.sourcePath = $(srcEdgeButtonX40)
359359
edge550.resourcePath=$(resEdgeShort);$(resLauncherIcons)/56x56-dark
360360
edge550.excludeAnnotations = $(annotCiq510Plus);$(annotButtonWithSettingsMenuItem);$(annotScreenRectangular);$(annotFullMenu)
361-
edge550.sourcePath = $(srcEdgeButtonX50)
361+
edge550.sourcePath = $(srcEdgeButtonX50);source-constants/device-edge/device-x50-button/device-550
362362
edge850.resourcePath=$(edge550.resourcePath)
363363
edge850.excludeAnnotations = $(edge550.excludeAnnotations)
364-
edge850.sourcePath = $(srcEdgeButtonX50)
364+
edge850.sourcePath = $(srcEdgeButtonX50);source-constants/device-edge/device-x50-button/device-850
365365

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

source-constants/base/DefaultConstants.mc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,22 @@ class DefaultConstants {
107107
// menu item. The color of the divider is set in Theme.menuItemDividerColor
108108
public static const UI_MENU_ITEM_SHOW_DIVIDER as Boolean = false;
109109

110-
// If set to true, a vertical strip is rendered on the left side
111-
// of the menu item. This serves as a workaround for a firmware bug on the
112-
// Edge 550 and 850 (see ../device-edge/widget/device-x50-button for details).
113-
public static const UI_MENU_FOCUS_EDGEX50_WORKAROUND as Boolean = false;
110+
// UI_MENU_FOCUS_EDGEX50_SHOW_ALTERNATE_FOCUS_INDICATOR
111+
// If true, a vertical strip is rendered on the left side of the focused
112+
// menu item.
113+
//
114+
// UI_MENU_FOCUS_EDGEX50_SUPPRESS_FOCUS_INDICATOR
115+
// If true, the standard focus indicator theme is suppressed and the
116+
// focused menu item is rendered like a regular, unfocused item.
117+
//
118+
// These options provide a workaround for a firmware bug on the
119+
// Edge 550 and 850.
120+
//
121+
// See the following files for implementation details:
122+
// ../device-edge/widget/device-x50-button/device-550/Constants.mc
123+
// ../device-edge/widget/device-x50-button/device-850/Constants.mc
124+
public static const UI_MENU_FOCUS_EDGEX50_SHOW_ALTERNATE_FOCUS_INDICATOR as Boolean = false;
125+
public static const UI_MENU_FOCUS_EDGEX50_SUPRESS_FOCUS_INDICATOR as Boolean = false;
114126

115127
/*
116128
* These factors determine the spacing of menu item components

source-constants/device-edge/widget/base/EdgeDefaultConstants.mc renamed to source-constants/device-edge/base/EdgeDefaultConstants.mc

File renamed without changes.

source-constants/device-edge/widget/device-x40-button/Constants.mc renamed to source-constants/device-edge/device-x40-button/Constants.mc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ class Constants extends EdgeDefaultConstants {
1717
// that overlaps the divider, therefore we do not show it.
1818
public static const UI_MENU_ITEM_SHOW_DIVIDER as Boolean = false;
1919

20+
// Note: Static functions cannot access inherited static constants.
21+
// Therefore, any constant that is required in a static function
22+
// must be explicitly defined in each Constants implementation.
23+
public static const UI_MENU_FOCUS_EDGEX50_SUPRESS_FOCUS_INDICATOR as Boolean = DefaultConstants.UI_MENU_FOCUS_EDGEX50_SUPRESS_FOCUS_INDICATOR;
24+
2025
// Menu item padding is increased, due to the rounded rectangle focus indicator
2126
public static const UI_MENU_ITEM_PADDING_LEFT_FACTOR as Float = 0.05;
2227
public static const UI_MENU_ITEM_PADDING_RIGHT_FACTOR as Float = 0.05;

source-constants/device-edge/widget/device-x40-touch/Constants.mc renamed to source-constants/device-edge/device-x40-touch/Constants.mc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ class Constants extends EdgeDefaultConstants {
1616
// Show menu item dividers
1717
public static const UI_MENU_ITEM_SHOW_DIVIDER as Boolean = true;
1818

19+
// Note: Static functions cannot access inherited static constants.
20+
// Therefore, any constant that is required in a static function
21+
// must be explicitly defined in each Constants implementation.
22+
public static const UI_MENU_FOCUS_EDGEX50_SUPRESS_FOCUS_INDICATOR as Boolean = DefaultConstants.UI_MENU_FOCUS_EDGEX50_SUPRESS_FOCUS_INDICATOR;
23+
1924
// Padding is less then on button-based device, since touch-based
2025
// devices do not have a focus indicator that takes up space around
2126
// the focused menu item
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import Toybox.Lang;
2+
import Toybox.Graphics;
3+
import Toybox.System;
4+
5+
/*
6+
* Constants specific to button-based Edge devices.
7+
*/
8+
class EdgeX50ButtonDefaultConstants extends EdgeDefaultConstants {
9+
protected function initialize() { EdgeDefaultConstants.initialize(); }
10+
11+
// Positions of the keys, for drawing input hints
12+
// Corresponds to CustomView.InputHints enumeration
13+
// 0=ENTER
14+
// 1=BACK
15+
// 2=UP
16+
// 3=DOWN
17+
// + positive position indicates y coordinate on the right side of the screen
18+
// - negative position indicates y coordinate on the left side of the screen
19+
public static const UI_INPUT_HINT_POSITIONS as Array<Number> = [
20+
( DefaultConstants.UI_SCREEN_HEIGHT * 0.125 ).toNumber(),
21+
( DefaultConstants.UI_SCREEN_HEIGHT * 0.755 ).toNumber(),
22+
-( DefaultConstants.UI_SCREEN_HEIGHT * 0.495 ).toNumber(),
23+
-( DefaultConstants.UI_SCREEN_HEIGHT * 0.755 ).toNumber()
24+
];
25+
26+
// Padding is increased, due to the rounded rectangle focus indicator
27+
public static const UI_MENU_ITEM_PADDING_LEFT_FACTOR as Float = 0.05;
28+
public static const UI_MENU_ITEM_PADDING_RIGHT_FACTOR as Float = 0.05;
29+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import Toybox.Lang;
2+
import Toybox.Graphics;
3+
import Toybox.System;
4+
5+
/*
6+
* Constants specific to button-based Edge devices.
7+
*/
8+
class Constants extends EdgeX50ButtonDefaultConstants {
9+
protected function initialize() { EdgeX50ButtonDefaultConstants.initialize(); }
10+
11+
// The following two constants control the workaround for a firmware bug on the
12+
// Edge 550 and 850 that prevents the focus indicator from being rendered properly.
13+
//
14+
// On these devices, the native focus indicator is a frame drawn on top of the
15+
// menu item in the system-defined background color (which cannot be changed
16+
// from the CIQ app). The frame adapts to the system’s dark and light display modes.
17+
//
18+
// The intended behavior is that the CIQ app fills the menu item with a contrasting
19+
// color to highlight the focused item. However, CustomMenuItem.isFocused() is
20+
// faulty on these devices, so this mechanism does not work as expected.
21+
//
22+
// On the Edge 550, the standard focus indicator is suppressed and the
23+
// alternate focus indicator is shown instead.
24+
//
25+
// On the Edge 850, only the standard focus indicator is suppressed.
26+
// The alternate focus indicator is not used because it is visually
27+
// unappealing and difficult to notice.
28+
//
29+
// If touch input is available as an alternative input method, we assume
30+
// the user will use touch interaction, which does not require a focus
31+
// indicator.
32+
//
33+
// See also:
34+
// Bug report: https://github.com/openhab/openhab-garmin/issues/267
35+
// Workaround implementation: https://github.com/openhab/openhab-garmin/issues/268
36+
public static const UI_MENU_FOCUS_EDGEX50_SHOW_ALTERNATE_FOCUS_INDICATOR as Boolean = true;
37+
public static const UI_MENU_FOCUS_EDGEX50_SUPRESS_FOCUS_INDICATOR as Boolean = true;
38+
39+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import Toybox.Lang;
2+
import Toybox.Graphics;
3+
import Toybox.System;
4+
5+
/*
6+
* Constants specific to button-based Edge devices.
7+
*/
8+
class Constants extends EdgeX50ButtonDefaultConstants {
9+
protected function initialize() { EdgeX50ButtonDefaultConstants.initialize(); }
10+
11+
// The following two constants control the workaround for a firmware bug on the
12+
// Edge 550 and 850 that prevents the focus indicator from being rendered properly.
13+
//
14+
// On these devices, the native focus indicator is a frame drawn on top of the
15+
// menu item in the system-defined background color (which cannot be changed
16+
// from the CIQ app). The frame adapts to the system’s dark and light display modes.
17+
//
18+
// The intended behavior is that the CIQ app fills the menu item with a contrasting
19+
// color to highlight the focused item. However, CustomMenuItem.isFocused() is
20+
// faulty on these devices, so this mechanism does not work as expected.
21+
//
22+
// On the Edge 550, the standard focus indicator is suppressed and the
23+
// alternate focus indicator is shown instead.
24+
//
25+
// On the Edge 850, only the standard focus indicator is suppressed.
26+
// The alternate focus indicator is not used because it is visually
27+
// unappealing and difficult to notice.
28+
//
29+
// If touch input is available as an alternative input method, we assume
30+
// the user will use touch interaction, which does not require a focus
31+
// indicator.
32+
//
33+
// See also:
34+
// Bug report: https://github.com/openhab/openhab-garmin/issues/267
35+
// Workaround implementation: https://github.com/openhab/openhab-garmin/issues/268
36+
(:debug)
37+
public static const UI_MENU_FOCUS_EDGEX50_SUPRESS_FOCUS_INDICATOR as Boolean = false;
38+
(:release)
39+
public static const UI_MENU_FOCUS_EDGEX50_SUPRESS_FOCUS_INDICATOR as Boolean = true;
40+
41+
}

source-constants/device-edge/widget/device-x50-touch/Constants.mc renamed to source-constants/device-edge/device-x50-touch/Constants.mc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ class Constants extends EdgeDefaultConstants {
1212
// Show menu item dividers
1313
public static const UI_MENU_ITEM_SHOW_DIVIDER as Boolean = true;
1414

15+
// Note: Static functions cannot access inherited static constants.
16+
// Therefore, any constant that is required in a static function
17+
// must be explicitly defined in each Constants implementation.
18+
public static const UI_MENU_FOCUS_EDGEX50_SUPRESS_FOCUS_INDICATOR as Boolean = DefaultConstants.UI_MENU_FOCUS_EDGEX50_SUPRESS_FOCUS_INDICATOR;
19+
1520
// Padding is less then on button-based device, since touch-based
1621
// devices do not have a focus indicator that takes up space around
1722
// the focused menu item

source-constants/device-edge/widget/device-x50-button/Constants.mc

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)