Skip to content

Commit

Permalink
Merge pull request sahin#103 from mobileplayer/feature/improve-defaul…
Browse files Browse the repository at this point in the history
…t-ui

Improve default UI
  • Loading branch information
isair committed Dec 10, 2015
2 parents 08628fd + 5a61530 commit 0d06232
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
18 changes: 9 additions & 9 deletions MobilePlayer/Config/SliderConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,36 +67,36 @@ public class SliderConfig: ElementConfig {
/// - parameters:
/// - dictionary: Toggle button configuration dictionary.
public override init(dictionary: [String: AnyObject]) {
trackHeight = (dictionary["trackHeight"] as? CGFloat) ?? 4
trackCornerRadius = (dictionary["trackCornerRadius"] as? CGFloat) ?? 2
trackHeight = (dictionary["trackHeight"] as? CGFloat) ?? 6
trackCornerRadius = (dictionary["trackCornerRadius"] as? CGFloat) ?? 3

if let minimumTrackTintColorHex = dictionary["minimumTrackTintColor"] as? String {
minimumTrackTintColor = UIColor(hex: minimumTrackTintColorHex)
} else {
minimumTrackTintColor = UIColor.blueColor()
minimumTrackTintColor = UIColor(white: 0.9, alpha: 1)
}

if let availableTrackTintColorHex = dictionary["availableTrackTintColor"] as? String {
availableTrackTintColor = UIColor(hex: availableTrackTintColorHex)
} else {
availableTrackTintColor = UIColor.grayColor()
availableTrackTintColor = UIColor(white: 0.6, alpha: 1)
}

if let maximumTrackTintColorHex = dictionary["maximumTrackTintColor"] as? String {
maximumTrackTintColor = UIColor(hex: maximumTrackTintColorHex)
} else {
maximumTrackTintColor = UIColor.darkGrayColor()
maximumTrackTintColor = UIColor(white: 0.3, alpha: 1)
}

if let thumbTintColorHex = dictionary["thumbTintColor"] as? String {
thumbTintColor = UIColor(hex: thumbTintColorHex)
} else {
thumbTintColor = UIColor.lightGrayColor()
thumbTintColor = UIColor.whiteColor()
}

thumbWidth = (dictionary["thumbWidth"] as? CGFloat) ?? 22
thumbHeight = (dictionary["thumbHeight"] as? CGFloat) ?? 22
thumbCornerRadius = (dictionary["thumbCornerRadius"] as? CGFloat) ?? 11
thumbWidth = (dictionary["thumbWidth"] as? CGFloat) ?? 16
thumbHeight = (dictionary["thumbHeight"] as? CGFloat) ?? 16
thumbCornerRadius = (dictionary["thumbCornerRadius"] as? CGFloat) ?? 8
thumbBorderWidth = (dictionary["thumbBorderWidth"] as? CGFloat) ?? 0

if let thumbBorderColorHex = dictionary["thumbBorderColor"] as? String {
Expand Down
6 changes: 6 additions & 0 deletions MobilePlayer/MobilePlayerOverlayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ protocol MobilePlayerOverlayViewControllerDelegate: class {
public class MobilePlayerOverlayViewController: UIViewController {
weak var delegate: MobilePlayerOverlayViewControllerDelegate?

/// The MobilePlayerViewController instance that the overlay is being shown by.
/// It's value is nil if the overlay is not being shown at the time this property is accessed.
public var mobilePlayer: MobilePlayerViewController? {
return delegate as? MobilePlayerViewController
}

/// Causes the view controller's view to be removed from on top of player content if it is being displayed.
public func dismiss() {
delegate?.dismissMobilePlayerOverlayViewController(self)
Expand Down
2 changes: 1 addition & 1 deletion MobilePlayer/Views/MobilePlayerControlsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class MobilePlayerControlsView: UIView {
bottomBar.addElementUsingConfig(ToggleButtonConfig(dictionary: ["type": "toggleButton", "identifier": "play"]))
bottomBar.addElementUsingConfig(LabelConfig(dictionary: ["type": "label", "identifier": "currentTime"]))
bottomBar.addElementUsingConfig(SliderConfig(dictionary: ["type": "slider", "identifier": "playback"]))
bottomBar.addElementUsingConfig(LabelConfig(dictionary: ["type": "label", "identifier": "duration"]))
bottomBar.addElementUsingConfig(LabelConfig(dictionary: ["type": "label", "identifier": "duration", "marginRight": 8]))
}
addSubview(bottomBar)
}
Expand Down
24 changes: 12 additions & 12 deletions MobilePlayer/WatermarkViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,28 @@ class WatermarkViewController: MobilePlayerOverlayViewController {
watermarkImageView.frame.origin.y = (size.height - watermarkSize.height) / 2
case .Top:
watermarkImageView.frame.origin.x = (size.width - watermarkSize.width) / 2
watermarkImageView.frame.origin.y = 0
watermarkImageView.frame.origin.y = 8
case .TopRight:
watermarkImageView.frame.origin.x = size.width - watermarkSize.width
watermarkImageView.frame.origin.y = 0
watermarkImageView.frame.origin.x = size.width - watermarkSize.width - 8
watermarkImageView.frame.origin.y = 8
case .Right:
watermarkImageView.frame.origin.x = size.width - watermarkSize.width
watermarkImageView.frame.origin.x = size.width - watermarkSize.width - 8
watermarkImageView.frame.origin.y = (size.height - watermarkSize.height) / 2
case .BottomRight:
watermarkImageView.frame.origin.x = size.width - watermarkSize.width
watermarkImageView.frame.origin.y = size.height - watermarkSize.height
watermarkImageView.frame.origin.x = size.width - watermarkSize.width - 8
watermarkImageView.frame.origin.y = size.height - watermarkSize.height - 8
case .Bottom:
watermarkImageView.frame.origin.x = (size.width - watermarkSize.width) / 2
watermarkImageView.frame.origin.y = size.height - watermarkSize.height
watermarkImageView.frame.origin.y = size.height - watermarkSize.height - 8
case .BottomLeft:
watermarkImageView.frame.origin.x = 0
watermarkImageView.frame.origin.y = size.height - watermarkSize.height
watermarkImageView.frame.origin.x = 8
watermarkImageView.frame.origin.y = size.height - watermarkSize.height - 8
case .Left:
watermarkImageView.frame.origin.x = 0
watermarkImageView.frame.origin.x = 8
watermarkImageView.frame.origin.y = (size.height - watermarkSize.height) / 2
case .TopLeft:
watermarkImageView.frame.origin.x = 0
watermarkImageView.frame.origin.y = 0
watermarkImageView.frame.origin.x = 8
watermarkImageView.frame.origin.y = 8
}
}
}

0 comments on commit 0d06232

Please sign in to comment.