@@ -94,7 +94,7 @@ - (id)initWithFrame:(CGRect)frame withItem:(id)item {
9494 else if ([itemControls[@" type" ] isEqualToString: @" spinner" ] && settingOptions == nil ) {
9595 xbmcSetting = cSlider;
9696 storeSliderValue = [self .detailItem[@" value" ] intValue ];
97- cellHeight = 184 .0 ;
97+ cellHeight = 242 .0 ;
9898 }
9999 else if ([itemControls[@" type" ] isEqualToString: @" edit" ]) {
100100 xbmcSetting = cInput;
@@ -232,9 +232,7 @@ - (NSString*)getActionButtonTitle {
232232 subTitle = [NSString stringWithFormat: @" : %@ " , settingOptions[longPressRow.row][@" label" ]];
233233 break ;
234234 case cSlider:
235- if (itemControls[@" formatlabel" ] != nil ) {
236- stringFormat = [NSString stringWithFormat: @" : %@ " , itemControls[@" formatlabel" ]];
237- }
235+ stringFormat = [self getStringFormatFromItem: itemControls defaultFormat: stringFormat];
238236 subTitle = [NSString stringWithFormat: stringFormat, (int )storeSliderValue];
239237 break ;
240238 case cUnsupported:
@@ -344,7 +342,18 @@ - (void)retrieveXBMCData:(NSString*)method parameters:(NSDictionary*)params item
344342 return ;
345343}
346344
347- #pragma mark -
345+ #pragma mark Helper
346+
347+ - (NSString *)getStringFormatFromItem : (id )item defaultFormat : (NSString *)defaultFormat {
348+ // Workaround!! Before Kodi 18.x an older format ("%i ms") was used. The new format ("{0:d} ms") needs
349+ // an updated parser. Until this is implemented just display the value itself, without the unit.
350+ NSString *format = item[@" formatlabel" ];
351+ if (format.length > 0 && AppDelegate.instance .serverVersion < 18 ) {
352+ return format;
353+ }
354+ return defaultFormat;
355+ }
356+
348357#pragma mark Table view data source
349358
350359- (CGFloat)tableView : (UITableView*)tableView heightForRowAtIndexPath : (NSIndexPath *)indexPath {
@@ -518,16 +527,15 @@ - (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSI
518527 cellLabel.textAlignment = NSTextAlignmentCenter;
519528 cellText = [NSString stringWithFormat: @" %@ " , self .detailItem[@" label" ]];
520529
521- descriptionLabel.frame = CGRectMake (descriptionLabel.frame .origin .x , descriptionLabel.frame .origin .y + 2 , self.view .bounds .size .width - (cellLabelOffset * 2 ), 58 );
530+ descriptionLabel.frame = CGRectMake (descriptionLabel.frame .origin .x , descriptionLabel.frame .origin .y + 2 , self.view .bounds .size .width - (cellLabelOffset * 2 ), 116 );
522531 descriptionLabel.textAlignment = NSTextAlignmentCenter;
523- descriptionLabel.numberOfLines = 4 ;
532+ descriptionLabel.numberOfLines = 8 ;
524533 descriptionLabel.text = [NSString stringWithFormat: @" %@ " , self .detailItem[@" genre" ]];
534+ [self adjustFontSize: descriptionLabel];
525535 slider.minimumValue = [self .detailItem[@" minimum" ] intValue ];
526536 slider.maximumValue = [self .detailItem[@" maximum" ] intValue ];
527537 slider.value = [self .detailItem[@" value" ] intValue ];
528- if (itemControls[@" formatlabel" ] != nil ) {
529- stringFormat = [NSString stringWithFormat: @" %@ " , itemControls[@" formatlabel" ]];
530- }
538+ stringFormat = [self getStringFormatFromItem: itemControls defaultFormat: stringFormat];
531539 sliderLabel.text = [NSString stringWithFormat: stringFormat, [self .detailItem[@" value" ] intValue ]];
532540 break ;
533541
@@ -788,9 +796,7 @@ - (void)sliderAction:(id)sender {
788796 if ([[[slider superview ] viewWithTag: 102 ] isKindOfClass: [UILabel class ]]) {
789797 UILabel *sliderLabel = (UILabel*)[[slider superview ] viewWithTag: 102 ];
790798 NSString *stringFormat = @" %i " ;
791- if (itemControls[@" formatlabel" ] != nil ) {
792- stringFormat = [NSString stringWithFormat: @" %@ " , itemControls[@" formatlabel" ]];
793- }
799+ stringFormat = [self getStringFormatFromItem: itemControls defaultFormat: stringFormat];
794800 sliderLabel.text = [NSString stringWithFormat: stringFormat, (int )storeSliderValue];
795801 }
796802 }
0 commit comments