Просмотр исходного кода

VideoOptionsControlBar: Highlight buttons when enabled.

Buttons are now highlighted when they are toggled. Renamed the new button icons to now follow
a pattern: "icon<Description>" and placed them in their own assets folder"
Robert Gordon 6 лет назад
Родитель
Сommit
06badd83bc
52 измененных файлов с 97 добавлено и 69 удалено
  1. 3 2
      Sources/VLCMovieViewController.m
  2. 33 12
      Sources/VideoOptionsControlBar.swift
  3. BIN
      vlc-ios/Images.xcassets/MovieController/lock-new.imageset/lock-new.png
  4. BIN
      vlc-ios/Images.xcassets/MovieController/lock-new.imageset/lock-new@2x.png
  5. BIN
      vlc-ios/Images.xcassets/MovieController/lock-new.imageset/lock-new@3x.png
  6. BIN
      vlc-ios/Images.xcassets/MovieController/no-repeat-new.imageset/no-repeat-new.png
  7. BIN
      vlc-ios/Images.xcassets/MovieController/no-repeat-new.imageset/no-repeat-new@2x.png
  8. BIN
      vlc-ios/Images.xcassets/MovieController/no-repeat-new.imageset/no-repeat-new@3x.png
  9. BIN
      vlc-ios/Images.xcassets/MovieController/repeat-new.imageset/repeat-new.png
  10. BIN
      vlc-ios/Images.xcassets/MovieController/repeat-new.imageset/repeat-new@2x.png
  11. BIN
      vlc-ios/Images.xcassets/MovieController/repeat-new.imageset/repeat-new@3x.png
  12. 0 23
      vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/Contents.json
  13. BIN
      vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/repeatOne-new.png
  14. BIN
      vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/repeatOne-new@2x.png
  15. BIN
      vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/repeatOne-new@3x.png
  16. 0 23
      vlc-ios/Images.xcassets/MovieController/subtitleIcon.imageset/Contents.json
  17. BIN
      vlc-ios/Images.xcassets/MovieController/subtitleIcon.imageset/subtitleIcon.png
  18. BIN
      vlc-ios/Images.xcassets/MovieController/subtitleIcon.imageset/subtitleIcon@2x.png
  19. BIN
      vlc-ios/Images.xcassets/MovieController/subtitleIcon.imageset/subtitleIcon@3x.png
  20. 6 0
      vlc-ios/Images.xcassets/VideoOptions/Contents.json
  21. 3 3
      vlc-ios/Images.xcassets/MovieController/repeat-new.imageset/Contents.json
  22. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconExpand.imageset/iconExpand.png
  23. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconExpand.imageset/iconExpand@2x.png
  24. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconExpand.imageset/iconExpand@3x.png
  25. 3 3
      vlc-ios/Images.xcassets/MovieController/lock-new.imageset/Contents.json
  26. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconLock.imageset/iconLock.png
  27. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconLock.imageset/iconLock@2x.png
  28. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconLock.imageset/iconLock@3x.png
  29. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconMoreOptions.imageset/Contents.json
  30. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconMoreOptions.imageset/moreWhite-new.png
  31. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconMoreOptions.imageset/moreWhite-new@2x.png
  32. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconMoreOptions.imageset/moreWhite-new@3x.png
  33. 23 0
      vlc-ios/Images.xcassets/VideoOptions/iconNoRepeat.imageset/Contents.json
  34. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconNoRepeat.imageset/iconNoRepeat.png
  35. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconNoRepeat.imageset/iconNoRepeat@2x.png
  36. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconNoRepeat.imageset/iconNoRepeat@3x.png
  37. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconReduce.imageset/Contents.json
  38. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconReduce.imageset/fullscreenIcon.png
  39. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconReduce.imageset/fullscreenIcon@2x.png
  40. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconReduce.imageset/fullscreenIcon@3x.png
  41. 23 0
      vlc-ios/Images.xcassets/VideoOptions/iconRepeat.imageset/Contents.json
  42. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconRepeat.imageset/iconRepeat.png
  43. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconRepeat.imageset/iconRepeat@2x.png
  44. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconRepeat.imageset/iconRepeat@3x.png
  45. 3 3
      vlc-ios/Images.xcassets/MovieController/no-repeat-new.imageset/Contents.json
  46. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconRepeatOne.imageset/iconRepeatOne.png
  47. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconRepeatOne.imageset/iconRepeatOne@2x.png
  48. BIN
      vlc-ios/Images.xcassets/VideoOptions/iconRepeatOne.imageset/iconRepeatOne@3x.png
  49. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconSubtitle.imageset/Contents.json
  50. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconSubtitle.imageset/subtitlesIcon-new.png
  51. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconSubtitle.imageset/subtitlesIcon-new@2x.png
  52. 0 0
      vlc-ios/Images.xcassets/VideoOptions/iconSubtitle.imageset/subtitlesIcon-new@3x.png

