mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
Temp fixes
This commit is contained in:
parent
3f87ee8321
commit
9d6518a738
5 changed files with 18 additions and 7 deletions
|
|
@ -217,6 +217,7 @@ public final class ChatListSearchItemHeader: ListViewItemHeader {
|
||||||
public let action: ((ASDisplayNode) -> Void)?
|
public let action: ((ASDisplayNode) -> Void)?
|
||||||
|
|
||||||
public let height: CGFloat = 28.0
|
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) {
|
public init(type: ChatListSearchItemHeaderType, theme: PresentationTheme, strings: PresentationStrings, actionTitle: String? = nil, action: ((ASDisplayNode) -> Void)? = nil) {
|
||||||
self.type = type
|
self.type = type
|
||||||
|
|
|
||||||
|
|
@ -3873,7 +3873,11 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
|
||||||
switch item.stickDirection {
|
switch item.stickDirection {
|
||||||
case .top:
|
case .top:
|
||||||
naturalY = lowerBound
|
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
|
stickLocationDistance = headerFrame.minY - upperBound
|
||||||
stickLocationDistanceFactor = max(0.0, min(1.0, stickLocationDistance / itemHeaderHeight))
|
stickLocationDistanceFactor = max(0.0, min(1.0, stickLocationDistance / itemHeaderHeight))
|
||||||
case .topEdge:
|
case .topEdge:
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ public protocol ListViewItemHeader: AnyObject {
|
||||||
var id: ListViewItemNode.HeaderId { get }
|
var id: ListViewItemNode.HeaderId { get }
|
||||||
var stackingId: ListViewItemNode.HeaderId? { get }
|
var stackingId: ListViewItemNode.HeaderId? { get }
|
||||||
var stickDirection: ListViewItemHeaderStickDirection { get }
|
var stickDirection: ListViewItemHeaderStickDirection { get }
|
||||||
|
var isSticky: Bool { get }
|
||||||
var height: CGFloat { get }
|
var height: CGFloat { get }
|
||||||
var stickOverInsets: Bool { get }
|
var stickOverInsets: Bool { get }
|
||||||
|
|
||||||
|
|
@ -21,6 +22,12 @@ public protocol ListViewItemHeader: AnyObject {
|
||||||
func updateNode(_ node: ListViewItemHeaderNode, previous: ListViewItemHeader?, next: ListViewItemHeader?)
|
func updateNode(_ node: ListViewItemHeaderNode, previous: ListViewItemHeader?, next: ListViewItemHeader?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public extension ListViewItemHeader {
|
||||||
|
var isSticky: Bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
open class ListViewItemHeaderNode: ASDisplayNode {
|
open class ListViewItemHeaderNode: ASDisplayNode {
|
||||||
let isRotated: Bool
|
let isRotated: Bool
|
||||||
final private(set) var internalStickLocationDistanceFactor: CGFloat = 0.0
|
final private(set) var internalStickLocationDistanceFactor: CGFloat = 0.0
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ public final class ListSectionHeaderNode: ASDisplayNode {
|
||||||
|
|
||||||
self.layer.addSublayer(self.backgroundLayer)
|
self.layer.addSublayer(self.backgroundLayer)
|
||||||
|
|
||||||
self.view.addSubview(self.labelBackgroundView)
|
//self.view.addSubview(self.labelBackgroundView)
|
||||||
self.addSubnode(self.label)
|
self.addSubnode(self.label)
|
||||||
|
|
||||||
//self.backgroundLayer.backgroundColor = theme.chatList.sectionHeaderFillColor.cgColor
|
//self.backgroundLayer.backgroundColor = theme.chatList.sectionHeaderFillColor.cgColor
|
||||||
|
|
@ -159,17 +159,16 @@ public final class ListSectionHeaderNode: ASDisplayNode {
|
||||||
self.label.frame = labelFrame
|
self.label.frame = labelFrame
|
||||||
|
|
||||||
let labelBackgroundSize: CGFloat = labelSize.height
|
let labelBackgroundSize: CGFloat = labelSize.height
|
||||||
let labelBackgroundInnerInset: CGFloat = 6.0
|
let labelBackgroundInnerInset: CGFloat = 2.0
|
||||||
let labelBackgroundInset: CGFloat = 10.0 + labelBackgroundInnerInset
|
let labelBackgroundInset: CGFloat = 10.0 + labelBackgroundInnerInset
|
||||||
if self.labelBackgroundView.image?.size.width != labelBackgroundSize + labelBackgroundInset * 2.0 {
|
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
|
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.clear(CGRect(origin: CGPoint(), size: size))
|
||||||
context.setFillColor(UIColor.white.cgColor)
|
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)))
|
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 = self.theme.list.plainBackgroundColor.withAlphaComponent(self.theme.overallDarkAppearance ? 0.5 : 0.7)
|
||||||
//self.labelBackgroundView.tintColor = UIColor.blue.withMultipliedAlpha(0.8)
|
|
||||||
|
|
||||||
self.labelBackgroundView.frame = labelFrame.insetBy(dx: -labelBackgroundInset - 4.0, dy: -labelBackgroundInset)
|
self.labelBackgroundView.frame = labelFrame.insetBy(dx: -labelBackgroundInset - 4.0, dy: -labelBackgroundInset)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1435,7 +1435,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
||||||
self.currentParams = (size, topInset, sideInset, bottomInset, deviceMetrics, visibleHeight, isScrollingLockedAtTop, expandProgress, navigationHeight, presentationData)
|
self.currentParams = (size, topInset, sideInset, bottomInset, deviceMetrics, visibleHeight, isScrollingLockedAtTop, expandProgress, navigationHeight, presentationData)
|
||||||
self.presentationDataPromise.set(.single(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.backgroundNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 48.0), size: size))
|
||||||
transition.updateFrame(node: self.scrollNode, frame: CGRect(origin: CGPoint(), size: size))
|
transition.updateFrame(node: self.scrollNode, frame: CGRect(origin: CGPoint(), size: size))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue