diff --git a/submodules/ChatListSearchItemHeader/Sources/ChatListSearchItemHeader.swift b/submodules/ChatListSearchItemHeader/Sources/ChatListSearchItemHeader.swift index 6aa19911c7..202513dab0 100644 --- a/submodules/ChatListSearchItemHeader/Sources/ChatListSearchItemHeader.swift +++ b/submodules/ChatListSearchItemHeader/Sources/ChatListSearchItemHeader.swift @@ -217,6 +217,7 @@ public final class ChatListSearchItemHeader: ListViewItemHeader { public let action: ((ASDisplayNode) -> Void)? public let height: CGFloat = 28.0 + public let isSticky: Bool = false public init(type: ChatListSearchItemHeaderType, theme: PresentationTheme, strings: PresentationStrings, actionTitle: String? = nil, action: ((ASDisplayNode) -> Void)? = nil) { self.type = type diff --git a/submodules/Display/Source/ListView.swift b/submodules/Display/Source/ListView.swift index 729b32f8f2..a1ab459d40 100644 --- a/submodules/Display/Source/ListView.swift +++ b/submodules/Display/Source/ListView.swift @@ -3873,7 +3873,11 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel switch item.stickDirection { case .top: naturalY = lowerBound - headerFrame = CGRect(origin: CGPoint(x: 0.0, y: min(max(upperDisplayBound, upperBound), lowerBound - itemHeaderHeight)), size: CGSize(width: self.visibleSize.width, height: itemHeaderHeight)) + if item.isSticky { + headerFrame = CGRect(origin: CGPoint(x: 0.0, y: min(max(upperDisplayBound, upperBound), lowerBound - itemHeaderHeight)), size: CGSize(width: self.visibleSize.width, height: itemHeaderHeight)) + } else { + headerFrame = CGRect(origin: CGPoint(x: 0.0, y: min(upperBound, lowerBound - itemHeaderHeight)), size: CGSize(width: self.visibleSize.width, height: itemHeaderHeight)) + } stickLocationDistance = headerFrame.minY - upperBound stickLocationDistanceFactor = max(0.0, min(1.0, stickLocationDistance / itemHeaderHeight)) case .topEdge: diff --git a/submodules/Display/Source/ListViewItemHeader.swift b/submodules/Display/Source/ListViewItemHeader.swift index 6187c5dd0b..92bb2f0868 100644 --- a/submodules/Display/Source/ListViewItemHeader.swift +++ b/submodules/Display/Source/ListViewItemHeader.swift @@ -12,6 +12,7 @@ public protocol ListViewItemHeader: AnyObject { var id: ListViewItemNode.HeaderId { get } var stackingId: ListViewItemNode.HeaderId? { get } var stickDirection: ListViewItemHeaderStickDirection { get } + var isSticky: Bool { get } var height: CGFloat { get } var stickOverInsets: Bool { get } @@ -21,6 +22,12 @@ public protocol ListViewItemHeader: AnyObject { func updateNode(_ node: ListViewItemHeaderNode, previous: ListViewItemHeader?, next: ListViewItemHeader?) } +public extension ListViewItemHeader { + var isSticky: Bool { + return true + } +} + open class ListViewItemHeaderNode: ASDisplayNode { let isRotated: Bool final private(set) var internalStickLocationDistanceFactor: CGFloat = 0.0 diff --git a/submodules/ListSectionHeaderNode/Sources/ListSectionHeaderNode.swift b/submodules/ListSectionHeaderNode/Sources/ListSectionHeaderNode.swift index 015d71cbab..e933bbd643 100644 --- a/submodules/ListSectionHeaderNode/Sources/ListSectionHeaderNode.swift +++ b/submodules/ListSectionHeaderNode/Sources/ListSectionHeaderNode.swift @@ -97,7 +97,7 @@ public final class ListSectionHeaderNode: ASDisplayNode { self.layer.addSublayer(self.backgroundLayer) - self.view.addSubview(self.labelBackgroundView) + //self.view.addSubview(self.labelBackgroundView) self.addSubnode(self.label) //self.backgroundLayer.backgroundColor = theme.chatList.sectionHeaderFillColor.cgColor @@ -159,17 +159,16 @@ public final class ListSectionHeaderNode: ASDisplayNode { self.label.frame = labelFrame let labelBackgroundSize: CGFloat = labelSize.height - let labelBackgroundInnerInset: CGFloat = 6.0 + let labelBackgroundInnerInset: CGFloat = 2.0 let labelBackgroundInset: CGFloat = 10.0 + labelBackgroundInnerInset if self.labelBackgroundView.image?.size.width != labelBackgroundSize + labelBackgroundInset * 2.0 { self.labelBackgroundView.image = blurredImage(generateImage(CGSize(width: labelBackgroundSize + labelBackgroundInset * 2.0, height: labelBackgroundSize + labelBackgroundInset * 2.0), rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) context.setFillColor(UIColor.white.cgColor) context.fillEllipse(in: CGRect(origin: CGPoint(x: labelBackgroundInset - labelBackgroundInnerInset, y: labelBackgroundInset - labelBackgroundInnerInset), size: CGSize(width: labelBackgroundSize + labelBackgroundInnerInset * 2.0, height: labelBackgroundSize + labelBackgroundInnerInset * 2.0))) - })!, radius: 19, iterations: 3)?.stretchableImage(withLeftCapWidth: Int(labelBackgroundInset + labelBackgroundSize * 0.5), topCapHeight: Int(labelBackgroundInset + labelBackgroundSize * 0.5)).withRenderingMode(.alwaysTemplate) + })!, radius: 17, iterations: 3)?.stretchableImage(withLeftCapWidth: Int(labelBackgroundInset + labelBackgroundSize * 0.5), topCapHeight: Int(labelBackgroundInset + labelBackgroundSize * 0.5)).withRenderingMode(.alwaysTemplate) } - self.labelBackgroundView.tintColor = self.theme.list.plainBackgroundColor.withAlphaComponent(self.theme.overallDarkAppearance ? 0.5 : 0.85) - //self.labelBackgroundView.tintColor = UIColor.blue.withMultipliedAlpha(0.8) + self.labelBackgroundView.tintColor = self.theme.list.plainBackgroundColor.withAlphaComponent(self.theme.overallDarkAppearance ? 0.5 : 0.7) self.labelBackgroundView.frame = labelFrame.insetBy(dx: -labelBackgroundInset - 4.0, dy: -labelBackgroundInset) diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift index a2b2b79f37..2e05138cbb 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoVisualMediaPaneNode/Sources/PeerInfoGiftsPaneNode.swift @@ -1435,7 +1435,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr self.currentParams = (size, topInset, sideInset, bottomInset, deviceMetrics, visibleHeight, isScrollingLockedAtTop, expandProgress, navigationHeight, presentationData) self.presentationDataPromise.set(.single(presentationData)) - self.backgroundNode.backgroundColor = presentationData.theme.list.blocksBackgroundColor + //self.backgroundNode.backgroundColor = presentationData.theme.list.blocksBackgroundColor transition.updateFrame(node: self.backgroundNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 48.0), size: size)) transition.updateFrame(node: self.scrollNode, frame: CGRect(origin: CGPoint(), size: size))