mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Smaller tabbar if names are hidden, closes #115
Fix spacing for smaller devices
This commit is contained in:
parent
15dbdd4fe5
commit
35caff956b
@ -12,6 +12,7 @@ private extension ToolbarTheme {
|
|||||||
|
|
||||||
final class TabBarControllerNode: ASDisplayNode {
|
final class TabBarControllerNode: ASDisplayNode {
|
||||||
private var navigationBarPresentationData: NavigationBarPresentationData
|
private var navigationBarPresentationData: NavigationBarPresentationData
|
||||||
|
private let showTabNames: Bool // MARK: Swiftgram
|
||||||
private var theme: TabBarControllerTheme
|
private var theme: TabBarControllerTheme
|
||||||
let tabBarNode: TabBarNode
|
let tabBarNode: TabBarNode
|
||||||
private let disabledOverlayNode: ASDisplayNode
|
private let disabledOverlayNode: ASDisplayNode
|
||||||
@ -45,6 +46,7 @@ final class TabBarControllerNode: ASDisplayNode {
|
|||||||
|
|
||||||
init(showTabNames: Bool, theme: TabBarControllerTheme, navigationBarPresentationData: NavigationBarPresentationData, itemSelected: @escaping (Int, Bool, [ASDisplayNode]) -> Void, contextAction: @escaping (Int, ContextExtractedContentContainingNode, ContextGesture) -> Void, swipeAction: @escaping (Int, TabBarItemSwipeDirection) -> Void, toolbarActionSelected: @escaping (ToolbarActionOption) -> Void, disabledPressed: @escaping () -> Void) {
|
init(showTabNames: Bool, theme: TabBarControllerTheme, navigationBarPresentationData: NavigationBarPresentationData, itemSelected: @escaping (Int, Bool, [ASDisplayNode]) -> Void, contextAction: @escaping (Int, ContextExtractedContentContainingNode, ContextGesture) -> Void, swipeAction: @escaping (Int, TabBarItemSwipeDirection) -> Void, toolbarActionSelected: @escaping (ToolbarActionOption) -> Void, disabledPressed: @escaping () -> Void) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
self.showTabNames = showTabNames
|
||||||
self.navigationBarPresentationData = navigationBarPresentationData
|
self.navigationBarPresentationData = navigationBarPresentationData
|
||||||
self.tabBarNode = TabBarNode(showTabNames: showTabNames, theme: theme, itemSelected: itemSelected, contextAction: contextAction, swipeAction: swipeAction)
|
self.tabBarNode = TabBarNode(showTabNames: showTabNames, theme: theme, itemSelected: itemSelected, contextAction: contextAction, swipeAction: swipeAction)
|
||||||
self.tabBarNode.isHidden = SGSimpleSettings.shared.hideTabBar
|
self.tabBarNode.isHidden = SGSimpleSettings.shared.hideTabBar
|
||||||
@ -103,8 +105,10 @@ final class TabBarControllerNode: ASDisplayNode {
|
|||||||
let bottomInset: CGFloat = layout.insets(options: options).bottom
|
let bottomInset: CGFloat = layout.insets(options: options).bottom
|
||||||
if !layout.safeInsets.left.isZero {
|
if !layout.safeInsets.left.isZero {
|
||||||
tabBarHeight = 34.0 + bottomInset
|
tabBarHeight = 34.0 + bottomInset
|
||||||
|
if !self.showTabNames { tabBarHeight -= 6.0 } // MARK: Swiftgram
|
||||||
} else {
|
} else {
|
||||||
tabBarHeight = 49.0 + bottomInset
|
tabBarHeight = 49.0 + bottomInset
|
||||||
|
if !self.showTabNames { tabBarHeight -= 12.0 } // MARK: Swiftgram
|
||||||
}
|
}
|
||||||
|
|
||||||
let tabBarFrame = CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - (self.tabBarHidden ? 0.0 : tabBarHeight)), size: CGSize(width: layout.size.width, height: tabBarHeight))
|
let tabBarFrame = CGRect(origin: CGPoint(x: 0.0, y: layout.size.height - (self.tabBarHidden ? 0.0 : tabBarHeight)), size: CGSize(width: layout.size.width, height: tabBarHeight))
|
||||||
|
@ -272,6 +272,7 @@ open class TabBarControllerImpl: ViewController, TabBarController {
|
|||||||
} else {
|
} else {
|
||||||
tabBarHeight = 49.0 + bottomInset
|
tabBarHeight = 49.0 + bottomInset
|
||||||
}
|
}
|
||||||
|
if !strongSelf.showTabNames { tabBarHeight -= 12.0 } // MARK: Swiftgram
|
||||||
updatedLayout.intrinsicInsets.bottom = tabBarHeight
|
updatedLayout.intrinsicInsets.bottom = tabBarHeight
|
||||||
|
|
||||||
strongSelf.controllers[index].containerLayoutUpdated(updatedLayout, transition: .immediate)
|
strongSelf.controllers[index].containerLayoutUpdated(updatedLayout, transition: .immediate)
|
||||||
@ -448,8 +449,10 @@ open class TabBarControllerImpl: ViewController, TabBarController {
|
|||||||
let bottomInset: CGFloat = updatedLayout.insets(options: options).bottom
|
let bottomInset: CGFloat = updatedLayout.insets(options: options).bottom
|
||||||
if !updatedLayout.safeInsets.left.isZero {
|
if !updatedLayout.safeInsets.left.isZero {
|
||||||
tabBarHeight = 34.0 + bottomInset
|
tabBarHeight = 34.0 + bottomInset
|
||||||
|
if !self.showTabNames { tabBarHeight -= 6.0 } // MARK: Swiftgram
|
||||||
} else {
|
} else {
|
||||||
tabBarHeight = 49.0 + bottomInset
|
tabBarHeight = 49.0 + bottomInset
|
||||||
|
if !self.showTabNames { tabBarHeight -= 12.0 } // MARK: Swiftgram
|
||||||
}
|
}
|
||||||
if !self.tabBarControllerNode.tabBarHidden {
|
if !self.tabBarControllerNode.tabBarHidden {
|
||||||
updatedLayout.intrinsicInsets.bottom = tabBarHeight
|
updatedLayout.intrinsicInsets.bottom = tabBarHeight
|
||||||
@ -477,8 +480,10 @@ open class TabBarControllerImpl: ViewController, TabBarController {
|
|||||||
let bottomInset: CGFloat = updatedLayout.insets(options: options).bottom
|
let bottomInset: CGFloat = updatedLayout.insets(options: options).bottom
|
||||||
if !updatedLayout.safeInsets.left.isZero {
|
if !updatedLayout.safeInsets.left.isZero {
|
||||||
tabBarHeight = 34.0 + bottomInset
|
tabBarHeight = 34.0 + bottomInset
|
||||||
|
if !self.showTabNames { tabBarHeight -= 6.0 } // MARK: Swiftgram
|
||||||
} else {
|
} else {
|
||||||
tabBarHeight = 49.0 + bottomInset
|
tabBarHeight = 49.0 + bottomInset
|
||||||
|
if !self.showTabNames { tabBarHeight -= 12.0 } // MARK: Swiftgram
|
||||||
}
|
}
|
||||||
if !self.tabBarControllerNode.tabBarHidden {
|
if !self.tabBarControllerNode.tabBarHidden {
|
||||||
updatedLayout.intrinsicInsets.bottom = tabBarHeight
|
updatedLayout.intrinsicInsets.bottom = tabBarHeight
|
||||||
|
Loading…
x
Reference in New Issue
Block a user