From 0b39382f26b241df83c47e4bad05e158bb91d023 Mon Sep 17 00:00:00 2001 From: Marcus Zhou Date: Wed, 11 Dec 2019 12:06:14 -0500 Subject: [PATCH] Fix a problem that caused texts and backgrounds to appear in inverted colors --- NineAnimator/Base.lproj/Settings.storyboard | 93 +++++++++++++------ .../SettingsDownloadsController.swift | 1 + NineAnimator/Views/Theme/Theme.swift | 16 ++-- .../UITableViewCell+StyleAttributes.swift | 7 ++ 4 files changed, 83 insertions(+), 34 deletions(-) diff --git a/NineAnimator/Base.lproj/Settings.storyboard b/NineAnimator/Base.lproj/Settings.storyboard index ee9cf0501..f5039cd58 100644 --- a/NineAnimator/Base.lproj/Settings.storyboard +++ b/NineAnimator/Base.lproj/Settings.storyboard @@ -18,7 +18,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -59,7 +59,7 @@ - + @@ -100,7 +100,7 @@ - + @@ -138,7 +138,7 @@ - + @@ -158,7 +158,7 @@ - + @@ -182,7 +182,7 @@ - + @@ -217,7 +217,7 @@ - + @@ -252,7 +252,7 @@ - + @@ -484,7 +484,7 @@ NineAnimator uses Background App Refresh to determine if a new episode of a subs - + @@ -498,7 +498,7 @@ NineAnimator uses Background App Refresh to determine if a new episode of a subs - + @@ -522,7 +522,7 @@ NineAnimator uses Background App Refresh to determine if a new episode of a subs - + - + - + @@ -1448,6 +1448,9 @@ NineAnimator is not affiliated with simkl.com. + + + @@ -1493,6 +1496,9 @@ The system may delete downloaded contents when disk space is low. + + + @@ -1533,6 +1539,9 @@ The system may delete downloaded contents when disk space is low. + + + @@ -1565,6 +1574,9 @@ The system may delete downloaded contents when disk space is low. + + + @@ -1606,6 +1618,9 @@ Enable Prevent Purging to protect episodes from being deleted by the system. The + + + @@ -1619,6 +1634,10 @@ Enable Prevent Purging to protect episodes from being deleted by the system. The + + + + @@ -1636,6 +1655,9 @@ Enable Prevent Purging to protect episodes from being deleted by the system. The + + + @@ -1649,6 +1671,10 @@ Enable Prevent Purging to protect episodes from being deleted by the system. The + + + + @@ -1666,13 +1692,16 @@ Enable Prevent Purging to protect episodes from being deleted by the system. The + + + - + @@ -1689,10 +1718,11 @@ Enable Prevent Purging to protect episodes from being deleted by the system. The + - + @@ -1704,9 +1734,16 @@ Enable Prevent Purging to protect episodes from being deleted by the system. The + + + + + + + diff --git a/NineAnimator/Controllers/Settings Scene/SettingsDownloadsController.swift b/NineAnimator/Controllers/Settings Scene/SettingsDownloadsController.swift index 4148f6011..b3ff42f19 100644 --- a/NineAnimator/Controllers/Settings Scene/SettingsDownloadsController.swift +++ b/NineAnimator/Controllers/Settings Scene/SettingsDownloadsController.swift @@ -43,6 +43,7 @@ class SettingsDownloadsController: UITableViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + self.tableView.makeThemable() self.reloadUsage() } diff --git a/NineAnimator/Views/Theme/Theme.swift b/NineAnimator/Views/Theme/Theme.swift index 4cb0bff5b..1efc75e4e 100644 --- a/NineAnimator/Views/Theme/Theme.swift +++ b/NineAnimator/Views/Theme/Theme.swift @@ -133,13 +133,17 @@ extension Theme { view.backgroundColor = theme.background view.indicatorStyle = theme.scrollIndicatorStyle case let view as UITableViewCell: - // For table view cell, set the content background color to clear - // and the background color to the theme background color - if view.tintText { - view.textLabel?.textColor = theme.tint - } else { view.textLabel?.textColor = theme.primaryText } + // Update label colors + if !view.determinedLabelColors { + // For table view cell, set the content background color to clear + // and the background color to the theme background color + if view.tintText { + view.textLabel?.textColor = theme.tint + } else { view.textLabel?.textColor = theme.primaryText } + + view.detailTextLabel?.textColor = theme.secondaryText + } - view.detailTextLabel?.textColor = theme.secondaryText view.backgroundColor = theme.background view.contentView.backgroundColor = .clear view.textLabel?.backgroundColor = .clear diff --git a/NineAnimator/Views/Theme/UITableViewCell+StyleAttributes.swift b/NineAnimator/Views/Theme/UITableViewCell+StyleAttributes.swift index 41ed53b98..838b4e494 100644 --- a/NineAnimator/Views/Theme/UITableViewCell+StyleAttributes.swift +++ b/NineAnimator/Views/Theme/UITableViewCell+StyleAttributes.swift @@ -26,4 +26,11 @@ extension UITableViewCell { get { return themableOptionsStore["cell.tintText"] as? Bool ?? false } set { themableOptionsStore["cell.tintText"] = newValue } } + + /// Mark the color of the labels in this cell as predetermined + /// - Note: This prevents `Theme` from updating the foreground colors of the labels in the cell. + @IBInspectable var determinedLabelColors: Bool { + get { return themableOptionsStore["cell.determinedLabelColors"] as? Bool ?? false } + set { themableOptionsStore["cell.determinedLabelColors"] = newValue } + } }