Jelajahi Sumber

OneDrive: switch to collection view based layout

Felix Paul Kühne 9 tahun lalu
induk
melakukan
8583446bbc

+ 3 - 3
Apple-TV/VLCCloudServicesTVViewController.m

@@ -16,7 +16,7 @@
 #import "SSKeychain.h"
 #import "VLCPlayerDisplayController.h"
 #import "VLCOneDriveController.h"
-#import "VLCOneDriveTableViewController2.h"
+#import "VLCOneDriveCollectionViewController.h"
 #import "VLCBoxTableViewController.h"
 #import "VLCBoxController.h"
 #import "MetaDataFetcherKit.h"
@@ -90,8 +90,8 @@
 
 - (IBAction)onedrive:(id)sender
 {
-    VLCOneDriveTableViewController2 *newKid = [[VLCOneDriveTableViewController2 alloc] initWithOneDriveObject:nil];
-    [self.navigationController pushViewController:newKid animated:YES];
+    VLCOneDriveCollectionViewController *targetViewController = [[VLCOneDriveCollectionViewController alloc] initWithOneDriveObject:nil];
+    [self.navigationController pushViewController:targetViewController animated:YES];
 }
 
 - (IBAction)box:(id)sender

+ 1 - 1
SharedSources/Clouds/VLCCloudStorageCollectionViewCell.m

@@ -100,7 +100,6 @@
                 }
             } else
                 self.thumbnailImage = [UIImage imageNamed:@"blank"];
-            self.title = self.oneDriveFile.name;
 
             if (self.oneDriveFile.size > 0) {
                 [subtitle appendString:[NSByteCountFormatter stringFromByteCount:[self.oneDriveFile.size longLongValue] countStyle:NSByteCountFormatterCountStyleFile]];
@@ -114,6 +113,7 @@
             }
             self.subtitle = subtitle;
         }
+        self.title = self.oneDriveFile.name;
     }
 }
 

+ 0 - 3
SharedSources/Clouds/VLCDropboxCollectionViewController.m

