Commit aeef84bd authored by Carola Nitz's avatar Carola Nitz

MediaSubcategoryViewController: adding swipable viewcontrollers for the Video...

MediaSubcategoryViewController: adding swipable viewcontrollers for the Video and Audio subcategories
parent a89d9f9b
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14092" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14081.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="zg4-fX-zUF">
<rect key="frame" x="0.0" y="0.0" width="80" height="40"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="80" height="40"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="s7f-rk-sQl">
<rect key="frame" x="22" y="12" width="37.5" height="17"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="14"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="tFG-yJ-6Th">
<rect key="frame" x="22.5" y="2.5" width="35" height="35"/>
<constraints>
<constraint firstAttribute="width" constant="35" id="VRw-5F-5WY"/>
<constraint firstAttribute="height" constant="35" id="ojk-Ug-Lgh"/>
</constraints>
</imageView>
</subviews>
</view>
<color key="backgroundColor" red="0.027450980390000001" green="0.72549019609999998" blue="0.60784313729999995" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="tFG-yJ-6Th" firstAttribute="centerY" secondItem="zg4-fX-zUF" secondAttribute="centerY" id="5so-ZP-gRs"/>
<constraint firstItem="tFG-yJ-6Th" firstAttribute="centerX" secondItem="zg4-fX-zUF" secondAttribute="centerX" id="9em-NR-hoa"/>
<constraint firstItem="s7f-rk-sQl" firstAttribute="centerY" secondItem="zg4-fX-zUF" secondAttribute="centerY" id="ZeP-6I-AXE"/>
<constraint firstItem="s7f-rk-sQl" firstAttribute="centerX" secondItem="zg4-fX-zUF" secondAttribute="centerX" id="c15-bZ-hPG"/>
</constraints>
<connections>
<outlet property="imageView" destination="tFG-yJ-6Th" id="Odb-dR-tf4"/>
<outlet property="label" destination="s7f-rk-sQl" id="4gU-tb-BMB"/>
</connections>
<point key="canvasLocation" x="307" y="541"/>
</collectionViewCell>
</objects>
</document>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14092" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14081.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="2CI-9N-dP3" userLabel="Icon Label Cell" customClass="IconLabelCell" customModule="VLC_iOS" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="74" height="70"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="74" height="70"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Tkn-VR-o25">
<rect key="frame" x="20" y="10" width="35" height="35"/>
<constraints>
<constraint firstAttribute="width" constant="35" id="EUF-rI-9Y8"/>
<constraint firstAttribute="height" constant="35" id="RoA-LT-AHV"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rwk-fy-4KB">
<rect key="frame" x="0.0" y="45" width="74" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="kWi-HY-P6M"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</view>
<constraints>
<constraint firstItem="rwk-fy-4KB" firstAttribute="top" secondItem="Tkn-VR-o25" secondAttribute="bottom" id="A8G-Sk-d4C"/>
<constraint firstItem="Tkn-VR-o25" firstAttribute="top" secondItem="2CI-9N-dP3" secondAttribute="top" constant="10" id="DaW-j3-w2g"/>
<constraint firstItem="rwk-fy-4KB" firstAttribute="leading" secondItem="2CI-9N-dP3" secondAttribute="leading" id="HFm-qh-fCk"/>
<constraint firstAttribute="bottom" secondItem="rwk-fy-4KB" secondAttribute="bottom" constant="5" id="Q0g-pb-bbf"/>
<constraint firstAttribute="trailing" secondItem="rwk-fy-4KB" secondAttribute="trailing" id="YuE-x9-9EY"/>
<constraint firstItem="Tkn-VR-o25" firstAttribute="centerX" secondItem="2CI-9N-dP3" secondAttribute="centerX" id="wav-eA-a2N"/>
</constraints>
<size key="customSize" width="74" height="50"/>
<connections>
<outlet property="iconImage" destination="Tkn-VR-o25" id="7DO-mm-BJX"/>
<outlet property="iconLabel" destination="rwk-fy-4KB" id="76s-nG-weE"/>
</connections>
<point key="canvasLocation" x="317" y="376"/>
</collectionViewCell>
</objects>
</document>
......@@ -305,3 +305,16 @@
"SORT" = "Sort";
"SORT_BY" = "Sort by";
"VIDEO" = "Video";
/* New strings */
"FOLDER_EMPTY" = "FOLDER_EMPTY";
/* New strings */
"albums" = "albums";
"artists" = "artists";
"genres" = "genres";
"movies" = "movies";
"playlists" = "playlists";
"songs" = "songs";
"videos" = "videos";
"episodes" = "episodes";
......@@ -39,7 +39,9 @@ public class MediaDataSourceAndDelegate: NSObject, UICollectionViewDataSource, U
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if let playlistCell = collectionView.dequeueReusableCell(withReuseIdentifier: VLCPlaylistCollectionViewCell.cellIdentifier(), for: indexPath) as? VLCPlaylistCollectionViewCell {
playlistCell.mediaObject = services.mediaDataSource.object(at: indexPath.row, subcategory: mediaType.subcategory)
if let mediaObject = services.mediaDataSource.object(at: indexPath.row, subcategory: mediaType.subcategory) as? NSManagedObject {
playlistCell.mediaObject = mediaObject
}
return playlistCell
}
return UICollectionViewCell()
......
This diff is collapsed.
/*****************************************************************************
* MediaSubcategoryViewController.swift
* 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 UIKit
class VLCVideoSubcategoryViewController: VLCMediaSubcategoryViewController
{
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let movies = VLCMediaViewController(services: services, type: VLCMediaType(category: .video, subcategory: .allVideos))
let episodes = VLCMediaViewController(services: services, type: VLCMediaType(category: .video, subcategory: .episodes))
let playlists = VLCMediaViewController(services: services, type: VLCMediaType(category: .video, subcategory: .videoPlaylists))
return [movies, episodes, playlists]
}
}
class VLCAudioSubcategoryViewController: VLCMediaSubcategoryViewController
{
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
let tracks = VLCMediaViewController(services: services, type: VLCMediaType(category: .audio, subcategory: .tracks))
let genres = VLCMediaViewController(services: services, type: VLCMediaType(category: .audio, subcategory: .genres))
let artists = VLCMediaViewController(services: services, type: VLCMediaType(category: .audio, subcategory: .artists))
let albums = VLCMediaViewController(services: services, type: VLCMediaType(category: .audio, subcategory: .albums))
let playlists = VLCMediaViewController(services: services, type: VLCMediaType(category: .audio, subcategory: .audioPlaylists))
return [tracks, genres, artists, albums, playlists]
}
}
class VLCMediaSubcategoryViewController: BaseButtonBarPagerTabStripViewController<IconLabelCell> {
internal var services: Services
init(services: Services) {
self.services = services
super.init(nibName: nil, bundle: nil)
buttonBarItemSpec = ButtonBarItemSpec.nibFile(nibName: "IconLabelCell", bundle: Bundle.main, width: { _ in
return 70.0
})
}
required public init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
// change selected bar color
settings.style.buttonBarBackgroundColor = .white
settings.style.selectedBarBackgroundColor = PresentationTheme.current.colors.orangeUI
settings.style.selectedBarHeight = 4.0
settings.style.buttonBarItemTitleColor = .black
settings.style.buttonBarItemsShouldFillAvailableWidth = true
changeCurrentIndexProgressive = { (oldCell: IconLabelCell?, newCell: IconLabelCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) in
guard changeCurrentIndex == true else { return }
oldCell?.iconImage.tintColor = PresentationTheme.current.colors.cellDetailTextColor
oldCell?.iconLabel.textColor = PresentationTheme.current.colors.cellDetailTextColor
newCell?.iconImage.tintColor = PresentationTheme.current.colors.orangeUI
newCell?.iconLabel.textColor = PresentationTheme.current.colors.orangeUI
}
if #available(iOS 11.0, *) {
navigationController?.navigationBar.prefersLargeTitles = false
}
super.viewDidLoad()
}
// MARK: - PagerTabStripDataSource
override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
fatalError("this should only be used as subclass")
}
override func configure(cell: IconLabelCell, for indicatorInfo: IndicatorInfo) {
cell.iconImage.image = indicatorInfo.image?.withRenderingMode(.alwaysTemplate)
cell.iconLabel.text = indicatorInfo.title?.trimmingCharacters(in: .whitespacesAndNewlines)
}
override func updateIndicator(for viewController: PagerTabStripViewController, fromIndex: Int, toIndex: Int, withProgressPercentage progressPercentage: CGFloat, indexWasChanged: Bool) {
super.updateIndicator(for: viewController, fromIndex: fromIndex, toIndex: toIndex, withProgressPercentage: progressPercentage, indexWasChanged: indexWasChanged)
if indexWasChanged && toIndex >= 0 && toIndex < viewControllers.count {
let child = viewControllers[toIndex] as! IndicatorInfoProvider
UIView.performWithoutAnimation({ [weak self] in
guard let me = self else { return }
me.navigationItem.leftBarButtonItem?.title = child.indicatorInfo(for: me).title
})
}
}
}
......@@ -18,7 +18,7 @@ import Foundation
func mediaViewControllerDidSelectSort(_ mediaViewController: VLCMediaViewController)
}
public class VLCMediaViewController: UICollectionViewController, UISearchResultsUpdating, UISearchControllerDelegate {
public class VLCMediaViewController: UICollectionViewController, UISearchResultsUpdating, UISearchControllerDelegate, IndicatorInfoProvider {
private var services: Services
private var mediaDataSourceAndDelegate: MediaDataSourceAndDelegate?
private var searchController: UISearchController?
......@@ -171,7 +171,9 @@ public class VLCMediaViewController: UICollectionViewController, UISearchResults
// MARK: - MediaDatasourceAndDelegate
override public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
delegate?.mediaViewControllerDidSelectMediaObject(self, mediaObject: services.mediaDataSource.object(at: indexPath.row, subcategory: mediaType.subcategory))
if let mediaObject = services.mediaDataSource.object(at: indexPath.row, subcategory: mediaType.subcategory) as? NSManagedObject {
delegate?.mediaViewControllerDidSelectMediaObject(self, mediaObject: mediaObject)
}
}
// MARK: - Search
......@@ -188,4 +190,8 @@ public class VLCMediaViewController: UICollectionViewController, UISearchResults
public func didDismissSearchController(_ searchController: UISearchController) {
collectionView?.dataSource = mediaDataSourceAndDelegate
}
public func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
return services.mediaDataSource.indicatorInfo(for:mediaType.subcategory)
}
}
......@@ -25,7 +25,7 @@ struct DropError: Error {
@available(iOS 11.0, *)
@objc protocol VLCDragAndDropManagerDelegate: NSObjectProtocol {
func dragAndDropManagerRequestsFile(manager: VLCDragAndDropManager, atIndexPath indexPath: IndexPath) -> AnyObject?
func dragAndDropManagerRequestsFile(manager: VLCDragAndDropManager, atIndexPath indexPath: IndexPath) -> Any?
func dragAndDropManagerInsertItem(manager: VLCDragAndDropManager, item: NSManagedObject, atIndexPath indexPath: IndexPath)
func dragAndDropManagerDeleteItem(manager: VLCDragAndDropManager, atIndexPath indexPath: IndexPath)
func dragAndDropManagerRemoveFileFromFolder(manager: VLCDragAndDropManager, file: NSManagedObject)
......@@ -343,7 +343,7 @@ class VLCDragAndDropManager: NSObject, UICollectionViewDragDelegate, UITableView
return false
}
private func fileIsCollection(file: AnyObject?) -> Bool {
private func fileIsCollection(file: Any?) -> Bool {
let isFolder = file as? MLLabel != nil
let isAlbum = file as? MLAlbum != nil
let isShow = file as? MLShow != nil
......@@ -352,8 +352,9 @@ class VLCDragAndDropManager: NSObject, UICollectionViewDragDelegate, UITableView
private func fileIsCollection(atIndexPath indexPath: IndexPath?) -> Bool {
if let indexPath = indexPath {
let file = delegate?.dragAndDropManagerRequestsFile(manager: self, atIndexPath: indexPath)
return fileIsCollection(file: file)
if let file = delegate?.dragAndDropManagerRequestsFile(manager: self, atIndexPath: indexPath) {
return fileIsCollection(file:file)
}
}
return false
}
......@@ -375,7 +376,7 @@ class VLCDragAndDropManager: NSObject, UICollectionViewDragDelegate, UITableView
///
/// - Parameter file: Can be of type MLAlbum, MLLabel or MLShow
/// - Returns: An array of UIDragItems
private func dragItemsforCollection(file: AnyObject) -> [UIDragItem] {
private func dragItemsforCollection(file: Any) -> [UIDragItem] {
var dragItems = [UIDragItem]()
var set = Set<AnyHashable>()
if let folder = file as? MLLabel {
......@@ -403,9 +404,9 @@ class VLCDragAndDropManager: NSObject, UICollectionViewDragDelegate, UITableView
return dragItems
}
// Provides an item for other applications
private func dragItem(fromFile file: AnyObject) -> [UIDragItem] {
guard let file = mlFile(from: file), let path = file.url else {
//Provides an item for other applications
private func dragItem(fromFile file: Any) -> [UIDragItem] {
guard let file = mlFile(from: file as AnyObject), let path = file.url else {
assert(false, "can't create a dragitem if there is no file or the file has no url")
return []
}
......
......@@ -14,7 +14,8 @@ import Foundation
@available(iOS 11.0, *)
extension VLCMediaDataSource: VLCDragAndDropManagerDelegate {
func dragAndDropManagerRequestsFile(manager: VLCDragAndDropManager, atIndexPath indexPath: IndexPath) -> AnyObject? {
func dragAndDropManagerRequestsFile(manager: VLCDragAndDropManager, atIndexPath indexPath: IndexPath) -> Any? {
return object(at: indexPath.row, subcategory: manager.mediaType.subcategory)
}
......
......@@ -42,14 +42,12 @@ struct VLCMediaType {
var foundAudio = [MLFile]()
var movies = [MLFile]()
var episodes = [MLFile]()
var artists = [MLFile]()
var albums = [MLFile]()
var tracks = [MLFile]() // might be just foundAudio
var genres = [MLFile]()
var audioPlaylist = [MLFile]()
var videoPlaylist = [MLFile]()
var allVideos = [MLFile]() // might be just foundVideo
var episodes = [MLShowEpisode]()
var artists = [String]()
var albums = [MLAlbum]()
var genres = [String]()
var audioPlaylist = [MLLabel]()
var videoPlaylist = [MLLabel]()
override init() {
super.init()
......@@ -57,43 +55,66 @@ struct VLCMediaType {
getAllAudio()
}
@objc func numberOfFiles(subcategory: VLCMediaSubcategory) -> Int {
@objc
func numberOfFiles(subcategory: VLCMediaSubcategory) -> Int {
return array(for: subcategory).count
}
private func array(for subcategory: VLCMediaSubcategory) -> [MLFile] {
private func array(for subcategory: VLCMediaSubcategory ) -> [Any] {
switch subcategory {
case .unknown:
preconditionFailure("No")
case .movies:
preconditionFailure("TODO")
return movies
case .episodes:
preconditionFailure("TODO")
return episodes
case .artists:
preconditionFailure("TODO")
return artists
case .albums:
preconditionFailure("TODO")
return albums
case .tracks:
return tracks
return foundAudio
case .genres:
preconditionFailure("TODO")
return genres
case .audioPlaylists:
preconditionFailure("TODO")
return audioPlaylist
case .videoPlaylists:
preconditionFailure("TODO")
return videoPlaylist
case .allVideos:
return allVideos
return foundVideos
}
}
@objc func object(at index: Int, subcategory: VLCMediaSubcategory) -> NSManagedObject {
func indicatorInfo(for subcategory: VLCMediaSubcategory) -> IndicatorInfo {
switch subcategory {
case .unknown:
preconditionFailure("No")
case .movies:
return IndicatorInfo(title: NSLocalizedString("movies", comment: ""), image: UIImage(named: "TVShowsIcon"))
case .episodes:
return IndicatorInfo(title: NSLocalizedString("episodes", comment: ""), image: UIImage(named: "episodes"))
case .artists:
return IndicatorInfo(title: NSLocalizedString("artists", comment: ""), image: UIImage(named: "artists"))
case .albums:
return IndicatorInfo(title: NSLocalizedString("albums", comment: ""), image: UIImage(named: "MusicAlbums"))
case .tracks:
return IndicatorInfo(title: NSLocalizedString("songs", comment: ""), image: UIImage(named: "songs"))
case .genres:
return IndicatorInfo(title: NSLocalizedString("genres", comment: ""), image: UIImage(named: "genres"))
case .audioPlaylists:
return IndicatorInfo(title: NSLocalizedString("playlists", comment: ""), image: UIImage(named: "playlists"))
case .videoPlaylists:
return IndicatorInfo(title: NSLocalizedString("playlists", comment: ""), image: UIImage(named: "playlists"))
case .allVideos:
return IndicatorInfo(title: NSLocalizedString("videos", comment: ""), image: UIImage(named: "videos"))
}
}
@objc func object(at index: Int, subcategory: VLCMediaSubcategory) -> Any {
guard index >= 0 else {
preconditionFailure("a negative value ? I don't think so!")
......@@ -106,8 +127,8 @@ struct VLCMediaType {
preconditionFailure("index is taller than count")
}
func allObjects(for subcategory: VLCMediaSubcategory) -> [MLFile] {
return array(for: subcategory)
func allObjects(for subcategory: VLCMediaSubcategory) -> [Any] {
return array(for:subcategory)
}
internal func removeObject(at index: Int, subcategory: VLCMediaSubcategory) {
......@@ -139,30 +160,88 @@ struct VLCMediaType {
($0 as MLFile).isKind(ofType: kMLFileTypeTVShowEpisode) ||
($0 as MLFile).isKind(ofType: kMLFileTypeClip)
}
allVideosFromVideos()
// TODO: generate video subcategories
moviesFromVideos()
episodesFromVideos()
videoPlaylistsFromVideos()
}
private func getAllAudio() {
let files = MLFile.allFiles() as! [MLFile]
foundAudio = files.filter { $0.isSupportedAudioFile() }
tracksFromAudio()
// TODO: generate remaining subcategories
artistsFromAudio()
albumsFromAudio()
audioPlaylistsFromAudio()
genresFromAudio()
}
private func artistsFromAudio() {
let albumtracks = MLAlbumTrack.allTracks() as! [MLAlbumTrack]
let tracksWithArtist = albumtracks.filter {
$0.artist != nil && $0.artist != ""
}
artists = tracksWithArtist.map{ $0.artist }
}
private func tracksFromAudio() {
if tracks != foundAudio {
tracks = foundAudio
NotificationCenter.default.post(name: .VLCTracksDidChangeNotification, object: tracks)
private func genresFromAudio(){
let albumtracks = MLAlbumTrack.allTracks() as! [MLAlbumTrack]
let tracksWithArtist = albumtracks.filter {
$0.genre != nil && $0.genre != ""
}
genres = tracksWithArtist.map{ $0.genre }
}
private func allVideosFromVideos() {
if allVideos != foundVideos {
allVideos = foundVideos
NotificationCenter.default.post(name: .VLCAllVideosDidChangeNotification, object: allVideos)
private func episodesFromVideos() {
episodes = MLShowEpisode.allEpisodes() as! [MLShowEpisode]
}
private func albumsFromAudio(){
albums = MLAlbum.allAlbums() as! [MLAlbum]
}
private func audioPlaylistsFromAudio() {
let labels = MLLabel.allLabels() as! [MLLabel]
audioPlaylist = labels.filter {
let audioFiles = $0.files.filter{
if let file = $0 as? MLFile {
return file.isSupportedAudioFile()
}
return false
}
return !audioFiles.isEmpty
}
}
private func videoPlaylistsFromVideos() {
let labels = MLLabel.allLabels() as! [MLLabel]
audioPlaylist = labels.filter {
let audioFiles = $0.files.filter{
if let file = $0 as? MLFile {
return file.isShowEpisode() || file.isMovie() || file.isClip()
}
return false
}
return !audioFiles.isEmpty
}
}
private func moviesFromVideos() {
movies = foundVideos.filter{ $0.isMovie() }
}
// private func tracksFromAudio() {
// if tracks != foundAudio {
// tracks = foundAudio
// NotificationCenter.default.post(name: .VLCTracksDidChangeNotification, object: tracks)
// }
// }
//
// private func allVideosFromVideos() {
// if allVideos != foundVideos {
// allVideos = foundVideos
// NotificationCenter.default.post(name: .VLCAllVideosDidChangeNotification, object: allVideos)
// }
// }
}
// Todo: implement the remove
......
......@@ -55,9 +55,8 @@ class VLCTabbarCooordinator: NSObject, VLCMediaViewControllerDelegate {
displayController.view.layoutMargins = UIEdgeInsets(top: 0, left: 0, bottom: tabBarController.tabBar.frame.size.height, right: 0)
displayController.didMove(toParentViewController: tabBarController)
let videoVC = VLCMediaViewController(services: services, type: VLCMediaType(category: .video, subcategory: .allVideos))
//this should probably not be the delegate
videoVC.delegate = self
let videoVC = VLCVideoSubcategoryViewController(services: services)
//videoVC.delegate = self
videoVC.title = NSLocalizedString("VIDEO", comment: "")
videoVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("VIDEO", comment: ""),
......@@ -66,9 +65,8 @@ class VLCTabbarCooordinator: NSObject, VLCMediaViewControllerDelegate {
videoVC.tabBarItem.accessibilityIdentifier = VLCAccessibilityIdentifier.video
// Audio
let audioVC = VLCMediaViewController(services: services, type: VLCMediaType(category: .audio, subcategory: .tracks))
//this should probably not be the delegate
audioVC.delegate = self
let audioVC = VLCAudioSubcategoryViewController(services: services)
//audioVC.delegate = self
audioVC.title = NSLocalizedString("AUDIO", comment: "")
audioVC.tabBarItem = UITabBarItem(
title: NSLocalizedString("AUDIO", comment: ""),
......
......@@ -22,6 +22,8 @@
4152F1621FEF19BD00F1908B /* KeychainCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4152F1611FEF19BD00F1908B /* KeychainCoordinator.swift */; };
416443862048419E00CAC646 /* DeviceMotion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 416443852048419E00CAC646 /* DeviceMotion.swift */; };
416DACB720B6DB9A001BC75D /* VLCPlayingExternallyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 416DACB620B6DB9A001BC75D /* VLCPlayingExternallyView.swift */; };
4170152C209A1D3600802E44 /* MediaSubcategoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4170152B209A1D3600802E44 /* MediaSubcategoryViewController.swift */; };
41701546209B36E800802E44 /* BaseButtonBarPagerTabStripViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41701545209B36E800802E44 /* BaseButtonBarPagerTabStripViewController.swift */; };
417CDA231A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 417CDA211A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.m */; };
417CDA241A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 417CDA221A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.xib */; };
417D7F601F7BA26200DDF36A /* VLCRemoteControlService.m in Sources */ = {isa = PBXBuildFile; fileRef = 417D7F5F1F7BA26200DDF36A /* VLCRemoteControlService.m */; };
......@@ -50,6 +52,8 @@
41EB91D71F7BE6F500821AA5 /* VLCRemoteControlService.m in Sources */ = {isa = PBXBuildFile; fileRef = 417D7F5F1F7BA26200DDF36A /* VLCRemoteControlService.m */; };
41EB91DD1F7BFF8500821AA5 /* VLCMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 41EB91DC1F7BFF8400821AA5 /* VLCMetadata.m */; };
41EB91DE1F7BFF8500821AA5 /* VLCMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 41EB91DC1F7BFF8400821AA5 /* VLCMetadata.m */; };
41EB94B4209B46E9002F4C30 /* ButtonCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 41EB94B3209B46E9002F4C30 /* ButtonCell.xib */; };
41EB94B6209B4869002F4C30 /* IconLabelCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 41EB94B5209B4869002F4C30 /* IconLabelCell.xib */; };
41F5C0781F41ED55005EB9CB /* VLCLibrarySearchDisplayDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 41F5C0771F41ED55005EB9CB /* VLCLibrarySearchDisplayDataSource.m */; };
41F9BC7C1F4F20E400268461 /* VLCTrackSelectorView.m in Sources */ = {isa = PBXBuildFile; fileRef = 41F9BC7B1F4F20E400268461 /* VLCTrackSelectorView.m */; };
41FCD2F820B565B600660AAB /* VLCAlertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41FCD2F720B565B500660AAB /* VLCAlertViewController.swift */; };
......@@ -498,6 +502,8 @@
416443852048419E00CAC646 /* DeviceMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DeviceMotion.swift; path = Sources/DeviceMotion.swift; sourceTree = "<group>"; };
416DACB620B6DB9A001BC75D /* VLCPlayingExternallyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VLCPlayingExternallyView.swift; sourceTree = "<group>"; };
416DEFF51FEEA76A00F4FC59 /* LayoutAnchorContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LayoutAnchorContainer.swift; path = Sources/LayoutAnchorContainer.swift; sourceTree = "<group>"; };
4170152B209A1D3600802E44 /* MediaSubcategoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MediaSubcategoryViewController.swift; path = Sources/MediaSubcategoryViewController.swift; sourceTree = "<group>"; };
41701545209B36E800802E44 /* BaseButtonBarPagerTabStripViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = BaseButtonBarPagerTabStripViewController.swift; path = Sources/BaseButtonBarPagerTabStripViewController.swift; sourceTree = "<group>"; };
417CDA201A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCCloudServicesTableViewController.h; path = Sources/VLCCloudServicesTableViewController.h; sourceTree = SOURCE_ROOT; };
417CDA211A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCCloudServicesTableViewController.m; path = Sources/VLCCloudServicesTableViewController.m; sourceTree = SOURCE_ROOT; };
417CDA221A48D1F300D9ACE7 /* VLCCloudServicesTableViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = VLCCloudServicesTableViewController.xib; path = Resources/VLCCloudServicesTableViewController.xib; sourceTree = SOURCE_ROOT; };
......@@ -577,6 +583,8 @@
41E6BECC207E64E900E158BA /* RemoteNetworkCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteNetworkCell.swift; sourceTree = "<group>"; };
41EB91DB1F7BFF8400821AA5 /* VLCMetadata.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCMetadata.h; sourceTree = "<group>"; };
41EB91DC1F7BFF8400821AA5 /* VLCMetadata.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCMetadata.m; sourceTree = "<group>"; };
41EB94B3209B46E9002F4C30 /* ButtonCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ButtonCell.xib; sourceTree = "<group>"; };
41EB94B5209B4869002F4C30 /* IconLabelCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IconLabelCell.xib; sourceTree = "<group>"; };
41F5C0761F41ED55005EB9CB /* VLCLibrarySearchDisplayDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = VLCLibrarySearchDisplayDataSource.h; path = Sources/VLCLibrarySearchDisplayDataSource.h; sourceTree = SOURCE_ROOT; };
41F5C0771F41ED55005EB9CB /* VLCLibrarySearchDisplayDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = VLCLibrarySearchDisplayDataSource.m; path = Sources/VLCLibrarySearchDisplayDataSource.m; sourceTree = SOURCE_ROOT; };
41F9BC7A1F4F20E400268461 /* VLCTrackSelectorView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = VLCTrackSelectorView.h; path = Sources/VLCTrackSelectorView.h; sourceTree = SOURCE_ROOT; };
......@@ -1540,6 +1548,11 @@
8F91EC78195CEC7900F5BCBA /* VLCOpenInActivity.m */,
41F5C0761F41ED55005EB9CB /* VLCLibrarySearchDisplayDataSource.h */,
41F5C0771F41ED55005EB9CB /* VLCLibrarySearchDisplayDataSource.m */,
412831632093323700FAA307 /* VLCMediaDataSource.swift */,
4170152B209A1D3600802E44 /* MediaSubcategoryViewController.swift */,
41701545209B36E800802E44 /* BaseButtonBarPagerTabStripViewController.swift */,
41EB94B3209B46E9002F4C30 /* ButtonCell.xib */,
41EB94B5209B4869002F4C30 /* IconLabelCell.xib */,
);
name = "Everything Playlist";
sourceTree = "<group>";
......@@ -2752,6 +2765,7 @@
419D7F051F54176900AF69A2 /* VLCTimeNavigationTitleView.xib in Resources */,
7D1516431868D7E0004B18F3 /* VLCFirstStepsFirstPageViewController~iphone.xib in Resources */,
7DF04F4E1961F2B8004A5429 /* web-download.png in Resources */,
41EB94B4209B46E9002F4C30 /* ButtonCell.xib in Resources */,
41B93C081A53853B00102E8B /* VLCCloudServiceCell.xib in Resources */,
29125E5617492219003F03E5 /* index.html in Resources */,
7DB638AB185BC0890003887C /* Images.xcassets in Resources */,
......@@ -2764,6 +2778,7 @@
7D32B384185E293D006CA474 /* Raleway.woff in Resources */,
7D9870691A3E03D5009CF27D /* papasscode_marker@2x.png in Resources */,
7D5DD5C717590ABF001421E3 /* About Contents.html in Resources */,
41EB94B6209B4869002F4C30 /* IconLabelCell.xib in Resources */,
7DBBF19B183AB4300009A339 /* VLCCloudStorageTableViewCell~iphone.xib in Resources */,
7D92897B1877467E009108FD /* VLCFirstStepsFourthPageViewController~iphone.xib in Resources */,
7D1516461868D7E0004B18F3 /* VLCFirstStepsSixthPageViewController~iphone.xib in Resources */,
......@@ -3197,6 +3212,7 @@
8D437154205808FF00F36458 /* VLCActionSheet.swift in Sources */,
DDF908E41CFCD97400108B70 /* VLCNetworkLoginDataSourceProtocol.m in Sources */,
7D378492183A98BF009EE944 /* VLCExternalDisplayController.m in Sources */,
4170152C209A1D3600802E44 /* MediaSubcategoryViewController.swift in Sources */,
41F9BC7C1F4F20E400268461 /* VLCTrackSelectorView.m in Sources */,
7D378499183A98D1009EE944 /* VLCPlaylistCollectionViewCell.m in Sources */,
DD8F84311B00EB3B0009138A /* VLCPlaybackController+MediaLibrary.m in Sources */,
......@@ -3256,6 +3272,7 @@
7D5CAA8C1A4AD8E5003F2CBC /* VLCTrackSelectorHeaderView.m in Sources */,
DD870E951CEF78D800BBD4FE /* VLCNetworkLoginDataSourceLogin.m in Sources */,
CAC0AFED20CF8F6F00EDB035 /* VLCAccessibilityIdentifier.swift in Sources */,
41701546209B36E800802E44 /* BaseButtonBarPagerTabStripViewController.swift in Sources */,
7D398DC11CC3E709002C999A /* VLCLocalNetworkServiceBrowserBonjour.m in Sources */,
7D30F3CA183AB27A00FFC021 /* VLCDownloadViewController.m in Sources */,
DDEAECC61BDEC79D00756C83 /* VLCLocalNetworkServiceBrowserSAP.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