Browse Source

VideoOptionsControlBar: Initial

Create UI component to replace existing video options buttons

This change makes way for the revamp of the MovieViewController by rewriting the MultiSelectionMenuView
component. The five buttons have been replaced. Functionality will be added in the next upcoming changes
Robert Gordon 6 years ago
parent
commit
daf1c6d8ca
22 changed files with 227 additions and 0 deletions
  1. 108 0
      Sources/VideoOptionsControlBar.swift
  2. 4 0
      VLC.xcodeproj/project.pbxproj
  3. 23 0
      vlc-ios/Images.xcassets/MovieController/fullscreenIcon-new.imageset/Contents.json
  4. BIN
      vlc-ios/Images.xcassets/MovieController/fullscreenIcon-new.imageset/fullscreenIcon.png
  5. BIN
      vlc-ios/Images.xcassets/MovieController/fullscreenIcon-new.imageset/fullscreenIcon@2x.png
  6. BIN
      vlc-ios/Images.xcassets/MovieController/fullscreenIcon-new.imageset/fullscreenIcon@3x.png
  7. 23 0
      vlc-ios/Images.xcassets/MovieController/lock-new.imageset/Contents.json
  8. BIN
      vlc-ios/Images.xcassets/MovieController/lock-new.imageset/lock-new.png
  9. BIN
      vlc-ios/Images.xcassets/MovieController/lock-new.imageset/lock-new@2x.png
  10. BIN
      vlc-ios/Images.xcassets/MovieController/lock-new.imageset/lock-new@3x.png
  11. 23 0
      vlc-ios/Images.xcassets/MovieController/moreWhite-new.imageset/Contents.json
  12. BIN
      vlc-ios/Images.xcassets/MovieController/moreWhite-new.imageset/moreWhite-new.png
  13. BIN
      vlc-ios/Images.xcassets/MovieController/moreWhite-new.imageset/moreWhite-new@2x.png
  14. BIN
      vlc-ios/Images.xcassets/MovieController/moreWhite-new.imageset/moreWhite-new@3x.png
  15. 23 0
      vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/Contents.json
  16. BIN
      vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/repeatOne-new.png
  17. BIN
      vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/repeatOne-new@2x.png
  18. BIN
      vlc-ios/Images.xcassets/MovieController/repeatOne-new.imageset/repeatOne-new@3x.png
  19. 23 0
      vlc-ios/Images.xcassets/MovieController/subtitlesIcon-new.imageset/Contents.json
  20. BIN
      vlc-ios/Images.xcassets/MovieController/subtitlesIcon-new.imageset/subtitlesIcon-new.png
  21. BIN
      vlc-ios/Images.xcassets/MovieController/subtitlesIcon-new.imageset/subtitlesIcon-new@2x.png
  22. BIN
      vlc-ios/Images.xcassets/MovieController/subtitlesIcon-new.imageset/subtitlesIcon-new@3x.png

+ 108 - 0
Sources/VideoOptionsControlBar.swift

