diff options
Diffstat (limited to 'Example Apps/Example ObjC/MenuManager.m')
-rw-r--r-- | Example Apps/Example ObjC/MenuManager.m | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Example Apps/Example ObjC/MenuManager.m b/Example Apps/Example ObjC/MenuManager.m index 083d368d8..c142225ae 100644 --- a/Example Apps/Example ObjC/MenuManager.m +++ b/Example Apps/Example ObjC/MenuManager.m @@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN [self sdlex_menuCellShowPerformInteractionWithManager:manager performManager:performManager], [self sdlex_menuCellRecordInCarMicrophoneAudioWithManager:manager], [self sdlex_menuCellDialNumberWithManager:manager], + [self sdlex_menuCellChangeTemplateWithManager:manager], [self sdlex_menuCellWithSubmenuWithManager:manager]]; } @@ -86,6 +87,34 @@ NS_ASSUME_NONNULL_BEGIN }]; } ++ (SDLMenuCell *)sdlex_menuCellChangeTemplateWithManager:(SDLManager *)manager { + NSMutableArray *submenuItems = [NSMutableArray array]; + + // Non - Media + SDLMenuCell *cell = [[SDLMenuCell alloc] initWithTitle:@"Non - Media (Default)" icon:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + SDLSetDisplayLayout* display = [[SDLSetDisplayLayout alloc] initWithPredefinedLayout:SDLPredefinedLayoutNonMedia]; + [manager sendRequest:display withResponseHandler:^(SDLRPCRequest *request, SDLRPCResponse *response, NSError *error) { + if ([response.resultCode isEqualToEnum:SDLResultSuccess]) { + // The template has been set successfully + } + }]; + }]; + [submenuItems addObject:cell]; + + // Graphic With Text + SDLMenuCell *cell2 = [[SDLMenuCell alloc] initWithTitle:@"Graphic With Text" icon:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) { + SDLSetDisplayLayout* display = [[SDLSetDisplayLayout alloc] initWithPredefinedLayout:SDLPredefinedLayoutGraphicWithText]; + [manager sendRequest:display withResponseHandler:^(SDLRPCRequest *request, SDLRPCResponse *response, NSError *error) { + if ([response.resultCode isEqualToEnum:SDLResultSuccess]) { + // The template has been set successfully + } + }]; + }]; + [submenuItems addObject:cell2]; + + return [[SDLMenuCell alloc] initWithTitle:ACSubmenuTemplateMenuName icon:nil subCells:[submenuItems copy]]; +} + + (SDLMenuCell *)sdlex_menuCellWithSubmenuWithManager:(SDLManager *)manager { NSMutableArray *submenuItems = [NSMutableArray array]; for (int i = 0; i < 75; i++) { |