Skip to content

Commit

Permalink
Lower shadow opacity on skip controls and remove border
Browse files Browse the repository at this point in the history
  • Loading branch information
GianniCarlo committed Aug 12, 2019
1 parent 8c48f9a commit f878458
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 20 deletions.
3 changes: 2 additions & 1 deletion BookPlayer/Extensions/UIView+BookPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ extension UIView {
self.layer.anchorPoint = anchorPoint
}

func addLayerMask(_ name: String, backgroundColor: UIColor) {
func addLayerMask(_ name: String, backgroundColor: UIColor, opacity: Float = 1.0) {
guard let image = UIImage(named: name),
let maskImage = image.cgImage else { return }

let layer = CALayer()
layer.frame = self.bounds
layer.backgroundColor = backgroundColor.cgColor
layer.opacity = opacity

let mask = CALayer(layer: maskImage)
mask.frame = self.bounds
Expand Down
4 changes: 3 additions & 1 deletion BookPlayer/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<array/>
<key>CFBundleTypeName</key>
<string>Audiobook Archive</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>com.pkware.zip-archive</string>
Expand Down Expand Up @@ -187,7 +189,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<string>3</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ extension PlayerControlsViewController: Themeable {
self.progressSlider.maximumTrackTintColor = theme.lightHighlightColor

self.artworkControl.iconColor = .white
self.artworkControl.borderColor = theme.highlightColor

self.currentTimeLabel.textColor = theme.primaryColor
self.maxTimeButton.setTitleColor(theme.primaryColor, for: .normal)
Expand Down
11 changes: 1 addition & 10 deletions BookPlayer/Player/Views/ArtworkControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ class ArtworkControl: UIView, UIGestureRecognizerDelegate {
}
}

var borderColor: UIColor {
get {
return UIColor(cgColor: self.artworkImage.layer.borderColor!)
}

set {
self.artworkImage.layer.borderColor = newValue.withAlphaComponent(0.2).cgColor
}
}

var artwork: UIImage? {
get {
return self.artworkImage.image
Expand Down Expand Up @@ -138,6 +128,7 @@ class ArtworkControl: UIView, UIGestureRecognizerDelegate {
self.artworkImage.contentMode = .scaleAspectFit
self.artworkImage.layer.cornerRadius = 6.0
self.artworkImage.layer.masksToBounds = true
self.artworkImage.layer.borderColor = UIColor.clear.cgColor

self.artworkOverlay.clipsToBounds = false
self.artworkOverlay.contentMode = .scaleAspectFit
Expand Down
4 changes: 2 additions & 2 deletions BookPlayer/Player/Views/PlayerJumpIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class PlayerJumpIconForward: PlayerJumpIcon {
override func setup() {
super.setup()

self.backgroundImageView.addLayerMask("playerIconShadow", backgroundColor: .playerControlsShadowColor)
self.backgroundImageView.addLayerMask("playerIconShadow", backgroundColor: .playerControlsShadowColor, opacity: 0.5)
self.backgroundImageView.addLayerMask("playerIconForwardArrowShadow", backgroundColor: .black)
self.backgroundImageView.addLayerMask("playerIconForward", backgroundColor: .white)
self.title = "+\(Int(PlayerManager.shared.forwardInterval.rounded()))s"
Expand All @@ -98,7 +98,7 @@ class PlayerJumpIconRewind: PlayerJumpIcon {
override func setup() {
super.setup()

self.backgroundImageView.addLayerMask("playerIconShadow", backgroundColor: .playerControlsShadowColor)
self.backgroundImageView.addLayerMask("playerIconShadow", backgroundColor: .playerControlsShadowColor, opacity: 0.5)
self.backgroundImageView.addLayerMask("playerIconRewindArrowShadow", backgroundColor: .black)
self.backgroundImageView.addLayerMask("playerIconRewind", backgroundColor: .white)
self.title = "\(Int(PlayerManager.shared.rewindInterval.rounded()))s"
Expand Down
4 changes: 2 additions & 2 deletions BookPlayerWatch Extension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>3.3.1</string>
<string>3.4.0</string>
<key>CFBundleVersion</key>
<string>2</string>
<string>3</string>
<key>CLKComplicationPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ComplicationController</string>
<key>CLKComplicationSupportedFamilies</key>
Expand Down
2 changes: 1 addition & 1 deletion BookPlayerWatch/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>3.4.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>3</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
4 changes: 2 additions & 2 deletions BookPlayerWidget/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>3.4.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>3</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
Expand Down

0 comments on commit f878458

Please sign in to comment.