Commit 9e37b33e authored by Felix Paul Kühne's avatar Felix Paul Kühne

library: fix corner case which lead the empty folder strings appear for an...

library: fix corner case which lead the empty folder strings appear for an empty library (close #14851)

(cherry picked from commit 89f1f3a150dfc15252f3e1c86ca050737f79b11c)
parent b9369bf7
......@@ -53,7 +53,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
id _folderObject;
VLCFolderCollectionViewFlowLayout *_folderLayout;
LXReorderableCollectionViewFlowLayout *_reorderLayout;
BOOL inFolder;
BOOL _inFolder;
UILongPressGestureRecognizer *_longPressGestureRecognizer;
NSMutableArray *_searchData;
......@@ -292,7 +292,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
[self reloadViews];
} else if ([mediaObject isKindOfClass:[MLLabel class]]) {
MLLabel *folder = (MLLabel*) mediaObject;
inFolder = YES;
_inFolder = YES;
if (!_usingTableViewToShowData) {
if (![self.collectionView.collectionViewLayout isEqual:_reorderLayout]) {
for (UIGestureRecognizer *recognizer in _collectionView.gestureRecognizers) {
......@@ -378,7 +378,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
- (void)_deleteMediaObject:(MLFile *)mediaObject
{
if (inFolder)
if (_inFolder)
[self rearrangeFolderTrackNumbersForRemovedItem:mediaObject];
/* stop playback if needed */
......@@ -418,9 +418,10 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
[self.emptyLibraryView removeFromSuperview];
if (_foundMedia.count == 0) {
self.emptyLibraryView.emptyLibraryLabel.text = inFolder ? NSLocalizedString(@"FOLDER_EMPTY", nil) : NSLocalizedString(@"EMPTY_LIBRARY", nil);
self.emptyLibraryView.emptyLibraryLongDescriptionLabel.text = inFolder ? NSLocalizedString(@"FOLDER_EMPTY_LONG", nil) : NSLocalizedString(@"EMPTY_LIBRARY_LONG", nil);
self.emptyLibraryView.learnMoreButton.hidden = inFolder;
_inFolder = (_libraryMode == VLCLibraryModeFolder || _libraryMode == VLCLibraryModeCreateFolder);
self.emptyLibraryView.emptyLibraryLabel.text = _inFolder ? NSLocalizedString(@"FOLDER_EMPTY", nil) : NSLocalizedString(@"EMPTY_LIBRARY", nil);
self.emptyLibraryView.emptyLibraryLongDescriptionLabel.text = _inFolder ? NSLocalizedString(@"FOLDER_EMPTY_LONG", nil) : NSLocalizedString(@"EMPTY_LIBRARY_LONG", nil);
self.emptyLibraryView.learnMoreButton.hidden = _inFolder;
self.emptyLibraryView.frame = self.view.bounds;
[self.view addSubview:self.emptyLibraryView];
self.navigationItem.rightBarButtonItems = nil;
......@@ -629,7 +630,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
return inFolder;
return _inFolder;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
......@@ -1198,7 +1199,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
if (self.editing)
[self setEditing:NO animated:NO];
}
inFolder = NO;
_inFolder = NO;
UIBarButtonItem *createFolderItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize target:self action:@selector(createFolder)];
NSMutableArray *toolbarItems = [self.toolbarItems mutableCopy];
toolbarItems[2] = createFolderItem;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment