Merge branch 'develop' into feature/leftvariableicon_with_rightcaretlist

This commit is contained in:
Kruthika KP 2020-02-06 10:36:42 +05:30
commit e2d2decc5c
9 changed files with 275 additions and 12 deletions

View File

@ -108,6 +108,10 @@
9455B19C234F8A0400A574DB /* MVMAnimationFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */; };
946EE1BA237B66D80036751F /* MoleculeModelHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 946EE1B9237B66D80036751F /* MoleculeModelHelper.swift */; };
948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 948DB67D2326DCD90011F916 /* MultiProgress.swift */; };
94AF4A3E23E9D13900676048 /* MFCaretButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 94AF4A3C23E9D13900676048 /* MFCaretButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
94AF4A3F23E9D13900676048 /* MFCaretButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94AF4A3D23E9D13900676048 /* MFCaretButton.m */; };
94AF4A4223E9D19E00676048 /* MFCaretView.h in Headers */ = {isa = PBXBuildFile; fileRef = 94AF4A4023E9D19E00676048 /* MFCaretView.h */; settings = {ATTRIBUTES = (Public, ); }; };
94AF4A4323E9D19E00676048 /* MFCaretView.m in Sources */ = {isa = PBXBuildFile; fileRef = 94AF4A4123E9D19E00676048 /* MFCaretView.m */; };
94C2D9842386F3F80006CF46 /* LabelAttributeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C2D9832386F3F80006CF46 /* LabelAttributeModel.swift */; };
94C2D9A123872BCC0006CF46 /* LabelAttributeUnderlineModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C2D9A023872BCC0006CF46 /* LabelAttributeUnderlineModel.swift */; };
94C2D9A323872C110006CF46 /* LabelAttributeStrikeThroughModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C2D9A223872C110006CF46 /* LabelAttributeStrikeThroughModel.swift */; };
@ -424,6 +428,10 @@
9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MVMAnimationFramework.framework; path = ../SharedFrameworks/MVMAnimationFramework.framework; sourceTree = "<group>"; };
946EE1B9237B66D80036751F /* MoleculeModelHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeModelHelper.swift; sourceTree = "<group>"; };
948DB67D2326DCD90011F916 /* MultiProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiProgress.swift; sourceTree = "<group>"; };
94AF4A3C23E9D13900676048 /* MFCaretButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MFCaretButton.h; sourceTree = "<group>"; };
94AF4A3D23E9D13900676048 /* MFCaretButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MFCaretButton.m; sourceTree = "<group>"; };
94AF4A4023E9D19E00676048 /* MFCaretView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MFCaretView.h; sourceTree = "<group>"; };
94AF4A4123E9D19E00676048 /* MFCaretView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MFCaretView.m; sourceTree = "<group>"; };
94C2D9832386F3F80006CF46 /* LabelAttributeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelAttributeModel.swift; sourceTree = "<group>"; };
94C2D9A023872BCC0006CF46 /* LabelAttributeUnderlineModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelAttributeUnderlineModel.swift; sourceTree = "<group>"; };
94C2D9A223872C110006CF46 /* LabelAttributeStrikeThroughModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelAttributeStrikeThroughModel.swift; sourceTree = "<group>"; };
@ -832,6 +840,10 @@
D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */,
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */,
D282AACA2243C61700C46919 /* ButtonView.swift */,
94AF4A3C23E9D13900676048 /* MFCaretButton.h */,
94AF4A3D23E9D13900676048 /* MFCaretButton.m */,
94AF4A4023E9D19E00676048 /* MFCaretView.h */,
94AF4A4123E9D19E00676048 /* MFCaretView.m */,
);
path = Views;
sourceTree = "<group>";
@ -1414,6 +1426,7 @@
D29DF27521E79E81003B2FB9 /* MVMCoreUILoggingHandler.h in Headers */,
D29DF28B21E7AC2B003B2FB9 /* ViewConstrainingView.h in Headers */,
D29DF2B321E7B76D003B2FB9 /* MFLoadingSpinner.h in Headers */,
94AF4A3E23E9D13900676048 /* MFCaretButton.h in Headers */,
0A21DB8A235E06EF00C160A2 /* MFDigitTextBox.h in Headers */,
D29DF32521ED0DA2003B2FB9 /* TextButtonView.h in Headers */,
0A21DB8C235E06EF00C160A2 /* MFDigitTextField.h in Headers */,
@ -1432,6 +1445,7 @@
D29DF2CA21E7BFC8003B2FB9 /* MFSizeThreshold.h in Headers */,
D29DF28021E7AA51003B2FB9 /* MVMCoreUIDetailViewProtocol.h in Headers */,
D29DF2BD21E7BEA4003B2FB9 /* MVMCoreUITabBarPageControlViewController.h in Headers */,
94AF4A4223E9D19E00676048 /* MFCaretView.h in Headers */,
D29DF2EE21ECEADF003B2FB9 /* MFFonts.h in Headers */,
D29DF12D21E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.h in Headers */,
D29770F321F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.h in Headers */,
@ -1677,6 +1691,7 @@
944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */,
D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */,
C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */,
94AF4A3F23E9D13900676048 /* MFCaretButton.m in Sources */,
D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */,
D2A5146B2214905000345BFB /* ThreeLayerViewController.swift in Sources */,
8D24041523E7FC0B009E23BE /* LeftVariableIconRightCaretListModel.swift in Sources */,
@ -1728,6 +1743,7 @@
D2B1E3E522F37D6A0065F95C /* ImageHeadlineBody.swift in Sources */,
0A21DB94235E24ED00C160A2 /* DigitEntryField.swift in Sources */,
0A21DB8D235E06EF00C160A2 /* MFDigitTextField.m in Sources */,
94AF4A4323E9D19E00676048 /* MFCaretView.m in Sources */,
943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */,
D29DF2AA21E7B2F9003B2FB9 /* MVMCoreUIConstants.m in Sources */,
948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */,

View File

@ -0,0 +1,26 @@
//
// MFCaretButton.h
// MobileFirstFramework
//
// Created by Kolli, Praneeth on 1/5/18.
// Copyright © 2018 Verizon Wireless. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MVMCoreUI/MFCustomButton.h>
@interface MFCaretButton : MFCustomButton
@property (nullable, nonatomic, strong) UIView *rightView;
@property (nullable, nonatomic, strong) NSNumber *rightViewHeight;
@property (nullable, nonatomic, strong) NSNumber *rightViewWidth;
-(void)updateCaretSpacing:(CGFloat)spacing;
/* The fill color of the Caret and titleLabel. The default is blackColor */
-(void)setEnableCaretColor:(nullable UIColor *)enableCaretColor;
/* The fill color of the Caret and titleLabel. The default is mfSilver */
-(void)setDisabledCaretColor:(nullable UIColor *)disabledCaretColor;
@end

View File

@ -0,0 +1,113 @@
//
// MFCaretButton.m
// MobileFirstFramework
//
// Created by Kolli, Praneeth on 1/5/18.
// Copyright © 2018 Verizon Wireless. All rights reserved.
//
#import "MFCaretButton.h"
#import "MFCaretView.h"
#import "UIColor+MFConvenience.h"
@interface MFCaretButton ()
@property (nonatomic, strong) UIColor *enableColor;
@property (nonatomic, strong) UIColor *disabledColor;
@property (nonatomic, strong) NSLayoutConstraint *caretSpacingConstraint;
@end
@implementation MFCaretButton
CGFloat const CaretViewHeight = 10.8f;
CGFloat const CaretViewWidth = 6.6f;
- (void)layoutSubviews {
[self addCaretImageView];
[super layoutSubviews];
}
- (void)setEnabled:(BOOL)enabled {
[super setEnabled:enabled];
[self changeCaretColor];
}
- (void)changeCaretColor {
[self setTitleColor:self.enableColor forState:UIControlStateNormal];
[self setTitleColor:self.disabledColor forState:UIControlStateDisabled];
if ([self.rightView isKindOfClass:[MFCaretView class]]) {
MFCaretView *caretView = (MFCaretView *)self.rightView;
if (self.enabled) {
[caretView setLineColor:self.enableColor];
} else {
[caretView setLineColor:self.disabledColor];
}
}
}
- (void)addCaretImageView {
[self.rightView removeFromSuperview];
UIEdgeInsets edgeInsets = self.contentEdgeInsets;
CGFloat rightInset = self.rightViewWidth?self.rightViewWidth.floatValue:CaretViewWidth;
UIEdgeInsets newInsets = UIEdgeInsetsMake(edgeInsets.top, edgeInsets.left, edgeInsets.bottom, 4 + rightInset);
self.contentEdgeInsets = newInsets;
UIView *caretViewIs = self.rightView;
if (!self.rightView) {
caretViewIs = [[MFCaretView alloc]init];
self.rightView = caretViewIs;
}
self.rightView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:self.rightView];
CGFloat width = self.rightViewWidth?self.rightViewWidth.floatValue:CaretViewWidth;
NSLayoutConstraint *caretViewWidthConstraint = [NSLayoutConstraint constraintWithItem:caretViewIs attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:width];
caretViewWidthConstraint.active = YES;
CGFloat height = self.rightViewHeight?self.rightViewHeight.floatValue:CaretViewHeight;
NSLayoutConstraint *caretViewHeightConstraint = [NSLayoutConstraint constraintWithItem:caretViewIs attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:height];
caretViewHeightConstraint.active = YES;
NSLayoutConstraint *caretLabelSpacing = [NSLayoutConstraint constraintWithItem:caretViewIs attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeRight multiplier:1.0 constant:4.0];
caretLabelSpacing.active = YES;
self.caretSpacingConstraint = caretLabelSpacing;
NSLayoutConstraint *caretCenterY = [NSLayoutConstraint constraintWithItem:caretViewIs attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0];
caretCenterY.active = YES;
NSLayoutConstraint *caretLabelRightPin = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationGreaterThanOrEqual toItem:caretViewIs attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
caretLabelRightPin.active = YES;
self.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
//set correct color after layout
[self changeCaretColor];
}
- (void)updateCaretSpacing:(CGFloat)spacing {
if (self.caretSpacingConstraint != nil) {
self.caretSpacingConstraint.constant = spacing;
}
}
- (void)setEnableCaretColor:(UIColor *)enableCaretColor {
self.enableColor = enableCaretColor;
[self changeCaretColor];
}
- (void)setDisabledCaretColor:(UIColor *)disabledCaretColor {
self.disabledColor = disabledCaretColor;
[self changeCaretColor];
}
@synthesize enableColor = _enableColor;
- (UIColor *)enableColor {
if (!_enableColor) {
_enableColor = [UIColor blackColor];
}
return _enableColor;
}
@synthesize disabledColor = _disabledColor;
- (UIColor *)disabledColor {
if (!_disabledColor) {
_disabledColor = [UIColor mfSilver];
}
return _disabledColor;
}
@end

View File

@ -0,0 +1,16 @@
//
// MFCaretView.h
// MobileFirstFramework
//
// Created by Kolli, Praneeth on 1/5/18.
// Copyright © 2018 Verizon Wireless. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MFCaretView : UIView
@property (strong, nonatomic, readonly) UIColor *strokeColor;
- (instancetype)initWithLineWidth:(CGFloat)lineWidth;
- (void)setLineColor:(UIColor *)color;
@end

View File

@ -0,0 +1,93 @@
//
// MFCaretView.m
// MobileFirstFramework
//
// Created by Kolli, Praneeth on 1/5/18.
// Copyright © 2018 Verizon Wireless. All rights reserved.
//
#import "MFCaretView.h"
#import "UIColor+MFConvenience.h"
@interface MFCaretView ()
@property (strong, nonatomic, readwrite) UIColor *strokeColor;
@property (nonatomic) NSNumber *lineWidth;
@end
@implementation MFCaretView
- (instancetype)init {
self = [super init];
if (self) {
// Initialization code
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
self.strokeColor = [UIColor blackColor];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
self.strokeColor = [UIColor blackColor];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
// Initialization code
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
self.strokeColor = [UIColor blackColor];
}
return self;
}
- (instancetype)initWithLineWidth:(CGFloat)lineWidth {
if (self = [super init]) {
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
self.lineWidth = @(lineWidth);
self.strokeColor = [UIColor blackColor];
}
return self;
}
- (void)drawRect:(CGRect)rect {
// Drawing Caret
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextClearRect(context, rect);
CGFloat lineWidth;
if (self.lineWidth) {
lineWidth = self.lineWidth.floatValue;
} else {
lineWidth = self.frame.size.width/2.6;
}
UIBezierPath *path = [[UIBezierPath alloc] init];
[path moveToPoint:CGPointMake(lineWidth/2.0, 0.0)];
[path addLineToPoint:CGPointMake(self.frame.size.width, self.frame.size.height/2.0)];
[path addLineToPoint:CGPointMake(lineWidth/2.0, self.frame.size.height)];
[path addLineToPoint:CGPointMake(0.0, self.frame.size.height-lineWidth/2.0)];
[path addLineToPoint:CGPointMake(self.frame.size.width-lineWidth, self.frame.size.height/2.0)];
[path addLineToPoint:CGPointMake(0.0, lineWidth/2.0)];
[path addLineToPoint:CGPointMake(lineWidth/2.0, 0.0)];
[self.strokeColor setFill];
[path fill];
[path closePath];
[self setBackgroundColor:[UIColor clearColor]];
}
- (void)setLineColor:(UIColor *)color {
self.strokeColor = color;
[self setNeedsDisplay];
}
@end

