This commit is contained in:
DDIsFriend
2023-08-18 17:28:57 +08:00
commit f0e8a1709d
4282 changed files with 192396 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
//
// EKAccessoryNoteMessageView.swift
// SwiftEntryKit
//
// Created by Daniel Huri on 5/4/18.
//
import UIKit
public class EKAccessoryNoteMessageView: UIView {
// MARK: Props
private let contentView = UIView()
private var noteMessageView: EKNoteMessageView!
var accessoryView: UIView!
func setup(with content: EKProperty.LabelContent) {
clipsToBounds = true
addSubview(contentView)
contentView.layoutToSuperview(.centerX, .top, .bottom)
contentView.layoutToSuperview(.left, relation: .greaterThanOrEqual, offset: 16)
contentView.layoutToSuperview(.right, relation: .lessThanOrEqual, offset: -16)
noteMessageView = EKNoteMessageView(with: content)
noteMessageView.horizontalOffset = 8
noteMessageView.verticalOffset = 7
contentView.addSubview(noteMessageView)
noteMessageView.layoutToSuperview(.top, .bottom, .trailing)
contentView.addSubview(accessoryView)
accessoryView.layoutToSuperview(.leading, .centerY)
accessoryView.layout(.trailing, to: .leading, of: noteMessageView)
}
}

View File

@@ -0,0 +1,28 @@
//
// EKImageNoteMessageView.swift
// SwiftEntryKit
//
// Created by Daniel Huri on 5/4/18.
//
import UIKit
public class EKImageNoteMessageView: EKAccessoryNoteMessageView {
// MARK: Setup
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
public init(with content: EKProperty.LabelContent, imageContent: EKProperty.ImageContent) {
super.init(frame: UIScreen.main.bounds)
setup(with: content, imageContent: imageContent)
}
private func setup(with content: EKProperty.LabelContent, imageContent: EKProperty.ImageContent) {
let imageView = UIImageView()
imageView.imageContent = imageContent
accessoryView = imageView
super.setup(with: content)
}
}

View File

@@ -0,0 +1,52 @@
//
// EKNoteMessageView.swift
// SwiftEntryKit
//
// Created by Daniel Huri on 4/19/18.
// Copyright (c) 2018 huri000@gmail.com. All rights reserved.
//
import UIKit
public class EKNoteMessageView: UIView {
// MARK: Props
private let label = UILabel()
private var horizontalConstrainsts: QLAxisConstraints!
private var verticalConstrainsts: QLAxisConstraints!
public var horizontalOffset: CGFloat = 10 {
didSet {
horizontalConstrainsts.first.constant = horizontalOffset
horizontalConstrainsts.second.constant = -horizontalOffset
layoutIfNeeded()
}
}
public var verticalOffset: CGFloat = 5 {
didSet {
verticalConstrainsts.first.constant = verticalOffset
verticalConstrainsts.second.constant = -verticalOffset
layoutIfNeeded()
}
}
// MARK: Setup
public init(with content: EKProperty.LabelContent) {
super.init(frame: UIScreen.main.bounds)
setup(with: content)
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setup(with content: EKProperty.LabelContent) {
clipsToBounds = true
addSubview(label)
label.content = content
horizontalConstrainsts = label.layoutToSuperview(axis: .horizontally, offset: horizontalOffset, priority: .must)
verticalConstrainsts = label.layoutToSuperview(axis: .vertically, offset: verticalOffset, priority: .must)
}
}

View File

@@ -0,0 +1,45 @@
//
// EKProcessingNoteMessageView.swift
// SwiftEntryKit
//
// Created by Daniel Huri on 4/20/18.
// Copyright (c) 2018 huri000@gmail.com. All rights reserved.
//
import UIKit
public class EKProcessingNoteMessageView: EKAccessoryNoteMessageView {
// MARK: Props
private var activityIndicatorView: UIActivityIndicatorView!
private var noteMessageView: EKNoteMessageView!
/** Activity indication can be turned off / on */
public var isProcessing: Bool = true {
didSet {
if isProcessing {
activityIndicatorView.startAnimating()
} else {
activityIndicatorView.stopAnimating()
}
}
}
// MARK: Setup
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
public init(with content: EKProperty.LabelContent, activityIndicator: UIActivityIndicatorView.Style) {
super.init(frame: UIScreen.main.bounds)
setup(with: content, activityIndicator: activityIndicator)
}
private func setup(with content: EKProperty.LabelContent, activityIndicator: UIActivityIndicatorView.Style, setProcessing: Bool = true) {
activityIndicatorView = UIActivityIndicatorView()
activityIndicatorView.style = activityIndicator
isProcessing = setProcessing
accessoryView = activityIndicatorView
super.setup(with: content)
}
}

View File

@@ -0,0 +1,46 @@
//
// EKXStatusBarMessageView.swift
// SwiftEntryKit
//
// Created by Daniel Huri on 4/19/18.
// Copyright (c) 2018 huri000@gmail.com. All rights reserved.
//
import UIKit
public class EKXStatusBarMessageView: UIView {
// MARK: Props
private let leadingLabel = UILabel()
private let trailingLabel = UILabel()
// MARK: Setup
public init(leading: EKProperty.LabelContent, trailing: EKProperty.LabelContent) {
super.init(frame: UIScreen.main.bounds)
setup(leading: leading, trailing: trailing)
}
public required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func setup(leading: EKProperty.LabelContent, trailing: EKProperty.LabelContent) {
clipsToBounds = true
set(.height, of: UIApplication.shared.statusBarFrame.maxY)
addSubview(leadingLabel)
leadingLabel.content = leading
leadingLabel.layoutToSuperview(axis: .vertically)
leadingLabel.layoutToSuperview(.leading)
leadingLabel.layoutToSuperview(.width, ratio: 0.26)
addSubview(trailingLabel)
trailingLabel.content = trailing
trailingLabel.layoutToSuperview(axis: .vertically)
trailingLabel.layoutToSuperview(.trailing)
trailingLabel.layoutToSuperview(.width, ratio: 0.26)
}
}