Browse Source

EmptyView: don't show large title for emptyview

minor cosmetic renaming and refactoring and making the linter happy
Carola Nitz 7 years ago
parent
commit
e86aed241c
2 changed files with 6 additions and 9 deletions
  1. 1 1
      SharedSources/VLCPlayingExternallyView.swift
  2. 5 8
      Sources/MediaViewController.swift

+ 1 - 1
SharedSources/VLCPlayingExternallyView.swift

@@ -49,7 +49,7 @@ class VLCPlayingExternallyView: UIView {
     @objc func updateUI(rendererItem: VLCRendererItem?) {
         if let rendererItem = rendererItem {
             playingExternallyTitle.text = NSLocalizedString("PLAYING_EXTERNALLY_TITLE_CHROMECAST", comment:"")
-            playingExternallyDescription.text = rendererItem.name;
+            playingExternallyDescription.text = rendererItem.name
         } else {
             playingExternallyTitle.text = NSLocalizedString("PLAYING_EXTERNALLY_TITLE", comment: "")
             playingExternallyDescription.text = NSLocalizedString("PLAYING_EXTERNALLY_DESC", comment:"")

+ 5 - 8
Sources/MediaViewController.swift

@@ -62,7 +62,7 @@ public class VLCMediaViewController: UICollectionViewController, UISearchResults
 
     @objc func reloadData() {
         collectionView?.reloadData()
-        updateUIForEmptyView()
+        updateUIForContent()
     }
 
     @available(*, unavailable)
@@ -131,20 +131,17 @@ public class VLCMediaViewController: UICollectionViewController, UISearchResults
         navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("SORT", comment: ""), style: .plain, target: self, action: #selector(sort))
     }
     
-    func updateUIForEmptyView() {
+    func updateUIForContent() {
         let isEmpty = collectionView?.numberOfItems(inSection: 0) == 0
 
         if isEmpty {
             collectionView?.setContentOffset(.zero, animated: false)
-            collectionView?.backgroundView = emptyView
-            edgesForExtendedLayout = []
-        } else {
-            collectionView?.backgroundView = nil
-            edgesForExtendedLayout = .all
         }
+        collectionView?.backgroundView = isEmpty ? emptyView : nil
         
         if #available(iOS 11.0, *) {
-            navigationItem.searchController = isEmpty ? nil :searchController
+            navigationItem.searchController = isEmpty ? nil : searchController
+            navigationController?.navigationBar.prefersLargeTitles = !isEmpty
         } else {
             navigationItem.titleView = isEmpty ? nil : searchController?.searchBar
         }