Dynamic progress indicator

This commit is contained in:
Isaac 2024-05-14 16:45:14 +04:00
parent c6ca23181e
commit 2cf5bd724a
2 changed files with 16 additions and 3 deletions

View File

@ -37,6 +37,7 @@ swift_library(
"//submodules/TelegramAnimatedStickerNode", "//submodules/TelegramAnimatedStickerNode",
"//submodules/ActivityIndicator", "//submodules/ActivityIndicator",
"//submodules/UndoUI", "//submodules/UndoUI",
"//submodules/RadialStatusNode",
], ],
visibility = [ visibility = [
"//visibility:public", "//visibility:public",

View File

@ -16,13 +16,14 @@ import ChatMessageBackground
import WallpaperBackgroundNode import WallpaperBackgroundNode
import AppBundle import AppBundle
import ActivityIndicator import ActivityIndicator
import RadialStatusNode
final class SendButton: HighlightTrackingButton { final class SendButton: HighlightTrackingButton {
private let containerView: UIView private let containerView: UIView
private var backgroundContent: WallpaperBubbleBackgroundNode? private var backgroundContent: WallpaperBubbleBackgroundNode?
private let backgroundLayer: SimpleLayer private let backgroundLayer: SimpleLayer
private let iconView: UIImageView private let iconView: UIImageView
private var activityIndicator: ActivityIndicator? private var activityIndicator: RadialStatusNode?
private var didProcessSourceCustomContent: Bool = false private var didProcessSourceCustomContent: Bool = false
private var sourceCustomContentView: UIView? private var sourceCustomContentView: UIView?
@ -127,12 +128,23 @@ final class SendButton: HighlightTrackingButton {
if isLoadingEffectAnimation { if isLoadingEffectAnimation {
var animateIn = false var animateIn = false
let activityIndicator: ActivityIndicator let activityIndicator: RadialStatusNode
if let current = self.activityIndicator { if let current = self.activityIndicator {
activityIndicator = current activityIndicator = current
} else { } else {
animateIn = true animateIn = true
activityIndicator = ActivityIndicator(type: .custom(presentationData.theme.list.itemCheckColors.foregroundColor, 18.0, 2.0, true)) activityIndicator = RadialStatusNode(
backgroundNodeColor: .clear,
enableBlur: false,
isPreview: false
)
activityIndicator.transitionToState(.progress(
color: presentationData.theme.list.itemCheckColors.foregroundColor,
lineWidth: 2.0,
value: nil,
cancelEnabled: false,
animateRotation: true
))
self.activityIndicator = activityIndicator self.activityIndicator = activityIndicator
self.containerView.addSubview(activityIndicator.view) self.containerView.addSubview(activityIndicator.view)
} }