fix: update audio player slider appearance

This commit is contained in:
CMK 2021-06-17 18:31:14 +08:00
parent b52508dd03
commit 41322c63e3
5 changed files with 44 additions and 26 deletions

View File

@ -81,7 +81,7 @@ internal enum Asset {
internal static let searchCard = ColorAsset(name: "Colors/Shadow/SearchCard")
}
internal enum Slider {
internal static let bar = ColorAsset(name: "Colors/Slider/bar")
internal static let track = ColorAsset(name: "Colors/Slider/track")
}
internal enum TextField {
internal static let background = ColorAsset(name: "Colors/TextField/background")

View File

@ -1,20 +0,0 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "147",
"green" : "106",
"red" : "51"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.600",
"blue" : "213",
"green" : "213",
"red" : "212"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.300",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -54,8 +54,8 @@ final class AudioContainerView: UIView {
let slider = UISlider()
slider.isContinuous = true
slider.translatesAutoresizingMaskIntoConstraints = false
slider.minimumTrackTintColor = Asset.Colors.Slider.bar.color
slider.maximumTrackTintColor = Asset.Colors.Slider.bar.color
slider.minimumTrackTintColor = Asset.Colors.Slider.track.color
slider.maximumTrackTintColor = Asset.Colors.Slider.track.color
if let image = UIImage.placeholder(size: CGSize(width: 22, height: 22), color: .white).withRoundedCorners(radius: 11) {
slider.setThumbImage(image, for: .normal)
}

View File

@ -100,14 +100,14 @@ class AudioContainerViewModel {
switch playbackState {
case .stopped:
audioView.playButton.isSelected = false
audioView.slider.isEnabled = false
audioView.slider.isUserInteractionEnabled = false
audioView.slider.setValue(0, animated: false)
case .paused:
audioView.playButton.isSelected = false
audioView.slider.isEnabled = true
audioView.slider.isUserInteractionEnabled = true
case .playing, .readyToPlay:
audioView.playButton.isSelected = true
audioView.slider.isEnabled = true
audioView.slider.isUserInteractionEnabled = true
default:
assertionFailure()
}