






#import "SolidDryHardCell.h"
#import "SumWorkTrad.h"
#import "Masonry.h"
#import "UIImage+LawImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+BoostTone.h"

@interface SolidDryHardCell()


@property (nonatomic,strong) NSString * notStripMaker;


@property (nonatomic,strong) UIImageView * sobKeepRunView;


@property (nonatomic,strong) UILabel * notBeenWetLabel;


@property (nonatomic,strong) UILabel * tightHashLabel;

@property (nonatomic, strong) UIButton * napZipButton;

@end

@implementation SolidDryHardCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.layer.cornerRadius = SumWorkTrad.fastAgeWidth.manWinFinal;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.sobKeepRunView = [UIImageView new];
        self.sobKeepRunView.tintColor = [SumWorkTrad alphaPingColor];
        self.sobKeepRunView.layer.cornerRadius = SumWorkTrad.fastAgeWidth.armWetKelvin;
        [self.contentView addSubview:self.sobKeepRunView];
        [self.sobKeepRunView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(SumWorkTrad.fastAgeWidth.allLosePage);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(SumWorkTrad.fastAgeWidth.abovePlayWon);
        }];
        
        self.notBeenWetLabel = [UILabel new];
        self.notBeenWetLabel.font = [UIFont boldSystemFontOfSize:SumWorkTrad.fastAgeWidth.bigStreetAir];
        self.notBeenWetLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.notBeenWetLabel];
        
        self.tightHashLabel = [UILabel new];
        self.tightHashLabel.font = [UIFont boldSystemFontOfSize:SumWorkTrad.fastAgeWidth.paymentsDust];
        self.tightHashLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.tightHashLabel];
        
        [self.notBeenWetLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.sobKeepRunView.mas_right).offset(SumWorkTrad.fastAgeWidth.databasesBus);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.tightHashLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.notBeenWetLabel);
            make.top.equalTo(self.notBeenWetLabel.mas_bottom).offset(SumWorkTrad.fastAgeWidth.tempRespond);
        }];
        
        self.napZipButton = [[UIButton alloc] init];
        _napZipButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage preciseProvidingLexicalAddressHandlesName:SumWorkTrad.fastAgeWidth.removalBitmapLoopCarrierGaelic] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_napZipButton setBackgroundImage:[UIImage preciseProvidingLexicalAddressHandlesName:SumWorkTrad.fastAgeWidth.partNetFetchStarAnd] forState: UIControlStateNormal];
        [_napZipButton setBackgroundImage:image forState: UIControlStateSelected];
        _napZipButton.tintColor = [SumWorkTrad alphaPingColor];
        [self.contentView addSubview:_napZipButton];
        [_napZipButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-SumWorkTrad.fastAgeWidth.databasesBus);
            make.size.mas_equalTo(CGSizeMake(SumWorkTrad.fastAgeWidth.stationChain, SumWorkTrad.fastAgeWidth.stationChain));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _napZipButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [SumWorkTrad alphaPingColor].CGColor;
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = SumWorkTrad.fastAgeWidth.allLosePage;
    frame.size.width -= SumWorkTrad.fastAgeWidth.bigStreetAir;
    frame.origin.y += SumWorkTrad.fastAgeWidth.allLosePage;
    frame.size.height -= SumWorkTrad.fastAgeWidth.allLosePage;
    [super setFrame:frame];
}

-(void)setNotStripMaker:(NSString *)notStripMaker {
    _notStripMaker = notStripMaker;
    [self.sobKeepRunView sd_setImageWithURL:[NSURL URLWithString:notStripMaker] placeholderImage:nil];
}

- (void)setAcuteMouth:(BaseSumHundredMegabytesCycleFlag *)acuteMouth {
    _acuteMouth= acuteMouth;
    self.notStripMaker = acuteMouth.wasBuffer;
    self.notBeenWetLabel.text = acuteMouth.canDevice;
    NSString *note = acuteMouth.perfusion?:@"";
    if (note.seeBecomeThe) {
        self.tightHashLabel.hidden = YES;
        [self.notBeenWetLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.sobKeepRunView.mas_right).offset(SumWorkTrad.fastAgeWidth.databasesBus);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.tightHashLabel.hidden = NO;
        NSRange sunSaw = [note rangeOfString:SumWorkTrad.fastAgeWidth.dublinTheBothAssignWhoHex];
        NSRange sawAnd = [note rangeOfString:SumWorkTrad.fastAgeWidth.forwardsSonMagnitudeFrictionDryHex];
        
        if (sunSaw.length == 0 && sawAnd.length == 0) {
            self.tightHashLabel.text = note;
            self.tightHashLabel.font = [UIFont systemFontOfSize:SumWorkTrad.fastAgeWidth.paymentsDust];
            self.tightHashLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange cardWait = NSMakeRange(sunSaw.location+sunSaw.length, sawAnd.location-(sunSaw.location+sunSaw.length));
            NSString *prolog = [note substringWithRange:cardWait];
            NSString *howPath = [note stringByReplacingOccurrencesOfString:SumWorkTrad.fastAgeWidth.dublinTheBothAssignWhoHex withString:@""];
            howPath = [howPath stringByReplacingOccurrencesOfString:SumWorkTrad.fastAgeWidth.forwardsSonMagnitudeFrictionDryHex withString:@""];
            
            cardWait = [howPath rangeOfString:prolog];
            NSMutableAttributedString *caretAdaptor = [[NSMutableAttributedString alloc] initWithString:howPath];
            [caretAdaptor addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, howPath.length)];
            [caretAdaptor addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, howPath.length)];
            [caretAdaptor addAttribute:NSForegroundColorAttributeName value:[SumWorkTrad alphaPingColor] range:cardWait];
            [caretAdaptor addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:cardWait];
            
            self.tightHashLabel.attributedText = caretAdaptor;
        }
        
        [self.notBeenWetLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.sobKeepRunView.mas_right).offset(SumWorkTrad.fastAgeWidth.databasesBus);
            make.top.equalTo(self.sobKeepRunView).offset(SumWorkTrad.fastAgeWidth.danceDuplex);
        }];
    }
}

@end
