Fix keyboard focus background on list cells not showing correctly
This commit is contained in:
parent
5ec35b6009
commit
15c83f8332
|
@ -336,6 +336,7 @@
|
|||
D6F0B17524A3A1AA001E48C3 /* MainSidebarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F0B17424A3A1AA001E48C3 /* MainSidebarViewController.swift */; };
|
||||
D6F2E965249E8BFD005846BB /* IssueReporterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F2E963249E8BFD005846BB /* IssueReporterViewController.swift */; };
|
||||
D6F2E966249E8BFD005846BB /* IssueReporterViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D6F2E964249E8BFD005846BB /* IssueReporterViewController.xib */; };
|
||||
D6F4D79429ECB0AF00351B87 /* UIBackgroundConfiguration+AppColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F4D79329ECB0AF00351B87 /* UIBackgroundConfiguration+AppColors.swift */; };
|
||||
D6F6A550291F058600F496A8 /* CreateListService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F6A54F291F058600F496A8 /* CreateListService.swift */; };
|
||||
D6F6A552291F098700F496A8 /* RenameListService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F6A551291F098700F496A8 /* RenameListService.swift */; };
|
||||
D6F6A554291F0D9600F496A8 /* DeleteListService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6F6A553291F0D9600F496A8 /* DeleteListService.swift */; };
|
||||
|
@ -735,6 +736,7 @@
|
|||
D6F0B17424A3A1AA001E48C3 /* MainSidebarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainSidebarViewController.swift; sourceTree = "<group>"; };
|
||||
D6F2E963249E8BFD005846BB /* IssueReporterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueReporterViewController.swift; sourceTree = "<group>"; };
|
||||
D6F2E964249E8BFD005846BB /* IssueReporterViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = IssueReporterViewController.xib; sourceTree = "<group>"; };
|
||||
D6F4D79329ECB0AF00351B87 /* UIBackgroundConfiguration+AppColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIBackgroundConfiguration+AppColors.swift"; sourceTree = "<group>"; };
|
||||
D6F6A54F291F058600F496A8 /* CreateListService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateListService.swift; sourceTree = "<group>"; };
|
||||
D6F6A551291F098700F496A8 /* RenameListService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RenameListService.swift; sourceTree = "<group>"; };
|
||||
D6F6A553291F0D9600F496A8 /* DeleteListService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteListService.swift; sourceTree = "<group>"; };
|
||||
|
@ -1226,6 +1228,7 @@
|
|||
D667E5F02134D5050057A976 /* UIViewController+Delegates.swift */,
|
||||
D667E5F72135C3040057A976 /* Mastodon+Equatable.swift */,
|
||||
D663626B21361C6700C9CBA2 /* Account+Preferences.swift */,
|
||||
D6F4D79329ECB0AF00351B87 /* UIBackgroundConfiguration+AppColors.swift */,
|
||||
D6333B362137838300CE884A /* AttributedString+Helpers.swift */,
|
||||
D6333B782139AEFD00CE884A /* Date+TimeAgo.swift */,
|
||||
D67C57AE21E28EAD00C3118B /* Array+Uniques.swift */,
|
||||
|
@ -2064,6 +2067,7 @@
|
|||
D663626C21361C6700C9CBA2 /* Account+Preferences.swift in Sources */,
|
||||
D67895C0246870DE00D4CD9E /* LocalAccountAvatarView.swift in Sources */,
|
||||
D6ADB6E828E8C878009924AB /* PublicTimelineDescriptionCollectionViewCell.swift in Sources */,
|
||||
D6F4D79429ECB0AF00351B87 /* UIBackgroundConfiguration+AppColors.swift in Sources */,
|
||||
D6333B372137838300CE884A /* AttributedString+Helpers.swift in Sources */,
|
||||
D681A29A249AD62D0085E54E /* LargeImageContentView.swift in Sources */,
|
||||
D6DFC69E242C490400ACC392 /* TrackpadScrollGestureRecognizer.swift in Sources */,
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// UIBackgroundConfiguration+AppColors.swift
|
||||
// Tusker
|
||||
//
|
||||
// Created by Shadowfacts on 4/16/23.
|
||||
// Copyright © 2023 Shadowfacts. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIBackgroundConfiguration {
|
||||
static func appListPlainCell(for state: UICellConfigurationState) -> UIBackgroundConfiguration {
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
if state.isFocused {
|
||||
// use default
|
||||
} else if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appBackground
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
static func appListGroupedCell(for state: UICellConfigurationState) -> UIBackgroundConfiguration {
|
||||
var config = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
if state.isFocused {
|
||||
// use default
|
||||
} else if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
return config
|
||||
}
|
||||
}
|
|
@ -68,13 +68,7 @@ class AccountFollowsListViewController: UIViewController, CollectionViewControll
|
|||
cell.updateUI(accountID: item)
|
||||
|
||||
cell.configurationUpdateHandler = { cell, state in
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appBackground
|
||||
}
|
||||
cell.backgroundConfiguration = config
|
||||
cell.backgroundConfiguration = .appListPlainCell(for: state)
|
||||
}
|
||||
}
|
||||
let loadingCell = UICollectionView.CellRegistration<LoadingCollectionViewCell, Void> { cell, indexPath, item in
|
||||
|
|
|
@ -141,13 +141,7 @@ class ExpandThreadCollectionViewCell: UICollectionViewListCell {
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
if state.isSelected || state.isHighlighted {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appSecondaryBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListPlainCell(for: state)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -143,13 +143,7 @@ class ExploreViewController: UIViewController, UICollectionViewDelegate, Collect
|
|||
cell.contentConfiguration = config
|
||||
|
||||
cell.configurationUpdateHandler = { cell, state in
|
||||
var config = UIBackgroundConfiguration.listGroupedCell()
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
cell.backgroundConfiguration = config
|
||||
cell.backgroundConfiguration = .appListGroupedCell(for: state)
|
||||
}
|
||||
|
||||
switch item {
|
||||
|
|
|
@ -81,13 +81,7 @@ class TrendingLinkTableViewCell: UITableViewCell {
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListGroupedCell(for: state)
|
||||
}
|
||||
|
||||
func updateUI(card: Card) {
|
||||
|
|
|
@ -63,13 +63,7 @@ class EditListAccountsViewController: EnhancedTableViewController {
|
|||
cell.delegate = self
|
||||
cell.updateUI(accountID: id)
|
||||
cell.configurationUpdateHandler = { cell, state in
|
||||
var config = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
cell.backgroundConfiguration = config
|
||||
cell.backgroundConfiguration = .appListGroupedCell(for: state)
|
||||
}
|
||||
return cell
|
||||
})
|
||||
|
|
|
@ -61,13 +61,7 @@ class SwipeActionsPrefsViewController: UIViewController, UICollectionViewDelegat
|
|||
cell.contentConfiguration = config
|
||||
cell.accessories = [.reorder(displayed: .always)]
|
||||
cell.configurationUpdateHandler = { cell, state in
|
||||
var config = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
cell.backgroundConfiguration = config
|
||||
cell.backgroundConfiguration = .appListGroupedCell(for: state)
|
||||
}
|
||||
}
|
||||
let dataSource = UICollectionViewDiffableDataSource<Section, Item>(collectionView: collectionView) { collectionView, indexPath, itemIdentifier in
|
||||
|
|
|
@ -142,13 +142,7 @@ class SearchResultsViewController: UIViewController, CollectionViewController {
|
|||
cell = collectionView.dequeueConfiguredReusableCell(using: statusCell, for: indexPath, item: (id, state))
|
||||
}
|
||||
cell.configurationUpdateHandler = { cell, state in
|
||||
var config = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
cell.backgroundConfiguration = config
|
||||
cell.backgroundConfiguration = .appListGroupedCell(for: state)
|
||||
}
|
||||
return cell
|
||||
}
|
||||
|
|
|
@ -89,13 +89,7 @@ class StatusActionAccountListCollectionViewController: UIViewController, Collect
|
|||
cell.updateUI(statusID: item.0, state: item.1, filterResult: .allow, precomputedContent: nil)
|
||||
|
||||
cell.configurationUpdateHandler = { cell, state in
|
||||
var config = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
cell.backgroundConfiguration = config
|
||||
cell.backgroundConfiguration = .appListGroupedCell(for: state)
|
||||
}
|
||||
}
|
||||
let accountCell = UICollectionView.CellRegistration<AccountCollectionViewCell, String> { [unowned self] cell, indexPath, item in
|
||||
|
@ -103,13 +97,7 @@ class StatusActionAccountListCollectionViewController: UIViewController, Collect
|
|||
cell.updateUI(accountID: item)
|
||||
|
||||
cell.configurationUpdateHandler = { cell, state in
|
||||
var config = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
cell.backgroundConfiguration = config
|
||||
cell.backgroundConfiguration = .appListGroupedCell(for: state)
|
||||
}
|
||||
}
|
||||
let loadingCell = UICollectionView.CellRegistration<LoadingCollectionViewCell, Void> { cell, indexPath, item in
|
||||
|
|
|
@ -119,7 +119,7 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
|||
collectionView.delegate = self
|
||||
collectionView.dragDelegate = self
|
||||
collectionView.allowsFocus = true
|
||||
collectionView.backgroundColor = .appBackground
|
||||
// collectionView.backgroundColor = .appBackground
|
||||
collectionView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(collectionView)
|
||||
NSLayoutConstraint.activate([
|
||||
|
@ -130,7 +130,6 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro
|
|||
])
|
||||
|
||||
registerTimelineLikeCells()
|
||||
collectionView.register(PublicTimelineDescriptionCollectionViewCell.self, forCellWithReuseIdentifier: "publicTimelineDescription")
|
||||
dataSource = createDataSource()
|
||||
applyInitialSnapshot()
|
||||
|
||||
|
|
|
@ -59,13 +59,7 @@ class TrendingHashtagCollectionViewCell: UICollectionViewCell {
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListGroupedCell(for: state)
|
||||
}
|
||||
|
||||
func updateUI(hashtag: Hashtag) {
|
||||
|
|
|
@ -40,13 +40,7 @@ class InstanceTableViewCell: UITableViewCell {
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listGroupedCell()
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListGroupedCell(for: state)
|
||||
}
|
||||
|
||||
func updateUI(instance: InstanceSelector.Instance) {
|
||||
|
|
|
@ -49,13 +49,7 @@ class ActionNotificationGroupTableViewCell: UITableViewCell {
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListPlainCell(for: state)
|
||||
}
|
||||
|
||||
@objc func updateUIForPreferences() {
|
||||
|
|
|
@ -44,13 +44,7 @@ class FollowNotificationGroupTableViewCell: UITableViewCell {
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListPlainCell(for: state)
|
||||
}
|
||||
|
||||
@objc func updateUIForPreferences() {
|
||||
|
|
|
@ -50,13 +50,7 @@ class FollowRequestNotificationTableViewCell: UITableViewCell {
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListPlainCell(for: state)
|
||||
}
|
||||
|
||||
@objc func updateUIForPreferences() {
|
||||
|
|
|
@ -39,13 +39,7 @@ class PollFinishedTableViewCell: UITableViewCell {
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListPlainCell(for: state)
|
||||
}
|
||||
|
||||
func updateUI(notification: Pachyderm.Notification) {
|
||||
|
|
|
@ -36,13 +36,7 @@ class StatusUpdatedNotificationTableViewCell: UITableViewCell {
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListPlainCell(for: state)
|
||||
}
|
||||
|
||||
func updateUI(notification: Pachyderm.Notification) {
|
||||
|
|
|
@ -318,9 +318,7 @@ class ConversationMainStatusCollectionViewCell: UICollectionViewListCell, Status
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
config.backgroundColor = .appBackground
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListPlainCell(for: state)
|
||||
}
|
||||
|
||||
// MARK: Configure UI
|
||||
|
|
|
@ -352,13 +352,7 @@ class TimelineStatusCollectionViewCell: UICollectionViewListCell, StatusCollecti
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListPlainCell(for: state)
|
||||
}
|
||||
|
||||
// MARK: Accessibility
|
||||
|
|
|
@ -94,13 +94,7 @@ class TimelineStatusTableViewCell: BaseStatusTableViewCell {
|
|||
}
|
||||
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListPlainCell(for: state)
|
||||
}
|
||||
|
||||
override func createObserversIfNecessary() {
|
||||
|
|
|
@ -10,12 +10,6 @@ import UIKit
|
|||
|
||||
class TrendingStatusCollectionViewCell: TimelineStatusCollectionViewCell {
|
||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||
var config = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
|
||||
if state.isHighlighted || state.isSelected {
|
||||
config.backgroundColor = .appSelectedCellBackground
|
||||
} else {
|
||||
config.backgroundColor = .appGroupedCellBackground
|
||||
}
|
||||
backgroundConfiguration = config
|
||||
backgroundConfiguration = .appListGroupedCell(for: state)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue