Fix background color during transition

In Dark Mode the transition into a folder and back started and ended with a very noticeable white flicker. Now, the color will be updated before every transition.
This commit is contained in:
Danny Moesch 2020-03-21 16:58:11 +01:00 committed by Mingshen Sun
parent 54e104d2f0
commit 4bed5fcf8b

View file

@ -101,6 +101,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
transition.fillMode = CAMediaTimingFillMode.forwards
transition.duration = 0.25
transition.subtype = CATransitionSubtype.fromRight
transition.delegate = self
return transition
}()
@ -111,6 +112,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
transition.fillMode = CAMediaTimingFillMode.forwards
transition.duration = 0.25
transition.subtype = CATransitionSubtype.fromLeft
transition.delegate = self
return transition
}()
@ -675,8 +677,17 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
}
extension PasswordsViewController: UISearchResultsUpdating {
func updateSearchResults(for searchController: UISearchController) {
let scope = SearchBarScope(rawValue: searchController.searchBar.selectedScopeButtonIndex) ?? .all
filterContentForSearchText(searchText: searchController.searchBar.text!, scope: scope)
}
}
extension PasswordsViewController: CAAnimationDelegate {
func animationDidStart(_ anim: CAAnimation) {
view.window?.backgroundColor = Colors.systemBackground
view.layer.backgroundColor = Colors.systemBackground.cgColor
}
}