|
@@ -41,12 +41,6 @@ class NCPlayerToolBar: UIView {
|
|
|
@IBOutlet weak var labelLeftTime: UILabel!
|
|
|
@IBOutlet weak var labelCurrentTime: UILabel!
|
|
|
|
|
|
- private let volumeProgressView: UIProgressView = {
|
|
|
- let progressView = UIProgressView()
|
|
|
- progressView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- return progressView
|
|
|
- }()
|
|
|
-
|
|
|
enum sliderEventType {
|
|
|
case began
|
|
|
case ended
|
|
@@ -105,12 +99,6 @@ class NCPlayerToolBar: UIView {
|
|
|
backButton.setImage(NCUtility.shared.loadImage(named: "gobackward.10", color: .white), for: .normal)
|
|
|
|
|
|
forwardButton.setImage(NCUtility.shared.loadImage(named: "goforward.10", color: .white), for: .normal)
|
|
|
-
|
|
|
- addSubview(volumeProgressView)
|
|
|
- volumeProgressView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -10).isActive = true
|
|
|
- volumeProgressView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
|
|
|
- volumeProgressView.widthAnchor.constraint(equalToConstant: 2).isActive = true
|
|
|
- volumeProgressView.heightAnchor.constraint(equalTo: heightAnchor, multiplier: 0.3).isActive = true
|
|
|
}
|
|
|
|
|
|
required init?(coder aDecoder: NSCoder) {
|
|
@@ -316,135 +304,3 @@ class NCPlayerToolBar: UIView {
|
|
|
reStartTimerAutoHide()
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-// MARK: - Action
|
|
|
-
|
|
|
-//
|
|
|
-// VerticalSliderView.swift
|
|
|
-// MovieApp
|
|
|
-//
|
|
|
-// Created by Muhammad Naeem Jawaid on 23/07/2017.
|
|
|
-// Copyright © 2017 Muhammad Naeem Jawaid. All rights reserved.
|
|
|
-//
|
|
|
-
|
|
|
-open class VerticalProgressView: UIView {
|
|
|
-
|
|
|
- private let progressView: UIProgressView = {
|
|
|
- let progressView = UIProgressView()
|
|
|
- progressView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- return progressView
|
|
|
- }()
|
|
|
-
|
|
|
- open var progress: Float {
|
|
|
- get {
|
|
|
- return progressView.progress
|
|
|
- }
|
|
|
- set {
|
|
|
- progressView.progress = newValue
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- open var progressViewStyle: UIProgressView.Style {
|
|
|
- get {
|
|
|
- return progressView.progressViewStyle
|
|
|
- }
|
|
|
- set {
|
|
|
- progressView.progressViewStyle = newValue
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- open var progressTintColor: UIColor? {
|
|
|
- get {
|
|
|
- return progressView.progressTintColor
|
|
|
- }
|
|
|
- set {
|
|
|
- progressView.progressTintColor = newValue
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- open var progressImage: UIImage? {
|
|
|
- get {
|
|
|
- return progressView.progressImage
|
|
|
- }
|
|
|
- set {
|
|
|
- progressView.progressImage = newValue
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- open var trackTintColor: UIColor? {
|
|
|
- get {
|
|
|
- return progressView.trackTintColor
|
|
|
- }
|
|
|
- set {
|
|
|
- progressView.trackTintColor = newValue
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- open var trackImage: UIImage? {
|
|
|
- get {
|
|
|
- return progressView.trackImage
|
|
|
- }
|
|
|
- set {
|
|
|
- progressView.trackImage = newValue
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- open var isAscending: Bool = true {
|
|
|
- didSet {
|
|
|
- rotateSlider()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- required public init?(coder aDecoder: NSCoder) {
|
|
|
- super.init(coder: aDecoder)
|
|
|
-
|
|
|
- initialize()
|
|
|
- }
|
|
|
-
|
|
|
- required override public init(frame: CGRect) {
|
|
|
- super.init(frame: frame)
|
|
|
- progressView.frame = frame
|
|
|
- initialize()
|
|
|
- }
|
|
|
-
|
|
|
- convenience init(progressViewStyle style: UIProgressView.Style) {
|
|
|
- self.init()
|
|
|
- initialize()
|
|
|
- progressView.progressViewStyle = style
|
|
|
- }
|
|
|
-
|
|
|
- fileprivate func initialize() {
|
|
|
- rotateSlider()
|
|
|
- addSubview(progressView)
|
|
|
- }
|
|
|
-
|
|
|
- fileprivate func rotateSlider() {
|
|
|
- if isAscending {
|
|
|
- progressView.transform = CGAffineTransform(rotationAngle: .pi * -0.5)
|
|
|
- } else {
|
|
|
- progressView.transform = CGAffineTransform(rotationAngle: .pi * 0.5)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- override open func layoutSubviews() {
|
|
|
- super.layoutSubviews()
|
|
|
-
|
|
|
- let width = bounds.width
|
|
|
- let height = bounds.height
|
|
|
-
|
|
|
- progressView.bounds.size.width = height
|
|
|
- progressView.bounds.size.height = width
|
|
|
- progressView.center.x = bounds.midX
|
|
|
- progressView.center.y = bounds.midY
|
|
|
- }
|
|
|
-
|
|
|
- override open var intrinsicContentSize: CGSize {
|
|
|
- get {
|
|
|
- return CGSize(width: progressView.intrinsicContentSize.height, height: progressView.intrinsicContentSize.width)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- open func setProgress(_ progress: Float, animated: Bool) {
|
|
|
- progressView.setProgress(progress, animated: animated)
|
|
|
- }
|
|
|
-}
|