Improves iPad layout

main
Laurent 2 years ago
parent 9b35f69fb2
commit f0900bca79
  1. 4
      LeCountdown.xcodeproj/project.pbxproj
  2. 9
      LeCountdown/Views/Countdown/CountdownDialView.swift
  3. 9
      LeCountdown/Views/DialView.swift
  4. 24
      LeCountdown/Views/Reusable/ViewStyles.swift
  5. 9
      LeCountdown/Views/Stopwatch/StopwatchDialView.swift

@ -37,6 +37,7 @@
C415D3F729C378D10037B215 /* QP01 0037 Tropical forest morning.wav in Resources */ = {isa = PBXBuildFile; fileRef = C415D3F629C378D10037B215 /* QP01 0037 Tropical forest morning.wav */; }; C415D3F729C378D10037B215 /* QP01 0037 Tropical forest morning.wav in Resources */ = {isa = PBXBuildFile; fileRef = C415D3F629C378D10037B215 /* QP01 0037 Tropical forest morning.wav */; };
C415D3FB29C37A460037B215 /* QP01 0096 Wetland lake early morning.wav in Resources */ = {isa = PBXBuildFile; fileRef = C415D3FA29C37A460037B215 /* QP01 0096 Wetland lake early morning.wav */; }; C415D3FB29C37A460037B215 /* QP01 0096 Wetland lake early morning.wav in Resources */ = {isa = PBXBuildFile; fileRef = C415D3FA29C37A460037B215 /* QP01 0096 Wetland lake early morning.wav */; };
C415D3FD29C37AA40037B215 /* QP01 0118 Riparian Zone thrush.wav in Resources */ = {isa = PBXBuildFile; fileRef = C415D3FC29C37AA40037B215 /* QP01 0118 Riparian Zone thrush.wav */; }; C415D3FD29C37AA40037B215 /* QP01 0118 Riparian Zone thrush.wav in Resources */ = {isa = PBXBuildFile; fileRef = C415D3FC29C37AA40037B215 /* QP01 0118 Riparian Zone thrush.wav */; };
C419EEE52AC5AC0200A66BBB /* ViewStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = C419EEE42AC5AC0200A66BBB /* ViewStyles.swift */; };
C4286E962A14EC4E0070D075 /* AppError.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4286E952A14EC4E0070D075 /* AppError.swift */; }; C4286E962A14EC4E0070D075 /* AppError.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4286E952A14EC4E0070D075 /* AppError.swift */; };
C4286EA12A1502FD0070D075 /* Stopwatch+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4286E9F2A1502FD0070D075 /* Stopwatch+CoreDataClass.swift */; }; C4286EA12A1502FD0070D075 /* Stopwatch+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4286E9F2A1502FD0070D075 /* Stopwatch+CoreDataClass.swift */; };
C4286EA32A1503320070D075 /* Stopwatch+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4286E9F2A1502FD0070D075 /* Stopwatch+CoreDataClass.swift */; }; C4286EA32A1503320070D075 /* Stopwatch+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4286E9F2A1502FD0070D075 /* Stopwatch+CoreDataClass.swift */; };
@ -379,6 +380,7 @@
C415D3FA29C37A460037B215 /* QP01 0096 Wetland lake early morning.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = "QP01 0096 Wetland lake early morning.wav"; sourceTree = "<group>"; }; C415D3FA29C37A460037B215 /* QP01 0096 Wetland lake early morning.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = "QP01 0096 Wetland lake early morning.wav"; sourceTree = "<group>"; };
C415D3FC29C37AA40037B215 /* QP01 0118 Riparian Zone thrush.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = "QP01 0118 Riparian Zone thrush.wav"; sourceTree = "<group>"; }; C415D3FC29C37AA40037B215 /* QP01 0118 Riparian Zone thrush.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = "QP01 0118 Riparian Zone thrush.wav"; sourceTree = "<group>"; };
C418A14F298428CB00C22230 /* LeCountdown.0.1.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = LeCountdown.0.1.xcdatamodel; sourceTree = "<group>"; }; C418A14F298428CB00C22230 /* LeCountdown.0.1.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = LeCountdown.0.1.xcdatamodel; sourceTree = "<group>"; };
C419EEE42AC5AC0200A66BBB /* ViewStyles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewStyles.swift; sourceTree = "<group>"; };
C4286E952A14EC4E0070D075 /* AppError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppError.swift; sourceTree = "<group>"; }; C4286E952A14EC4E0070D075 /* AppError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppError.swift; sourceTree = "<group>"; };
C4286E9F2A1502FD0070D075 /* Stopwatch+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Stopwatch+CoreDataClass.swift"; sourceTree = "<group>"; }; C4286E9F2A1502FD0070D075 /* Stopwatch+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Stopwatch+CoreDataClass.swift"; sourceTree = "<group>"; };
C4286EA52A150A7E0070D075 /* TimePickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimePickerView.swift; sourceTree = "<group>"; }; C4286EA52A150A7E0070D075 /* TimePickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimePickerView.swift; sourceTree = "<group>"; };
@ -973,6 +975,7 @@
C4BA2B2E299E69A000CB4FBA /* View+Extension.swift */, C4BA2B2E299E69A000CB4FBA /* View+Extension.swift */,
C4742B5E2984205000D5D950 /* ViewModifiers.swift */, C4742B5E2984205000D5D950 /* ViewModifiers.swift */,
C4E5D67929B8C5A1008E7465 /* VolumeView.swift */, C4E5D67929B8C5A1008E7465 /* VolumeView.swift */,
C419EEE42AC5AC0200A66BBB /* ViewStyles.swift */,
); );
path = Reusable; path = Reusable;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1279,6 +1282,7 @@
C4742B5F2984205000D5D950 /* ViewModifiers.swift in Sources */, C4742B5F2984205000D5D950 /* ViewModifiers.swift in Sources */,
C4F8B1D8298C0727005C86A5 /* TimerRouter.swift in Sources */, C4F8B1D8298C0727005C86A5 /* TimerRouter.swift in Sources */,
C4BA2B13299BE61E00CB4FBA /* Countdown+CoreDataProperties.swift in Sources */, C4BA2B13299BE61E00CB4FBA /* Countdown+CoreDataProperties.swift in Sources */,
C419EEE52AC5AC0200A66BBB /* ViewStyles.swift in Sources */,
C4F8B186298AC234005C86A5 /* Activity+CoreDataClass.swift in Sources */, C4F8B186298AC234005C86A5 /* Activity+CoreDataClass.swift in Sources */,
C4BA2B57299FFA4F00CB4FBA /* AppGuard.swift in Sources */, C4BA2B57299FFA4F00CB4FBA /* AppGuard.swift in Sources */,
C4F8B15729891271005C86A5 /* Conductor.swift in Sources */, C4F8B15729891271005C86A5 /* Conductor.swift in Sources */,

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
struct CountdownDialView: View { struct CountdownDialView: View, DialStyle {
@EnvironmentObject var conductor: Conductor @EnvironmentObject var conductor: Conductor
@Environment(\.colorScheme) var colorScheme @Environment(\.colorScheme) var colorScheme
@ -19,7 +19,10 @@ struct CountdownDialView: View {
var body: some View { var body: some View {
HStack { HStack {
VStack(alignment: .leading) { if UIDevice.isPadIdiom {
Spacer()
}
VStack(alignment: self.dialAlignment) {
Text(countdown.activity?.name?.uppercased() ?? "") Text(countdown.activity?.name?.uppercased() ?? "")
.foregroundColor(self._titleColor) .foregroundColor(self._titleColor)
.multilineTextAlignment(.leading) .multilineTextAlignment(.leading)
@ -28,7 +31,7 @@ struct CountdownDialView: View {
.foregroundColor(self._durationColor) .foregroundColor(self._durationColor)
} }
Spacer() Spacer()
} }.font(.system(size: self.dialFontSize))
} }
private var _titleColor: Color { private var _titleColor: Color {

@ -65,11 +65,16 @@ struct DialView: View {
} }
} }
}.background(self._dialBackgroundColor) }
.frame(width: frameSize, height: 80.0) .background(self._dialBackgroundColor)
.frame(width: frameSize, height: self._height)
.cornerRadius(20.0) .cornerRadius(20.0)
} }
fileprivate var _height: CGFloat {
return UIDevice.isPhoneIdiom ? 80.0 : 200.0
}
private var _dialBackgroundColor: Color { private var _dialBackgroundColor: Color {
let darkMode = self.colorScheme == .dark let darkMode = self.colorScheme == .dark
let isEditing = self.isEditingBinding.wrappedValue let isEditing = self.isEditingBinding.wrappedValue

@ -0,0 +1,24 @@
//
// ViewStyles.swift
// LeCountdown
//
// Created by Laurent Morvillier on 28/09/2023.
//
import Foundation
import UIKit
import SwiftUI
protocol DialStyle { }
extension DialStyle {
var dialFontSize: CGFloat {
return UIDevice.isPhoneIdiom ? 17.0 : 24.0
}
var dialAlignment: HorizontalAlignment {
return UIDevice.isPhoneIdiom ? .leading : .center
}
}

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
struct StopwatchDialView: View { struct StopwatchDialView: View, DialStyle {
@EnvironmentObject var conductor: Conductor @EnvironmentObject var conductor: Conductor
@Environment(\.colorScheme) var colorScheme @Environment(\.colorScheme) var colorScheme
@ -18,7 +18,12 @@ struct StopwatchDialView: View {
var body: some View { var body: some View {
HStack { HStack {
Text(stopwatch.activity?.name?.uppercased() ?? "").foregroundColor(self._titleColor) if UIDevice.isPadIdiom {
Spacer()
}
Text(stopwatch.activity?.name?.uppercased() ?? "")
.foregroundColor(self._titleColor)
.font(.system(size: self.dialFontSize))
Spacer() Spacer()
} }
} }

Loading…
Cancel
Save