






#import "LogDashMiterCell.h"
#import "UserArtRoot.h"
#import "Masonry.h"
#import "UIImage+WasImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+TiedWorld.h"

@interface LogDashMiterCell()


@property (nonatomic,strong) NSString * signBadminton;


@property (nonatomic,strong) UIImageView * tipAgePongView;


@property (nonatomic,strong) UILabel * butLocalesLabel;


@property (nonatomic,strong) UILabel * usesYearsLabel;

@property (nonatomic, strong) UIButton * sunSinButton;

@end

@implementation LogDashMiterCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = UserArtRoot.wayAbortLove.lossyAdverb;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.tipAgePongView = [UIImageView new];
        self.tipAgePongView.tintColor = [UserArtRoot partBoostColor];
        self.tipAgePongView.layer.cornerRadius = UserArtRoot.wayAbortLove.keepHelloPin;
        [self.contentView addSubview:self.tipAgePongView];
        [self.tipAgePongView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(UserArtRoot.wayAbortLove.hueSpineKit);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(UserArtRoot.wayAbortLove.awakeEyeItem);
        }];
        
        self.butLocalesLabel = [UILabel new];
        self.butLocalesLabel.font = [UIFont boldSystemFontOfSize:UserArtRoot.wayAbortLove.exponentsShe];
        self.butLocalesLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.butLocalesLabel];
        
        self.usesYearsLabel = [UILabel new];
        self.usesYearsLabel.font = [UIFont boldSystemFontOfSize:UserArtRoot.wayAbortLove.inlandImpact];
        self.usesYearsLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.usesYearsLabel];
        
        [self.butLocalesLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.tipAgePongView.mas_right).offset(UserArtRoot.wayAbortLove.panGreenSpan);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.usesYearsLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.butLocalesLabel);
            make.top.equalTo(self.butLocalesLabel.mas_bottom).offset(UserArtRoot.wayAbortLove.searchError);
        }];
        
        self.sunSinButton = [[UIButton alloc] init];
        _sunSinButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage containerModifiersAskSceneOuterName:UserArtRoot.wayAbortLove.anySphericalStrongestServicesPatch] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_sunSinButton setBackgroundImage:[UIImage containerModifiersAskSceneOuterName:UserArtRoot.wayAbortLove.categoryStatementAirlineMatrixSquash] forState: UIControlStateNormal];
        [_sunSinButton setBackgroundImage:image forState: UIControlStateSelected];
        _sunSinButton.tintColor = [UserArtRoot partBoostColor];
        [self.contentView addSubview:_sunSinButton];
        [_sunSinButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-UserArtRoot.wayAbortLove.panGreenSpan);
            make.size.mas_equalTo(CGSizeMake(UserArtRoot.wayAbortLove.aboutDynamic, UserArtRoot.wayAbortLove.aboutDynamic));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _sunSinButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [UserArtRoot partBoostColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = UserArtRoot.wayAbortLove.hueSpineKit;
    frame.size.width -= UserArtRoot.wayAbortLove.exponentsShe;
    frame.origin.y += UserArtRoot.wayAbortLove.hueSpineKit;
    frame.size.height -= UserArtRoot.wayAbortLove.hueSpineKit;
    [super setFrame:frame];
}

-(void)setSignBadminton:(NSString *)signBadminton {
    _signBadminton = signBadminton;
    [self.tipAgePongView sd_setImageWithURL:[NSURL URLWithString:signBadminton] placeholderImage:nil];
}

- (void)setRootExpose:(BinaryMajorPreventedOuterScalarStrength *)rootExpose {
    _rootExpose= rootExpose;
    self.signBadminton = rootExpose.sixAnswer;
    self.butLocalesLabel.text = rootExpose.stoodLift;
    NSString *note = rootExpose.legalHigh?:@"";
    if (note.capCovariant) {
        self.usesYearsLabel.hidden = YES;
        [self.butLocalesLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.tipAgePongView.mas_right).offset(UserArtRoot.wayAbortLove.panGreenSpan);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.usesYearsLabel.hidden = NO;
        NSRange eleven = [note rangeOfString:UserArtRoot.wayAbortLove.lossVisionEggWelshNoneOther];
        NSRange iodine = [note rangeOfString:UserArtRoot.wayAbortLove.recentCourseEntriesSemanticsPlacementSources];
        
        if (eleven.length == 0 && iodine.length == 0) {
            self.usesYearsLabel.text = note;
            self.usesYearsLabel.font = [UIFont systemFontOfSize:UserArtRoot.wayAbortLove.inlandImpact];
            self.usesYearsLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange swipePop = NSMakeRange(eleven.location+eleven.length, iodine.location-(eleven.location+eleven.length));
            NSString *plural = [note substringWithRange:swipePop];
            NSString *pickBed = [note stringByReplacingOccurrencesOfString:UserArtRoot.wayAbortLove.lossVisionEggWelshNoneOther withString:@""];
            pickBed = [pickBed stringByReplacingOccurrencesOfString:UserArtRoot.wayAbortLove.recentCourseEntriesSemanticsPlacementSources withString:@""];
            
            swipePop = [pickBed rangeOfString:plural];
            NSMutableAttributedString *spousesAlong = [[NSMutableAttributedString alloc] initWithString:pickBed];
            [spousesAlong addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, pickBed.length)];
            [spousesAlong addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, pickBed.length)];
            [spousesAlong addAttribute:NSForegroundColorAttributeName value:[UserArtRoot partBoostColor] range:swipePop];
            [spousesAlong addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:swipePop];
            
            self.usesYearsLabel.attributedText = spousesAlong;
        }
        
        [self.butLocalesLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.tipAgePongView.mas_right).offset(UserArtRoot.wayAbortLove.panGreenSpan);
            make.top.equalTo(self.tipAgePongView).offset(UserArtRoot.wayAbortLove.growNapBusy);
        }];
    }
}

@end
