Commit 74a6261f authored by Carola Nitz's avatar Carola Nitz

UIBarButtonItem+Theme: Remove MenuRevealButton

parent 80a283ec
......@@ -78,7 +78,6 @@
"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";
"OPEN_VLC_MENU" = "Open VLC sidebar menu";
"HTTP_UPLOAD_SERVER_OFF" = "Inactive Server";
"HTTP_UPLOAD_NO_CONNECTIVITY" = "No active WiFi connection";
"OPEN_STREAM_OR_DOWNLOAD" = "Would you like to download or play this URL?";
......
......@@ -84,13 +84,22 @@ class VLCTabbarController:UITabBarController
//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"))
image: coneIcon(),
selectedImage: coneIcon())
let controllers = [audioVC, serverVC, videoVC, settingsVC, cloudVC, downloadVC, streamVC, aboutVC]
self.viewControllers = controllers.map { UINavigationController(rootViewController: $0)}
}
func coneIcon() -> UIImage? {
let calendar = NSCalendar(calendarIdentifier: .gregorian)
if let dayOfYear = calendar?.ordinality(of: .day, in: .year, for: Date()) {
return dayOfYear >= 354 ? UIImage(named: "vlc-xmas") : UIImage(named: "menuCone")
}
return nil
}
}
......@@ -45,7 +45,6 @@ public class VLCVideoViewController: UICollectionViewController, UICollectionVie
override public func viewDidLoad() {
setupCollectionView()
setupNavigationbar()
setupSearchController()
_ = (MLMediaLibrary.sharedMediaLibrary() as AnyObject).perform(#selector(MLMediaLibrary.libraryDidAppear))
......@@ -69,14 +68,6 @@ public class VLCVideoViewController: UICollectionViewController, UICollectionVie
}
}
func setupNavigationbar() {
if #available(iOS 11.0, *) {
navigationController?.navigationBar.prefersLargeTitles = true
let attributes = [NSAttributedStringKey.foregroundColor : UIColor.white]
navigationController?.navigationBar.largeTitleTextAttributes = attributes
}
}
func setupSearchController() {
searchController = UISearchController(searchResultsController: nil)
searchController?.searchResultsUpdater = self
......
......@@ -71,8 +71,7 @@ NSString *VLCNetworkListCellIdentifier = @"VLCNetworkListCellIdentifier";
_tableView.tableHeaderView = _searchController.searchBar;
self.definesPresentationContext = YES;
self.navigationItem.rightBarButtonItems = @[[UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(menuButtonAction:)],
[UIBarButtonItem themedPlayAllButtonWithTarget:self andSelector:@selector(playAllAction:)]];
self.navigationItem.rightBarButtonItems = @[[UIBarButtonItem themedPlayAllButtonWithTarget:self andSelector:@selector(playAllAction:)]];
_searchData = [[NSMutableArray alloc] init];
[_searchData removeAllObjects];
......@@ -93,6 +92,8 @@ NSString *VLCNetworkListCellIdentifier = @"VLCNetworkListCellIdentifier";
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
if (self.isEditing)
[self setEditing:NO animated:YES];
}
- (BOOL)shouldAutorotate
......@@ -103,14 +104,6 @@ NSString *VLCNetworkListCellIdentifier = @"VLCNetworkListCellIdentifier";
return YES;
}
- (IBAction)menuButtonAction:(id)sender
{
[[VLCSidebarController sharedInstance] toggleSidebar];
if (self.isEditing)
[self setEditing:NO animated:YES];
}
- (IBAction)playAllAction:(id)sender
{
// to be implemented by subclass
......
......@@ -41,8 +41,6 @@
{
VLCLocalServerDiscoveryController *_discoveryController;
UIBarButtonItem *_backToMenuButton;
UIRefreshControl *_refreshControl;
UIActivityIndicatorView *_activityIndicator;
}
......@@ -92,9 +90,6 @@
_discoveryController = [[VLCLocalServerDiscoveryController alloc] initWithServiceBrowserClasses:browserClasses];
_discoveryController.delegate = self;
_backToMenuButton = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
self.navigationItem.leftBarButtonItem = _backToMenuButton;
self.tableView.rowHeight = [VLCNetworkListCell heightOfCell];
self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
self.view.backgroundColor = [UIColor VLCDarkBackgroundColor];
......@@ -120,12 +115,6 @@
[_discoveryController startDiscovery];
}
- (IBAction)goBack:(id)sender
{
[_discoveryController stopDiscovery];
[[VLCSidebarController sharedInstance] toggleSidebar];
}
- (BOOL)shouldAutorotate
{
UIInterfaceOrientation toInterfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
......
......@@ -11,7 +11,6 @@
*****************************************************************************/
@interface UIBarButtonItem (ThemedButtons)
+ (UIBarButtonItem *)themedBackButtonWithTarget:(id)target andSelector:(SEL)selector;
+ (UIBarButtonItem *)themedRevealMenuButtonWithTarget:(id)target andSelector:(SEL)selector;
+ (UIBarButtonItem *)themedDarkToolbarButtonWithTitle: (NSString*) title target:(id)target andSelector:(SEL)selector;
+ (UIBarButtonItem *)themedPlayAllButtonWithTarget:(id)target andSelector:(SEL)selector;
@end
......@@ -26,28 +26,6 @@
return backButton;
}
+ (UIBarButtonItem *)themedRevealMenuButtonWithTarget:(id)target andSelector:(SEL)selector
{
/* After day 354 of the year, the usual VLC cone is replaced by another cone
* wearing a Father Xmas hat.
* Note: this icon doesn't represent an endorsement of The Coca-Cola Company
* and should not be confused with the idea of religious statements or propagation there off
*/
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
NSUInteger dayOfYear = [gregorian ordinalityOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitYear forDate:[NSDate date]];
UIImage *icon;
if (dayOfYear >= 354)
icon = [UIImage imageNamed:@"vlc-xmas"];
else
icon = [UIImage imageNamed:@"menuCone"];
UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithImage:icon style:UIBarButtonItemStylePlain target:target action:selector];
menuButton.tintColor = [UIColor whiteColor];
menuButton.accessibilityLabel = NSLocalizedString(@"OPEN_VLC_MENU", nil);
return menuButton;
}
+ (UIBarButtonItem *)themedDarkToolbarButtonWithTitle:(NSString*)title target:(id)target andSelector:(SEL)selector
{
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStylePlain target:target action:selector];
......
......@@ -49,7 +49,6 @@
contributeButton.tintColor = [UIColor whiteColor];
self.navigationItem.rightBarButtonItem = contributeButton;
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
NSBundle *mainBundle = [NSBundle mainBundle];
NSMutableString *htmlContent = [NSMutableString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"About Contents" ofType:@"html"] encoding:NSUTF8StringEncoding error:nil];
......@@ -67,11 +66,6 @@
return YES;
}
- (IBAction)goBack:(id)sender
{
[[VLCSidebarController sharedInstance] toggleSidebar];
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *requestURL = request.URL;
......
......@@ -207,6 +207,8 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
[[UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[VLCPlaybackNavigationController class]]] setBarTintColor: nil];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTitleTextAttributes: @{ NSForegroundColorAttributeName : [UIColor whiteColor] }];
[[UINavigationBar appearance] setPrefersLargeTitles:@YES];
[[UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[VLCPlaybackNavigationController class]]] setPrefersLargeTitles: @NO];
// For the edit selection indicators
[[UITabBar appearance] setTintColor:vlcOrange];
[[UITableView appearance] setTintColor:vlcOrange];
......
......@@ -39,7 +39,6 @@
[super viewDidLoad];
[self.tableView registerNib:[UINib nibWithNibName:@"VLCCloudServiceCell" bundle:nil] forCellReuseIdentifier:@"CloudServiceCell"];
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack)];
self.tableView.separatorColor = [UIColor VLCDarkBackgroundColor];
self.tableView.backgroundColor = [UIColor VLCDarkBackgroundColor];
......@@ -58,12 +57,6 @@
[super viewWillAppear:animated];
}
- (void)goBack
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[VLCSidebarController sharedInstance] toggleSidebar];
}
- (void)authenticationSessionsChanged:(NSNotification *)notification
{
[self.tableView reloadData];
......
......@@ -75,7 +75,6 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
self.urlField.attributedPlaceholder = coloredAttributedPlaceholder;
[self.downloadButton setTitle:NSLocalizedString(@"BUTTON_DOWNLOAD", nil) forState:UIControlStateNormal];
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
self.whatToDownloadHelpLabel.text = [NSString stringWithFormat:NSLocalizedString(@"DOWNLOAD_FROM_HTTP_HELP", nil), [[UIDevice currentDevice] model]];
self.urlField.delegate = self;
self.urlField.keyboardType = UIKeyboardTypeURL;
......@@ -99,6 +98,11 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[self.view endEditing:YES];
}
#pragma mark - UI interaction
- (BOOL)shouldAutorotate
......@@ -109,12 +113,6 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
return YES;
}
- (IBAction)goBack:(id)sender
{
[self.view endEditing:YES];
[[VLCSidebarController sharedInstance] toggleSidebar];
}
- (IBAction)downloadAction:(id)sender
{
if ([self.urlField.text length] > 0) {
......
......@@ -185,7 +185,6 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
{
[super viewDidLoad];
self.title = NSLocalizedString(@"LIBRARY_ALL_FILES", nil);
_menuButton = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(leftButtonAction:)];
self.navigationItem.leftBarButtonItem = _menuButton;
self.editButtonItem.title = NSLocalizedString(@"BUTTON_EDIT", nil);
......@@ -1068,8 +1067,6 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
- (IBAction)leftButtonAction:(id)sender
{
[[VLCSidebarController sharedInstance] toggleSidebar];
if (self.isEditing)
[self setEditing:NO animated:YES];
}
......
......@@ -102,8 +102,7 @@
[scanSubModelabel setText:NSLocalizedString(@"SCAN_SUBTITLE_TOGGLE", nil)];
[scanSubModelabel setAdjustsFontSizeToFitWidth:YES];
[scanSubModelabel setNumberOfLines:0];
self.title = NSLocalizedString(@"OPEN_NETWORK", nil);
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(goBack:)];
[self.whatToOpenHelpLabel setText:NSLocalizedString(@"OPEN_NETWORK_HELP", nil)];
self.urlField.delegate = self;
self.urlField.keyboardType = UIKeyboardTypeURL;
......@@ -150,6 +149,7 @@
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setBool:self.privateToggleSwitch.on forKey:kVLCPrivateWebStreaming];
[defaults setBool:self.ScanSubToggleSwitch.on forKey:kVLChttpScanSubtitle];
[self.view endEditing:YES];
/* force update before we leave */
[[NSUbiquitousKeyValueStore defaultStore] synchronize];
......@@ -170,12 +170,6 @@
return YES;
}
- (IBAction)goBack:(id)sender
{
[self.view endEditing:YES];
[[VLCSidebarController sharedInstance] toggleSidebar];
}
- (IBAction)openButtonAction:(id)sender
{
if ([self.urlField.text length] > 0) {
......
......@@ -36,7 +36,6 @@
- (void)viewDidLoad
{
self.navigationItem.leftBarButtonItem = [UIBarButtonItem themedRevealMenuButtonWithTarget:self andSelector:@selector(dismiss:)];
self.modalPresentationStyle = UIModalPresentationFormSheet;
self.delegate = self;
self.showDoneButton = NO;
......
/*****************************************************************************
* VLC for iOS
*****************************************************************************
* Copyright (c) 2018 VideoLAN. All rights reserved.
* $Id$
*
* Authors: Carola Nitz <caro # videolan.org>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
import Foundation
import UIKit
extension UINavigationController {
open override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 11.0, *) {
navigationBar.prefersLargeTitles = true
navigationBar.largeTitleTextAttributes = [NSAttributedStringKey.foregroundColor : UIColor.white]
}
}
}
......@@ -51,6 +51,8 @@
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 */; };
41A9D81420098B9B00FCF6A5 /* UINavigationController+VLC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41A9D81320098B9B00FCF6A5 /* UINavigationController+VLC.swift */; };
41A9D81520098B9B00FCF6A5 /* UINavigationController+VLC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41A9D81320098B9B00FCF6A5 /* UINavigationController+VLC.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 */; };
......@@ -812,6 +814,7 @@
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>"; };
41A9D81320098B9B00FCF6A5 /* UINavigationController+VLC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+VLC.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>"; };
......@@ -2530,6 +2533,7 @@
7DEBF37D1C076ECE007A4043 /* NSString+Locale.h */,
7DEBF37E1C076EE8007A4043 /* NSString+Locale.m */,
416DEFF51FEEA76A00F4FC59 /* LayoutAnchorContainer.swift */,
41A9D81320098B9B00FCF6A5 /* UINavigationController+VLC.swift */,
);
name = Extensions;
sourceTree = "<group>";
......@@ -3862,6 +3866,7 @@
4171D35018A2C19000A16EF9 /* VLCFolderCollectionViewFlowLayout.m in Sources */,
DD870E951CEF78D800BBD4FE /* VLCNetworkLoginDataSourceLogin.m in Sources */,
7D398DC11CC3E709002C999A /* VLCLocalNetworkServiceBrowserBonjour.m in Sources */,
41A9D81420098B9B00FCF6A5 /* UINavigationController+VLC.swift in Sources */,
7D30F3CA183AB27A00FFC021 /* VLCDownloadViewController.m in Sources */,
DDEAECC61BDEC79D00756C83 /* VLCLocalNetworkServiceBrowserSAP.m in Sources */,
DD3EFF491BDEBCE500B68579 /* VLCLocalNetworkServiceBrowserPlex.m in Sources */,
......@@ -3914,6 +3919,7 @@
7DC54FBA1C046615007B4E42 /* UIViewController+VLCAlert.m in Sources */,
7DC54FBB1C046615007B4E42 /* VLCFirstStepsThirdPageViewController.m in Sources */,
26D2F0701D3D3CD8003F7417 /* VLCNetworkLoginViewFieldCell.m in Sources */,
41A9D81520098B9B00FCF6A5 /* UINavigationController+VLC.swift in Sources */,
7DC54FBD1C046615007B4E42 /* VLCMiniPlaybackView.m in Sources */,
7DC54FBE1C046615007B4E42 /* VLCLocalNetworkServiceBrowserManualConnect.m in Sources */,
7DC54FBF1C046615007B4E42 /* VLCFirstStepsFifthPageViewController.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