summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2018-03-23 14:35:37 -0400
committerNicoleYarroch <nicole@livio.io>2018-03-23 14:35:37 -0400
commitaae8db9c51db4c45a5643ba41292cbb566a01c0f (patch)
tree7a59af6e9bb74f0b025bd5917847fa41b61760af
parent93f4dda2e1be235fb30c78fc95af342d56484f34 (diff)
downloadsdl_ios-bugs/issue_912_update_example_app_for_5.2.tar.gz
Added hexagon button states with no images to example appbugs/issue_912_update_example_app_for_5.2
-rw-r--r--SmartDeviceLink_Example/Classes/ProxyManager.m18
1 files changed, 11 insertions, 7 deletions
diff --git a/SmartDeviceLink_Example/Classes/ProxyManager.m b/SmartDeviceLink_Example/Classes/ProxyManager.m
index e9474aa3e..27ccd46bd 100644
--- a/SmartDeviceLink_Example/Classes/ProxyManager.m
+++ b/SmartDeviceLink_Example/Classes/ProxyManager.m
@@ -136,13 +136,17 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setImagesEnabled:(BOOL)imagesEnabled {
_imagesEnabled = imagesEnabled;
[self sdlex_updateScreen];
+ [self setHexagonButtonIcon:self.isHexagonEnabled imagesEnabled:imagesEnabled];
}
- (void)setHexagonEnabled:(BOOL)hexagonEnabled {
_hexagonEnabled = hexagonEnabled;
+ [self setHexagonButtonIcon:hexagonEnabled imagesEnabled:self.areImagesEnabled];
+}
+- (void)setHexagonButtonIcon:(BOOL)hexagonEnabled imagesEnabled:(BOOL)imagesEnabled {
SDLSoftButtonObject *object = [self.sdlManager.screenManager softButtonObjectNamed:@"HexagonButton"];
- [object transitionToNextState];
+ imagesEnabled ? [object transitionToStateNamed:(hexagonEnabled ? @"imageOnState" : @"imageOffState")] : [object transitionToStateNamed:(hexagonEnabled ? @"textOnState" : @"textOffState")];
}
- (void)sdlex_updateScreen {
@@ -351,12 +355,12 @@ NS_ASSUME_NONNULL_BEGIN
SDLLogD(@"Star icon soft button press fired");
}];
- SDLSoftButtonState *hexOnState = [[SDLSoftButtonState alloc] initWithStateName:@"onState" text:@"➖Hex" image:[UIImage imageNamed:@"hexagon_on_softbutton_icon"]];
- SDLSoftButtonState *hexOffState = [[SDLSoftButtonState alloc] initWithStateName:@"offState" text:@"➕Hex" image:[UIImage imageNamed:@"hexagon_off_softbutton_icon"]];
- SDLSoftButtonObject *hexButton = [[SDLSoftButtonObject alloc] initWithName:@"HexagonButton" states:@[hexOnState, hexOffState] initialStateName:@"onState" handler:^(SDLOnButtonPress * _Nullable buttonPress, SDLOnButtonEvent * _Nullable buttonEvent) {
- if (buttonPress == nil) {
- return;
- }
+ SDLSoftButtonState *hexImageOnState = [[SDLSoftButtonState alloc] initWithStateName:@"imageOnState" text:nil image:[UIImage imageNamed:@"hexagon_on_softbutton_icon"]];
+ SDLSoftButtonState *hexImageOffState = [[SDLSoftButtonState alloc] initWithStateName:@"imageOffState" text:nil image:[UIImage imageNamed:@"hexagon_off_softbutton_icon"]];
+ SDLSoftButtonState *hexTextOnState = [[SDLSoftButtonState alloc] initWithStateName:@"textOnState" text:@"➖Hex" image:nil];
+ SDLSoftButtonState *hexTextOffState = [[SDLSoftButtonState alloc] initWithStateName:@"textOffState" text:@"➕Hex" image:nil];
+ SDLSoftButtonObject *hexButton = [[SDLSoftButtonObject alloc] initWithName:@"HexagonButton" states:@[hexImageOnState, hexImageOffState, hexTextOnState, hexTextOffState] initialStateName:hexImageOnState.name handler:^(SDLOnButtonPress * _Nullable buttonPress, SDLOnButtonEvent * _Nullable buttonEvent) {
+ if (buttonPress == nil) { return; }
weakself.hexagonEnabled = !weakself.hexagonEnabled;
SDLLogD(@"Hexagon icon button press fired %d", self.hexagonEnabled);