Skip to content

Commit d9bbae2

Browse files
committed
Highlight custom button press by quick alpha animation
This ensures feedback is given to the user after selecting custom buttons. For the OnOff switch buttons the feedback is done via changing the OnOff switch state. Remove assignment of CustomButtonCell's title.highlightedTextColor as anyway unused.
1 parent 96045e9 commit d9bbae2

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

XBMC Remote/CustomButtonCell.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuse
6565
title.adjustsFontSizeToFitWidth = YES;
6666
title.minimumScaleFactor = FONT_SCALING_MIN;
6767
title.textColor = UIColor.lightGrayColor;
68-
title.highlightedTextColor = UIColor.grayColor;
6968
[self.contentView addSubview:title];
7069
self.buttonLabel = title;
7170

XBMC Remote/RightMenuViewController.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,20 @@ - (void)loadCustomButtons {
232232
}
233233
}
234234

235+
- (void)highlightCustomButton:(NSIndexPath*)indexPath {
236+
// Short animation to highlight the button selection
237+
CustomButtonCell *cell = [menuTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row inSection:0]];
238+
[UIView animateWithDuration:0.1
239+
delay:0.0
240+
options:UIViewAnimationOptionCurveEaseInOut
241+
animations:^{
242+
cell.alpha = 0.1;
243+
}
244+
completion:^(BOOL finished) {
245+
cell.alpha = 1.0;
246+
}];
247+
}
248+
235249
#pragma mark - UISwitch
236250

237251
- (void)toggleSwitch:(UISwitch*)onoff {
@@ -351,6 +365,7 @@ - (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)
351365
NSDictionary *parameters = tableData[indexPath.row][@"action"][@"params"] ?: @{};
352366
[self xbmcAction:command params:parameters uiControl:nil];
353367
}
368+
[self highlightCustomButton:indexPath];
354369
}
355370
}
356371

0 commit comments

Comments
 (0)