






#import "NextIllKeyView.h"
#import "ChunkyGetManager.h"
#import "BinTopLemma.h"
#import "Masonry.h"

@interface NextIllKeyView ()

@property (nonatomic, strong) UIView *tableYetWeekBackgroundView;
@property (nonatomic, strong) UIActivityIndicatorView *mixerPlayingFloorBikeBookmarks;
@property (nonatomic, strong) UILabel *hueGainLabel;
@end

@implementation NextIllKeyView


static NextIllKeyView *literDarkViewView = nil;



- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self smallView];
    }
    return self;
}
- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self smallView];
    }
    return self;
}
- (void)smallView {
    
    
    self.tableYetWeekBackgroundView = [UIView new];
    self.tableYetWeekBackgroundView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
    self.tableYetWeekBackgroundView.layer.cornerRadius = 2.0;
    self.tableYetWeekBackgroundView.clipsToBounds = YES;
    [self addSubview:self.tableYetWeekBackgroundView];
    
    
    self.mixerPlayingFloorBikeBookmarks = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
    self.mixerPlayingFloorBikeBookmarks.color = BinTopLemma.tabCookieColor;
    [self.tableYetWeekBackgroundView addSubview:self.mixerPlayingFloorBikeBookmarks];
    
    
    self.hueGainLabel = [[UILabel alloc] init];
    self.hueGainLabel.text = BinTopLemma.oldHitDownIron.ampereWeight;
    self.hueGainLabel.textColor = [UIColor whiteColor];
    self.hueGainLabel.font = [UIFont systemFontOfSize:14];
    self.hueGainLabel.numberOfLines = 0;
    self.hueGainLabel.textAlignment = NSTextAlignmentCenter;
    [self.tableYetWeekBackgroundView addSubview:self.hueGainLabel];
    
    
    [self.tableYetWeekBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(BinTopLemma.drainCatFair.photoManTight, BinTopLemma.drainCatFair.photoManTight));
        make.center.equalTo(self);
    }];
    
    [self.mixerPlayingFloorBikeBookmarks mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(BinTopLemma.drainCatFair.producingEar);
        make.centerX.equalTo(self.tableYetWeekBackgroundView.mas_centerX);
    }];
    
    [self.hueGainLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mixerPlayingFloorBikeBookmarks.mas_bottom).offset(BinTopLemma.drainCatFair.producingEar);
        make.centerX.equalTo(self.tableYetWeekBackgroundView.mas_centerX);
        make.left.equalTo(self.tableYetWeekBackgroundView.mas_left).offset(BinTopLemma.drainCatFair.danceBetter);
        make.right.equalTo(self.tableYetWeekBackgroundView.mas_right).offset(-BinTopLemma.drainCatFair.danceBetter);
    }];
    
    
    self.hidden = YES;
}



- (void)startAnimating {
    self.hidden = NO;
    [self.mixerPlayingFloorBikeBookmarks startAnimating];
}

- (void)stopAnimating {
    [self.mixerPlayingFloorBikeBookmarks stopAnimating];
    self.hidden = YES;
}

- (void)messageEraText:(NSString *)text {
    self.hueGainLabel.text = text;
    
    
    CGFloat drawWidth = [text boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)
                                          options:NSStringDrawingUsesLineFragmentOrigin
                                       attributes:@{NSFontAttributeName: self.hueGainLabel.font}
                                          context:nil].size.width;
    UIWindow *window = [[ChunkyGetManager shared] identicalDogWindow];
    CGFloat mailTwoWidth = MIN(MAX(120, drawWidth + 2 * 8), window.bounds.size.width);
    [self.tableYetWeekBackgroundView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(mailTwoWidth);
    }];
    
    [self layoutIfNeeded];
}


+ (void)italianFormatWindow {
    [self slabConcertPresetLigaturesRomanBigText:BinTopLemma.oldHitDownIron.ampereWeight];
}

+ (void)slabConcertPresetLigaturesRomanBigText:(NSString *)text {
    dispatch_async(dispatch_get_main_queue(), ^{
        UIWindow *window = [[ChunkyGetManager shared] identicalDogWindow];
        
        if (!literDarkViewView) {
            CGSize size = UIScreen.mainScreen.bounds.size;
            literDarkViewView = [[NextIllKeyView alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
            literDarkViewView.center = window.center;
        }
        if (!literDarkViewView.superview) {
            [window addSubview:literDarkViewView];
        }
        [literDarkViewView messageEraText:text];
        [literDarkViewView startAnimating];
    });
}

+ (void)legibleSecondaryResponseDelayMediaWindow {
    dispatch_async(dispatch_get_main_queue(), ^{
        [literDarkViewView stopAnimating];
        [literDarkViewView removeFromSuperview];
        literDarkViewView = nil;
    });
}


+ (NextIllKeyView *)deepLibrariesView:(UIView *)view {
    return [self deepLibrariesView:view withText:BinTopLemma.oldHitDownIron.ampereWeight];
}

+ (NextIllKeyView *)deepLibrariesView:(UIView *)view withText:(NSString *)text {
    __block NextIllKeyView *loadingView = nil;
    dispatch_async(dispatch_get_main_queue(), ^{
        
        loadingView = [[NextIllKeyView alloc] initWithFrame:CGRectMake(0, 0, view.frame.size.width, view.frame.size.height)];
        loadingView.center = CGPointMake(CGRectGetMidX(view.bounds), CGRectGetMidY(view.bounds));
        [loadingView messageEraText:text];
        [loadingView startAnimating];
        [view addSubview:loadingView];
    });
    return loadingView;
}

+ (void)hourlyEggFoldCancelingAssignView:(UIView *)view {
    dispatch_async(dispatch_get_main_queue(), ^{
        
        for (UIView *leftPan in view.subviews) {
            if ([leftPan isKindOfClass:[NextIllKeyView class]]) {
                [(NextIllKeyView *)leftPan stopAnimating];
                [leftPan removeFromSuperview];
            }
        }
    });
}

@end