@@ -65,9 +65,6 @@
 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
 {
     VLCCloudStorageCollectionViewCell *cell = (VLCCloudStorageCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:VLCRemoteBrowsingTVCellIdentifier forIndexPath:indexPath];
-    if (!cell) {
-        NSLog(@"oh boy");
-    }
 
     NSUInteger index = indexPath.row;
     if (_mediaList) {

+ 2 - 6
SharedSources/Clouds/VLCOneDriveTableViewController2.h

@@ -1,5 +1,4 @@
 /*****************************************************************************
- * VLCOneDriveTableViewController.h
  * VLC for iOS
  *****************************************************************************
  * Copyright (c) 2015 VideoLAN. All rights reserved.
@@ -10,12 +9,9 @@
  * Refer to the COPYING file of the official project for license.
  *****************************************************************************/
 
-#import <UIKit/UIKit.h>
-#import "VLCCloudStorageTVTableViewController.h"
+#import "VLCCloudStorageTVViewController.h"
 
-@class VLCOneDriveObject;
-
-@interface VLCOneDriveTableViewController2 : VLCCloudStorageTVTableViewController
+@interface VLCOneDriveCollectionViewController : VLCCloudStorageTVViewController
 
 - (instancetype)initWithOneDriveObject:(VLCOneDriveObject *)object;
 

+ 15 - 29
SharedSources/Clouds/VLCOneDriveTableViewController2.m

@@ -1,5 +1,4 @@
 /*****************************************************************************
- * VLCOneDriveTableViewController.m
  * VLC for iOS
  *****************************************************************************
  * Copyright (c) 2014-2015 VideoLAN. All rights reserved.
@@ -10,22 +9,22 @@
  * Refer to the COPYING file of the official project for license.
  *****************************************************************************/
 
-#import "VLCOneDriveTableViewController2.h"
+#import "VLCOneDriveCollectionViewController.h"
 #import "VLCOneDriveController.h"
-#import "VLCCloudStorageTableViewCell.h"
+#import "VLCRemoteBrowsingTVCell.h"
 
-@interface VLCOneDriveTableViewController2 () <VLCCloudStorageDelegate>
+@interface VLCOneDriveCollectionViewController ()
 {
     VLCOneDriveObject *_currentFolder;
     VLCOneDriveController *_oneDriveController;
 }
 @end
 
-@implementation VLCOneDriveTableViewController2
+@implementation VLCOneDriveCollectionViewController
 
 - (instancetype)initWithOneDriveObject:(VLCOneDriveObject *)object
 {
-    self = [super init];
+    self = [super initWithNibName:@"VLCRemoteBrowsingCollectionViewController" bundle:nil];
 
     if (self) {
         _oneDriveController = [VLCOneDriveController sharedInstance];
@@ -53,15 +52,16 @@
     [super viewWillAppear:animated];
 }
 
-#pragma mark - table view data source
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+- (void)mediaListUpdated
 {
-    static NSString *CellIdentifier = @"OneDriveCell";
+    [self.collectionView reloadData];
+    [self.activityIndicator stopAnimating];
+}
 
-    VLCCloudStorageTableViewCell *cell = (VLCCloudStorageTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
-    if (cell == nil)
-        cell = [VLCCloudStorageTableViewCell cellWithReuseIdentifier:CellIdentifier];
+
+- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+    VLCCloudStorageCollectionViewCell *cell = (VLCCloudStorageCollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:VLCRemoteBrowsingTVCellIdentifier forIndexPath:indexPath];
 
     if (_currentFolder == nil)
         _currentFolder = _oneDriveController.rootFolder;
@@ -71,24 +71,14 @@
 
         if (indexPath.row < items.count) {
             cell.oneDriveFile = items[indexPath.row];
-            cell.delegate = self;
         }
     }
 
     return cell;
 }
 
-#pragma mark - table view delegate
-
-- (void)mediaListUpdated
-{
-    [self.tableView reloadData];
-    [self.activityIndicator stopAnimating];
-}
-
-- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
 {
-    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
     if (_currentFolder == nil)
         return;
 
@@ -100,24 +90,20 @@
     VLCOneDriveObject *selectedObject = folderItems[row];
     if (selectedObject.isFolder) {
         /* dive into sub folder */
-        VLCOneDriveTableViewController2 *targetViewController = [[VLCOneDriveTableViewController2 alloc] initWithOneDriveObject:selectedObject];
+        VLCOneDriveCollectionViewController *targetViewController = [[VLCOneDriveCollectionViewController alloc] initWithOneDriveObject:selectedObject];
         [self.navigationController pushViewController:targetViewController animated:YES];
     } else {
         /* stream file */
         NSURL *url = [NSURL URLWithString:selectedObject.downloadPath];
         VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
         [vpc playURL:url successCallback:nil errorCallback:nil];
-#if TARGET_OS_TV
         VLCFullscreenMovieTVViewController *movieVC = [VLCFullscreenMovieTVViewController fullscreenMovieTVViewController];
         [self presentViewController:movieVC
                            animated:YES
                          completion:nil];
-#endif
     }
 }
 
-#pragma mark - onedrive controller delegation
-
 - (void)sessionWasUpdated
 {
     [self updateViewAfterSessionChange];

+ 6 - 6
VLC for iOS.xcodeproj/project.pbxproj

@@ -194,7 +194,6 @@
 		7DDE41901BE9225A0065C53A /* VLCAboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7DDE418E1BE9225A0065C53A /* VLCAboutViewController.xib */; };
 		7DDE41931BE925820065C53A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7D13294E1BA1F10100BE647E /* Assets.xcassets */; };
 		7DDFF4251BDFD23300913BD1 /* VLCCone512x512.png in Resources */ = {isa = PBXBuildFile; fileRef = 7DDFF4241BDFD23300913BD1 /* VLCCone512x512.png */; };
-		7DE0648D1BE3F36700C706BE /* VLCOneDriveTableViewController2.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DE0648C1BE3F36700C706BE /* VLCOneDriveTableViewController2.m */; };
 		7DE56C1A1AD93F9100E8CA00 /* VLCPlaybackController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DE56C191AD93F9100E8CA00 /* VLCPlaybackController.m */; };
 		7DEC8BD91BD670EB006E1093 /* VLCPlaybackNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D9CB9DB1A4C55EF00BB74B4 /* VLCPlaybackNavigationController.m */; };
 		7DEC8BDA1BD67112006E1093 /* VLCFrostedGlasView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BADAF44185FBD9D00108BD8 /* VLCFrostedGlasView.m */; };
