Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#531 | Fixing Disabled Color State #536

Merged
merged 2 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Vocable/Common/Views/GazeableButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class GazeableButton: UIButton {
setFillColor(.cellSelectionColor, for: [.selected, .highlighted])
setTitleColor(.collectionViewBackgroundColor, for: .selected)
setTitleColor(.collectionViewBackgroundColor, for: [.selected, .highlighted])
setTitleColor(.white.withAlphaComponent(0.5), for: .disabled)
titleLabel?.numberOfLines = 3
contentEdgeInsets = .init(top: 8, left: 8, bottom: 8, right: 8)
layoutMargins = .zero
Expand Down Expand Up @@ -194,6 +195,11 @@ class GazeableButton: UIButton {
}
}

override func setAttributedTitle(_ title: NSAttributedString?, for state: UIControl.State) {
super.setAttributedTitle(title, for: state)
setTitleColor(titleColor(for: state), for: state)
}

private func updateSelectionAppearance() {

func actions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ struct VocableListContentConfiguration: UIContentConfiguration, Equatable {
accessibilityLabel: String? = nil,
primaryAction: @escaping () -> Void
) {
let attributes: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor.white,
.font: UIFont.systemFont(ofSize: 22, weight: .bold)]
let attributes: [NSAttributedString.Key: Any] = [.font: UIFont.systemFont(ofSize: 22, weight: .bold)]

let attributedText = NSAttributedString(string: title, attributes: attributes)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,7 @@ private extension NSAttributedString {
.localizedStringWithFormat(" %@", buttonText)

let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.systemFont(ofSize: 22, weight: .bold),
.foregroundColor: UIColor.white
.font: UIFont.systemFont(ofSize: 22, weight: .bold)
]

let text = NSMutableAttributedString(string: formatString, attributes: attributes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,13 @@ private extension EditPhrasesViewController {
func phraseCellRegistration() ->
UICollectionView.CellRegistration<VocableListCell, Phrase> {
return .init { cell, _, phrase in
let attributes: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor.white,
.font: UIFont.systemFont(ofSize: 22, weight: .bold)]

let attributedText = NSAttributedString(string: phrase.utterance ?? "", attributes: attributes)
let phraseIdentifier = phrase.objectID

let deleteAction = VocableListCellAction.delete { [weak self] in
self?.presentDeletionPromptForPhrase(with: phraseIdentifier)
}

cell.contentConfiguration = VocableListContentConfiguration(attributedText: attributedText,
cell.contentConfiguration = VocableListContentConfiguration(title: phrase.utterance ?? "",
actions: [deleteAction],
accessory: .disclosureIndicator()) { [weak self] in
self?.presentEditorForPhrase(with: phraseIdentifier)
Expand Down