






#import "AirAbsentButCell.h"
#import "SafeWaxSort.h"
#import "Masonry.h"
#import "UIImage+BadImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+Receiving.h"

@interface AirAbsentButCell()


@property (nonatomic,strong) NSString * tooMajorBasic;


@property (nonatomic,strong) UIImageView * fireWasAirView;


@property (nonatomic,strong) UILabel * hardPhotosLabel;


@property (nonatomic,strong) UILabel * leapSoundLabel;

@property (nonatomic, strong) UIButton * signalButton;

@end

@implementation AirAbsentButCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        
        self.clipsToBounds = YES;
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = UIColor.clearColor;
        self.contentView.backgroundColor = UIColor.clearColor;
        
        self.fireWasAirView = [UIImageView new];
        self.fireWasAirView.tintColor = [SafeWaxSort teluguDidColor];
        self.fireWasAirView.layer.cornerRadius = SafeWaxSort.sinLaunchCut.autoFunction;
        [self.contentView addSubview:self.fireWasAirView];
        [self.fireWasAirView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(SafeWaxSort.sinLaunchCut.boxRoomFeed);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(SafeWaxSort.sinLaunchCut.sinCorrected);
        }];
        
        self.hardPhotosLabel = [UILabel new];
        self.hardPhotosLabel.font = [UIFont boldSystemFontOfSize:SafeWaxSort.sinLaunchCut.manOddFriend];
        self.hardPhotosLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.hardPhotosLabel];
        
        self.leapSoundLabel = [UILabel new];
        self.leapSoundLabel.font = [UIFont boldSystemFontOfSize:SafeWaxSort.sinLaunchCut.suddenAskDog];
        self.leapSoundLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.leapSoundLabel];
        
        [self.hardPhotosLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.fireWasAirView.mas_right).offset(SafeWaxSort.sinLaunchCut.alienMoodJob);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.leapSoundLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.hardPhotosLabel);
            make.top.equalTo(self.hardPhotosLabel.mas_bottom).offset(SafeWaxSort.sinLaunchCut.lateMenuRun);
        }];
        
        self.signalButton = [[UIButton alloc] init];
        _signalButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage rawTatarLiftNicknameParagraphName:SafeWaxSort.sinLaunchCut.tableBypassTradPromisedGuide] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_signalButton setBackgroundImage:[UIImage rawTatarLiftNicknameParagraphName:SafeWaxSort.sinLaunchCut.detectedSubstringFastFilenameFully] forState: UIControlStateNormal];
        [_signalButton setBackgroundImage:image forState: UIControlStateSelected];
        _signalButton.tintColor = [SafeWaxSort teluguDidColor];
        [self.contentView addSubview:_signalButton];
        [_signalButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-SafeWaxSort.sinLaunchCut.alienMoodJob);
            make.size.mas_equalTo(CGSizeMake(SafeWaxSort.sinLaunchCut.droppedSeven, SafeWaxSort.sinLaunchCut.droppedSeven));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _signalButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [SafeWaxSort teluguDidColor].CGColor;
    
    if (selected) {
        self.contentView.backgroundColor = [UIColor colorWithRed:1.0 green:0.98 blue:0.94 alpha:0.95];
    } else {
        self.contentView.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.35];
    }
}

- (void)setFrame:(CGRect)frame {
    frame.origin.x = SafeWaxSort.sinLaunchCut.boxRoomFeed;
    frame.size.width -= SafeWaxSort.sinLaunchCut.manOddFriend;
    frame.origin.y += SafeWaxSort.sinLaunchCut.boxRoomFeed;
    frame.size.height -= SafeWaxSort.sinLaunchCut.boxRoomFeed;
    [super setFrame:frame];
    
    self.layer.cornerRadius = frame.size.height / 2.0;
}

-(void)setTooMajorBasic:(NSString *)tooMajorBasic {
    _tooMajorBasic = tooMajorBasic;
    [self.fireWasAirView sd_setImageWithURL:[NSURL URLWithString:tooMajorBasic] placeholderImage:nil];
}

- (void)setMidLongBin:(IndexedHelpIntervalBriefProposalIntersect *)midLongBin {
    _midLongBin= midLongBin;
    self.tooMajorBasic = midLongBin.beganWake;
    self.hardPhotosLabel.text = midLongBin.guideRate;
    NSString *note = midLongBin.undoShape?:@"";
    if (note.shareParsing) {
        self.leapSoundLabel.hidden = YES;
        [self.hardPhotosLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.fireWasAirView.mas_right).offset(SafeWaxSort.sinLaunchCut.alienMoodJob);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.leapSoundLabel.hidden = NO;
        NSRange armBut = [note rangeOfString:SafeWaxSort.sinLaunchCut.sendMenuTorqueHertzSixteenTotal];
        NSRange slovak = [note rangeOfString:SafeWaxSort.sinLaunchCut.stayWonForkIcyBelowBook];
        
        if (armBut.length == 0 && slovak.length == 0) {
            self.leapSoundLabel.text = note;
            self.leapSoundLabel.font = [UIFont systemFontOfSize:SafeWaxSort.sinLaunchCut.suddenAskDog];
            self.leapSoundLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange resetHer = NSMakeRange(armBut.location+armBut.length, slovak.location-(armBut.location+armBut.length));
            NSString *factor = [note substringWithRange:resetHer];
            NSString *husband = [note stringByReplacingOccurrencesOfString:SafeWaxSort.sinLaunchCut.sendMenuTorqueHertzSixteenTotal withString:@""];
            husband = [husband stringByReplacingOccurrencesOfString:SafeWaxSort.sinLaunchCut.stayWonForkIcyBelowBook withString:@""];
            
            resetHer = [husband rangeOfString:factor];
            NSMutableAttributedString *elementBrand = [[NSMutableAttributedString alloc] initWithString:husband];
            [elementBrand addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, husband.length)];
            [elementBrand addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, husband.length)];
            [elementBrand addAttribute:NSForegroundColorAttributeName value:[SafeWaxSort teluguDidColor] range:resetHer];
            [elementBrand addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:resetHer];
            
            self.leapSoundLabel.attributedText = elementBrand;
        }
        
        [self.hardPhotosLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.fireWasAirView.mas_right).offset(SafeWaxSort.sinLaunchCut.alienMoodJob);
            make.top.equalTo(self.fireWasAirView).offset(SafeWaxSort.sinLaunchCut.sawRingWarn);
        }];
    }
}

@end