+ 3 - 2
Sources/VLCMovieViewController.m

@@ -258,7 +258,6 @@ typedef NS_ENUM(NSInteger, VLCPanType) {
     _videoOptionsControlBar.delegate = self;
     _videoOptionsControlBar.hidden = YES;
     _videoOptionsControlBar.repeatMode = _vpc.repeatMode;
-    _videoOptionsControlBar.spacing = 32.0f;
     [self.view addSubview:_videoOptionsControlBar];
 }
 
@@ -1400,6 +1399,8 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
     
     #if !NEW_UI
         _multiSelectionView.displayLock = _interfaceIsLocked;
+    #else
+        _videoOptionsControlBar.interfaceDisabled = _interfaceIsLocked;
     #endif
 }
 
@@ -1876,7 +1877,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
 }
 
 - (void)didSelectSubtitle:(VLCVideoOptionsControlBar * _Nonnull)optionsBar {
-    NSLog(@"subtitles Selected");
+    NSAssert(0, @"didSelectSubtitle not implemented");
 }
 
 - (void)didToggleFullScreen:(VLCVideoOptionsControlBar * _Nonnull)optionsBar {

+ 33 - 12
Sources/VideoOptionsControlBar.swift

@@ -24,24 +24,38 @@ protocol VideoOptionsControlBarDelegate: class {
     // MARK: Instance variables
     weak var delegate: VideoOptionsControlBarDelegate?
     
+    var subtitleToggled: Bool {
+        didSet {
+            selectSubtitleButton.tintColor = subtitleToggled ? .orange : .white
+        }
+    }
+    
+    var interfaceDisabled: Bool {
+        didSet {
+            interfaceLockButton.tintColor = interfaceDisabled ? .orange : .white
+        }
+    }
+    
     var repeatMode: VLCRepeatMode {
         didSet {
             switch repeatMode {
             case .repeatCurrentItem:
-                repeatButton.setImage(UIImage(named: "repeatOne-new"), for: .normal)
+                repeatButton.setImage(UIImage(named: "iconRepeatOne"), for: .normal)
             case .repeatAllItems:
-                repeatButton.setImage(UIImage(named: "repeat-new"), for: .normal)
+                repeatButton.setImage(UIImage(named: "iconRepeat"), for: .normal)
             case .doNotRepeat:
-                repeatButton.setImage(UIImage(named: "no-repeat-new"), for: .normal)
+                repeatButton.setImage(UIImage(named: "iconNoRepeat"), for: .normal)
             default:
                 assertionFailure("unhandled repeatmode")
             }
+            
+            repeatButton.tintColor = (repeatMode == .doNotRepeat) ? .white : .orange // highlight the colors that are not the default (.doNotRepeat)
         }
     }
     
     lazy var toggleFullScreenButton: UIButton = {
         var toggle = UIButton(type: .system)
-        toggle.setImage(UIImage(named: "fullscreenIcon-new"), for: .normal)
+        toggle.setImage(UIImage(named: "iconExpand"), for: .normal)
         toggle.addTarget(self, action: #selector(toggleFullscreen), for: .touchUpInside)
         toggle.tintColor = .white
         toggle.accessibilityLabel = NSLocalizedString("VIDEO_ASPECT_RATIO_BUTTON", comment: "")
@@ -51,7 +65,7 @@ protocol VideoOptionsControlBarDelegate: class {
     
     lazy var selectSubtitleButton: UIButton = {
         var subbutton = UIButton(type: .system)
-        subbutton.setImage(UIImage(named: "subtitlesIcon-new"), for: .normal)
+        subbutton.setImage(UIImage(named: "iconSubtitle"), for: .normal)
         subbutton.addTarget(self, action: #selector(selectSubtitle), for: .touchUpInside)
         subbutton.tintColor = .white
         subbutton.accessibilityHint = NSLocalizedString("CHOOSE_SUBTITLE_TRACK", comment: "")
@@ -62,7 +76,7 @@ protocol VideoOptionsControlBarDelegate: class {
     lazy var repeatButton: UIButton = {
         var rptButton = UIButton(type: .system)
         rptButton.addTarget(self, action: #selector(toggleRepeat), for: .touchUpInside)
-        rptButton.setImage(UIImage(named: "no-repeat-new"), for: .normal)
+        rptButton.setImage(UIImage(named: "iconNoRepeat"), for: .normal)
         rptButton.tintColor = .white
         rptButton.accessibilityHint = NSLocalizedString("REPEAT_MODE", comment: "")
         rptButton.accessibilityLabel = NSLocalizedString("REPEAT_MODE_HINT", comment: "")
@@ -71,7 +85,7 @@ protocol VideoOptionsControlBarDelegate: class {
     
     lazy var interfaceLockButton: UIButton = {
         var interfaceLockButton = UIButton(type: .system)
-        interfaceLockButton.setImage(UIImage(named: "lock-new"), for: .normal)
+        interfaceLockButton.setImage(UIImage(named: "iconLock"), for: .normal)
         interfaceLockButton.addTarget(self, action: #selector(toggleInterfaceLock), for: .touchUpInside)
         interfaceLockButton.tintColor = .white
         interfaceLockButton.accessibilityHint = NSLocalizedString("INTERFACE_LOCK_HINT", comment: "")
@@ -81,7 +95,7 @@ protocol VideoOptionsControlBarDelegate: class {
     
     lazy var moreOptionsButton: UIButton = {
         var moreOptionsButton = UIButton(type: .system)
-        moreOptionsButton.setImage(UIImage(named: "moreWhite-new"), for: .normal)
+        moreOptionsButton.setImage(UIImage(named: "iconMoreOptions"), for: .normal)
         moreOptionsButton.addTarget(self, action: #selector(selectMoreOptions), for: .touchUpInside)
         moreOptionsButton.tintColor = .white
         moreOptionsButton.accessibilityHint = NSLocalizedString("MORE_OPTIONS_HINT", comment: "")
@@ -94,19 +108,26 @@ protocol VideoOptionsControlBarDelegate: class {
         fatalError("init(coder aDecoder: NSCoder) not implemented")
     }
     
-    override init(frame: CGRect) {
-        repeatMode = .doNotRepeat
-        super.init(frame: frame)
+    private func setupView() {
         addArrangedSubview(toggleFullScreenButton)
         addArrangedSubview(selectSubtitleButton)
         addArrangedSubview(repeatButton)
         addArrangedSubview(interfaceLockButton)
         addArrangedSubview(moreOptionsButton)
         axis = .horizontal
+        spacing = 32
         translatesAutoresizingMaskIntoConstraints = false
     }
     
-    // MARK: Button Action Buttons
+    override init(frame: CGRect) {
+        repeatMode = .doNotRepeat
+        subtitleToggled = false
+        interfaceDisabled = false
+        super.init(frame: frame)
+        setupView()
+    }
+    
+    // MARK: Button Actions
     func toggleFullscreen() {
         delegate?.didToggleFullScreen(self)
     }

BIN
vlc-ios/Images.xcassets/MovieController/lock-new.imageset/lock-new.png


BIN
vlc-ios/Images.xcassets/MovieController/lock-new.imageset/lock-new@2x.png


BIN
vlc-ios/Images.xcassets/MovieController/lock-new.imageset/lock-new@3x.png


BIN
vlc-ios/Images.xcassets/MovieController/no-repeat-new.imageset/no-repeat-new.png


BIN
vlc-ios/Images.xcassets/MovieController/no-repeat-new.imageset/no-repeat-new@2x.png


BIN
vlc-ios/Images.xcassets/MovieController/no-repeat-new.imageset/no-repeat-new@3x.png


BIN
vlc-ios/Images.xcassets/MovieController/repeat-new.imageset/repeat-new.png


BIN
vlc-ios/Images.xcassets/MovieController/repeat-new.imageset/repeat-new@2x.png


BIN
vlc-ios/Images.xcassets/MovieController/repeat-new.imageset/repeat-new@3x.png


+ 0 - 23
vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/Contents.json

@@ -1,23 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "filename" : "repeatOne-new.png",
-      "scale" : "1x"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "repeatOne-new@2x.png",
-      "scale" : "2x"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "repeatOne-new@3x.png",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "version" : 1,
-    "author" : "xcode"
-  }
-}

BIN
vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/repeatOne-new.png


BIN
vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/repeatOne-new@2x.png


BIN
vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/repeatOne-new@3x.png


+ 0 - 23
vlc-ios/Images.xcassets/MovieController/subtitleIcon.imageset/Contents.json

@@ -1,23 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x",
-      "filename" : "subtitleIcon.png"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "2x",
-      "filename" : "subtitleIcon@2x.png"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "3x",
-      "filename" : "subtitleIcon@3x.png"
-    }
-  ],
-  "info" : {
-    "version" : 1,
-    "author" : "xcode"
-  }
-}

BIN
vlc-ios/Images.xcassets/MovieController/subtitleIcon.imageset/subtitleIcon.png


BIN
vlc-ios/Images.xcassets/MovieController/subtitleIcon.imageset/subtitleIcon@2x.png


BIN
vlc-ios/Images.xcassets/MovieController/subtitleIcon.imageset/subtitleIcon@3x.png


+ 6 - 0
vlc-ios/Images.xcassets/VideoOptions/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

+ 3 - 3
vlc-ios/Images.xcassets/MovieController/repeat-new.imageset/Contents.json

@@ -2,17 +2,17 @@
   "images" : [
     {
       "idiom" : "universal",
-      "filename" : "repeat-new.png",
+      "filename" : "iconExpand.png",
       "scale" : "1x"
     },
     {
       "idiom" : "universal",
-      "filename" : "repeat-new@2x.png",
+      "filename" : "iconExpand@2x.png",
       "scale" : "2x"
     },
     {
       "idiom" : "universal",
-      "filename" : "repeat-new@3x.png",
+      "filename" : "iconExpand@3x.png",
       "scale" : "3x"
     }
   ],

BIN
vlc-ios/Images.xcassets/VideoOptions/iconExpand.imageset/iconExpand.png


BIN
vlc-ios/Images.xcassets/VideoOptions/iconExpand.imageset/iconExpand@2x.png


BIN
vlc-ios/Images.xcassets/VideoOptions/iconExpand.imageset/iconExpand@3x.png


+ 3 - 3
vlc-ios/Images.xcassets/MovieController/lock-new.imageset/Contents.json

@@ -2,17 +2,17 @@
   "images" : [
     {
       "idiom" : "universal",
-      "filename" : "lock-new.png",
+      "filename" : "iconLock.png",
       "scale" : "1x"
     },
     {
       "idiom" : "universal",
-      "filename" : "lock-new@2x.png",
+      "filename" : "iconLock@2x.png",
       "scale" : "2x"
     },
     {
       "idiom" : "universal",
-      "filename" : "lock-new@3x.png",
+      "filename" : "iconLock@3x.png",
       "scale" : "3x"
     }
   ],

BIN
vlc-ios/Images.xcassets/VideoOptions/iconLock.imageset/iconLock.png


BIN
vlc-ios/Images.xcassets/VideoOptions/iconLock.imageset/iconLock@2x.png


BIN
vlc-ios/Images.xcassets/VideoOptions/iconLock.imageset/iconLock@3x.png


vlc-ios/Images.xcassets/MovieController/moreWhite-new.imageset/Contents.json → vlc-ios/Images.xcassets/VideoOptions/iconMoreOptions.imageset/Contents.json


vlc-ios/Images.xcassets/MovieController/moreWhite-new.imageset/moreWhite-new.png → vlc-ios/Images.xcassets/VideoOptions/iconMoreOptions.imageset/moreWhite-new.png


vlc-ios/Images.xcassets/MovieController/moreWhite-new.imageset/moreWhite-new@2x.png → vlc-ios/Images.xcassets/VideoOptions/iconMoreOptions.imageset/moreWhite-new@2x.png


vlc-ios/Images.xcassets/MovieController/moreWhite-new.imageset/moreWhite-new@3x.png → vlc-ios/Images.xcassets/VideoOptions/iconMoreOptions.imageset/moreWhite-new@3x.png


+ 23 - 0
vlc-ios/Images.xcassets/VideoOptions/iconNoRepeat.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "iconNoRepeat.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "iconNoRepeat@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "iconNoRepeat@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
vlc-ios/Images.xcassets/VideoOptions/iconNoRepeat.imageset/iconNoRepeat.png


BIN
vlc-ios/Images.xcassets/VideoOptions/iconNoRepeat.imageset/iconNoRepeat@2x.png


BIN
vlc-ios/Images.xcassets/VideoOptions/iconNoRepeat.imageset/iconNoRepeat@3x.png


vlc-ios/Images.xcassets/MovieController/fullscreenIcon-new.imageset/Contents.json → vlc-ios/Images.xcassets/VideoOptions/iconReduce.imageset/Contents.json


vlc-ios/Images.xcassets/MovieController/fullscreenIcon-new.imageset/fullscreenIcon.png → vlc-ios/Images.xcassets/VideoOptions/iconReduce.imageset/fullscreenIcon.png


vlc-ios/Images.xcassets/MovieController/fullscreenIcon-new.imageset/fullscreenIcon@2x.png → vlc-ios/Images.xcassets/VideoOptions/iconReduce.imageset/fullscreenIcon@2x.png


vlc-ios/Images.xcassets/MovieController/fullscreenIcon-new.imageset/fullscreenIcon@3x.png → vlc-ios/Images.xcassets/VideoOptions/iconReduce.imageset/fullscreenIcon@3x.png


+ 23 - 0
vlc-ios/Images.xcassets/VideoOptions/iconRepeat.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "iconRepeat.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "iconRepeat@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "iconRepeat@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
vlc-ios/Images.xcassets/VideoOptions/iconRepeat.imageset/iconRepeat.png


BIN
vlc-ios/Images.xcassets/VideoOptions/iconRepeat.imageset/iconRepeat@2x.png


BIN
vlc-ios/Images.xcassets/VideoOptions/iconRepeat.imageset/iconRepeat@3x.png


+ 3 - 3
vlc-ios/Images.xcassets/MovieController/no-repeat-new.imageset/Contents.json

@@ -2,17 +2,17 @@
   "images" : [
     {
       "idiom" : "universal",
-      "filename" : "no-repeat-new.png",
+      "filename" : "iconRepeatOne.png",
       "scale" : "1x"
     },
     {
       "idiom" : "universal",
-      "filename" : "no-repeat-new@2x.png",
+      "filename" : "iconRepeatOne@2x.png",
       "scale" : "2x"
     },
     {
       "idiom" : "universal",
-      "filename" : "no-repeat-new@3x.png",
+      "filename" : "iconRepeatOne@3x.png",
       "scale" : "3x"
     }
   ],

BIN
vlc-ios/Images.xcassets/VideoOptions/iconRepeatOne.imageset/iconRepeatOne.png


BIN
vlc-ios/Images.xcassets/VideoOptions/iconRepeatOne.imageset/iconRepeatOne@2x.png


BIN
vlc-ios/Images.xcassets/VideoOptions/iconRepeatOne.imageset/iconRepeatOne@3x.png


vlc-ios/Images.xcassets/MovieController/subtitlesIcon-new.imageset/Contents.json → vlc-ios/Images.xcassets/VideoOptions/iconSubtitle.imageset/Contents.json


vlc-ios/Images.xcassets/MovieController/subtitlesIcon-new.imageset/subtitlesIcon-new.png → vlc-ios/Images.xcassets/VideoOptions/iconSubtitle.imageset/subtitlesIcon-new.png


vlc-ios/Images.xcassets/MovieController/subtitlesIcon-new.imageset/subtitlesIcon-new@2x.png → vlc-ios/Images.xcassets/VideoOptions/iconSubtitle.imageset/subtitlesIcon-new@2x.png


vlc-ios/Images.xcassets/MovieController/subtitlesIcon-new.imageset/subtitlesIcon-new@3x.png → vlc-ios/Images.xcassets/VideoOptions/iconSubtitle.imageset/subtitlesIcon-new@3x.png