themed scrollable subtitle

pull/941/head
Ryan Zhao 2 years ago
parent 12cd02fa0e
commit d803ba20e7

@ -130,8 +130,6 @@ final class ConversationTitleView: UIView {
let diff: CGFloat = (bounds.size.width - oldSize.width)
self.stackViewTrailingConstraint.constant = -max(0, diff)
self.oldSize = bounds.size
print("\(bounds.size.width), \(diff)")
}
public func update(

@ -3,7 +3,7 @@
import UIKit
import SessionUIKit
final class PagedScrollView: UIView {
final class PagedScrollView: UIView, UIScrollViewDelegate {
private static let autoScrollingTimeInterval: TimeInterval = 10
private var slides: [UIView] = []
private var slideSize: CGSize = .zero
@ -20,6 +20,7 @@ final class PagedScrollView: UIView {
result.isPagingEnabled = true
result.showsVerticalScrollIndicator = false
result.showsHorizontalScrollIndicator = false
result.delegate = self
return result
}()
@ -33,8 +34,8 @@ final class PagedScrollView: UIView {
private lazy var pageControl: UIPageControl = {
let result = UIPageControl(frame: .zero)
result.currentPageIndicatorTintColor = .black
result.pageIndicatorTintColor = .gray
result.themeCurrentPageIndicatorTintColor = .textPrimary
result.themePageIndicatorTintColor = .textSecondary
result.themeTintColor = .textPrimary
result.set(.height, to: 5)
result.transform = CGAffineTransform(scaleX: 0.5, y: 0.5)
@ -111,7 +112,6 @@ final class PagedScrollView: UIView {
),
animated: true
)
self.pageControl.currentPage = targetPage
}
}
@ -119,4 +119,9 @@ final class PagedScrollView: UIView {
timer?.invalidate()
timer = nil
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let pageIndex = round(scrollView.contentOffset.x/slideSize.width)
pageControl.currentPage = Int(pageIndex)
}
}

@ -452,6 +452,18 @@ public extension UIContextualAction {
}
}
public extension UIPageControl {
var themeCurrentPageIndicatorTintColor: ThemeValue? {
set { ThemeManager.set(self, keyPath: \.currentPageIndicatorTintColor, to: newValue) }
get { return nil }
}
var themePageIndicatorTintColor: ThemeValue? {
set { ThemeManager.set(self, keyPath: \.pageIndicatorTintColor, to: newValue) }
get { return nil }
}
}
public extension GradientView {
var themeBackgroundGradient: [ThemeValue]? {
set {

Loading…
Cancel
Save