Merge branch 'develop' into bugfix/layout_accessibility_fx
This commit is contained in:
commit
01f7e87981
@ -140,7 +140,7 @@ open class CaretView: View {
|
|||||||
caretPath.addLine(to: CGPoint(x: frame.size.width - inset, y: frame.size.height - inset))
|
caretPath.addLine(to: CGPoint(x: frame.size.width - inset, y: frame.size.height - inset))
|
||||||
}
|
}
|
||||||
|
|
||||||
enabledColor.setStroke()
|
_ = isEnabled ? enabledColor.setStroke() : disabledColor.setStroke()
|
||||||
caretPath.stroke()
|
caretPath.stroke()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +160,7 @@ open class CaretView: View {
|
|||||||
isHidden = false
|
isHidden = false
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
enabledColor = .mvmBlack
|
enabledColor = .mvmBlack
|
||||||
|
disabledColor = .mvmCoolGray3
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensure you have defined a CaretSize with Orientation before calling.
|
/// Ensure you have defined a CaretSize with Orientation before calling.
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
public var contentMode: UIView.ContentMode?
|
public var contentMode: UIView.ContentMode?
|
||||||
public var localBundle: Bundle?
|
public var localBundle: Bundle?
|
||||||
public var cornerRadius: CGFloat?
|
public var cornerRadius: CGFloat?
|
||||||
|
public var clipsImage: Bool?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
@ -51,5 +52,6 @@
|
|||||||
case height
|
case height
|
||||||
case contentMode
|
case contentMode
|
||||||
case cornerRadius
|
case cornerRadius
|
||||||
|
case clipsImage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -254,6 +254,10 @@ import UIKit
|
|||||||
clipsToBounds = true
|
clipsToBounds = true
|
||||||
layer.cornerRadius = cornerRadius
|
layer.cornerRadius = cornerRadius
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let clipsImage = imageModel.clipsImage {
|
||||||
|
clipsToBounds = clipsImage
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - load functions
|
// MARK: - load functions
|
||||||
|
|||||||
@ -8,20 +8,24 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
enum MFTransparentGIFViewError: Error {
|
||||||
|
case gifNotFoundError
|
||||||
|
}
|
||||||
|
|
||||||
@objcMembers public class MFTransparentGIFView: FLAnimatedImageView {
|
@objcMembers public class MFTransparentGIFView: FLAnimatedImageView {
|
||||||
var imageData: Data?
|
var imageData: Data?
|
||||||
|
|
||||||
/** Creates the GIF display view with the passed in frame.
|
/** Creates the GIF display view with the passed in frame.
|
||||||
frame: frame to set the view to.
|
frame: frame to set the view to.
|
||||||
ImageName: name of the .gif to load. Should not contain the extension.
|
ImageName: name of the .gif to load. Should not contain the extension. Local images only.
|
||||||
StartImmediately: should the gif immeidately begin playing. If YES, it will start. If NO, call [performAnimations] to start it.
|
StartImmediately: should the gif immeidately begin playing. If YES, it will start. If NO, call [performAnimations] to start it.
|
||||||
Duration: how long the animation takes to loop. Pass a negative value to use the default.
|
Duration: how long the animation takes to loop. Pass a negative value to use the default.
|
||||||
LoopCompletionBlock: a block called whenever the gif finishes a loop.
|
LoopCompletionBlock: a block called whenever the gif finishes a loop.
|
||||||
animatedImage : set as nil when use this view in reusable cell
|
animatedImage : set as nil when use this view in reusable cell
|
||||||
*/
|
*/
|
||||||
public init(withFrame frame: CGRect, imageName: String, startImmediately: Bool, duration: TimeInterval, loopCompletionBlock: ((UInt) -> Void)?) {
|
public init(withFrame frame: CGRect, imageName: String, startImmediately: Bool, duration: TimeInterval, loopCompletionBlock: ((UInt) -> Void)?) throws {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
loadImage(imageName, startImmediately: startImmediately, duration: duration, loopCompletionBlock: loopCompletionBlock)
|
try loadImage(imageName, startImmediately: startImmediately, duration: duration, loopCompletionBlock: loopCompletionBlock)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
@ -32,7 +36,7 @@ import UIKit
|
|||||||
super.init(coder: aDecoder)
|
super.init(coder: aDecoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func loadImage(_ imageName: String, startImmediately: Bool, duration: TimeInterval, loopCompletionBlock: ((UInt) -> Void)?) {
|
public func loadImage(_ imageName: String, startImmediately: Bool, duration: TimeInterval, loopCompletionBlock: ((UInt) -> Void)?) throws {
|
||||||
contentMode = UIView.ContentMode.scaleAspectFill
|
contentMode = UIView.ContentMode.scaleAspectFill
|
||||||
clipsToBounds = true
|
clipsToBounds = true
|
||||||
|
|
||||||
@ -42,13 +46,10 @@ import UIKit
|
|||||||
self.loopCompletionBlock = loopCompletionBlock
|
self.loopCompletionBlock = loopCompletionBlock
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
|
|
||||||
var url: URL?
|
guard let url = MVMCoreUIUtility.bundleForMVMCoreUI()?.url(forResource: imageName, withExtension: "gif") else {
|
||||||
if imageName.contains("http") {
|
throw MFTransparentGIFViewError.gifNotFoundError
|
||||||
url = URL(string: imageName)
|
|
||||||
} else {
|
|
||||||
url = MVMCoreUIUtility.bundleForMVMCoreUI()?.url(forResource: imageName, withExtension: "gif")
|
|
||||||
}
|
}
|
||||||
imageData = MFFreebeeHandler.shared()?.freebee_data(withContentsOf: url)
|
imageData = try Data(contentsOf: url)
|
||||||
|
|
||||||
runLoopMode = RunLoop.Mode.common.rawValue
|
runLoopMode = RunLoop.Mode.common.rawValue
|
||||||
if startImmediately {
|
if startImmediately {
|
||||||
|
|||||||
@ -9,12 +9,21 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class AccordionListItemModel: MoleculeListItemModel {
|
class AccordionListItemModel: MoleculeListItemModel {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
override public class var identifier: String {
|
override public class var identifier: String {
|
||||||
return "accordionListItem"
|
return "accordionListItem"
|
||||||
}
|
}
|
||||||
|
|
||||||
public var molecules: [ListItemModelProtocol & MoleculeModelProtocol]
|
public var molecules: [ListItemModelProtocol & MoleculeModelProtocol]
|
||||||
public var hideLineWhenExpanded: Bool = false
|
public var hideLineWhenExpanded: Bool = false
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case molecules
|
case molecules
|
||||||
@ -22,11 +31,19 @@ class AccordionListItemModel: MoleculeListItemModel {
|
|||||||
case hideLineWhenExpanded
|
case hideLineWhenExpanded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Methods
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override func setDefaults() {
|
public override func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
hideArrow = true
|
hideArrow = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
molecules = try typeContainer.decodeModels(codingKey: .molecules)
|
molecules = try typeContainer.decodeModels(codingKey: .molecules)
|
||||||
|
|||||||
@ -8,20 +8,29 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
@objcMembers public class AccordionMoleculeTableViewCell: MoleculeTableViewCell {
|
@objcMembers public class AccordionMoleculeTableViewCell: MoleculeTableViewCell {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
var accordionListItemModel: AccordionListItemModel? {
|
var accordionListItemModel: AccordionListItemModel? {
|
||||||
return listItemModel as? AccordionListItemModel
|
return listItemModel as? AccordionListItemModel
|
||||||
}
|
}
|
||||||
let accordionButton = createAccordionButton()
|
|
||||||
|
|
||||||
static func createAccordionButton() -> Button {
|
let accordionButton: Button = {
|
||||||
let accordionButton = Button(type: .custom)
|
let accordionButton = Button(type: .custom)
|
||||||
accordionButton.setTitle("+", for: .normal)
|
accordionButton.setTitle("+", for: .normal)
|
||||||
accordionButton.setTitleColor(.black, for: .normal)
|
accordionButton.setTitleColor(.black, for: .normal)
|
||||||
accordionButton.titleLabel?.font = UIFont.systemFont(ofSize: 40, weight: .ultraLight)
|
accordionButton.titleLabel?.font = UIFont.systemFont(ofSize: 40, weight: .ultraLight)
|
||||||
accordionButton.frame = CGRect(x: 0, y: 0, width: 20, height: 20)
|
accordionButton.frame = CGRect(x: 0, y: 0, width: 20, height: 20)
|
||||||
|
accordionButton.translatesAutoresizingMaskIntoConstraints = true
|
||||||
return accordionButton
|
return accordionButton
|
||||||
}
|
}()
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Setup
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
override public func setupView() {
|
override public func setupView() {
|
||||||
customAccessoryView = true
|
customAccessoryView = true
|
||||||
@ -29,11 +38,13 @@ import UIKit
|
|||||||
accessoryView = accordionButton
|
accessoryView = accordionButton
|
||||||
}
|
}
|
||||||
|
|
||||||
override public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
override public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
accordionButton.isSelected = !accordionButton.isSelected
|
|
||||||
|
accordionButton.isSelected.toggle()
|
||||||
accordionButton.setTitle(accordionButton.isSelected ? "-" : "+", for: .normal)
|
accordionButton.setTitle(accordionButton.isSelected ? "-" : "+", for: .normal)
|
||||||
|
|
||||||
guard let model = accordionListItemModel else { return }
|
guard let model = accordionListItemModel else { return }
|
||||||
|
|
||||||
if accordionButton.isSelected {
|
if accordionButton.isSelected {
|
||||||
if let indexPath = delegateObject?.moleculeDelegate?.getIndexPath(for: model) {
|
if let indexPath = delegateObject?.moleculeDelegate?.getIndexPath(for: model) {
|
||||||
delegateObject?.moleculeDelegate?.addMolecules(model.molecules, indexPath: indexPath, animation: .automatic)
|
delegateObject?.moleculeDelegate?.addMolecules(model.molecules, indexPath: indexPath, animation: .automatic)
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import Foundation
|
|||||||
|
|
||||||
open class BGImageMolecule: MoleculeContainer {
|
open class BGImageMolecule: MoleculeContainer {
|
||||||
|
|
||||||
let image = LoadImageView(pinnedEdges: .all)
|
public let image = LoadImageView(pinnedEdges: .all)
|
||||||
|
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
open class BGImageMoleculeModel: MoleculeContainerModel {
|
open class BGImageMoleculeModel: MoleculeContainerModel {
|
||||||
public override class var identifier: String {
|
open override class var identifier: String {
|
||||||
return "bgImageContainer"
|
return "bgImageContainer"
|
||||||
}
|
}
|
||||||
public var image: ImageViewModel
|
public var image: ImageViewModel
|
||||||
@ -44,7 +44,7 @@ open class BGImageMoleculeModel: MoleculeContainerModel {
|
|||||||
try super.init(from: decoder)
|
try super.init(from: decoder)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func encode(to encoder: Encoder) throws {
|
open override func encode(to encoder: Encoder) throws {
|
||||||
try super.encode(to: encoder)
|
try super.encode(to: encoder)
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encode(image, forKey: .image)
|
try container.encode(image, forKey: .image)
|
||||||
|
|||||||
@ -8,8 +8,12 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol, MVMCoreViewProtocol, MFButtonProtocol {
|
|
||||||
|
|
||||||
|
@objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol, MVMCoreViewProtocol, MFButtonProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
open var molecule: MoleculeViewProtocol?
|
open var molecule: MoleculeViewProtocol?
|
||||||
open var listItemModel: ListItemModelProtocol?
|
open var listItemModel: ListItemModelProtocol?
|
||||||
public let containerHelper = ContainerHelper()
|
public let containerHelper = ContainerHelper()
|
||||||
@ -30,7 +34,10 @@ import UIKit
|
|||||||
|
|
||||||
private var initialSetupPerformed = false
|
private var initialSetupPerformed = false
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
// MARK: - Styling
|
// MARK: - Styling
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
open func styleLine(with style: ListItemStyle?) {
|
open func styleLine(with style: ListItemStyle?) {
|
||||||
switch style {
|
switch style {
|
||||||
case .standard?:
|
case .standard?:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user