UI Changes:

Change time format for better readability with titles over 1hr
Add padding between title and media information
Change watched status image to circle check system image
This commit is contained in:
Stephen Byatt 2021-06-22 11:35:28 +10:00
parent a12429ba46
commit ee39d81510
3 changed files with 23 additions and 16 deletions

View File

@ -52,6 +52,7 @@ struct EpisodeItemView: View {
.stroke(Color.secondary, lineWidth: 1))
}
}
.padding(.top, 1)
}
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 98 : 30)
}
@ -89,10 +90,10 @@ struct EpisodeItemView: View {
viewModel.updateWatchState()
} label: {
if viewModel.isWatched {
Image(systemName: "checkmark.rectangle.fill").foregroundColor(Color.primary)
Image(systemName: "checkmark.circle.fill").foregroundColor(Color.primary)
.font(.system(size: 20))
} else {
Image(systemName: "xmark.rectangle").foregroundColor(Color.primary)
Image(systemName: "checkmark.circle").foregroundColor(Color.primary)
.font(.system(size: 20))
}
}
@ -254,6 +255,8 @@ struct EpisodeItemView: View {
Spacer()
}.frame(maxWidth: .infinity, alignment: .leading)
.offset(x: 14)
.padding(.top, 1)
}.frame(maxWidth: .infinity, alignment: .leading)
Spacer()
HStack {
@ -273,10 +276,10 @@ struct EpisodeItemView: View {
viewModel.updateWatchState()
} label: {
if viewModel.isWatched {
Image(systemName: "checkmark.rectangle.fill").foregroundColor(Color.primary)
Image(systemName: "checkmark.circle.fill").foregroundColor(Color.primary)
.font(.system(size: 20))
} else {
Image(systemName: "xmark.rectangle").foregroundColor(Color.primary)
Image(systemName: "checkmark.circle").foregroundColor(Color.primary)
.font(.system(size: 20))
}
}

View File

@ -58,6 +58,7 @@ struct MovieItemView: View {
.stroke(Color.secondary, lineWidth: 1))
}
}
.padding(.top, 1)
}
.padding(.bottom, UIDevice.current.userInterfaceIdiom == .pad ? 98 : 30)
}
@ -95,10 +96,10 @@ struct MovieItemView: View {
viewModel.updateWatchState()
} label: {
if viewModel.isWatched {
Image(systemName: "checkmark.rectangle.fill").foregroundColor(Color.primary)
Image(systemName: "checkmark.circle.fill").foregroundColor(Color.primary)
.font(.system(size: 20))
} else {
Image(systemName: "xmark.rectangle").foregroundColor(Color.primary)
Image(systemName: "checkmark.circle").foregroundColor(Color.primary)
.font(.system(size: 20))
}
}
@ -270,6 +271,7 @@ struct MovieItemView: View {
Spacer()
}.frame(maxWidth: .infinity, alignment: .leading)
.offset(x: 14)
.padding(.top, 1)
}.frame(maxWidth: .infinity, alignment: .leading)
Spacer()
HStack {
@ -289,10 +291,10 @@ struct MovieItemView: View {
viewModel.updateWatchState()
} label: {
if viewModel.isWatched {
Image(systemName: "checkmark.rectangle.fill").foregroundColor(Color.primary)
Image(systemName: "checkmark.circle.fill").foregroundColor(Color.primary)
.font(.system(size: 20))
} else {
Image(systemName: "xmark.rectangle").foregroundColor(Color.primary)
Image(systemName: "checkmark.circle").foregroundColor(Color.primary)
.font(.system(size: 20))
}
}

View File

@ -104,14 +104,16 @@ extension BaseItemDto {
// MARK: Calculations
func getItemRuntime() -> String {
let seconds = (self.runTimeTicks ?? 0) / 10_000_000
let hours = (seconds / 3600)
let minutes = ((seconds - (hours * 3600)) / 60)
if hours != 0 {
return "\(hours):\(String(minutes).leftPad(toWidth: 2, withString: "0"))"
} else {
return "\(String(minutes))m"
}
let timeHMSFormatter: DateComponentsFormatter = {
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .brief
formatter.allowedUnits = [.hour, .minute]
return formatter
}()
let text = timeHMSFormatter.string(from: Double(self.runTimeTicks! / 10_000_000)) ?? ""
return text
}
func getItemProgressString() -> String {