finalize work and fix overlay

This commit is contained in:
Ethan Pippin 2022-01-19 14:33:18 -07:00
parent df73265df3
commit 433d4a97be
2 changed files with 17 additions and 17 deletions

View File

@ -52,14 +52,14 @@ struct VLCPlayerOverlayView: View {
// MARK: Top Bar // MARK: Top Bar
ZStack { ZStack(alignment: .center) {
if viewModel.overlayType == .compact { if viewModel.overlayType == .compact {
LinearGradient(gradient: Gradient(colors: [.black.opacity(0.7), .clear]), LinearGradient(gradient: Gradient(colors: [.black.opacity(0.8), .clear]),
startPoint: .top, startPoint: .top,
endPoint: .bottom) endPoint: .bottom)
.ignoresSafeArea() .ignoresSafeArea()
.frame(height: 80) .frame(height: 70)
} }
VStack(alignment: .EpisodeSeriesAlignmentGuide) { VStack(alignment: .EpisodeSeriesAlignmentGuide) {
@ -78,6 +78,7 @@ struct VLCPlayerOverlayView: View {
Text(viewModel.title) Text(viewModel.title)
.font(.title3) .font(.title3)
.fontWeight(.bold) .fontWeight(.bold)
.lineLimit(1)
.alignmentGuide(.EpisodeSeriesAlignmentGuide) { context in .alignmentGuide(.EpisodeSeriesAlignmentGuide) { context in
context[.leading] context[.leading]
} }
@ -297,12 +298,11 @@ struct VLCPlayerOverlayView: View {
.alignmentGuide(.EpisodeSeriesAlignmentGuide) { context in .alignmentGuide(.EpisodeSeriesAlignmentGuide) { context in
context[.leading] context[.leading]
} }
.offset(y: -20) .offset(y: -18)
} }
} }
.padding(.horizontal, UIDevice.current.userInterfaceIdiom == .pad ? 30 : 0)
} }
.padding(.horizontal, UIDevice.current.userInterfaceIdiom == .pad ? 50 : 0)
.padding(.top, UIDevice.current.userInterfaceIdiom == .pad ? 10 : 0)
// MARK: Center // MARK: Center
@ -336,10 +336,10 @@ struct VLCPlayerOverlayView: View {
// MARK: Bottom Bar // MARK: Bottom Bar
ZStack { ZStack(alignment: .center) {
if viewModel.overlayType == .compact { if viewModel.overlayType == .compact {
LinearGradient(gradient: Gradient(colors: [.clear, .black.opacity(0.7)]), LinearGradient(gradient: Gradient(colors: [.clear, .black.opacity(0.8)]),
startPoint: .top, startPoint: .top,
endPoint: .bottom) endPoint: .bottom)
.ignoresSafeArea() .ignoresSafeArea()
@ -401,12 +401,10 @@ struct VLCPlayerOverlayView: View {
.accessibilityLabel(L10n.remainingTime) .accessibilityLabel(L10n.remainingTime)
.accessibilityValue(viewModel.rightLabelText) .accessibilityValue(viewModel.rightLabelText)
} }
.padding(.horizontal) .padding(.horizontal, UIDevice.current.userInterfaceIdiom == .pad ? 30 : 0)
.frame(maxWidth: UIDevice.current.userInterfaceIdiom == .pad ? 800 : nil) .padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 10 : 0)
} }
.frame(maxHeight: 50)
} }
.ignoresSafeArea(edges: .top)
.tint(Color.white) .tint(Color.white)
.foregroundColor(Color.white) .foregroundColor(Color.white)
} }

View File

@ -151,7 +151,7 @@ class VLCPlayerViewController: UIViewController {
super.viewWillTransition(to: size, with: coordinator) super.viewWillTransition(to: size, with: coordinator)
} }
// MARK: subviews // MARK: VideoContentView
private func makeVideoContentView() -> UIView { private func makeVideoContentView() -> UIView {
let view = UIView() let view = UIView()
@ -161,6 +161,8 @@ class VLCPlayerViewController: UIViewController {
return view return view
} }
// MARK: MainGestureView
private func makeMainGestureView() -> UIView { private func makeMainGestureView() -> UIView {
let view = UIView() let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false view.translatesAutoresizingMaskIntoConstraints = false
@ -206,11 +208,11 @@ class VLCPlayerViewController: UIViewController {
if gestureRecognizer.state == .began || gestureRecognizer.state == .changed { if gestureRecognizer.state == .began || gestureRecognizer.state == .changed {
pinchScale = gestureRecognizer.scale pinchScale = gestureRecognizer.scale
} else { } else {
isScreenFilled.toggle() if pinchScale > 1 && !isScreenFilled {
isScreenFilled.toggle()
if pinchScale > 1 {
fillScreen() fillScreen()
} else { } else if pinchScale < 1 && isScreenFilled {
isScreenFilled.toggle()
shrinkScreen() shrinkScreen()
} }
} }