Home telegram - chatTextInputPanelNode
Post
Cancel

telegram - chatTextInputPanelNode

class ChatTextInputPanelNode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
let textInputBackgroundNode: ASImageNode
let textInputContainer: ASDisplayNode
var textInputNode: EditableTextNode?

let actionButtons: ChatTextInputActionButtonsNode

let attachmentButton: HighlightableButtonNode
let attachmentButtonDisabledNode: HighlightableButtonNode

let searchLayoutClearButton: HighlightableButton
let searchLayoutProgressView: UIImageView

var audioRecordingInfoContainerNode: ASDisplayNode?
var audioRecordingDotNode: ASImageNode?
var audioRecordingTimeNode: ChatTextInputAudioRecordingTimeNode?
var audioRecordingCancelIndicator: ChatTextInputAudioRecordingCancelIndicator?

private var accessoryItemButtons: [(ChatTextInputAccessoryItem, AccessoryItemIconButton)] = []

self.addSubnode(self.attachmentButton)
self.addSubnode(self.attachmentButtonDisabledNode)
self.addSubnode(self.actionButtons)

self.addSubnode(self.textInputContainer)
self.addSubnode(self.textInputBackgroundNode)
self.addSubnode(self.textPlaceholderNode)

for (_, button) in self.accessoryItemButtons.reversed() {
    let buttonSize = CGSize(width: button.buttonWidth, height: minimalInputHeight)
    button.updateLayout(size: buttonSize)
    
    let buttonFrame = CGRect(origin: CGPoint(x: nextButtonTopRight.x - buttonSize.width - (17.5 - 9.0 - (button.buttonWidth - button.imageWidth)/2.0), y: nextButtonTopRight.y +
floor((minimalInputHeight - buttonSize.height) / 2.0)), size: buttonSize)
    if button.superview == nil {
        self.view.addSubview(button) // 添加到图层上
        button.frame = buttonFrame
        transition.updateFrame(layer: button.layer, frame: buttonFrame)
        if animatedTransition {
            button.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
            button.layer.animateScale(from: 0.2, to: 1.0, duration: 0.25)
        }
    } else {
        transition.updateFrame(layer: button.layer, frame: buttonFrame)
    }
    nextButtonTopRight.x -= buttonSize.width
    nextButtonTopRight.x -= accessoryButtonSpacing
}

class ChatTextInputActionButtonsNode

1
2
3
4
5
6
let micButton: ChatTextInputMediaRecordingButton
let sendButton: HighlightTrackingButton
var sendButtonRadialStatusNode: ChatSendButtonRadialStatusNode?

let expandMediaInputButton: HighlightableButtonNode
var sendButtonLongPressed: (() -> Void)?

enum ChatTextInputAccessoryItem

1
2
3
4
5
6
7
case keyboard
case stickers(Bool)
case inputButtons
case commands
case silentPost(Bool)
case messageAutoremoveTimeout(Int32?)
case scheduledMessages
This post is licensed under CC BY 4.0 by the author.