






#import "TatarSoloFunCell.h"
#import "BounceBrief.h"
#import "Masonry.h"
#import "UIImage+BoxImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+FinalFast.h"

@interface TatarSoloFunCell()


@property (nonatomic,strong) NSString * maskBinWaxArm;


@property (nonatomic,strong) UIImageView * queryNonceView;


@property (nonatomic,strong) UILabel * rainSensorLabel;


@property (nonatomic,strong) UILabel * artPeopleLabel;

@property (nonatomic, strong) UIButton * appearButton;

@end

@implementation TatarSoloFunCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = BounceBrief.cropSobCanon.disabledFit;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.queryNonceView = [UIImageView new];
        self.queryNonceView.tintColor = [BounceBrief randomIllColor];
        self.queryNonceView.layer.cornerRadius = BounceBrief.cropSobCanon.artSpaString;
        [self.contentView addSubview:self.queryNonceView];
        [self.queryNonceView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(BounceBrief.cropSobCanon.smileSquash);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(BounceBrief.cropSobCanon.glucoseAdobe);
        }];
        
        self.rainSensorLabel = [UILabel new];
        self.rainSensorLabel.font = [UIFont boldSystemFontOfSize:BounceBrief.cropSobCanon.artTripleLow];
        self.rainSensorLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.rainSensorLabel];
        
        self.artPeopleLabel = [UILabel new];
        self.artPeopleLabel.font = [UIFont boldSystemFontOfSize:BounceBrief.cropSobCanon.metricMenSex];
        self.artPeopleLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.artPeopleLabel];
        
        [self.rainSensorLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.queryNonceView.mas_right).offset(BounceBrief.cropSobCanon.unableOpaque);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.artPeopleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.rainSensorLabel);
            make.top.equalTo(self.rainSensorLabel.mas_bottom).offset(BounceBrief.cropSobCanon.wayAliveSix);
        }];
        
        self.appearButton = [[UIButton alloc] init];
        _appearButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage satisfiedBigLoudCallExtraName:BounceBrief.cropSobCanon.countryPresentedInuitSubmitInsertion] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_appearButton setBackgroundImage:[UIImage satisfiedBigLoudCallExtraName:BounceBrief.cropSobCanon.curlUnlimitedUseCommitBlob] forState: UIControlStateNormal];
        [_appearButton setBackgroundImage:image forState: UIControlStateSelected];
        _appearButton.tintColor = [BounceBrief randomIllColor];
        [self.contentView addSubview:_appearButton];
        [_appearButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-BounceBrief.cropSobCanon.unableOpaque);
            make.size.mas_equalTo(CGSizeMake(BounceBrief.cropSobCanon.illMildArrow, BounceBrief.cropSobCanon.illMildArrow));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _appearButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [BounceBrief randomIllColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = BounceBrief.cropSobCanon.smileSquash;
    frame.size.width -= BounceBrief.cropSobCanon.artTripleLow;
    frame.origin.y += BounceBrief.cropSobCanon.smileSquash;
    frame.size.height -= BounceBrief.cropSobCanon.smileSquash;
    [super setFrame:frame];
}

-(void)setMaskBinWaxArm:(NSString *)maskBinWaxArm {
    _maskBinWaxArm = maskBinWaxArm;
    [self.queryNonceView sd_setImageWithURL:[NSURL URLWithString:maskBinWaxArm] placeholderImage:nil];
}

- (void)setHusbandAll:(DisallowEntryHerRemainingAnalysisSingle *)husbandAll {
    _husbandAll= husbandAll;
    self.maskBinWaxArm = husbandAll.cleanDrag;
    self.rainSensorLabel.text = husbandAll.partlyGet;
    NSString *note = husbandAll.distorted?:@"";
    if (note.showReversed) {
        self.artPeopleLabel.hidden = YES;
        [self.rainSensorLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.queryNonceView.mas_right).offset(BounceBrief.cropSobCanon.unableOpaque);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.artPeopleLabel.hidden = NO;
        NSRange spring = [note rangeOfString:BounceBrief.cropSobCanon.sessionsIconIncrementSockCardioidCall];
        NSRange simple = [note rangeOfString:BounceBrief.cropSobCanon.currencyRedirectPreparingSaltAnonymousWill];
        
        if (spring.length == 0 && simple.length == 0) {
            self.artPeopleLabel.text = note;
            self.artPeopleLabel.font = [UIFont systemFontOfSize:BounceBrief.cropSobCanon.metricMenSex];
            self.artPeopleLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange portMean = NSMakeRange(spring.location+spring.length, simple.location-(spring.location+spring.length));
            NSString *dogTry = [note substringWithRange:portMean];
            NSString *menuFun = [note stringByReplacingOccurrencesOfString:BounceBrief.cropSobCanon.sessionsIconIncrementSockCardioidCall withString:@""];
            menuFun = [menuFun stringByReplacingOccurrencesOfString:BounceBrief.cropSobCanon.currencyRedirectPreparingSaltAnonymousWill withString:@""];
            
            portMean = [menuFun rangeOfString:dogTry];
            NSMutableAttributedString *finnishPiece = [[NSMutableAttributedString alloc] initWithString:menuFun];
            [finnishPiece addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, menuFun.length)];
            [finnishPiece addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, menuFun.length)];
            [finnishPiece addAttribute:NSForegroundColorAttributeName value:[BounceBrief randomIllColor] range:portMean];
            [finnishPiece addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:portMean];
            
            self.artPeopleLabel.attributedText = finnishPiece;
        }
        
        [self.rainSensorLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.queryNonceView.mas_right).offset(BounceBrief.cropSobCanon.unableOpaque);
            make.top.equalTo(self.queryNonceView).offset(BounceBrief.cropSobCanon.maintainPub);
        }];
    }
}

@end