@@ -220,6 +219,7 @@
 		7DF383C11BF231BC00D71A5C /* VLCCloudStorageTVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DF383C01BF231BC00D71A5C /* VLCCloudStorageTVViewController.m */; };
 		7DF383C41BF2329500D71A5C /* VLCDropboxCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DF383C31BF2329500D71A5C /* VLCDropboxCollectionViewController.m */; };
 		7DF383C71BF23AC000D71A5C /* VLCCloudStorageCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DF383C61BF23AC000D71A5C /* VLCCloudStorageCollectionViewCell.m */; };
+		7DF383CB1BF2498800D71A5C /* VLCOneDriveCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DF383CA1BF2498800D71A5C /* VLCOneDriveCollectionViewController.m */; };
 		7DF7CA0717650C2A00C61739 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DF7CA0617650C2A00C61739 /* AVFoundation.framework */; };
 		7DF7E791175F47DC0018858D /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DF7E790175F47DC0018858D /* MediaPlayer.framework */; };
 		7DF90B441BE7A5380059C0E3 /* VLCSettingsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7DF90B431BE7A5380059C0E3 /* VLCSettingsTableViewController.m */; };
@@ -778,8 +778,6 @@
 		7DDE418D1BE9225A0065C53A /* VLCAboutViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCAboutViewController.m; sourceTree = "<group>"; };
 		7DDE418E1BE9225A0065C53A /* VLCAboutViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = VLCAboutViewController.xib; sourceTree = "<group>"; };
 		7DDFF4241BDFD23300913BD1 /* VLCCone512x512.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = VLCCone512x512.png; path = Resources/VLCCone512x512.png; sourceTree = SOURCE_ROOT; };
-		7DE0648B1BE3F36700C706BE /* VLCOneDriveTableViewController2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCOneDriveTableViewController2.h; path = SharedSources/Clouds/VLCOneDriveTableViewController2.h; sourceTree = SOURCE_ROOT; };
-		7DE0648C1BE3F36700C706BE /* VLCOneDriveTableViewController2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCOneDriveTableViewController2.m; path = SharedSources/Clouds/VLCOneDriveTableViewController2.m; sourceTree = SOURCE_ROOT; };
 		7DE56C181AD93F9100E8CA00 /* VLCPlaybackController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCPlaybackController.h; path = Sources/VLCPlaybackController.h; sourceTree = SOURCE_ROOT; };
 		7DE56C191AD93F9100E8CA00 /* VLCPlaybackController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCPlaybackController.m; path = Sources/VLCPlaybackController.m; sourceTree = SOURCE_ROOT; };
 		7DEB3B5F17647DE30038FC70 /* iTunesArtwork@2x */ = {isa = PBXFileReference; lastKnownFileType = file; path = "iTunesArtwork@2x"; sourceTree = "<group>"; };