View File

@ -81,6 +81,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
#import <MVMCoreUI/MVMCoreUICheckBox.h>
#import <MVMCoreUI/MVMCoreUISwitch.h>
#import <MVMCoreUI/MFRadioButton.h>
#import <MVMCoreUI/MFCaretView.h>
#pragma mark Buttons
#import <MVMCoreUI/MFButtonProtocol.h>
@ -89,6 +90,7 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
#import <MVMCoreUI/PrimaryButton.h>
#import <MVMCoreUI/MFTextButton.h>
#import <MVMCoreUI/PrimaryButtonView.h>
#import <MVMCoreUI/MFCaretButton.h>
#pragma mark TextFields
#import <MVMCoreUI/MFTextField.h>

View File

@ -171,10 +171,8 @@ import UIKit
guard let model = model as? CornerLabelsModel else { return }
if middleView != nil {
(middleView as? ModelMoleculeViewProtocol)?.setWithModel(model, delegateObject, additionalData)
} else {
if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(model.molecule, delegateObject) {
addMiddleView(molecule)
}
} else if let moleculeModel = model.molecule, let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(moleculeModel, delegateObject) {
addMiddleView(molecule)
}
topLeftLabel.setWithModel(model.topLeftLabel, delegateObject, additionalData)

View File

@ -15,9 +15,9 @@ public class CornerLabelsModel: MoleculeModelProtocol {
public var topRightLabel: LabelModel?
public var bottomLeftLabel: LabelModel?
public var bottomRightLabel: LabelModel?
public var molecule: MoleculeModelProtocol
public var molecule: MoleculeModelProtocol?
init(with molecule: MoleculeModelProtocol) {
init(with molecule: MoleculeModelProtocol?) {
self.molecule = molecule
}
@ -33,7 +33,7 @@ public class CornerLabelsModel: MoleculeModelProtocol {
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
molecule = try typeContainer.decodeMolecule(codingKey: .molecule)
molecule = try typeContainer.decodeMoleculeIfPresent(codingKey: .molecule)
topLeftLabel = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .topLeftLabel)
topRightLabel = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .topRightLabel)
bottomLeftLabel = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .bottomLeftLabel)

View File

@ -11,7 +11,6 @@ import Foundation
let headlineBody = HeadlineBody(frame: .zero)
let caretButton = CaretButton(frame: .zero)
let backgroundImageView = MFLoadImageView(pinnedEdges: .all)
var spaceBetweenConstant: CGFloat = 104.0
let maxWidth: CGFloat = 350.0
static let heightConstant: CGFloat = 320.0
var heightConstraint: NSLayoutConstraint?
@ -44,17 +43,17 @@ import Foundation
headlineBody.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: 0).isActive = true
headlineBody.topAnchor.constraint(equalTo: container.topAnchor, constant: 0).isActive = true
let headLineBodyWidth = headlineBody.widthAnchor.constraint(equalTo: container.widthAnchor, multiplier: 0.85)
headLineBodyWidth.priority = .defaultHigh
headlineBody.widthAnchor.constraint(equalTo: container.widthAnchor, multiplier: 0.67).isActive = true
let headLineBodyWidth = headlineBody.widthAnchor.constraint(lessThanOrEqualToConstant: maxWidth)
headLineBodyWidth.priority = UILayoutPriority(250)
headLineBodyWidth.isActive = true
headlineBody.widthAnchor.constraint(lessThanOrEqualToConstant: maxWidth).isActive = true
//Caret view
caretButton.translatesAutoresizingMaskIntoConstraints = false
caretButton.leadingAnchor.constraint(equalTo: container.leadingAnchor, constant: 0).isActive = true
container.bottomAnchor.constraint(equalTo: caretButton.bottomAnchor, constant: 0).isActive = true
caretButton.topAnchor.constraint(greaterThanOrEqualTo: headlineBody.bottomAnchor, constant: spaceBetweenConstant).isActive = true
caretButton.topAnchor.constraint(greaterThanOrEqualTo: headlineBody.bottomAnchor, constant: PaddingTwo).isActive = true
//Background image view
backgroundImageView.translatesAutoresizingMaskIntoConstraints = false