mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various Improvements
This commit is contained in:
parent
e98d60353d
commit
1d06d2c013
@ -248,6 +248,10 @@ open class GridNode: GridNodeScroller, UIScrollViewDelegate {
|
|||||||
public override init() {
|
public override init() {
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
|
if #available(iOS 11.0, *) {
|
||||||
|
self.scrollView.contentInsetAdjustmentBehavior = .never
|
||||||
|
}
|
||||||
|
|
||||||
self.scrollView.showsVerticalScrollIndicator = false
|
self.scrollView.showsVerticalScrollIndicator = false
|
||||||
self.scrollView.showsHorizontalScrollIndicator = false
|
self.scrollView.showsHorizontalScrollIndicator = false
|
||||||
self.scrollView.scrollsToTop = false
|
self.scrollView.scrollsToTop = false
|
||||||
|
@ -29,6 +29,8 @@ public class LocalizationListController: ViewController {
|
|||||||
|
|
||||||
private var searchContentNode: NavigationBarSearchContentNode?
|
private var searchContentNode: NavigationBarSearchContentNode?
|
||||||
|
|
||||||
|
private var previousContentOffset: ListViewVisibleContentOffset?
|
||||||
|
|
||||||
public init(context: AccountContext) {
|
public init(context: AccountContext) {
|
||||||
self.context = context
|
self.context = context
|
||||||
|
|
||||||
@ -125,8 +127,29 @@ public class LocalizationListController: ViewController {
|
|||||||
})
|
})
|
||||||
|
|
||||||
self.controllerNode.listNode.visibleContentOffsetChanged = { [weak self] offset in
|
self.controllerNode.listNode.visibleContentOffsetChanged = { [weak self] offset in
|
||||||
if let strongSelf = self, let searchContentNode = strongSelf.searchContentNode {
|
if let strongSelf = self {
|
||||||
searchContentNode.updateListVisibleContentOffset(offset)
|
if let searchContentNode = strongSelf.searchContentNode {
|
||||||
|
searchContentNode.updateListVisibleContentOffset(offset)
|
||||||
|
}
|
||||||
|
|
||||||
|
var previousContentOffsetValue: CGFloat?
|
||||||
|
if let previousContentOffset = strongSelf.previousContentOffset, case let .known(value) = previousContentOffset {
|
||||||
|
previousContentOffsetValue = value
|
||||||
|
}
|
||||||
|
switch offset {
|
||||||
|
case let .known(value):
|
||||||
|
let transition: ContainedViewLayoutTransition
|
||||||
|
if let previousContentOffsetValue = previousContentOffsetValue, value <= 0.0, previousContentOffsetValue > 30.0 {
|
||||||
|
transition = .animated(duration: 0.2, curve: .easeInOut)
|
||||||
|
} else {
|
||||||
|
transition = .immediate
|
||||||
|
}
|
||||||
|
strongSelf.navigationBar?.updateBackgroundAlpha(min(30.0, max(0.0, value - 54.0)) / 30.0, transition: transition)
|
||||||
|
case .unknown, .none:
|
||||||
|
strongSelf.navigationBar?.updateBackgroundAlpha(1.0, transition: .immediate)
|
||||||
|
}
|
||||||
|
|
||||||
|
strongSelf.previousContentOffset = offset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +161,8 @@ public class LocalizationListController: ViewController {
|
|||||||
|
|
||||||
self._ready.set(self.controllerNode._ready.get())
|
self._ready.set(self.controllerNode._ready.get())
|
||||||
|
|
||||||
|
self.navigationBar?.updateBackgroundAlpha(0.0, transition: .immediate)
|
||||||
|
|
||||||
self.displayNodeDidLoad()
|
self.displayNodeDidLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ private func preparedLanguageListNodeTransition(presentationData: PresentationDa
|
|||||||
final class LocalizationListControllerNode: ViewControllerTracingNode {
|
final class LocalizationListControllerNode: ViewControllerTracingNode {
|
||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
private var presentationData: PresentationData
|
private var presentationData: PresentationData
|
||||||
private let navigationBar: NavigationBar
|
private weak var navigationBar: NavigationBar?
|
||||||
private let requestActivateSearch: () -> Void
|
private let requestActivateSearch: () -> Void
|
||||||
private let requestDeactivateSearch: () -> Void
|
private let requestDeactivateSearch: () -> Void
|
||||||
private let present: (ViewController, Any?) -> Void
|
private let present: (ViewController, Any?) -> Void
|
||||||
@ -314,7 +314,7 @@ final class LocalizationListControllerNode: ViewControllerTracingNode {
|
|||||||
self.present = present
|
self.present = present
|
||||||
|
|
||||||
self.listNode = ListView()
|
self.listNode = ListView()
|
||||||
self.listNode.keepTopItemOverscrollBackground = ListViewKeepTopItemOverscrollBackground(color: presentationData.theme.chatList.backgroundColor, direction: true)
|
self.listNode.keepTopItemOverscrollBackground = ListViewKeepTopItemOverscrollBackground(color: presentationData.theme.list.blocksBackgroundColor, direction: true)
|
||||||
self.listNode.accessibilityPageScrolledString = { row, count in
|
self.listNode.accessibilityPageScrolledString = { row, count in
|
||||||
return presentationData.strings.VoiceOver_ScrollStatus(row, count).string
|
return presentationData.strings.VoiceOver_ScrollStatus(row, count).string
|
||||||
}
|
}
|
||||||
@ -594,8 +594,8 @@ final class LocalizationListControllerNode: ViewControllerTracingNode {
|
|||||||
if let strongSelf = self, let strongPlaceholderNode = placeholderNode {
|
if let strongSelf = self, let strongPlaceholderNode = placeholderNode {
|
||||||
if isSearchBar {
|
if isSearchBar {
|
||||||
strongPlaceholderNode.supernode?.insertSubnode(subnode, aboveSubnode: strongPlaceholderNode)
|
strongPlaceholderNode.supernode?.insertSubnode(subnode, aboveSubnode: strongPlaceholderNode)
|
||||||
} else {
|
} else if let navigationBar = strongSelf.navigationBar {
|
||||||
strongSelf.insertSubnode(subnode, belowSubnode: strongSelf.navigationBar)
|
strongSelf.insertSubnode(subnode, belowSubnode: navigationBar)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, placeholder: placeholderNode)
|
}, placeholder: placeholderNode)
|
||||||
|
@ -9,23 +9,23 @@ import TelegramPresentationData
|
|||||||
import AccountContext
|
import AccountContext
|
||||||
import AuthorizationUI
|
import AuthorizationUI
|
||||||
|
|
||||||
private func generateButtonImage(backgroundColor: UIColor, borderColor: UIColor, highlightColor: UIColor?) -> UIImage? {
|
private func generateButtonImage(backgroundColor: UIColor, highlightColor: UIColor?) -> UIImage? {
|
||||||
return generateImage(CGSize(width: 1.0, height: 44.0), contextGenerator: { size, context in
|
return generateImage(CGSize(width: 24.0, height: 44.0), contextGenerator: { size, context in
|
||||||
let bounds = CGRect(origin: CGPoint(), size: size)
|
let bounds = CGRect(origin: CGPoint(), size: size)
|
||||||
context.clear(bounds)
|
context.clear(bounds)
|
||||||
|
|
||||||
|
let path = UIBezierPath(roundedRect: bounds, byRoundingCorners: .allCorners, cornerRadii: CGSize(width: 11.0, height: 11.0))
|
||||||
|
context.addPath(path.cgPath)
|
||||||
|
context.clip()
|
||||||
|
|
||||||
if let highlightColor = highlightColor {
|
if let highlightColor = highlightColor {
|
||||||
context.setFillColor(highlightColor.cgColor)
|
context.setFillColor(highlightColor.cgColor)
|
||||||
context.fill(bounds)
|
context.fill(bounds)
|
||||||
} else {
|
} else {
|
||||||
context.setFillColor(backgroundColor.cgColor)
|
context.setFillColor(backgroundColor.cgColor)
|
||||||
context.fill(bounds)
|
context.fill(bounds)
|
||||||
|
|
||||||
context.setFillColor(borderColor.cgColor)
|
|
||||||
context.fill(CGRect(origin: CGPoint(), size: CGSize(width: 1.0, height: UIScreenPixel)))
|
|
||||||
context.fill(CGRect(origin: CGPoint(x: 0.0, y: size.height - UIScreenPixel), size: CGSize(width: 1.0, height: UIScreenPixel)))
|
|
||||||
}
|
}
|
||||||
})
|
}, opaque: false)?.stretchableImage(withLeftCapWidth: 11, topCapHeight: 11)
|
||||||
}
|
}
|
||||||
|
|
||||||
private let titleFont = Font.bold(17.0)
|
private let titleFont = Font.bold(17.0)
|
||||||
@ -105,8 +105,8 @@ final class PrivacyIntroControllerNode: ViewControllerTracingNode {
|
|||||||
self.buttonTextNode.attributedText = NSAttributedString(string: self.mode.buttonTitle(strings: presentationData.strings), font: buttonFont, textColor: presentationData.theme.list.itemAccentColor, paragraphAlignment: .center)
|
self.buttonTextNode.attributedText = NSAttributedString(string: self.mode.buttonTitle(strings: presentationData.strings), font: buttonFont, textColor: presentationData.theme.list.itemAccentColor, paragraphAlignment: .center)
|
||||||
self.buttonTextNode.isAccessibilityElement = false
|
self.buttonTextNode.isAccessibilityElement = false
|
||||||
self.buttonNode.accessibilityLabel = self.buttonTextNode.attributedText?.string
|
self.buttonNode.accessibilityLabel = self.buttonTextNode.attributedText?.string
|
||||||
self.buttonBackgroundNode.image = generateButtonImage(backgroundColor: presentationData.theme.list.itemBlocksBackgroundColor, borderColor: presentationData.theme.list.itemBlocksSeparatorColor, highlightColor: nil)
|
self.buttonBackgroundNode.image = generateButtonImage(backgroundColor: presentationData.theme.list.itemBlocksBackgroundColor, highlightColor: nil)
|
||||||
self.buttonHighlightedBackgroundNode.image = generateButtonImage(backgroundColor: presentationData.theme.list.itemBlocksBackgroundColor, borderColor: presentationData.theme.list.itemBlocksSeparatorColor, highlightColor: presentationData.theme.list.itemHighlightedBackgroundColor)
|
self.buttonHighlightedBackgroundNode.image = generateButtonImage(backgroundColor: presentationData.theme.list.itemBlocksBackgroundColor, highlightColor: presentationData.theme.list.itemHighlightedBackgroundColor)
|
||||||
|
|
||||||
if let (layout, navigationBarHeight) = self.validLayout {
|
if let (layout, navigationBarHeight) = self.validLayout {
|
||||||
self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
|
self.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
|
||||||
@ -136,11 +136,18 @@ final class PrivacyIntroControllerNode: ViewControllerTracingNode {
|
|||||||
let textSize = self.textNode.measure(CGSize(width: layout.size.width - inset * 2.0, height: CGFloat.greatestFiniteMagnitude))
|
let textSize = self.textNode.measure(CGSize(width: layout.size.width - inset * 2.0, height: CGFloat.greatestFiniteMagnitude))
|
||||||
let noticeSize = self.noticeNode.measure(CGSize(width: layout.size.width - inset * 2.0, height: CGFloat.greatestFiniteMagnitude))
|
let noticeSize = self.noticeNode.measure(CGSize(width: layout.size.width - inset * 2.0, height: CGFloat.greatestFiniteMagnitude))
|
||||||
|
|
||||||
|
let buttonInset: CGFloat
|
||||||
|
if layout.size.width >= 375.0 {
|
||||||
|
buttonInset = max(16.0, floor((layout.size.width - 674.0) / 2.0))
|
||||||
|
} else {
|
||||||
|
buttonInset = 0.0
|
||||||
|
}
|
||||||
|
|
||||||
let items: [AuthorizationLayoutItem] = [
|
let items: [AuthorizationLayoutItem] = [
|
||||||
AuthorizationLayoutItem(node: self.iconNode, size: iconSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
|
AuthorizationLayoutItem(node: self.iconNode, size: iconSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
|
||||||
AuthorizationLayoutItem(node: self.titleNode, size: titleSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 20.0, maxValue: 30.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
|
AuthorizationLayoutItem(node: self.titleNode, size: titleSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 20.0, maxValue: 30.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
|
||||||
AuthorizationLayoutItem(node: self.textNode, size: textSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 16.0, maxValue: 16.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
|
AuthorizationLayoutItem(node: self.textNode, size: textSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 16.0, maxValue: 16.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
|
||||||
AuthorizationLayoutItem(node: self.buttonNode, size: CGSize(width: layout.size.width, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 40.0, maxValue: 40.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
|
AuthorizationLayoutItem(node: self.buttonNode, size: CGSize(width: layout.size.width - buttonInset * 2.0, height: 44.0), spacingBefore: AuthorizationLayoutItemSpacing(weight: 40.0, maxValue: 40.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 0.0, maxValue: 0.0)),
|
||||||
AuthorizationLayoutItem(node: self.noticeNode, size: noticeSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 44.0, maxValue: 44.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 20.0, maxValue: 40.0))
|
AuthorizationLayoutItem(node: self.noticeNode, size: noticeSize, spacingBefore: AuthorizationLayoutItemSpacing(weight: 44.0, maxValue: 44.0), spacingAfter: AuthorizationLayoutItemSpacing(weight: 20.0, maxValue: 40.0))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -774,7 +774,7 @@ private class RecentSessionScreenNode: ViewControllerTracingNode, UIScrollViewDe
|
|||||||
let locationValueTextFrame = CGRect(origin: CGPoint(x: fieldFrame.maxX - locationValueTextSize.width - inset, y: fieldFrame.minY + fieldItemHeight + fieldItemHeight + floorToScreenPixels((fieldItemHeight - locationValueTextSize.height) / 2.0)), size: locationValueTextSize)
|
let locationValueTextFrame = CGRect(origin: CGPoint(x: fieldFrame.maxX - locationValueTextSize.width - inset, y: fieldFrame.minY + fieldItemHeight + fieldItemHeight + floorToScreenPixels((fieldItemHeight - locationValueTextSize.height) / 2.0)), size: locationValueTextSize)
|
||||||
transition.updateFrame(node: self.locationValueNode, frame: locationValueTextFrame)
|
transition.updateFrame(node: self.locationValueNode, frame: locationValueTextFrame)
|
||||||
|
|
||||||
let locationInfoTextSize = self.locationInfoNode.updateLayout(CGSize(width: fieldFrame.width - inset * 2.0, height: fieldItemHeight))
|
let locationInfoTextSize = self.locationInfoNode.updateLayout(CGSize(width: fieldFrame.width - inset * 2.0, height: fieldItemHeight * 2.0))
|
||||||
let locationInfoTextFrame = CGRect(origin: CGPoint(x: fieldFrame.minX + inset, y: fieldFrame.maxY + 6.0), size: locationInfoTextSize)
|
let locationInfoTextFrame = CGRect(origin: CGPoint(x: fieldFrame.minX + inset, y: fieldFrame.maxY + 6.0), size: locationInfoTextSize)
|
||||||
transition.updateFrame(node: self.locationInfoNode, frame: locationInfoTextFrame)
|
transition.updateFrame(node: self.locationInfoNode, frame: locationInfoTextFrame)
|
||||||
|
|
||||||
|
@ -119,6 +119,8 @@ final class ThemeColorsGridController: ViewController {
|
|||||||
|
|
||||||
private var validLayout: ContainerViewLayout?
|
private var validLayout: ContainerViewLayout?
|
||||||
|
|
||||||
|
private var previousContentOffset: GridNodeVisibleContentOffset?
|
||||||
|
|
||||||
init(context: AccountContext) {
|
init(context: AccountContext) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
@ -216,9 +218,34 @@ final class ThemeColorsGridController: ViewController {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
self.controllerNode.gridNode.visibleContentOffsetChanged = { [weak self] offset in
|
||||||
|
if let strongSelf = self {
|
||||||
|
var previousContentOffsetValue: CGFloat?
|
||||||
|
if let previousContentOffset = strongSelf.previousContentOffset, case let .known(value) = previousContentOffset {
|
||||||
|
previousContentOffsetValue = value
|
||||||
|
}
|
||||||
|
switch offset {
|
||||||
|
case let .known(value):
|
||||||
|
let transition: ContainedViewLayoutTransition
|
||||||
|
if let previousContentOffsetValue = previousContentOffsetValue, value <= 0.0, previousContentOffsetValue > 30.0 {
|
||||||
|
transition = .animated(duration: 0.2, curve: .easeInOut)
|
||||||
|
} else {
|
||||||
|
transition = .immediate
|
||||||
|
}
|
||||||
|
strongSelf.navigationBar?.updateBackgroundAlpha(min(30.0, max(0.0, value - 54.0)) / 30.0, transition: transition)
|
||||||
|
case .unknown, .none:
|
||||||
|
strongSelf.navigationBar?.updateBackgroundAlpha(1.0, transition: .immediate)
|
||||||
|
}
|
||||||
|
|
||||||
|
strongSelf.previousContentOffset = offset
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self._ready.set(self.controllerNode.ready.get())
|
self._ready.set(self.controllerNode.ready.get())
|
||||||
|
|
||||||
|
self.navigationBar?.updateBackgroundAlpha(0.0, transition: .immediate)
|
||||||
|
|
||||||
self.displayNodeDidLoad()
|
self.displayNodeDidLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ final class ThemeColorsGridControllerNode: ASDisplayNode {
|
|||||||
self.presentColorPicker = presentColorPicker
|
self.presentColorPicker = presentColorPicker
|
||||||
|
|
||||||
self.gridNode = GridNode()
|
self.gridNode = GridNode()
|
||||||
self.gridNode.showVerticalScrollIndicator = true
|
self.gridNode.showVerticalScrollIndicator = false
|
||||||
self.leftOverlayNode = ASDisplayNode()
|
self.leftOverlayNode = ASDisplayNode()
|
||||||
self.leftOverlayNode.backgroundColor = presentationData.theme.list.blocksBackgroundColor
|
self.leftOverlayNode.backgroundColor = presentationData.theme.list.blocksBackgroundColor
|
||||||
self.rightOverlayNode = ASDisplayNode()
|
self.rightOverlayNode = ASDisplayNode()
|
||||||
@ -271,8 +271,8 @@ final class ThemeColorsGridControllerNode: ASDisplayNode {
|
|||||||
let spacing = floor((layout.size.width - CGFloat(imageCount) * imageSize.width) / CGFloat(imageCount + 1))
|
let spacing = floor((layout.size.width - CGFloat(imageCount) * imageSize.width) / CGFloat(imageCount + 1))
|
||||||
|
|
||||||
var listInsets = insets
|
var listInsets = insets
|
||||||
if layout.size.width > 480.0 {
|
if layout.size.width >= 375.0 {
|
||||||
let inset = max(20.0, floor((layout.size.width - 674.0) / 2.0))
|
let inset = max(16.0, floor((layout.size.width - 674.0) / 2.0))
|
||||||
listInsets.left += inset
|
listInsets.left += inset
|
||||||
listInsets.right += inset
|
listInsets.right += inset
|
||||||
|
|
||||||
@ -307,8 +307,8 @@ final class ThemeColorsGridControllerNode: ASDisplayNode {
|
|||||||
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: -buttonOffset + buttonInset - UIScreenPixel), size: CGSize(width: layout.size.width, height: UIScreenPixel)))
|
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: -buttonOffset + buttonInset - UIScreenPixel), size: CGSize(width: layout.size.width, height: UIScreenPixel)))
|
||||||
transition.updateFrame(node: self.customColorItemNode, frame: CGRect(origin: CGPoint(x: 0.0, y: -buttonOffset + buttonTopInset), size: colorLayout.contentSize))
|
transition.updateFrame(node: self.customColorItemNode, frame: CGRect(origin: CGPoint(x: 0.0, y: -buttonOffset + buttonTopInset), size: colorLayout.contentSize))
|
||||||
|
|
||||||
self.leftOverlayNode.frame = CGRect(x: 0.0, y: -buttonOffset, width: listInsets.left, height: buttonTopInset + colorLayout.contentSize.height)
|
self.leftOverlayNode.frame = CGRect(x: 0.0, y: -buttonOffset, width: listInsets.left, height: buttonTopInset + colorLayout.contentSize.height + UIScreenPixel)
|
||||||
self.rightOverlayNode.frame = CGRect(x: layout.size.width - listInsets.right, y: -buttonOffset, width: listInsets.right, height: buttonTopInset + colorLayout.contentSize.height)
|
self.rightOverlayNode.frame = CGRect(x: layout.size.width - listInsets.right, y: -buttonOffset, width: listInsets.right, height: buttonTopInset + colorLayout.contentSize.height + UIScreenPixel)
|
||||||
|
|
||||||
insets.top += spacing + buttonInset
|
insets.top += spacing + buttonInset
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@ final class ThemeGridController: ViewController {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var previousContentOffset: GridNodeVisibleContentOffset?
|
||||||
|
|
||||||
init(context: AccountContext) {
|
init(context: AccountContext) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
@ -322,8 +324,29 @@ final class ThemeGridController: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.controllerNode.gridNode.visibleContentOffsetChanged = { [weak self] offset in
|
self.controllerNode.gridNode.visibleContentOffsetChanged = { [weak self] offset in
|
||||||
if let strongSelf = self, let searchContentNode = strongSelf.searchContentNode {
|
if let strongSelf = self {
|
||||||
searchContentNode.updateGridVisibleContentOffset(offset)
|
if let searchContentNode = strongSelf.searchContentNode {
|
||||||
|
searchContentNode.updateGridVisibleContentOffset(offset)
|
||||||
|
}
|
||||||
|
|
||||||
|
var previousContentOffsetValue: CGFloat?
|
||||||
|
if let previousContentOffset = strongSelf.previousContentOffset, case let .known(value) = previousContentOffset {
|
||||||
|
previousContentOffsetValue = value
|
||||||
|
}
|
||||||
|
switch offset {
|
||||||
|
case let .known(value):
|
||||||
|
let transition: ContainedViewLayoutTransition
|
||||||
|
if let previousContentOffsetValue = previousContentOffsetValue, value <= 0.0, previousContentOffsetValue > 30.0 {
|
||||||
|
transition = .animated(duration: 0.2, curve: .easeInOut)
|
||||||
|
} else {
|
||||||
|
transition = .immediate
|
||||||
|
}
|
||||||
|
strongSelf.navigationBar?.updateBackgroundAlpha(min(30.0, max(0.0, value - 54.0)) / 30.0, transition: transition)
|
||||||
|
case .unknown, .none:
|
||||||
|
strongSelf.navigationBar?.updateBackgroundAlpha(1.0, transition: .immediate)
|
||||||
|
}
|
||||||
|
|
||||||
|
strongSelf.previousContentOffset = offset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,6 +358,8 @@ final class ThemeGridController: ViewController {
|
|||||||
|
|
||||||
self._ready.set(self.controllerNode.ready.get())
|
self._ready.set(self.controllerNode.ready.get())
|
||||||
|
|
||||||
|
self.navigationBar?.updateBackgroundAlpha(0.0, transition: .immediate)
|
||||||
|
|
||||||
self.displayNodeDidLoad()
|
self.displayNodeDidLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
self.resetWallpapers = resetWallpapers
|
self.resetWallpapers = resetWallpapers
|
||||||
|
|
||||||
self.gridNode = GridNode()
|
self.gridNode = GridNode()
|
||||||
self.gridNode.showVerticalScrollIndicator = true
|
self.gridNode.showVerticalScrollIndicator = false
|
||||||
self.leftOverlayNode = ASDisplayNode()
|
self.leftOverlayNode = ASDisplayNode()
|
||||||
self.leftOverlayNode.backgroundColor = presentationData.theme.list.blocksBackgroundColor
|
self.leftOverlayNode.backgroundColor = presentationData.theme.list.blocksBackgroundColor
|
||||||
self.rightOverlayNode = ASDisplayNode()
|
self.rightOverlayNode = ASDisplayNode()
|
||||||
@ -609,6 +609,7 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
insets.top += navigationBarHeight
|
insets.top += navigationBarHeight
|
||||||
insets.left = layout.safeInsets.left
|
insets.left = layout.safeInsets.left
|
||||||
insets.right = layout.safeInsets.right
|
insets.right = layout.safeInsets.right
|
||||||
|
|
||||||
var scrollIndicatorInsets = insets
|
var scrollIndicatorInsets = insets
|
||||||
|
|
||||||
let minSpacing: CGFloat = 8.0
|
let minSpacing: CGFloat = 8.0
|
||||||
@ -628,8 +629,8 @@ final class ThemeGridControllerNode: ASDisplayNode {
|
|||||||
let makeDescriptionLayout = self.descriptionItemNode.asyncLayout()
|
let makeDescriptionLayout = self.descriptionItemNode.asyncLayout()
|
||||||
|
|
||||||
var listInsets = insets
|
var listInsets = insets
|
||||||
if layout.size.width > 480.0 {
|
if layout.size.width >= 375.0 {
|
||||||
let inset = max(20.0, floor((layout.size.width - 674.0) / 2.0))
|
let inset = max(16.0, floor((layout.size.width - 674.0) / 2.0))
|
||||||
listInsets.left += inset
|
listInsets.left += inset
|
||||||
listInsets.right += inset
|
listInsets.right += inset
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user