mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Improve Player Controls view
This commit is contained in:
parent
28709a2c80
commit
cc68e53f42
@ -89,7 +89,6 @@ struct ContentView: View {
|
|||||||
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)
|
SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared)
|
||||||
SDWebImageManager.defaultImageCache = PINCache(name: "net.yattee.app")
|
SDWebImageManager.defaultImageCache = PINCache(name: "net.yattee.app")
|
||||||
|
|
||||||
// TODO: Remove when piped supports videos information
|
|
||||||
if let account = accounts.lastUsed ??
|
if let account = accounts.lastUsed ??
|
||||||
instances.lastUsed?.anonymousAccount ??
|
instances.lastUsed?.anonymousAccount ??
|
||||||
instances.all.first?.anonymousAccount
|
instances.all.first?.anonymousAccount
|
||||||
|
@ -31,27 +31,24 @@ struct PlayerControlsView<Content: View>: View {
|
|||||||
model.presentingPlayer.toggle()
|
model.presentingPlayer.toggle()
|
||||||
}) {
|
}) {
|
||||||
HStack {
|
HStack {
|
||||||
if let item = model.currentItem {
|
VStack(alignment: .leading, spacing: 3) {
|
||||||
HStack(spacing: 3) {
|
Text(model.currentItem?.video.title ?? "Not playing")
|
||||||
Text(item.video.title)
|
.font(.system(size: 14).bold())
|
||||||
.fontWeight(.bold)
|
.foregroundColor(model.currentItem.isNil ? .secondary : .accentColor)
|
||||||
.foregroundColor(.accentColor)
|
.lineLimit(1)
|
||||||
.lineLimit(1)
|
|
||||||
|
|
||||||
Text("— \(item.video.author)")
|
Text(model.currentItem?.video.author ?? "Yattee v0.1")
|
||||||
.fontWeight(.semibold)
|
.fontWeight(model.currentItem.isNil ? .light : .bold)
|
||||||
.foregroundColor(.secondary)
|
.font(.system(size: 10))
|
||||||
.lineLimit(1)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Text("Not playing")
|
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
.lineLimit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
.padding(.vertical, 20)
|
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
}
|
}
|
||||||
|
.padding(.vertical, 20)
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
.keyboardShortcut("o")
|
.keyboardShortcut("o")
|
||||||
#endif
|
#endif
|
||||||
@ -74,8 +71,9 @@ struct PlayerControlsView<Content: View>: View {
|
|||||||
.disabled(model.player.currentItem.isNil)
|
.disabled(model.player.currentItem.isNil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.font(.system(size: 30))
|
||||||
.frame(minWidth: 30)
|
.frame(minWidth: 30)
|
||||||
.scaleEffect(1.7)
|
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
.keyboardShortcut("p")
|
.keyboardShortcut("p")
|
||||||
#endif
|
#endif
|
||||||
@ -89,10 +87,10 @@ struct PlayerControlsView<Content: View>: View {
|
|||||||
ProgressView(value: progressViewValue, total: progressViewTotal)
|
ProgressView(value: progressViewValue, total: progressViewTotal)
|
||||||
.progressViewStyle(.linear)
|
.progressViewStyle(.linear)
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
.offset(x: 0, y: 15)
|
.offset(x: 0, y: 8)
|
||||||
.frame(maxWidth: 60)
|
.frame(maxWidth: 60)
|
||||||
#else
|
#else
|
||||||
.offset(x: 0, y: 20)
|
.offset(x: 0, y: 15)
|
||||||
.frame(maxWidth: 70)
|
.frame(maxWidth: 70)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -100,7 +98,7 @@ struct PlayerControlsView<Content: View>: View {
|
|||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
.labelStyle(.iconOnly)
|
.labelStyle(.iconOnly)
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
.frame(minWidth: 0, maxWidth: .infinity)
|
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: 55)
|
||||||
.padding(.vertical, 0)
|
.padding(.vertical, 0)
|
||||||
.background(.ultraThinMaterial)
|
.background(.ultraThinMaterial)
|
||||||
.borderTop(height: 0.4, color: Color("PlayerControlsBorderColor"))
|
.borderTop(height: 0.4, color: Color("PlayerControlsBorderColor"))
|
||||||
|
Loading…
Reference in New Issue
Block a user