Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions XBMC Remote/DetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -3552,8 +3552,6 @@ - (void)actionSheetHandler:(NSString*)actiontitle origin:(CGPoint)origin fromvie
item[@"label"], @"label",
@"xbmc-exec-addon", @"type",
item[@"thumbnail"], @"icon",
@(0), @"xbmcSetting",
item[@"genre"], @"helpText",
[NSDictionary dictionaryWithObjectsAndKeys:
@"Addons.ExecuteAddon", @"command",
params, @"params",
Expand All @@ -3569,8 +3567,6 @@ - (void)actionSheetHandler:(NSString*)actiontitle origin:(CGPoint)origin fromvie
item[@"label"], @"label",
@"string", @"type",
@"", @"icon",
@(0), @"xbmcSetting",
item[@"genre"], @"helpText",
[NSDictionary dictionaryWithObjectsAndKeys:
@"Input.ExecuteAction", @"command",
params, @"params",
Expand All @@ -3586,8 +3582,6 @@ - (void)actionSheetHandler:(NSString*)actiontitle origin:(CGPoint)origin fromvie
item[@"label"], @"label",
@"string", @"type",
@"", @"icon",
@(0), @"xbmcSetting",
item[@"genre"], @"helpText",
[NSDictionary dictionaryWithObjectsAndKeys:
@"GUI.ActivateWindow", @"command",
params, @"params",
Expand Down
2 changes: 1 addition & 1 deletion XBMC Remote/RightMenuViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
NSMutableArray *tableData;
UIButton *editTableButton;
UIButton *moreButton;
NSDictionary *infoCustomButton;
UILabel *noFoundLabel;
}

@end
50 changes: 24 additions & 26 deletions XBMC Remote/RightMenuViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#define TOOLBAR_HEIGHT 44.0
#define BUTTON_SPACING 8.0
#define BUTTON_WIDTH 100.0
#define LABEL_SPACING 8.0
#define LABEL_HEIGHT 40.0
#define CUSTOM_BUTTON_CELL_IDENTIFIER @"customButtonCellIdentifier"
#define CUSTOM_TOGGLE_CELL_IDENTIFIER @"customToggleCellIdentifier"

Expand Down Expand Up @@ -147,7 +149,9 @@ - (UIView*)createToolbarView:(CGFloat)toolbarHeight {
editTableButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
[editTableButton setTitleColor:UIColor.darkGrayColor forState:UIControlStateDisabled];
[editTableButton setTitleColor:UIColor.lightGrayColor forState:UIControlStateNormal];
[editTableButton setTitleColor:UIColor.lightGrayColor forState:UIControlStateSelected];
[editTableButton setTitle:LOCALIZED_STR(@"Edit") forState:UIControlStateNormal];
[editTableButton setTitle:LOCALIZED_STR(@"Done") forState:UIControlStateSelected];
[editTableButton addTarget:self action:@selector(editTable:) forControlEvents:UIControlEventTouchUpInside];
[newView addSubview:editTableButton];

Expand Down Expand Up @@ -190,12 +194,9 @@ - (void)deleteCustomButton:(NSUInteger)idx {
[arrayButtons.buttons removeObjectAtIndex:idx];
[arrayButtons saveData];
if (arrayButtons.buttons.count == 0) {
[menuTableView setEditing:NO animated:YES];
[editTableButton setTitle:LOCALIZED_STR(@"Edit") forState:UIControlStateNormal];
editTableButton.enabled = NO;
[arrayButtons.buttons addObject:infoCustomButton];
[self loadCustomButtons];
[menuTableView reloadData];
editTableButton.selected = NO;
[Utilities alphaView:noFoundLabel AnimDuration:0.2 Alpha:1.0];
}
}

Expand All @@ -204,10 +205,11 @@ - (void)loadCustomButtons {
customButton *arrayButtons = [customButton new];
if (arrayButtons.buttons.count == 0) {
editTableButton.enabled = NO;
[arrayButtons.buttons addObject:infoCustomButton];
[Utilities alphaView:noFoundLabel AnimDuration:0.2 Alpha:1.0];
}
else {
editTableButton.enabled = YES;
[Utilities alphaView:noFoundLabel AnimDuration:0.2 Alpha:0.0];
}

// Build table with custom buttons
Expand All @@ -216,14 +218,11 @@ - (void)loadCustomButtons {
NSString *label = item[@"label"] ?: @"";
NSString *icon = item[@"icon"] ?: @"";
NSString *type = item[@"type"] ?: @"";
NSNumber *isSetting = item[@"isSetting"] ?: @YES;
NSDictionary *action = item[@"action"] ?: @{};

NSMutableDictionary *itemDict = [@{
@"label": label,
@"icon": icon,
@"isSetting": isSetting,
@"revealViewTop": @NO,
@"type": type,
@"action": action,
} mutableCopy];
Expand Down Expand Up @@ -257,14 +256,13 @@ - (void)toggleSwitch:(UISwitch*)onoff {
#pragma mark - Table view delegate

- (void)editTable:(id)sender {
UIButton *editButton = (UIButton*)sender;
if (menuTableView.editing) {
[menuTableView setEditing:NO animated:YES];
[editButton setTitle:LOCALIZED_STR(@"Edit") forState:UIControlStateNormal];
editTableButton.selected = NO;
}
else {
[menuTableView setEditing:YES animated:YES];
[editButton setTitle:LOCALIZED_STR(@"Done") forState:UIControlStateNormal];
editTableButton.selected = YES;
}
}

Expand All @@ -289,12 +287,7 @@ - (void)tableView:(UITableView*)tableView moveRowAtIndexPath:(NSIndexPath*)sourc
}

- (BOOL)tableView:(UITableView*)tableView canEditRowAtIndexPath:(NSIndexPath*)indexPath {
if (indexPath.row < tableData.count) {
return [tableData[indexPath.row][@"isSetting"] boolValue];
}
else {
return NO;
}
return YES;
}

- (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath {
Expand Down Expand Up @@ -427,14 +420,19 @@ - (void)viewDidLoad {
menuTableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
[self.view addSubview:menuTableView];

infoCustomButton = @{
@"label": LOCALIZED_STR(@"No custom button defined."),
@"icon": @"button_info",
@"action": @{},
@"revealViewTop": @NO,
@"isSetting": @NO,
@"type": @"",
};
noFoundLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(menuTableView.frame) + LABEL_SPACING,
CGRectGetMinY(menuTableView.frame),
CGRectGetWidth(menuTableView.frame) - 2 * LABEL_SPACING,
LABEL_HEIGHT)];
noFoundLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
noFoundLabel.text = LOCALIZED_STR(@"No custom button defined.");
noFoundLabel.textColor = UIColor.lightGrayColor;
noFoundLabel.font = [UIFont systemFontOfSize:17];
noFoundLabel.textAlignment = NSTextAlignmentCenter;
noFoundLabel.adjustsFontSizeToFitWidth = YES;
noFoundLabel.minimumScaleFactor = FONT_SCALING_MIN;
noFoundLabel.numberOfLines = 2;
[self.view addSubview:noFoundLabel];

[self loadCustomButtons];

Expand Down
2 changes: 0 additions & 2 deletions XBMC Remote/SettingsValuesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,6 @@ - (void)addActionButton:(UIAlertController*)alertCtrl {
alertCtrl.textFields[0].text, @"label",
type, @"type",
@"", @"icon",
@(xbmcSetting), @"xbmcSetting",
self.detailItem[@"genre"], @"helpText",
[NSDictionary dictionaryWithObjectsAndKeys:
@"Settings.SetSettingValue", @"command",
params, @"params",
Expand Down