Skip to content

Commit 6b34cc9

Browse files
Merge pull request #1342 from wutschel/rework_rightmenu
Maintenance: Internal rework around remote screen and custom buttons Improvement: Proper use of cell dequeuing of custom buttons Bugfix: Fixes custom buttons with on/off switches after another custom button was moved above them
2 parents 93c0d7d + 64ec76b commit 6b34cc9

19 files changed

+248
-587
lines changed

Kodi Remote.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
C7106D7B2D33EEE000A96C93 /* ProgressBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = C7106D7A2D33EEE000A96C93 /* ProgressBarView.m */; };
6161
C7106D842D33FBCE00A96C93 /* PlaylistProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = C7106D832D33FBCE00A96C93 /* PlaylistProgressView.m */; };
6262
C72CDAF22DD27AB800AFB2FA /* LocalNetworkAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = C72CDAF12DD27AB800AFB2FA /* LocalNetworkAlert.swift */; };
63+
C74B9CB22E979E2F0029B27E /* CustomButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C74B9CB12E979E2F0029B27E /* CustomButtonCell.m */; };
6364
C753585F2DE9A25F00952F0D /* LocalNetworkAccess.m in Sources */ = {isa = PBXBuildFile; fileRef = C753585E2DE9A25F00952F0D /* LocalNetworkAccess.m */; };
6465
C76451CE29C51221000AE949 /* UIImageView+HighlightedWebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = C76451AD29C51220000AE949 /* UIImageView+HighlightedWebCache.m */; };
6566
C76451CF29C51221000AE949 /* UIImage+WebP.m in Sources */ = {isa = PBXBuildFile; fileRef = C76451B129C51220000AE949 /* UIImage+WebP.m */; };
@@ -80,7 +81,6 @@
8081
C76594A02C5E871100B93A2A /* cellViewIPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0F6234E9192809B70024FEFA /* cellViewIPad.xib */; };
8182
C76594A12C5E871400B93A2A /* ViewControllerIPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0F175F23154D5C3600C1C61F /* ViewControllerIPad.xib */; };
8283
C76594A22C5E871600B93A2A /* cellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0F6234E7192808120024FEFA /* cellView.xib */; };
83-
C76594A32C5E871900B93A2A /* rightCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0F6234EB19280B120024FEFA /* rightCellView.xib */; };
8484
C76594A42C5E871C00B93A2A /* jsonDataCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0FB16163151F156A001BA2D4 /* jsonDataCell.xib */; };
8585
C76594A52C5E872000B93A2A /* playlistCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0F44E2D41527A9DF00D5958F /* playlistCellView.xib */; };
8686
C76594A62C5E872200B93A2A /* serverListCellView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0F487B5915399716004530C1 /* serverListCellView.xib */; };
@@ -196,7 +196,6 @@
196196
0F61E198153C828300A89BB1 /* AppInfoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppInfoViewController.m; sourceTree = "<group>"; };
197197
0F6234E7192808120024FEFA /* cellView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = cellView.xib; sourceTree = "<group>"; };
198198
0F6234E9192809B70024FEFA /* cellViewIPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = cellViewIPad.xib; sourceTree = "<group>"; };
199-
0F6234EB19280B120024FEFA /* rightCellView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = rightCellView.xib; sourceTree = "<group>"; };
200199
0F6234ED19280D9B0024FEFA /* DetailViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DetailViewController.xib; sourceTree = "<group>"; };
201200
0F6234EF192811150024FEFA /* NowPlaying.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NowPlaying.xib; sourceTree = "<group>"; };
202201
0F680CB717103DB60092298A /* ClearCacheView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClearCacheView.h; sourceTree = "<group>"; };
@@ -287,6 +286,8 @@
287286
C746406927E6209C00F6AD47 /* ko-KR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ko-KR"; path = "ko-KR.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
288287
C746406A27E6209C00F6AD47 /* ko-KR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ko-KR"; path = "ko-KR.lproj/Localizable.strings"; sourceTree = "<group>"; };
289288
C7478BF8257258E700161C1E /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
289+
C74B9CB12E979E2F0029B27E /* CustomButtonCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomButtonCell.m; sourceTree = "<group>"; };
290+
C74B9CB32E979E480029B27E /* CustomButtonCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomButtonCell.h; sourceTree = "<group>"; };
290291
C753585E2DE9A25F00952F0D /* LocalNetworkAccess.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocalNetworkAccess.m; sourceTree = "<group>"; };
291292
C75358602DE9A27100952F0D /* LocalNetworkAccess.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalNetworkAccess.h; sourceTree = "<group>"; };
292293
C76451AD29C51220000AE949 /* UIImageView+HighlightedWebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+HighlightedWebCache.m"; path = "SDWebImage/UIImageView+HighlightedWebCache.m"; sourceTree = "<group>"; };
@@ -420,6 +421,8 @@
420421
0F7F3DA9164AAD0F0080A14A /* InitialSlidingViewController.m */,
421422
0F40F5A4164D5FA000AF9DE9 /* RightMenuViewController.h */,
422423
0F40F5A5164D5FA000AF9DE9 /* RightMenuViewController.m */,
424+
C74B9CB32E979E480029B27E /* CustomButtonCell.h */,
425+
C74B9CB12E979E2F0029B27E /* CustomButtonCell.m */,
423426
0FEAE76616EA632800387DED /* ActorCell.h */,
424427
0FEAE76716EA632800387DED /* ActorCell.m */,
425428
0F284A5316F6419700AFC1EF /* PosterCell.h */,
@@ -438,7 +441,6 @@
438441
isa = PBXGroup;
439442
children = (
440443
0F6234E7192808120024FEFA /* cellView.xib */,
441-
0F6234EB19280B120024FEFA /* rightCellView.xib */,
442444
0FB16163151F156A001BA2D4 /* jsonDataCell.xib */,
443445
0F44E2D41527A9DF00D5958F /* playlistCellView.xib */,
444446
0F487B5915399716004530C1 /* serverListCellView.xib */,
@@ -833,7 +835,6 @@
833835
C76594A02C5E871100B93A2A /* cellViewIPad.xib in Resources */,
834836
C76594A12C5E871400B93A2A /* ViewControllerIPad.xib in Resources */,
835837
C76594A22C5E871600B93A2A /* cellView.xib in Resources */,
836-
C76594A32C5E871900B93A2A /* rightCellView.xib in Resources */,
837838
C76594A42C5E871C00B93A2A /* jsonDataCell.xib in Resources */,
838839
C76594A52C5E872000B93A2A /* playlistCellView.xib in Resources */,
839840
C76594A62C5E872200B93A2A /* serverListCellView.xib in Resources */,
@@ -868,6 +869,7 @@
868869
0F554907151D1187007E633F /* main.m in Sources */,
869870
0F55490B151D1187007E633F /* AppDelegate.m in Sources */,
870871
0F55490E151D1187007E633F /* MasterViewController.m in Sources */,
872+
C74B9CB22E979E2F0029B27E /* CustomButtonCell.m in Sources */,
871873
C76451D129C51221000AE949 /* NSData+ImageContentType.m in Sources */,
872874
0F554911151D1187007E633F /* DetailViewController.m in Sources */,
873875
C7106D842D33FBCE00A96C93 /* PlaylistProgressView.m in Sources */,

XBMC Remote/AppDelegate.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@
101101
@property (nonatomic, strong) mainMenu *playlistTvShows;
102102
@property (nonatomic, strong) mainMenu *playlistPVR;
103103
@property (nonatomic, strong) NSArray *globalSearchMenuLookup;
104-
@property (nonatomic, strong) NSArray *nowPlayingMenuItems;
105-
@property (nonatomic, strong) NSArray *remoteControlMenuItems;
106104
@property (nonatomic, assign) BOOL serverOnLine;
107105
@property (nonatomic, assign) BOOL serverTCPConnectionOpen;
108106
@property (nonatomic, assign) int serverVersion;

XBMC Remote/AppDelegate.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ @implementation AppDelegate
3939
@synthesize playlistPVR;
4040
@synthesize globalSearchMenuLookup;
4141
@synthesize serverName;
42-
@synthesize nowPlayingMenuItems;
4342
@synthesize serverVolume;
44-
@synthesize remoteControlMenuItems;
4543

4644
+ (AppDelegate*)instance {
4745
return (AppDelegate*)UIApplication.sharedApplication.delegate;

XBMC Remote/ConvenienceMacros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#define TOOLBAR_TINT_COLOR [Utilities getGrayColor:38 alpha:0.95]
2929
#define NAVBAR_TINT_COLOR [Utilities getGrayColor:38 alpha:1.0]
3030
#define KODI_BLUE_COLOR [Utilities getKodiBlue]
31-
#define CUSTOM_BUTTON_BACKGROUND [Utilities getGrayColor:36 alpha:1]
31+
#define CUSTOM_BUTTON_BACKGROUND [Utilities getGrayColor:25 alpha:1] // Gray:25 is same as the other remote buttons
3232
#define GRIDVIEW_SECTION_COLOR [Utilities getGrayColor:44 alpha:1.0]
3333
#define SYSTEMGRAY6_DARKMODE [Utilities getGrayColor:28 alpha:1] // Gray:28 is similar to systemGray6 in Dark Mode
3434
#define SYSTEMGRAY6_LIGHTMODE [Utilities getGrayColor:242 alpha:1] // Gray:242 is similar to systemGray6 in Light Mode

XBMC Remote/CustomButtonCell.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// CustomButtonCell.h
3+
// Kodi Remote
4+
//
5+
// Created by Buschmann on 09.10.25.
6+
// Copyright © 2025 Team Kodi. All rights reserved.
7+
//
8+
9+
@import UIKit;
10+
11+
#define CUSTOM_BUTTON_ITEM_HEIGHT 50.0
12+
13+
@interface CustomButtonCell : UITableViewCell
14+
15+
@property (nonatomic, strong) UILabel *buttonLabel;
16+
@property (nonatomic, strong) UIImageView *buttonIcon;
17+
@property (nonatomic, strong) UISwitch *onoffSwitch;
18+
@property (nonatomic, strong) UIActivityIndicatorView *busyView;
19+
20+
@end

XBMC Remote/CustomButtonCell.m

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
//
2+
// CustomButtonCell.m
3+
// Kodi Remote
4+
//
5+
// Created by Buschmann on 09.10.25.
6+
// Copyright © 2025 Team Kodi. All rights reserved.
7+
//
8+
9+
#import "CustomButtonCell.h"
10+
#import "Utilities.h"
11+
12+
#define CUSTOM_BUTTON_ITEM_SPACING 4.0
13+
#define CUSTOM_BUTTON_LABEL_PADDING 4.0
14+
#define CUSTOM_BUTTON_BACKGROUND_INSET 2.0
15+
16+
@implementation CustomButtonCell
17+
18+
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier {
19+
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
20+
if (self) {
21+
// Background view to better match a button style
22+
UIView *buttonBackground = [UIView new];
23+
buttonBackground.frame = CGRectInset(self.frame, CUSTOM_BUTTON_BACKGROUND_INSET, CUSTOM_BUTTON_BACKGROUND_INSET);
24+
buttonBackground.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
25+
buttonBackground.layer.cornerRadius = 8;
26+
buttonBackground.backgroundColor = CUSTOM_BUTTON_BACKGROUND;
27+
[self insertSubview:buttonBackground belowSubview:self.contentView];
28+
29+
// OnOff switch is placed right aligned in the content view
30+
UISwitch *onoff = [UISwitch new];
31+
CGRect frame = onoff.frame;
32+
frame.origin = CGPointMake(CGRectGetWidth(self.contentView.frame) - CGRectGetWidth(onoff.frame) - CUSTOM_BUTTON_ITEM_SPACING,
33+
(CUSTOM_BUTTON_ITEM_HEIGHT - CGRectGetHeight(onoff.frame)) / 2);
34+
onoff.frame = frame;
35+
onoff.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
36+
onoff.hidden = YES;
37+
onoff.alpha = 0.9;
38+
[self.contentView addSubview:onoff];
39+
self.onoffSwitch = onoff;
40+
41+
// Icon frame follows onoffSwitch size
42+
CGFloat iconSize = CGRectGetHeight(self.onoffSwitch.frame);
43+
UIImageView *icon = [UIImageView new];
44+
icon.frame = CGRectMake(CGRectGetWidth(self.contentView.frame) - (CGRectGetWidth(self.onoffSwitch.frame) + iconSize) / 2 - CUSTOM_BUTTON_ITEM_SPACING,
45+
(CGRectGetHeight(self.contentView.frame) - iconSize) / 2,
46+
iconSize,
47+
iconSize);
48+
icon.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
49+
icon.alpha = 0.9;
50+
[self.contentView addSubview:icon];
51+
self.buttonIcon = icon;
52+
53+
// Label follows onoffSwitch/icon size
54+
UILabel *title = [UILabel new];
55+
title.frame = CGRectMake(CUSTOM_BUTTON_LABEL_PADDING,
56+
CUSTOM_BUTTON_ITEM_SPACING,
57+
CGRectGetWidth(self.contentView.frame) - CGRectGetWidth(self.onoffSwitch.frame) - CUSTOM_BUTTON_LABEL_PADDING * 3,
58+
CUSTOM_BUTTON_ITEM_HEIGHT - CUSTOM_BUTTON_ITEM_SPACING * 2);
59+
title.autoresizingMask = UIViewAutoresizingFlexibleWidth;
60+
title.textAlignment = NSTextAlignmentRight;
61+
title.numberOfLines = 2;
62+
title.font = [UIFont fontWithName:@"Roboto-Regular" size:20];
63+
title.adjustsFontSizeToFitWidth = YES;
64+
title.minimumScaleFactor = FONT_SCALING_MIN;
65+
title.textColor = UIColor.lightGrayColor;
66+
title.highlightedTextColor = UIColor.grayColor;
67+
[self.contentView addSubview:title];
68+
self.buttonLabel = title;
69+
70+
// Activity indicator is placed on top of onoff switch
71+
UIActivityIndicatorView *busyView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
72+
busyView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;
73+
busyView.hidesWhenStopped = YES;
74+
busyView.center = onoff.center;
75+
[self.contentView addSubview:busyView];
76+
self.busyView = busyView;
77+
}
78+
return self;
79+
}
80+
81+
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
82+
[super setEditing:editing animated:animated];
83+
if (editing) {
84+
self.onoffSwitch.enabled = NO;
85+
self.buttonIcon.alpha = 0.5;
86+
}
87+
else {
88+
self.onoffSwitch.enabled = YES;
89+
self.buttonIcon.alpha = 0.9;
90+
}
91+
}
92+
93+
@end

XBMC Remote/DetailViewController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#import "customButton.h"
3131
#import "VersionCheck.h"
3232
#import "SharingActivityItemSource.h"
33+
#import "RemoteController.h"
3334

3435
#import "GeneratedAssetSymbols.h"
3536

XBMC Remote/NowPlaying.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,10 +2679,9 @@ - (void)viewDidAppear:(BOOL)animated {
26792679
[self startNowPlayingUpdates];
26802680
fromItself = NO;
26812681
if (IS_IPHONE) {
2682-
self.slidingViewController.underRightViewController = nil;
2683-
RightMenuViewController *rightMenuViewController = [[RightMenuViewController alloc] initWithNibName:@"RightMenuViewController" bundle:nil];
2684-
rightMenuViewController.rightMenuItems = AppDelegate.instance.nowPlayingMenuItems;
2685-
self.slidingViewController.underRightViewController = rightMenuViewController;
2682+
RemoteController *remoteController = [[RemoteController alloc] initWithNibName:@"RemoteController" withEmbedded:YES bundle:nil];
2683+
self.slidingViewController.underRightViewController = remoteController;
2684+
self.slidingViewController.anchorLeftPeekAmount = ANCHOR_RIGHT_PEEK;
26862685
}
26872686
}
26882687

XBMC Remote/RemoteController.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#import <UIKit/UIKit.h>
1010
#import "DSJSONRPC.h"
11+
#import "VolumeSliderView.h"
1112

1213
typedef NS_ENUM(NSInteger, RemotePositionType) {
1314
RemoteAtTop,
@@ -38,8 +39,7 @@ typedef NS_ENUM(NSInteger, RemotePositionType) {
3839
RemotePositionType positionMode;
3940
UIView *remoteToolbar;
4041
UIButton *positionButton;
41-
CGFloat embeddedShift;
42-
CGFloat topRemoteOffset;
42+
VolumeSliderView *volumeSliderView;
4343
__weak IBOutlet UIView *TransitionalView;
4444
__weak IBOutlet UIImageView *gestureZoneImageView;
4545
UIImage *gestureImage;
@@ -51,7 +51,6 @@ typedef NS_ENUM(NSInteger, RemotePositionType) {
5151
}
5252

5353
- (IBAction)startVibrate:(id)sender;
54-
- (void)setEmbeddedView;
5554
- (id)initWithNibName:(NSString*)nibNameOrNil withEmbedded:(BOOL)withEmbedded bundle:(NSBundle*)nibBundleOrNil;
5655

5756
@property (strong, nonatomic) id detailItem;

0 commit comments

Comments
 (0)