@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * VideoOptionsControlBar.swift
+ *
+ * Copyright © 2019 VLC authors and VideoLAN
+ *
+ * Authors: Robert Gordon <robwaynegordon@gmail.com>
+ *
+ *
+ * Refer to the COPYING file of the official project for license.
+ *****************************************************************************/
+
+@objc (VideoOptionsControlBarDelegate)
+protocol VideoOptionsControlBarDelegate: class {
+    func didToggleFullScreen(_ optionsBar: VideoOptionsControlBar)
+    func didToggleRepeat(_ optionsBar: VideoOptionsControlBar)
+    func didSelectSubtitle(_ optionsBar: VideoOptionsControlBar)
+    func didSelectMoreOptions(_ optionsBar: VideoOptionsControlBar)
+    func didToggleOrientationLock(_ optionsBar: VideoOptionsControlBar)
+}
+
+@objc (VLCVideoOptionsControlBar)
+@objcMembers class VideoOptionsControlBar: UIStackView {
+    
+    // MARK: Instance variables
+    weak var delegate: VideoOptionsControlBarDelegate?
+    
+    lazy var toggleFullScreenButton: UIButton = {
+        var toggle = UIButton(type: .system)
+        toggle.addTarget(self, action: #selector(toggleFullscreen), for: .touchUpInside)
+        toggle.setImage(UIImage(named: "fullscreenIcon-new"), for: .normal)
+        toggle.tintColor = .orange
+        //TODO: add accessability options for fullScreenButton
+        return toggle
+    }()
+    
+    lazy var selectSubtitleButton: UIButton = {
+        var subbutton = UIButton(type: .system)
+        subbutton.addTarget(self, action: #selector(selectSubtitle), for: .touchUpInside)
+        subbutton.setImage(UIImage(named: "subtitleIcon-new"), for: .normal)
+        subbutton.tintColor = .orange
+        //TODO: add accessability options for selectingSubtitleButton
+        return subbutton
+    }()
+    
+    lazy var repeatButton: UIButton = {
+        var rptButton = UIButton(type: .system)
+        rptButton.addTarget(self, action: #selector(toggleRepeat), for: .touchUpInside)
+        rptButton.setImage(UIImage(named: "repeatOne-new"), for: .normal)
+        rptButton.tintColor = .orange
+        //TODO: add accessability options for repeatButton
+        return rptButton
+    }()
+    
+    lazy var orientationLockButton: UIButton = {
+        var orientLockButton = UIButton(type: .system)
+        orientLockButton.addTarget(self, action: #selector(toggleOrientation), for: .touchUpInside)
+        orientLockButton.setImage(UIImage(named: "lockIcon-new"), for: .normal)
+        orientLockButton.tintColor = .orange
+        //TODO: add accessability options for orientationLockButton
+        return orientLockButton
+    }()
+    
+    lazy var moreOptionsButton: UIButton = {
+        var moreOptionsButton = UIButton(type: .system)
+        moreOptionsButton.addTarget(self, action: #selector(selectMoreOptions), for: .touchUpInside)
+        moreOptionsButton.setImage(UIImage(named: "moreWhite-new"), for: .normal)
+        moreOptionsButton.tintColor = .orange
+        //TODO: add accessability options for moreOptionsButton
+        return moreOptionsButton
+    }()
+    
+    // MARK: Class Initializers
+    required init(coder aDecoder: NSCoder) {
+        super.init(coder: aDecoder)
+    }
+    
+    override init(frame: CGRect) {
+        super.init(frame: frame)
+        addArrangedSubview(toggleFullScreenButton)
+        addArrangedSubview(selectSubtitleButton)
+        addArrangedSubview(repeatButton)
+        addArrangedSubview(orientationLockButton)
+        addArrangedSubview(moreOptionsButton)
+    }
+    
+    // MARK: Button Action Buttons
+    func toggleFullscreen() {
+        delegate?.didToggleFullScreen(self)
+    }
+    
+    func selectSubtitle() {
+        delegate?.didSelectSubtitle(self)
+    }
+    
+    func selectMoreOptions() {
+        delegate?.didSelectMoreOptions(self)
+    }
+    
+    func toggleRepeat() {
+        delegate?.didToggleRepeat(self)
+    }
+    
+    func toggleOrientation() {
+        delegate?.didToggleOrientationLock(self)
+    }
+}
+
+

+ 4 - 0
VLC.xcodeproj/project.pbxproj

@@ -380,6 +380,7 @@
 		DDF908D01CF4CCAA00108B70 /* VLCNetworkLoginViewButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = DDF908CF1CF4CCAA00108B70 /* VLCNetworkLoginViewButtonCell.m */; };
 		DDF908E01CF4E04A00108B70 /* VLCNetworkLoginDataSourceSavedLogins.m in Sources */ = {isa = PBXBuildFile; fileRef = DDF908DF1CF4E04A00108B70 /* VLCNetworkLoginDataSourceSavedLogins.m */; };
 		DDF908E41CFCD97400108B70 /* VLCNetworkLoginDataSourceProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef = DDF908E31CFCD97400108B70 /* VLCNetworkLoginDataSourceProtocol.m */; };
+		E016D07322B0FB4B009FC7CA /* VideoOptionsControlBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = E016D07222B0FB4B009FC7CA /* VideoOptionsControlBar.swift */; };
 		E0C04F951A25B4410080331A /* VLCDocumentPickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = E0C04F941A25B4410080331A /* VLCDocumentPickerController.m */; };
 /* End PBXBuildFile section */
 
@@ -1004,6 +1005,7 @@
 		DDF908E11CF4E70900108B70 /* VLCNetworkLoginDataSourceSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCNetworkLoginDataSourceSection.h; path = Sources/LocalNetworkConnectivity/VLCNetworkLoginDataSourceSection.h; sourceTree = SOURCE_ROOT; };
 		DDF908E21CFCD97400108B70 /* VLCNetworkLoginDataSourceProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCNetworkLoginDataSourceProtocol.h; path = Sources/LocalNetworkConnectivity/VLCNetworkLoginDataSourceProtocol.h; sourceTree = SOURCE_ROOT; };
 		DDF908E31CFCD97400108B70 /* VLCNetworkLoginDataSourceProtocol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCNetworkLoginDataSourceProtocol.m; path = Sources/LocalNetworkConnectivity/VLCNetworkLoginDataSourceProtocol.m; sourceTree = SOURCE_ROOT; };
+		E016D07222B0FB4B009FC7CA /* VideoOptionsControlBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = VideoOptionsControlBar.swift; path = Sources/VideoOptionsControlBar.swift; sourceTree = "<group>"; };
 		E0C04F931A25B4410080331A /* VLCDocumentPickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCDocumentPickerController.h; path = Sources/VLCDocumentPickerController.h; sourceTree = SOURCE_ROOT; };
 		E0C04F941A25B4410080331A /* VLCDocumentPickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCDocumentPickerController.m; path = Sources/VLCDocumentPickerController.m; sourceTree = SOURCE_ROOT; };
 		E39E49F085F7C54D2DB79534 /* Pods-VLC-iOSTests.distribution.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VLC-iOSTests.distribution.xcconfig"; path = "Pods/Target Support Files/Pods-VLC-iOSTests/Pods-VLC-iOSTests.distribution.xcconfig"; sourceTree = "<group>"; };
@@ -1248,6 +1250,7 @@
 		7D31CF061746AEF2005997E0 /* UI Elements */ = {
 			isa = PBXGroup;
 			children = (
+				E016D07222B0FB4B009FC7CA /* VideoOptionsControlBar.swift */,
 				41B93BFF1A53833B00102E8B /* VLCProgressView.h */,
 				41B93C001A53833B00102E8B /* VLCProgressView.m */,
 				7D3784B2183A9938009EE944 /* UIBarButtonItem+Theme.h */,
@@ -2982,6 +2985,7 @@
 				7D5CAA8C1A4AD8E5003F2CBC /* VLCTrackSelectorHeaderView.m in Sources */,
 				DD870E951CEF78D800BBD4FE /* VLCNetworkLoginDataSourceLogin.m in Sources */,
 				CAC0AFED20CF8F6F00EDB035 /* VLCAccessibilityIdentifier.swift in Sources */,
+				E016D07322B0FB4B009FC7CA /* VideoOptionsControlBar.swift in Sources */,
 				41701546209B36E800802E44 /* VLCPagingViewController.swift in Sources */,
 				7D398DC11CC3E709002C999A /* VLCLocalNetworkServiceBrowserBonjour.m in Sources */,
 				7D30F3CA183AB27A00FFC021 /* VLCDownloadViewController.m in Sources */,

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

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

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


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


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


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

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

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


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

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

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


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


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


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

@@ -0,0 +1,23 @@
+{
+  "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


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

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

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


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


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