Hi,
I read a few times here on the forum that you can go directly to the Menu2 and don't go to an extra view where you must longpress the menu button. I tried to implement this in my watchface but I get a black screen and I don't get how you can put a Menu2 and InputDelegate in getSettingsView(), because it is asking for a View and a InputDelegate. What else do I need to change to make it work and show the menu directly? Is there a sample code that does work? Or can we make the Analog sample work without the AnalogSettingsView?
I tried a lot of things. Hopefully someone can help me. Thanks a lot!
Sample code:class MyWatchFaceApp extends Application.AppBase {
//default functions
function getSettingsView() {
return [new SettingsMenu2(), new SettingsBehaviorDelegate()];
}
}
class SettingsMenu2 extends WatchUi.Menu2 {
function initialize() {
Menu2.initialize({:title=>"Settings"});
}
}
class SettingsMenu2InputDelegate extends WatchUi.Menu2InputDelegate {
function initialize() {
Menu2InputDelegate.initialize();
}
function onSelect(menuItem) {
Application.getApp().setProperty("Sample",menuItem.isEnabled());
WatchUi.requestUpdate();
}
function onBack() {
WatchUi.popView(WatchUi.SLIDE_DOWN);
}
function onDone() {
WatchUi.popView(WatchUi.SLIDE_DOWN);
}
}
class SettingsBehaviorDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
function onMenu() {
var menu = new SettingsMenu2();
var boolean = Application.getApp().getProperty("Sample") ? true : false;
menu.addItem(new WatchUi.ToggleMenuItem("Sample", null, 1, boolean, null));
WatchUi.pushView( menu, new SettingsMenu2InputDelegate(), WatchUi.SLIDE_IMMEDIATE);
}
}