






#import "PongIncreaseCell.h"
#import "BinFaxEight.h"
#import "Masonry.h"
#import "UIImage+EndImage.h"
#import "UIImageView+WebCache.h"
#import "NSString+OddArmpit.h"

@interface PongIncreaseCell()


@property (nonatomic,strong) NSString * subEggAndSend;


@property (nonatomic,strong) UIImageView * rangingDayView;


@property (nonatomic,strong) UILabel * wetEraGrowLabel;


@property (nonatomic,strong) UILabel * stylisticLabel;

@property (nonatomic, strong) UIButton * carLogButton;

@end

@implementation PongIncreaseCell

- (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.rangingDayView = [UIImageView new];
        self.rangingDayView.tintColor = [BinFaxEight indentJobColor];
        self.rangingDayView.layer.cornerRadius = BinFaxEight.icyAboutDrum.recycleToken;
        [self.contentView addSubview:self.rangingDayView];
        [self.rangingDayView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(BinFaxEight.icyAboutDrum.howShakeSix);
            make.centerY.mas_equalTo(self.contentView);
            make.width.height.mas_equalTo(BinFaxEight.icyAboutDrum.weightCoptic);
        }];
        
        self.wetEraGrowLabel = [UILabel new];
        self.wetEraGrowLabel.font = [UIFont boldSystemFontOfSize:BinFaxEight.icyAboutDrum.drawCardioid];
        self.wetEraGrowLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.wetEraGrowLabel];
        
        self.stylisticLabel = [UILabel new];
        self.stylisticLabel.font = [UIFont boldSystemFontOfSize:BinFaxEight.icyAboutDrum.unwindDarken];
        self.stylisticLabel.textColor = UIColor.darkGrayColor;
        [self.contentView addSubview:self.stylisticLabel];
        
        [self.wetEraGrowLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.rangingDayView.mas_right).offset(BinFaxEight.icyAboutDrum.pubAlignBeat);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.stylisticLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.wetEraGrowLabel);
            make.top.equalTo(self.wetEraGrowLabel.mas_bottom).offset(BinFaxEight.icyAboutDrum.lemmaFixNet);
        }];
        
        self.carLogButton = [[UIButton alloc] init];
        _carLogButton.userInteractionEnabled = NO;
        
        UIImage *image = [[UIImage unifyOccurredTryAwakeNaturalName:BinFaxEight.icyAboutDrum.unchangedLemmaViewCarbonVelocity] imageWithRenderingMode:(UIImageRenderingModeAlwaysTemplate)];
        [_carLogButton setBackgroundImage:[UIImage unifyOccurredTryAwakeNaturalName:BinFaxEight.icyAboutDrum.clampClockPassiveAgeIterative] forState: UIControlStateNormal];
        [_carLogButton setBackgroundImage:image forState: UIControlStateSelected];
        _carLogButton.tintColor = [BinFaxEight indentJobColor];
        [self.contentView addSubview:_carLogButton];
        [_carLogButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.offset(0);
            make.right.offset(-BinFaxEight.icyAboutDrum.pubAlignBeat);
            make.size.mas_equalTo(CGSizeMake(BinFaxEight.icyAboutDrum.safeWonBlend, BinFaxEight.icyAboutDrum.safeWonBlend));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected {
    _carLogButton.selected = selected;
    self.layer.borderWidth = selected ? 1:0;
    self.layer.borderColor = [BinFaxEight indentJobColor].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 = BinFaxEight.icyAboutDrum.howShakeSix;
    frame.size.width -= BinFaxEight.icyAboutDrum.drawCardioid;
    frame.origin.y += BinFaxEight.icyAboutDrum.howShakeSix;
    frame.size.height -= BinFaxEight.icyAboutDrum.howShakeSix;
    [super setFrame:frame];
    
    self.layer.cornerRadius = frame.size.height / 2.0;
}

-(void)setSubEggAndSend:(NSString *)subEggAndSend {
    _subEggAndSend = subEggAndSend;
    [self.rangingDayView sd_setImageWithURL:[NSURL URLWithString:subEggAndSend] placeholderImage:nil];
}

- (void)setFarLossPin:(OcclusionOcclusionPubMaskMenProvince *)farLossPin {
    _farLossPin= farLossPin;
    self.subEggAndSend = farLossPin.tempSpeed;
    self.wetEraGrowLabel.text = farLossPin.mutations;
    NSString *note = farLossPin.expertOdd?:@"";
    if (note.funExclusive) {
        self.stylisticLabel.hidden = YES;
        [self.wetEraGrowLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.rangingDayView.mas_right).offset(BinFaxEight.icyAboutDrum.pubAlignBeat);
            make.centerY.equalTo(self.contentView);
        }];
    }else {
        self.stylisticLabel.hidden = NO;
        NSRange google = [note rangeOfString:BinFaxEight.icyAboutDrum.strictMoreCommandsNewsstandMetricEight];
        NSRange eldest = [note rangeOfString:BinFaxEight.icyAboutDrum.cloudyBadLessItalianDistortedKin];
        
        if (google.length == 0 && eldest.length == 0) {
            self.stylisticLabel.text = note;
            self.stylisticLabel.font = [UIFont systemFontOfSize:BinFaxEight.icyAboutDrum.unwindDarken];
            self.stylisticLabel.textColor = UIColor.lightGrayColor;
        }else {
            NSRange ignoring = NSMakeRange(google.location+google.length, eldest.location-(google.location+google.length));
            NSString *airHex = [note substringWithRange:ignoring];
            NSString *sameFat = [note stringByReplacingOccurrencesOfString:BinFaxEight.icyAboutDrum.strictMoreCommandsNewsstandMetricEight withString:@""];
            sameFat = [sameFat stringByReplacingOccurrencesOfString:BinFaxEight.icyAboutDrum.cloudyBadLessItalianDistortedKin withString:@""];
            
            ignoring = [sameFat rangeOfString:airHex];
            NSMutableAttributedString *pastBarAlarm = [[NSMutableAttributedString alloc] initWithString:sameFat];
            [pastBarAlarm addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, sameFat.length)];
            [pastBarAlarm addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, sameFat.length)];
            [pastBarAlarm addAttribute:NSForegroundColorAttributeName value:[BinFaxEight indentJobColor] range:ignoring];
            [pastBarAlarm addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:ignoring];
            
            self.stylisticLabel.attributedText = pastBarAlarm;
        }
        
        [self.wetEraGrowLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.rangingDayView.mas_right).offset(BinFaxEight.icyAboutDrum.pubAlignBeat);
            make.top.equalTo(self.rangingDayView).offset(BinFaxEight.icyAboutDrum.carReceives);
        }];
    }
}

@end
