mirror of
https://github.com/house-of-abbey/GarminHomeAssistant.git
synced 2025-05-01 05:02:34 +00:00
Added vibrate to confirm toggle items tapped
This commit is contained in:
@ -25,9 +25,10 @@ using Toybox.Application.Properties;
|
|||||||
using Toybox.Timer;
|
using Toybox.Timer;
|
||||||
|
|
||||||
class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
||||||
private var mConfirm as Lang.Boolean;
|
private var mConfirm as Lang.Boolean;
|
||||||
private var mData as Lang.Dictionary;
|
private var mData as Lang.Dictionary;
|
||||||
private var mTemplate as Lang.String;
|
private var mTemplate as Lang.String;
|
||||||
|
private var mHasVibrate as Lang.Boolean = false;
|
||||||
|
|
||||||
function initialize(
|
function initialize(
|
||||||
label as Lang.String or Lang.Symbol,
|
label as Lang.String or Lang.Symbol,
|
||||||
@ -40,6 +41,9 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
|||||||
} or Null
|
} or Null
|
||||||
) {
|
) {
|
||||||
WatchUi.ToggleMenuItem.initialize(label, null, null, false, options);
|
WatchUi.ToggleMenuItem.initialize(label, null, null, false, options);
|
||||||
|
if (Attention has :vibrate) {
|
||||||
|
mHasVibrate = true;
|
||||||
|
}
|
||||||
mConfirm = confirm;
|
mConfirm = confirm;
|
||||||
mData = data;
|
mData = data;
|
||||||
mTemplate = template;
|
mTemplate = template;
|
||||||
@ -198,6 +202,13 @@ class HomeAssistantToggleMenuItem extends WatchUi.ToggleMenuItem {
|
|||||||
},
|
},
|
||||||
method(:onReturnSetState)
|
method(:onReturnSetState)
|
||||||
);
|
);
|
||||||
|
if (mHasVibrate and Settings.getVibrate()) {
|
||||||
|
Attention.vibrate([
|
||||||
|
new Attention.VibeProfile(50, 100), // On for 100ms
|
||||||
|
new Attention.VibeProfile( 0, 100), // Off for 100ms
|
||||||
|
new Attention.VibeProfile(50, 100) // On for 100ms
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user