Compare commits

...

6 Commits

Author SHA1 Message Date
fish 1a525c763e 归档笔记保留 Note 格式化操作
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-17 22:33:41 +08:00
fish a0dffdc715 增大收集箱列表文案与时间间距 2026-07-16 21:46:43 +08:00
fish 4765d48021 收集箱列表展示完整文案 2026-07-16 21:44:51 +08:00
fish f888e28d15 添加简体中文本地化支持 2026-07-16 21:38:07 +08:00
fish c934dbad84 调整完成按钮与键盘的间距 2026-07-16 21:35:40 +08:00
fish 4088db8ec0 编辑页完成按钮改为玻璃浮动效果 2026-07-16 21:26:36 +08:00
5 changed files with 34 additions and 22 deletions
+1
View File
@@ -184,6 +184,7 @@
knownRegions = (
en,
Base,
"zh-Hans",
);
mainGroup = CFD40B073003C283009C9F2A;
minimizedProjectReferenceProxies = 1;
+29 -15
View File
@@ -10,6 +10,8 @@ import UIKit
class ClipEditViewController: UIViewController {
private var textView: UITextView!
private var floatingDoneButton: UIButton!
private var floatingDoneButtonBottomConstraint: NSLayoutConstraint!
private var clip: Clip
init(clip: Clip) {
@@ -52,6 +54,8 @@ class ClipEditViewController: UIViewController {
UIView.animate(withDuration: duration, delay: 0, options: .beginFromCurrentState) {
self.textView.contentInset.bottom = keyboardHeight
self.textView.verticalScrollIndicatorInsets.bottom = keyboardHeight
self.floatingDoneButtonBottomConstraint.constant = -(keyboardHeight + 8)
self.floatingDoneButton.alpha = 1
self.view.layoutIfNeeded()
}
}
@@ -62,6 +66,8 @@ class ClipEditViewController: UIViewController {
UIView.animate(withDuration: duration, delay: 0, options: .beginFromCurrentState) {
self.textView.contentInset.bottom = 0
self.textView.verticalScrollIndicatorInsets.bottom = 0
self.floatingDoneButtonBottomConstraint.constant = -16
self.floatingDoneButton.alpha = 0
self.view.layoutIfNeeded()
}
}
@@ -94,31 +100,39 @@ class ClipEditViewController: UIViewController {
textView.font = UIFont.preferredFont(forTextStyle: .body)
textView.textContainerInset = UIEdgeInsets(top: 12, left: 12, bottom: 12, right: 12)
textView.text = clip.text
textView.inputAccessoryView = createInputAccessoryView()
view.addSubview(textView)
var doneConfig = UIButton.Configuration.glass()
doneConfig.title = "完成"
doneConfig.titleTextAttributesTransformer = UIConfigurationTextAttributesTransformer { incoming in
var outgoing = incoming
outgoing.font = UIFont.systemFont(ofSize: 17, weight: .semibold)
return outgoing
}
doneConfig.baseForegroundColor = .label
doneConfig.cornerStyle = .capsule
doneConfig.contentInsets = NSDirectionalEdgeInsets(top: 15, leading: 22, bottom: 15, trailing: 22)
floatingDoneButton = UIButton(configuration: doneConfig)
floatingDoneButton.translatesAutoresizingMaskIntoConstraints = false
floatingDoneButton.alpha = 0
floatingDoneButton.addTarget(self, action: #selector(didTapFloatingDoneButton), for: .touchUpInside)
view.addSubview(floatingDoneButton)
let safeArea = view.safeAreaLayoutGuide
floatingDoneButtonBottomConstraint = floatingDoneButton.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -16)
NSLayoutConstraint.activate([
textView.topAnchor.constraint(equalTo: safeArea.topAnchor, constant: 16),
textView.leadingAnchor.constraint(equalTo: safeArea.leadingAnchor, constant: 16),
textView.trailingAnchor.constraint(equalTo: safeArea.trailingAnchor, constant: -16),
textView.bottomAnchor.constraint(equalTo: safeArea.bottomAnchor, constant: -16)
textView.bottomAnchor.constraint(equalTo: safeArea.bottomAnchor, constant: -16),
floatingDoneButton.trailingAnchor.constraint(equalTo: safeArea.trailingAnchor, constant: -16),
floatingDoneButtonBottomConstraint
])
}
private func createInputAccessoryView() -> UIToolbar {
let toolbar = UIToolbar(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: 44))
toolbar.barStyle = .default
toolbar.isTranslucent = true
let flexSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
let doneButton = UIBarButtonItem(title: "完成", style: .done, target: self, action: #selector(didTapKeyboardDoneButton))
toolbar.items = [flexSpace, doneButton]
toolbar.sizeToFit()
return toolbar
}
@objc private func didTapKeyboardDoneButton() {
@objc private func didTapFloatingDoneButton() {
textView.resignFirstResponder()
}
+3 -3
View File
@@ -246,8 +246,10 @@ extension ClipInboxViewController: UITableViewDataSource {
var config = cell.defaultContentConfiguration()
config.text = previewText(for: clip.text)
config.textProperties.numberOfLines = 0
config.secondaryText = formattedDate(clip.createdAt)
config.secondaryTextProperties.color = .secondaryLabel
config.textToSecondaryTextVerticalPadding = 12
cell.contentConfiguration = config
cell.accessoryType = .disclosureIndicator
@@ -255,9 +257,7 @@ extension ClipInboxViewController: UITableViewDataSource {
}
private func previewText(for text: String) -> String {
let lines = text.components(separatedBy: .newlines)
let firstTwoLines = Array(lines.prefix(2))
let preview = firstTwoLines.joined(separator: " ").trimmingCharacters(in: .whitespaces)
let preview = text.trimmingCharacters(in: .whitespacesAndNewlines)
if preview.isEmpty {
return "(无内容)"
}
-4
View File
@@ -35,10 +35,6 @@ class FormatNoteViewController: UIViewController {
setupUI()
if let initialText = initialText {
textView.text = initialText
isNoteFormatted = true
noteButton.setTitle("复制并打开备忘录", for: .normal)
rightBarButtonMode = .reset
updateRightBarButtonItem()
}
setupKeyboardObservers()
}
+1
View File
@@ -0,0 +1 @@
/* Simplified Chinese localization */