Commit 7c1b0804 authored by Soomin Lee's avatar Soomin Lee

MediaCategoryViewController: Rename subcategory to category

parent 503327da
......@@ -12,48 +12,48 @@
class VLCMovieCategoryViewController: VLCMediaCategoryViewController<MLFile> {
init(_ services: Services) {
super.init(services: services, subcategory: VLCMediaSubcategories.movies)
super.init(services: services, category: VLCMediaSubcategories.movies)
}
}
class VLCShowEpisodeCategoryViewController: VLCMediaCategoryViewController<MLShowEpisode> {
init(_ services: Services) {
super.init(services: services, subcategory: VLCMediaSubcategories.episodes)
super.init(services: services, category: VLCMediaSubcategories.episodes)
}
}
class VLCVideoPlaylistCategoryViewController: VLCMediaCategoryViewController<MLLabel> {
init(_ services: Services) {
super.init(services: services, subcategory: VLCMediaSubcategories.videoPlaylists)
super.init(services: services, category: VLCMediaSubcategories.videoPlaylists)
}
}
class VLCTrackCategoryViewController: VLCMediaCategoryViewController<MLFile> {
init(_ services: Services) {
super.init(services: services, subcategory: VLCMediaSubcategories.tracks)
super.init(services: services, category: VLCMediaSubcategories.tracks)
}
}
class VLCGenreCategoryViewController: VLCMediaCategoryViewController<String> {
init(_ services: Services) {
super.init(services: services, subcategory: VLCMediaSubcategories.genres)
super.init(services: services, category: VLCMediaSubcategories.genres)
}
}
class VLCArtistCategoryViewController: VLCMediaCategoryViewController<String> {
init(_ services: Services) {
super.init(services: services, subcategory: VLCMediaSubcategories.artists)
super.init(services: services, category: VLCMediaSubcategories.artists)
}
}
class VLCAlbumCategoryViewController: VLCMediaCategoryViewController<MLAlbum> {
init(_ services: Services) {
super.init(services: services, subcategory: VLCMediaSubcategories.albums)
super.init(services: services, category: VLCMediaSubcategories.albums)
}
}
class VLCAudioPlaylistCategoryViewController: VLCMediaCategoryViewController<MLLabel> {
init(_ services: Services) {
super.init(services: services, subcategory: VLCMediaSubcategories.audioPlaylists)
super.init(services: services, category: VLCMediaSubcategories.audioPlaylists)
}
}
......@@ -18,11 +18,11 @@ class VLCMediaCategoryViewController<T>: UICollectionViewController, UICollectio
private var services: Services
private var searchController: UISearchController?
private let searchDataSource = VLCLibrarySearchDisplayDataSource()
var subcategory: VLCMediaSubcategoryModel<T>
var category: VLCMediaSubcategoryModel<T>
@available(iOS 11.0, *)
lazy var dragAndDropManager: VLCDragAndDropManager = { () -> VLCDragAndDropManager<T> in
VLCDragAndDropManager<T>(subcategory: subcategory)
VLCDragAndDropManager<T>(subcategory: category)
}()
......@@ -38,13 +38,13 @@ class VLCMediaCategoryViewController<T>: UICollectionViewController, UICollectio
fatalError()
}
init(services: Services, subcategory: VLCMediaSubcategoryModel<T>) {
init(services: Services, category: VLCMediaSubcategoryModel<T>) {
self.services = services
self.subcategory = subcategory
self.category = category
super.init(collectionViewLayout: UICollectionViewFlowLayout())
NotificationCenter.default.addObserver(self, selector: #selector(themeDidChange), name: .VLCThemeDidChangeNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(reloadData), name: subcategory.changeNotificationName, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(reloadData), name: category.changeNotificationName, object: nil)
}
override var preferredStatusBarStyle: UIStatusBarStyle {
......@@ -137,7 +137,7 @@ class VLCMediaCategoryViewController<T>: UICollectionViewController, UICollectio
// MARK: - Search
func updateSearchResults(for searchController: UISearchController) {
searchDataSource.shouldReloadTable(forSearch: searchController.searchBar.text, searchableFiles: subcategory.files)
searchDataSource.shouldReloadTable(forSearch: searchController.searchBar.text, searchableFiles: category.files)
collectionView?.reloadData()
}
......@@ -150,17 +150,17 @@ class VLCMediaCategoryViewController<T>: UICollectionViewController, UICollectio
}
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
return IndicatorInfo(title:subcategory.indicatorInfoName)
return IndicatorInfo(title:category.indicatorInfoName)
}
// MARK: - UICollectionViewDataSource
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return subcategory.files.count
return category.files.count
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
if let playlistCell = collectionView.dequeueReusableCell(withReuseIdentifier: VLCPlaylistCollectionViewCell.cellIdentifier(), for: indexPath) as? VLCPlaylistCollectionViewCell {
if let mediaObject = subcategory.files[indexPath.row] as? NSManagedObject {
if let mediaObject = category.files[indexPath.row] as? NSManagedObject {
playlistCell.mediaObject = mediaObject
}
return playlistCell
......@@ -170,7 +170,7 @@ class VLCMediaCategoryViewController<T>: UICollectionViewController, UICollectio
// MARK: - UICollectionViewDelegate
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if let mediaObject = subcategory.files[indexPath.row] as? NSManagedObject {
if let mediaObject = category.files[indexPath.row] as? NSManagedObject {
play(mediaObject: mediaObject)
}
}
......
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