@@ -811,6 +809,8 @@
 		7DF383C31BF2329500D71A5C /* VLCDropboxCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCDropboxCollectionViewController.m; path = SharedSources/Clouds/VLCDropboxCollectionViewController.m; sourceTree = SOURCE_ROOT; };
 		7DF383C51BF23AC000D71A5C /* VLCCloudStorageCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCCloudStorageCollectionViewCell.h; path = SharedSources/Clouds/VLCCloudStorageCollectionViewCell.h; sourceTree = "<group>"; };
 		7DF383C61BF23AC000D71A5C /* VLCCloudStorageCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCCloudStorageCollectionViewCell.m; path = SharedSources/Clouds/VLCCloudStorageCollectionViewCell.m; sourceTree = "<group>"; };
+		7DF383C91BF2498800D71A5C /* VLCOneDriveCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCOneDriveCollectionViewController.h; path = SharedSources/Clouds/VLCOneDriveCollectionViewController.h; sourceTree = SOURCE_ROOT; };
+		7DF383CA1BF2498800D71A5C /* VLCOneDriveCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCOneDriveCollectionViewController.m; path = SharedSources/Clouds/VLCOneDriveCollectionViewController.m; sourceTree = SOURCE_ROOT; };
 		7DF7CA0617650C2A00C61739 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
 		7DF7E790175F47DC0018858D /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
 		7DF90B421BE7A5380059C0E3 /* VLCSettingsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCSettingsTableViewController.h; sourceTree = "<group>"; };
@@ -1158,8 +1158,8 @@
 				7D1052EB1A4DCC4B00295F08 /* VLCOneDriveConstants.h */,
 				7D1052E71A4DCC1100295F08 /* VLCOneDriveTableViewController.h */,
 				7D1052E81A4DCC1100295F08 /* VLCOneDriveTableViewController.m */,
-				7DE0648B1BE3F36700C706BE /* VLCOneDriveTableViewController2.h */,
-				7DE0648C1BE3F36700C706BE /* VLCOneDriveTableViewController2.m */,
+				7DF383C91BF2498800D71A5C /* VLCOneDriveCollectionViewController.h */,
+				7DF383CA1BF2498800D71A5C /* VLCOneDriveCollectionViewController.m */,
 				7D1052EC1A4DCD1E00295F08 /* VLCOneDriveController.h */,
 				7D1052ED1A4DCD1E00295F08 /* VLCOneDriveController.m */,
 				7DB847D51A5871570002DC30 /* VLCOneDriveObject.h */,
@@ -2629,7 +2629,6 @@
 			files = (
 				DD3EFF441BDEBCE500B68579 /* VLCSharedLibraryParser.m in Sources */,
 				DD3EFF5E1BDEBCE500B68579 /* VLCLocalServerDiscoveryController.m in Sources */,
-				7DE0648D1BE3F36700C706BE /* VLCOneDriveTableViewController2.m in Sources */,
 				7D0C35371BD97E870058CD19 /* VLCOneDriveTableViewController.m in Sources */,
 				DD8095E01BE3EFC20065D8E1 /* VLCPlaybackInfoTVViewController.m in Sources */,
 				7DEC8C1F1BD6A113006E1093 /* UIDevice+VLC.m in Sources */,
@@ -2675,6 +2674,7 @@
 				7DF90B4A1BE7A8110059C0E3 /* IASKSettingsReader.m in Sources */,
 				DD3EFF3E1BDEBCE500B68579 /* VLCLocalNetworkServiceBrowserHTTP.m in Sources */,
 				7DC71D261BC830A5001FACAA /* VLCLocalNetworkTVViewController.m in Sources */,
+				7DF383CB1BF2498800D71A5C /* VLCOneDriveCollectionViewController.m in Sources */,
 				7D5278E21BD7E06E00D0CA0E /* VLCDropboxController.m in Sources */,
 				7DEC8BD91BD670EB006E1093 /* VLCPlaybackNavigationController.m in Sources */,
 				7DEC8BDA1BD67112006E1093 /* VLCFrostedGlasView.m in Sources */,