I have a few small input delegates, which I use in my program. They handle things like selections from my options menu, and selections from another options menu. I think it would be possible to simply "save memory space" by combining them into a single class? I could assign different menu option symbols to my menus, then in the delegate just handle the different symbols.
Would this practice be economical?
class OptionMenuDelegate extends WatchUi.MenuInputDelegate {
var baseDelegate = null;
var baseView = null;
function initialize(data, view) {
baseDelegate = data;
baseView = view;
MenuInputDelegate.initialize();
}
function onMenuItem(item) {
// handle options from one menu
if (item == :item_1) {
baseDelegate.stopBtnUnlocked = !baseDelegate.stopBtnUnlocked;
} else if (item == :item_2) { // handle other option
baseView.handleOtherOption();
} else if (item == :item_3) { // handle Another option
baseView.handleAnotherOption();
//handle options from another menu
} else if (item == :item_11) {
WatchUi.pushView(new MyPicker(), new MyPickerDelegate(), WatchUi.SLIDE_IMMEDIATE);
} else if (item == :item_12) {
baseView.booleanOption = !baseView.booleanOption;
}
}
}