Commit fab7ad39 authored by Soomin Lee's avatar Soomin Lee

VLCTabBarCoodinator: Move view logic into views

parent 8dac4cba
......@@ -59,6 +59,16 @@
@implementation VLCServerListViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
[self setupUI];
}
return self;
}
- (void)loadView
{
[super loadView];
......@@ -134,6 +144,15 @@
_scrollView.backgroundColor = PresentationTheme.current.colors.background;
}
- (void)setupUI
{
self.title = NSLocalizedString(@"LOCAL_NETWORK", nil);
self.tabBarItem = [[UITabBarItem alloc] initWithTitle: NSLocalizedString(@"LOCAL_NETWORK", nil)
image: [UIImage imageNamed:@"Local"]
selectedImage: [UIImage imageNamed:@"Local"]];
self.tabBarItem.accessibilityIdentifier = VLCAccessibilityIdentifier.localNetwork;
}
- (void)viewDidLoad
{
[super viewDidLoad];
......
......@@ -13,6 +13,21 @@
import UIKit
class VLCVideoViewController: VLCMediaViewController {
override init(services: Services) {
super.init(services: services)
setupUI()
}
private func setupUI() {
title = NSLocalizedString("VIDEO", comment: "")
tabBarItem = UITabBarItem(
title: NSLocalizedString("VIDEO", comment: ""),
image: UIImage(named: "TVShowsIcon"),
selectedImage: UIImage(named: "TVShowsIcon"))
tabBarItem.accessibilityIdentifier = VLCAccessibilityIdentifier.video
}
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let movies = VLCMediaCategoryViewController<MLFile>(services: services, subcategory: VLCMediaSubcategories.movies)
movies.delegate = super.self()
......@@ -25,6 +40,21 @@ class VLCVideoViewController: VLCMediaViewController {
}
class VLCAudioViewController: VLCMediaViewController {
override init(services: Services) {
super.init(services: services)
setupUI()
}
private func setupUI() {
title = NSLocalizedString("AUDIO", comment: "")
tabBarItem = UITabBarItem(
title: NSLocalizedString("AUDIO", comment: ""),
image: UIImage(named: "MusicAlbums"),
selectedImage: UIImage(named: "MusicAlbums"))
tabBarItem.accessibilityIdentifier = VLCAccessibilityIdentifier.audio
}
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let tracks = VLCMediaCategoryViewController<MLFile>(services: services, subcategory: VLCMediaSubcategories.tracks)
tracks.delegate = super.self()
......
......@@ -30,12 +30,22 @@ NSString * const kVLCSectionTableHeaderViewIdentifier = @"VLCSectionTableHeaderV
{
self = [super initWithStyle:style];
if (self) {
[self setupUI];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(settingDidChange:) name:kIASKAppSettingChanged object:nil];
}
return self;
}
- (void)setupUI
{
self.title = NSLocalizedString(@"Settings", nil);
self.tabBarItem = [[UITabBarItem alloc] initWithTitle: NSLocalizedString(@"Settings", nil)
image: [UIImage imageNamed:@"Settings"]
selectedImage: [UIImage imageNamed:@"Settings"]];
self.tabBarItem.accessibilityIdentifier = VLCAccessibilityIdentifier.settings;
}
- (void)viewDidLoad
{
[super viewDidLoad];
......
......@@ -46,39 +46,15 @@ class VLCTabBarCoordinator: NSObject {
private func setupViewControllers() {
// Video
let videoVC = VLCVideoViewController(services: services)
videoVC.title = NSLocalizedString("VIDEO", comment: "")
videoVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("VIDEO", comment: ""),
image: UIImage(named: "TVShowsIcon"),
selectedImage: UIImage(named: "TVShowsIcon"))
videoVC.tabBarItem.accessibilityIdentifier = VLCAccessibilityIdentifier.video
// Audio
let audioVC = VLCAudioViewController(services: services)
audioVC.title = NSLocalizedString("AUDIO", comment: "")
audioVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("AUDIO", comment: ""),
image: UIImage(named: "MusicAlbums"),
selectedImage: UIImage(named: "MusicAlbums"))
audioVC.tabBarItem.accessibilityIdentifier = VLCAccessibilityIdentifier.audio
// Serverlist
let serverVC = VLCServerListViewController(nibName: nil, bundle: nil)
serverVC.title = NSLocalizedString("LOCAL_NETWORK", comment: "")
serverVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("LOCAL_NETWORK", comment: ""),
image: UIImage(named: "Local"),
selectedImage: UIImage(named: "Local"))
serverVC.tabBarItem.accessibilityIdentifier = VLCAccessibilityIdentifier.localNetwork
// Settings
let settingsVC = VLCSettingsController()
settingsVC.title = NSLocalizedString("Settings", comment: "")
settingsVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("Settings", comment: ""),
image: UIImage(named: "Settings"),
selectedImage: UIImage(named: "Settings"))
settingsVC.tabBarItem.accessibilityIdentifier = VLCAccessibilityIdentifier.settings
let controllers = [videoVC, audioVC, serverVC, settingsVC]
tabBarController.viewControllers = controllers.map { UINavigationController(rootViewController: $0) }
......
......@@ -14,8 +14,8 @@ import Foundation
@objc class VLCAccessibilityIdentifier: NSObject {
static let video = "video"
static let audio = "audio"
static let localNetwork = "localNetwork"
static let settings = "settings"
@objc static let localNetwork = "localNetwork"
@objc static let settings = "settings"
static let cloud = "cloud"
static let stream = "stream"
static let downloads = "downloads"
......
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