完善阅读器主题与批注界面

This commit is contained in:
shenlei
2026-07-13 13:01:14 +09:00
parent adc24d3f36
commit 6a0a1223b1
22 changed files with 133 additions and 189 deletions
@@ -4,13 +4,20 @@ final class RDEPUBAnnotationEditorViewController: UIViewController, UITextViewDe
private let quote: String
private let initialNote: String?
private let theme: RDEPUBReaderTheme
private let onSave: (String?) -> Void
private let textView = UITextView()
private let countLabel = UILabel()
init(quote: String, initialNote: String?, onSave: @escaping (String?) -> Void) {
init(
quote: String,
initialNote: String?,
theme: RDEPUBReaderTheme,
onSave: @escaping (String?) -> Void
) {
self.quote = quote
self.initialNote = initialNote
self.theme = theme
self.onSave = onSave
super.init(nibName: nil, bundle: nil)
title = "写注释"
@@ -22,7 +29,7 @@ final class RDEPUBAnnotationEditorViewController: UIViewController, UITextViewDe
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor(red: 0.975, green: 0.965, blue: 0.935, alpha: 1)
view.backgroundColor = theme.toolBackgroundColor
configureNavigation()
configureContent()
updateCount()
@@ -36,9 +43,9 @@ final class RDEPUBAnnotationEditorViewController: UIViewController, UITextViewDe
navigationItem.rightBarButtonItem = UIBarButtonItem(
title: "保存", style: .done, target: self, action: #selector(saveAction)
)
navigationController?.navigationBar.tintColor = UIColor(red: 0.10, green: 0.34, blue: 0.78, alpha: 1)
navigationController?.navigationBar.tintColor = .systemBlue
navigationController?.navigationBar.titleTextAttributes = [
.foregroundColor: UIColor(red: 0.08, green: 0.10, blue: 0.14, alpha: 1),
.foregroundColor: theme.toolControlTextColor,
.font: UIFont.systemFont(ofSize: 17, weight: .semibold)
]
}
@@ -59,16 +66,16 @@ final class RDEPUBAnnotationEditorViewController: UIViewController, UITextViewDe
inputCard.addSubview(textView)
inputCard.addSubview(countLabel)
quoteCard.backgroundColor = UIColor.white.withAlphaComponent(0.78)
quoteCard.backgroundColor = theme.contentBackgroundColor.withAlphaComponent(0.78)
quoteCard.layer.cornerRadius = 16
rail.backgroundColor = UIColor(red: 0.94, green: 0.63, blue: 0.18, alpha: 1)
rail.layer.cornerRadius = 2
quoteLabel.text = quote
quoteLabel.numberOfLines = 5
quoteLabel.font = UIFont.systemFont(ofSize: 16)
quoteLabel.textColor = UIColor(red: 0.19, green: 0.20, blue: 0.23, alpha: 1)
quoteLabel.textColor = theme.contentTextColor.withAlphaComponent(0.85)
inputCard.backgroundColor = .white
inputCard.backgroundColor = theme.contentBackgroundColor
inputCard.layer.cornerRadius = 18
inputCard.layer.shadowColor = UIColor.black.cgColor
inputCard.layer.shadowOpacity = 0.06
@@ -77,7 +84,7 @@ final class RDEPUBAnnotationEditorViewController: UIViewController, UITextViewDe
textView.text = initialNote
textView.delegate = self
textView.font = UIFont.systemFont(ofSize: 17)
textView.textColor = UIColor(red: 0.08, green: 0.10, blue: 0.14, alpha: 1)
textView.textColor = theme.contentTextColor
textView.backgroundColor = .clear
textView.accessibilityIdentifier = "epub.reader.annotation.editor"
countLabel.font = UIFont.monospacedDigitSystemFont(ofSize: 12, weight: .regular)