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"; ...@@ -53,7 +53,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
id _folderObject; id _folderObject;
VLCFolderCollectionViewFlowLayout *_folderLayout; VLCFolderCollectionViewFlowLayout *_folderLayout;
LXReorderableCollectionViewFlowLayout *_reorderLayout; LXReorderableCollectionViewFlowLayout *_reorderLayout;
BOOL inFolder; BOOL _inFolder;
UILongPressGestureRecognizer *_longPressGestureRecognizer; UILongPressGestureRecognizer *_longPressGestureRecognizer;
NSMutableArray *_searchData; NSMutableArray *_searchData;
...@@ -292,7 +292,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData"; ...@@ -292,7 +292,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
[self reloadViews]; [self reloadViews];
} else if ([mediaObject isKindOfClass:[MLLabel class]]) { } else if ([mediaObject isKindOfClass:[MLLabel class]]) {
MLLabel *folder = (MLLabel*) mediaObject; MLLabel *folder = (MLLabel*) mediaObject;
inFolder = YES; _inFolder = YES;
if (!_usingTableViewToShowData) { if (!_usingTableViewToShowData) {
if (![self.collectionView.collectionViewLayout isEqual:_reorderLayout]) { if (![self.collectionView.collectionViewLayout isEqual:_reorderLayout]) {
for (UIGestureRecognizer *recognizer in _collectionView.gestureRecognizers) { for (UIGestureRecognizer *recognizer in _collectionView.gestureRecognizers) {
...@@ -378,7 +378,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData"; ...@@ -378,7 +378,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
- (void)_deleteMediaObject:(MLFile *)mediaObject - (void)_deleteMediaObject:(MLFile *)mediaObject
{ {
if (inFolder) if (_inFolder)
[self rearrangeFolderTrackNumbersForRemovedItem:mediaObject]; [self rearrangeFolderTrackNumbersForRemovedItem:mediaObject];
/* stop playback if needed */ /* stop playback if needed */
...@@ -418,9 +418,10 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData"; ...@@ -418,9 +418,10 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
[self.emptyLibraryView removeFromSuperview]; [self.emptyLibraryView removeFromSuperview];
if (_foundMedia.count == 0) { if (_foundMedia.count == 0) {
self.emptyLibraryView.emptyLibraryLabel.text = inFolder ? NSLocalizedString(@"FOLDER_EMPTY", nil) : NSLocalizedString(@"EMPTY_LIBRARY", nil); _inFolder = (_libraryMode == VLCLibraryModeFolder || _libraryMode == VLCLibraryModeCreateFolder);
self.emptyLibraryView.emptyLibraryLongDescriptionLabel.text = inFolder ? NSLocalizedString(@"FOLDER_EMPTY_LONG", nil) : NSLocalizedString(@"EMPTY_LIBRARY_LONG", nil); self.emptyLibraryView.emptyLibraryLabel.text = _inFolder ? NSLocalizedString(@"FOLDER_EMPTY", nil) : NSLocalizedString(@"EMPTY_LIBRARY", nil);
self.emptyLibraryView.learnMoreButton.hidden = inFolder; 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.emptyLibraryView.frame = self.view.bounds;
[self.view addSubview:self.emptyLibraryView]; [self.view addSubview:self.emptyLibraryView];
self.navigationItem.rightBarButtonItems = nil; self.navigationItem.rightBarButtonItems = nil;
...@@ -629,7 +630,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData"; ...@@ -629,7 +630,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{ {
return inFolder; return _inFolder;
} }
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
...@@ -1198,7 +1199,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData"; ...@@ -1198,7 +1199,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
if (self.editing) if (self.editing)
[self setEditing:NO animated:NO]; [self setEditing:NO animated:NO];
} }
inFolder = NO; _inFolder = NO;
UIBarButtonItem *createFolderItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize target:self action:@selector(createFolder)]; UIBarButtonItem *createFolderItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemOrganize target:self action:@selector(createFolder)];
NSMutableArray *toolbarItems = [self.toolbarItems mutableCopy]; NSMutableArray *toolbarItems = [self.toolbarItems mutableCopy];
toolbarItems[2] = createFolderItem; 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