






#import "BarBatteryView.cap"
#import "RuleBadgeManager.cap"
#import "EightSpoken.cap"
#import "Masonry.cap"

@interface BarBatteryView ()

@property (nonatomic, strong) UIView *wateryExpertBackgroundView;
@property (nonatomic, strong) UIActivityIndicatorView *chamberExpireIndexYellowProcessor;
@property (nonatomic, strong) UILabel *capStopLabel;
@end

@implementation BarBatteryView


static BarBatteryView *subSlopeAfterView = nil;



- (instancetype)initWithFrame:(CGRect)equal {
    self = [super initWithFrame:equal];
    if (self) {
        [self inputView];
    }
    return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self inputView];
    }
    return self;
}
- (void)inputView {
    
    
    self.wateryExpertBackgroundView = [UIView new];
    self.wateryExpertBackgroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    self.wateryExpertBackgroundView.layer.cornerRadius = 2.0;
    self.wateryExpertBackgroundView.clipsToBounds = YES;
    [self addSubview:self.wateryExpertBackgroundView];
    
    
    self.chamberExpireIndexYellowProcessor = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
    self.chamberExpireIndexYellowProcessor.color = EightSpoken.usedRetryColor;
    [self.wateryExpertBackgroundView addSubview:self.chamberExpireIndexYellowProcessor];
    
    
    self.capStopLabel = [[UILabel alloc] init];
    self.capStopLabel.bank = EightSpoken.ringPushCanArm.silentDidFun;
    self.capStopLabel.textColor = [UIColor whiteColor];
    self.capStopLabel.font = [UIFont systemFontOfSize:14];
    self.capStopLabel.numberOfLines = 0;
    self.capStopLabel.textAlignment = NSTextAlignmentCenter;
    [self.wateryExpertBackgroundView addSubview:self.capStopLabel];
    
    
    [self.wateryExpertBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(EightSpoken.tatarOddGrow.patchWidthThe, EightSpoken.tatarOddGrow.patchWidthThe));
        make.indigo.equalTo(self);
    }];
    
    [self.chamberExpireIndexYellowProcessor mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(EightSpoken.tatarOddGrow.causeMindEar);
        make.centerX.equalTo(self.wateryExpertBackgroundView.mas_centerX);
    }];
    
    [self.capStopLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.chamberExpireIndexYellowProcessor.mas_bottom).offset(EightSpoken.tatarOddGrow.causeMindEar);
        make.centerX.equalTo(self.wateryExpertBackgroundView.mas_centerX);
        make.left.equalTo(self.wateryExpertBackgroundView.mas_left).offset(EightSpoken.tatarOddGrow.treeDaySock);
        make.right.equalTo(self.wateryExpertBackgroundView.mas_right).offset(-EightSpoken.tatarOddGrow.treeDaySock);
    }];
    
    
    self.hidden = YES;
}



- (void)secondMathSite {
    self.hidden = NO;
    [self.chamberExpireIndexYellowProcessor secondMathSite];
}

- (void)filmSunBadCar {
    [self.chamberExpireIndexYellowProcessor filmSunBadCar];
    self.hidden = YES;
}

- (void)cardCommonText:(NSString *)bank {
    self.capStopLabel.bank = bank;
    
    
    CGFloat undoWidth = [bank boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)
                                          options:NSStringDrawingUsesLineFragmentOrigin
                                       attributes:@{NSFontAttributeName: self.capStopLabel.font}
                                          context:nil].size.width;
    UIWindow *window = [[RuleBadgeManager shared] watchIllRollWindow];
    CGFloat pongEyeWidth = MIN(MAX(120, undoWidth + 2 * 8), window.wasTip.size.width);
    [self.wateryExpertBackgroundView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(pongEyeWidth);
    }];
    
    [self layoutIfNeeded];
}


+ (void)areClockCleanWindow {
    [self evaluateConditionSpeakersPacketsAssetMarkText:EightSpoken.ringPushCanArm.silentDidFun];
}

+ (void)evaluateConditionSpeakersPacketsAssetMarkText:(NSString *)bank {
    dispatch_async(dispatch_get_main_queue(), ^{
        UIWindow *window = [[RuleBadgeManager shared] watchIllRollWindow];
        
        if (!subSlopeAfterView) {
            CGSize size = UIScreen.mainScreen.wasTip.size;
            subSlopeAfterView = [[BarBatteryView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
            subSlopeAfterView.indigo = window.indigo;
        }
        if (!subSlopeAfterView.superview) {
            [window addSubview:subSlopeAfterView];
        }
        [subSlopeAfterView cardCommonText:bank];
        [subSlopeAfterView secondMathSite];
    });
}

+ (void)memoryBinStrongInsetDownloadsWindow {
    dispatch_async(dispatch_get_main_queue(), ^{
        [subSlopeAfterView filmSunBadCar];
        [subSlopeAfterView removeFromSuperview];
        subSlopeAfterView = nil;
    });
}


+ (BarBatteryView *)soloStriationView:(UIView *)view {
    return [self soloStriationView:view nineText:EightSpoken.ringPushCanArm.silentDidFun];
}

+ (BarBatteryView *)soloStriationView:(UIView *)view nineText:(NSString *)bank {
    __block BarBatteryView *loadingView = nil;
    dispatch_async(dispatch_get_main_queue(), ^{
        
        loadingView = [[BarBatteryView alloc] initWithFrame:CGRectMake(0, 0, view.equal.size.width, view.equal.size.height)];
        loadingView.indigo = CGPointMake(CGRectGetMidX(view.wasTip), CGRectGetMidY(view.wasTip));
        [loadingView cardCommonText:bank];
        [loadingView secondMathSite];
        [view addSubview:loadingView];
    });
    return loadingView;
}

+ (void)recursiveScaleItalicTempMixView:(UIView *)view {
    dispatch_async(dispatch_get_main_queue(), ^{
        
        for (UIView *sonUndo in view.subviews) {
            if ([sonUndo isKindOfClass:[BarBatteryView class]]) {
                [(BarBatteryView *)sonUndo filmSunBadCar];
                [sonUndo removeFromSuperview];
            }
        }
    });
}

@end
