Commit 80a283ec authored by Carola Nitz's avatar Carola Nitz

VLCTabbarController:Changed the navigation to be tabbar based

parent 5fbf7911
......@@ -37,4 +37,5 @@ NSLocalizedString(@"Passcodes did not match. Try again.", nil);
NSLocalizedString(@"1 Failed Passcode Attempt", nil);
NSLocalizedString(@"%d Failed Passcode Attempts", nil);
NSLocalizedString(@"Next", nil);
NSLocalizedString(@"DOWNLOAD_FROM_HTTP", nil);
}
......@@ -77,7 +77,7 @@
"OPEN_NETWORK" = "Open Network Stream";
"NETWORK_TITLE" = "Network Stream";
"OPEN_NETWORK_HELP" = "Enter any HTTP, RTSP, RTMP, MMS, FTP or UDP/RTP address to open the stream directly.";
"ABOUT_APP" = "About VLC for iOS";
"ABOUT_APP" = "About";
"OPEN_VLC_MENU" = "Open VLC sidebar menu";
"HTTP_UPLOAD_SERVER_OFF" = "Inactive Server";
"HTTP_UPLOAD_NO_CONNECTIVITY" = "No active WiFi connection";
......
......@@ -13,16 +13,15 @@ import Foundation
var childCoordinators: [Coordinator] = []
var rootViewController: UIViewController {
return self.navigationController
return self.tabbarController
}
/// Window to manage
let window: UIWindow
private lazy var navigationController: UINavigationController = {
let navigationController = UINavigationController()
navigationController.isNavigationBarHidden = true
return navigationController
private lazy var tabbarController:VLCTabbarController = {
let tabBarController = VLCTabbarController()
return tabBarController
}()
@objc public init(window: UIWindow) {
......@@ -32,14 +31,6 @@ import Foundation
self.window.rootViewController = self.rootViewController
self.window.makeKeyAndVisible()
}
@objc public func start() {
showPlayerDisplayController()
}
private func showPlayerDisplayController() {
if let playerDisplayController = VLCPlayerDisplayController.sharedInstance() {
navigationController.setViewControllers([playerDisplayController], animated: true)
}
}
}
/*****************************************************************************
* VLCTabbarController.swift
* VLC for iOS
*****************************************************************************
* Copyright (c) 2018 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Carola Nitz <nitz.carola # gmail.com>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
class VLCTabbarController:UITabBarController
{
override func viewDidLoad() {
super.viewDidLoad()
setupViewControllers()
}
func setupViewControllers() {
//The title needs to be set on the VC here because otherwise it won't appear in the tabbar on first start
// video
let videoVC = VLCVideoViewController(collectionViewLayout: UICollectionViewFlowLayout())
//this should probably not be the delegate
videoVC.delegate = VLCPlayerDisplayController.sharedInstance()
videoVC.title = NSLocalizedString("Video",comment: "")
videoVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("Video",comment: ""),
image: UIImage(named: "TVShowsIcon"),
selectedImage: UIImage(named: "TVShowsIcon"))
// Audio
let audioVC = VLCVideoViewController(collectionViewLayout: UICollectionViewFlowLayout())
//this should probably not be the delegate
audioVC.delegate = VLCPlayerDisplayController.sharedInstance()
audioVC.title = NSLocalizedString("Audio",comment: "")
audioVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("Audio",comment: ""),
image: UIImage(named: "MusicAlbums"),
selectedImage:UIImage(named: "MusicAlbums"))
//Serverlist
let serverVC = VLCServerListViewController()
serverVC.title = NSLocalizedString("LOCAL_NETWORK", comment: "");
serverVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("LOCAL_NETWORK",comment: ""),
image: UIImage(named: "Local"),
selectedImage: UIImage(named: "Local"))
//CloudServices
let cloudVC = VLCCloudServicesTableViewController(nibName: "VLCCloudServicesTableViewController", bundle: Bundle.main)
cloudVC.title = NSLocalizedString("CLOUD_SERVICES",comment: "")
cloudVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("CLOUD_SERVICES",comment: ""),
image: UIImage(named: "iCloudIcon"),
selectedImage: UIImage(named: "iCloudIcon"))
//Settings
let settingsVC = VLCSettingsController()
settingsVC.title = NSLocalizedString("Settings",comment: "")
settingsVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("Settings",comment: ""),
image: UIImage(named: "Settings"),
selectedImage: UIImage(named: "Settings"))
//Download
let downloadVC = VLCDownloadViewController()
downloadVC.title = NSLocalizedString("DOWNLOAD_FROM_HTTP", comment:"")
downloadVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("DOWNLOAD_FROM_HTTP",comment: ""),
image: UIImage(named: "Downloads"),
selectedImage: UIImage(named: "Downloads"))
//Streaming
let streamVC = VLCOpenNetworkStreamViewController(nibName: "VLCOpenNetworkStreamViewController", bundle: Bundle.main)
streamVC.title = NSLocalizedString("OPEN_NETWORK", comment: "")
streamVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("OPEN_NETWORK", comment: ""),
image: UIImage(named: "OpenNetStream"),
selectedImage: UIImage(named: "OpenNetStream"))
//About
let aboutVC = VLCAboutViewController()
aboutVC.title = NSLocalizedString("ABOUT_APP",comment: "")
aboutVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("ABOUT_APP",comment: ""),
image: UIImage(named: "menuCone"),
selectedImage: UIImage(named: "menuCone"))
let controllers = [audioVC, serverVC, videoVC, settingsVC, cloudVC, downloadVC, streamVC, aboutVC]
self.viewControllers = controllers.map { UINavigationController(rootViewController: $0)}
}
}
......@@ -10,7 +10,6 @@ import Foundation
@objc public protocol VLCVideoControllerDelegate: class {
func videoViewControllerDidSelectMediaObject(VLCVideoViewController: VLCVideoViewController, mediaObject:NSManagedObject)
func videoViewControllerDidSelectBackbutton(VLCVideoViewController: VLCVideoViewController)
}
public class VLCVideoViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout, UISearchResultsUpdating, UISearchControllerDelegate
......@@ -19,7 +18,7 @@ public class VLCVideoViewController: UICollectionViewController, UICollectionVie
private let cellPadding:CGFloat = 5.0
private var searchController: UISearchController?
private let searchDataSource = VLCLibrarySearchDisplayDataSource()
@objc public weak var delegate: VLCVideoControllerDelegate?
public weak var delegate: VLCVideoControllerDelegate?
@available(iOS 11.0, *)
lazy var dragAndDropManager:VLCDragAndDropManager = {
......@@ -71,13 +70,11 @@ public class VLCVideoViewController: UICollectionViewController, UICollectionVie
}
func setupNavigationbar() {
title = "Videos"
if #available(iOS 11.0, *) {
navigationController?.navigationBar.prefersLargeTitles = true
let attributes = [NSAttributedStringKey.foregroundColor : UIColor.white]
navigationController?.navigationBar.largeTitleTextAttributes = attributes
}
self.navigationItem.leftBarButtonItem = UIBarButtonItem.themedRevealMenuButton(withTarget: self, andSelector: #selector(backbutton))
}
func setupSearchController() {
......@@ -100,10 +97,6 @@ public class VLCVideoViewController: UICollectionViewController, UICollectionVie
}
}
@objc func backbutton() {
delegate?.videoViewControllerDidSelectBackbutton(VLCVideoViewController: self)
}
//MARK: - CollectionViewDelegate & DataSource
override public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return Int(mediaDataSource.numberOfFiles())
......
......@@ -99,8 +99,6 @@
self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
self.view.backgroundColor = [UIColor VLCDarkBackgroundColor];
self.title = NSLocalizedString(@"LOCAL_NETWORK", nil);
_refreshControl = [[UIRefreshControl alloc] init];
_refreshControl.backgroundColor = [UIColor VLCDarkBackgroundColor];
_refreshControl.tintColor = [UIColor whiteColor];
......
......@@ -208,6 +208,7 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTitleTextAttributes: @{ NSForegroundColorAttributeName : [UIColor whiteColor] }];
// For the edit selection indicators
[[UITabBar appearance] setTintColor:vlcOrange];
[[UITableView appearance] setTintColor:vlcOrange];
[[UISegmentedControl appearance] setTintColor:vlcOrange];
[[UISwitch appearance] setOnTintColor:vlcOrange];
......
......@@ -38,8 +38,6 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.title = NSLocalizedString(@"CLOUD_SERVICES", "");
[self.tableView registerNib:[UINib nibWithNibName:@"VLCCloudServiceCell" bundle:nil] forCellReuseIdentifier:@"CloudServiceCell"];
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack)];
self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
......
......@@ -76,7 +76,6 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
[self.downloadButton setTitle:NSLocalizedString(@"BUTTON_DOWNLOAD", nil) forState:UIControlStateNormal];
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
self.title = NSLocalizedString(@"DOWNLOAD_FROM_HTTP", nil);
self.whatToDownloadHelpLabel.text = [NSString stringWithFormat:NSLocalizedString(@"DOWNLOAD_FROM_HTTP_HELP", nil), [[UIDevice currentDevice] model]];
self.urlField.delegate = self;
self.urlField.keyboardType = UIKeyboardTypeURL;
......
......@@ -236,7 +236,6 @@ static NSString *WiFiCellIdentifier = @"VLCMenuWiFiCell";
{
if (!_videoViewController) {
_videoViewController = [[VLCVideoViewController alloc] initWithCollectionViewLayout:[UICollectionViewFlowLayout new]];
_videoViewController.delegate = self;
}
return _videoViewController;
}
......
......@@ -11,6 +11,7 @@
*****************************************************************************/
@class VLCPlaybackController;
@protocol VLCVideoControllerDelegate;
typedef NS_ENUM(NSUInteger, VLCPlayerDisplayControllerDisplayMode) {
VLCPlayerDisplayControllerDisplayModeFullscreen,
......@@ -28,7 +29,7 @@ typedef NS_ENUM(NSUInteger, VLCPlayerDisplayControllerDisplayMode) {
@end
@interface VLCPlayerDisplayController : UIViewController
@interface VLCPlayerDisplayController : UIViewController <VLCVideoControllerDelegate>
+ (VLCPlayerDisplayController *)sharedInstance;
......
......@@ -14,6 +14,7 @@
#import "VLCPlaybackController.h"
#import "VLCMiniPlaybackView.h"
#import "VLCPlaybackNavigationController.h"
#import "VLCPlaybackController+MediaLibrary.h"
#import "VLC_iOS-Swift.h"
#if TARGET_OS_IOS
......@@ -66,16 +67,6 @@ static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDis
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)viewDidLoad
{
[super viewDidLoad];
VLCSidebarController *sidebarVC = [VLCSidebarController sharedInstance];
_childViewController = sidebarVC.fullViewController;
[self setupChildViewController];
}
#pragma mark - ChildViewController
- (void)setChildViewController:(UIViewController *)childViewController
......@@ -368,4 +359,11 @@ static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDis
#endif
}
- (void)videoViewControllerDidSelectMediaObjectWithVLCVideoViewController:(VLCVideoViewController *)VLCVideoViewController mediaObject:(NSManagedObject *)mediaObject
{
VLCPlaybackController *vpc = [VLCPlaybackController sharedInstance];
[vpc playMediaLibraryObject:mediaObject];
// [self createSpotlightItem:mediaObject];
}
@end
......@@ -9,7 +9,11 @@
#import <PAPasscode/PAPasscodeViewController.h>
#import <XKKeychain/XKKeychain.h>
#import "VLCConstants.h"
#import "UIBarButtonItem+Theme.h"
#import "VLCSidebarController.h"
#import "VLCPlayerDisplayController.h"
#import "VLCLibrarySearchDisplayDataSource.h"
#import "VLCServerListViewController.h"
#import "VLCSettingsController.h"
#import "VLCCloudServicesTableViewController.h"
#import "VLCDownloadViewController.h"
#import "VLCOpenNetworkStreamViewController.h"
#import "VLCAboutViewController.h"
......@@ -49,6 +49,8 @@
419A2C691F37A4B70069D224 /* VLCStringsForLocalization.m in Sources */ = {isa = PBXBuildFile; fileRef = 419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */; };
419D7F051F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */; };
419D7F071F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */; };
41A7FE5F2008C9BE009E0820 /* VLCTabbarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41A7FE5E2008C9BE009E0820 /* VLCTabbarController.swift */; };
41A7FE602008C9BE009E0820 /* VLCTabbarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41A7FE5E2008C9BE009E0820 /* VLCTabbarController.swift */; };
41B0BC931F73EF1B0063BA26 /* VLC_for_IOSTestMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B0BC911F73EF1B0063BA26 /* VLC_for_IOSTestMenu.m */; };
41B93C011A53833B00102E8B /* VLCProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B93C001A53833B00102E8B /* VLCProgressView.m */; };
41B93C051A53835300102E8B /* VLCCloudServiceCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B93C031A53835300102E8B /* VLCCloudServiceCell.m */; };
......@@ -809,6 +811,7 @@
4187112A1F78F87200317B1A /* VLC_for_iOSTestVideoCodecs.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLC_for_iOSTestVideoCodecs.m; sourceTree = "<group>"; };
419A2C651F37A4B70069D224 /* VLCStringsForLocalization.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCStringsForLocalization.m; sourceTree = "<group>"; };
419D7F041F54176900AF69A2 /* VLCTimeNavigationTitleView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = VLCTimeNavigationTitleView.xib; path = Resources/VLCTimeNavigationTitleView.xib; sourceTree = SOURCE_ROOT; };
41A7FE5E2008C9BE009E0820 /* VLCTabbarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VLCTabbarController.swift; sourceTree = "<group>"; };
41B0BC861F73ED7D0063BA26 /* VLC for iOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "VLC for iOSUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
41B0BC8A1F73ED7D0063BA26 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
41B0BC911F73EF1B0063BA26 /* VLC_for_IOSTestMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLC_for_IOSTestMenu.m; sourceTree = "<group>"; };
......@@ -2757,6 +2760,7 @@
417E68B81F321EFF00DB9BB2 /* VLCActivityViewControllerVendor.m */,
41EB91DB1F7BFF8400821AA5 /* VLCMetadata.h */,
41EB91DC1F7BFF8400821AA5 /* VLCMetadata.m */,
41A7FE5E2008C9BE009E0820 /* VLCTabbarController.swift */,
);
path = SharedSources;
sourceTree = "<group>";
......@@ -3808,6 +3812,7 @@
410045511FD49FC900FD7EAD /* PresentationOptionsView.swift in Sources */,
41EB91DD1F7BFF8500821AA5 /* VLCMetadata.m in Sources */,
DD3EFF551BDEBCE500B68579 /* VLCLocalNetworkServiceBrowserDSM.m in Sources */,
41A7FE5F2008C9BE009E0820 /* VLCTabbarController.swift in Sources */,
7D37849A183A98D1009EE944 /* VLCPlaylistTableViewCell.m in Sources */,
7D37849B183A98D1009EE944 /* VLCLibraryViewController.m in Sources */,
7D37849E183A98DD009EE944 /* VLCThumbnailsCache.m in Sources */,
......@@ -4015,6 +4020,7 @@
7DC5501C1C046615007B4E42 /* VLCPlayerDisplayController.m in Sources */,
7DC5501D1C046615007B4E42 /* VLCSharedLibraryParser.m in Sources */,
7DC5501E1C046615007B4E42 /* VLCCloudStorageTableViewController.m in Sources */,
41A7FE602008C9BE009E0820 /* VLCTabbarController.swift in Sources */,
41EB91DF1F7BFF8500821AA5 /* VLCMetadata.m in Sources */,
7DC5501F1C046615007B4E42 /* VLCGoogleDriveTableViewController.m in Sources */,
);
......
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