Skip to content
Open
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
50 changes: 30 additions & 20 deletions XBMC Remote/NowPlaying.m
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ - (void)setCoverSize:(NSString*)type {
- (void)serverIsDisconnected {
currentPlaylistID = PLAYERID_UNKNOWN;
storedItemID = 0;
[self nothingIsPlaying];
if (playlistData.count == 0) {
return;
}
[UIView animateWithDuration:0.1
delay:0.0
options:UIViewAnimationOptionCurveEaseInOut
Expand All @@ -369,7 +373,6 @@ - (void)serverIsDisconnected {
[playlistTableView reloadData];
[self notifyChangeForPlaylistHeader];
}];
[self nothingIsPlaying];
}

- (void)nothingIsPlaying {
Expand Down Expand Up @@ -2196,26 +2199,30 @@ - (void)tableView:(UITableView*)tableView moveRowAtIndexPath:(NSIndexPath*)sourc
};
[[Utilities getJsonRPC] callMethod:actionRemove withParameters:paramsRemove onCompletion:^(NSString *methodName, NSInteger callId, id methodResult, DSJSONRPCError *methodError, NSError *error) {
if (error == nil && methodError == nil) {
[[Utilities getJsonRPC] callMethod:actionInsert withParameters:paramsInsert];
NSInteger numObj = playlistData.count;
if (sourceIndexPath.row < numObj) {
[playlistData removeObjectAtIndex:sourceIndexPath.row];
}
if (destinationIndexPath.row <= playlistData.count) {
[playlistData insertObject:objSource atIndex:destinationIndexPath.row];
}
if (sourceIndexPath.row > storeSelection.row && destinationIndexPath.row <= storeSelection.row) {
storeSelection = [NSIndexPath indexPathForRow:storeSelection.row + 1 inSection:storeSelection.section];
}
else if (sourceIndexPath.row < storeSelection.row && destinationIndexPath.row >= storeSelection.row) {
storeSelection = [NSIndexPath indexPathForRow:storeSelection.row - 1 inSection:storeSelection.section];
}
[playlistTableView reloadData];
[[Utilities getJsonRPC] callMethod:actionInsert withParameters:paramsInsert onCompletion:^(NSString *methodName, NSInteger callId, id methodResult, DSJSONRPCError *methodError, NSError *error) {
if (error == nil && methodError == nil) {
if (sourceIndexPath.row < playlistData.count) {
[playlistData removeObjectAtIndex:sourceIndexPath.row];
}
if (destinationIndexPath.row <= playlistData.count) {
[playlistData insertObject:objSource atIndex:destinationIndexPath.row];
}
if (sourceIndexPath.row > storeSelection.row && destinationIndexPath.row <= storeSelection.row) {
storeSelection = [NSIndexPath indexPathForRow:storeSelection.row + 1 inSection:storeSelection.section];
}
else if (sourceIndexPath.row < storeSelection.row && destinationIndexPath.row >= storeSelection.row) {
storeSelection = [NSIndexPath indexPathForRow:storeSelection.row - 1 inSection:storeSelection.section];
}
}
else {
[Utilities showMessage:LOCALIZED_STR(@"Cannot do that") color:ERROR_MESSAGE_COLOR];
[self createPlaylistAnimated:YES];
}
}];
}
else {
[playlistTableView reloadData];
[playlistTableView selectRowAtIndexPath:storeSelection animated:YES scrollPosition:UITableViewScrollPositionMiddle];
[Utilities showMessage:LOCALIZED_STR(@"Cannot do that") color:ERROR_MESSAGE_COLOR];
[self createPlaylistAnimated:YES];
}
}];
}
Expand Down Expand Up @@ -2243,10 +2250,13 @@ - (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEdi
}
}
else {
[playlistTableView reloadData];
[playlistTableView selectRowAtIndexPath:storeSelection animated:YES scrollPosition:UITableViewScrollPositionMiddle];
[Utilities showMessage:LOCALIZED_STR(@"Cannot do that") color:ERROR_MESSAGE_COLOR];
}
// Are there still editable entries?
if (playlistData.count == 0) {
editTableButton.selected = editTableButton.enabled = NO;
[Utilities alphaView:noFoundView AnimDuration:0.2 Alpha:1.0];
}
}];
}
}
Expand Down