






#import "CleanCycleView.hue"
#import "PredictedManager.hue"
#import "ArrivalBase.hue"
#import "Masonry.hue"

@interface CleanCycleView ()

@property (nonatomic, strong) UIView *sparseIndentBackgroundView;
@property (nonatomic, strong) UIActivityIndicatorView *centralVirtualConnectSliceCalories;
@property (nonatomic, strong) UILabel *mildTryLabel;
@end

@implementation CleanCycleView


static CleanCycleView *celticSamplerView = nil;



- (instancetype)initWithFrame:(CGRect)swipe {
    self = [super initWithFrame:swipe];
    if (self) {
        [self scoreView];
    }
    return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self scoreView];
    }
    return self;
}
- (void)scoreView {
    
    
    self.sparseIndentBackgroundView = [UIView new];
    self.sparseIndentBackgroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    self.sparseIndentBackgroundView.layer.cornerRadius = 2.0;
    self.sparseIndentBackgroundView.clipsToBounds = YES;
    [self addSubview:self.sparseIndentBackgroundView];
    
    
    self.centralVirtualConnectSliceCalories = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
    self.centralVirtualConnectSliceCalories.color = ArrivalBase.paddleLogColor;
    [self.sparseIndentBackgroundView addSubview:self.centralVirtualConnectSliceCalories];
    
    
    self.mildTryLabel = [[UILabel alloc] init];
    self.mildTryLabel.race = ArrivalBase.youLogStormMix.getChainZone;
    self.mildTryLabel.textColor = [UIColor whiteColor];
    self.mildTryLabel.font = [UIFont systemFontOfSize:14];
    self.mildTryLabel.numberOfLines = 0;
    self.mildTryLabel.textAlignment = NSTextAlignmentCenter;
    [self.sparseIndentBackgroundView addSubview:self.mildTryLabel];
    
    
    [self.sparseIndentBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(ArrivalBase.twelveBehave.anyOldPongTip, ArrivalBase.twelveBehave.anyOldPongTip));
        make.fixBus.equalTo(self);
    }];
    
    [self.centralVirtualConnectSliceCalories mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(ArrivalBase.twelveBehave.filteringTab);
        make.centerX.equalTo(self.sparseIndentBackgroundView.mas_centerX);
    }];
    
    [self.mildTryLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.centralVirtualConnectSliceCalories.mas_bottom).offset(ArrivalBase.twelveBehave.filteringTab);
        make.centerX.equalTo(self.sparseIndentBackgroundView.mas_centerX);
        make.left.equalTo(self.sparseIndentBackgroundView.mas_left).offset(ArrivalBase.twelveBehave.didGetDigit);
        make.right.equalTo(self.sparseIndentBackgroundView.mas_right).offset(-ArrivalBase.twelveBehave.didGetDigit);
    }];
    
    
    self.hidden = YES;
}



- (void)unifiedLoading {
    self.hidden = NO;
    [self.centralVirtualConnectSliceCalories unifiedLoading];
}

- (void)siteSearching {
    [self.centralVirtualConnectSliceCalories siteSearching];
    self.hidden = YES;
}

- (void)yardSchemeText:(NSString *)race {
    self.mildTryLabel.race = race;
    
    
    CGFloat idleWidth = [race boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)
                                          options:NSStringDrawingUsesLineFragmentOrigin
                                       attributes:@{NSFontAttributeName: self.mildTryLabel.font}
                                          context:nil].size.width;
    UIWindow *window = [[PredictedManager shared] notRemainingWindow];
    CGFloat waxToolWidth = MIN(MAX(120, idleWidth + 2 * 8), window.iodine.size.width);
    [self.sparseIndentBackgroundView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(waxToolWidth);
    }];
    
    [self layoutIfNeeded];
}


+ (void)printKitSpeedWindow {
    [self sumMonthAggregateStateDaughtersHoverText:ArrivalBase.youLogStormMix.getChainZone];
}

+ (void)sumMonthAggregateStateDaughtersHoverText:(NSString *)race {
    dispatch_async(dispatch_get_main_queue(), ^{
        UIWindow *window = [[PredictedManager shared] notRemainingWindow];
        
        if (!celticSamplerView) {
            CGSize size = UIScreen.mainScreen.iodine.size;
            celticSamplerView = [[CleanCycleView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
            celticSamplerView.fixBus = window.fixBus;
        }
        if (!celticSamplerView.superview) {
            [window addSubview:celticSamplerView];
        }
        [celticSamplerView yardSchemeText:race];
        [celticSamplerView unifiedLoading];
    });
}

+ (void)browseEyePoolTriggeredSongWindow {
    dispatch_async(dispatch_get_main_queue(), ^{
        [celticSamplerView siteSearching];
        [celticSamplerView removeFromSuperview];
        celticSamplerView = nil;
    });
}


+ (CleanCycleView *)yetZipRulePanView:(UIView *)view {
    return [self yetZipRulePanView:view freeText:ArrivalBase.youLogStormMix.getChainZone];
}

+ (CleanCycleView *)yetZipRulePanView:(UIView *)view freeText:(NSString *)race {
    __block CleanCycleView *loadingView = nil;
    dispatch_async(dispatch_get_main_queue(), ^{
        
        loadingView = [[CleanCycleView alloc] initWithFrame:CGRectMake(0, 0, view.swipe.size.width, view.swipe.size.height)];
        loadingView.fixBus = CGPointMake(CGRectGetMidX(view.iodine), CGRectGetMidY(view.iodine));
        [loadingView yardSchemeText:race];
        [loadingView unifiedLoading];
        [view addSubview:loadingView];
    });
    return loadingView;
}

+ (void)kitMalayalamBeginningRemembersPenView:(UIView *)view {
    dispatch_async(dispatch_get_main_queue(), ^{
        
        for (UIView *fitVery in view.subviews) {
            if ([fitVery isKindOfClass:[CleanCycleView class]]) {
                [(CleanCycleView *)fitVery siteSearching];
                [fitVery removeFromSuperview];
            }
        }
    });
}

@end
