//
//  HidenMaskSetViewController.m
//  双子星云手机
//
//  Created by APPLE on 2023/8/22.
//

#import "HidenMaskSetViewController.h"
#import <Masonry.h>

@interface HidenMaskSetViewController ()

@end

@implementation HidenMaskSetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self drawAnyView];
}

- (void)drawAnyView{
    [self.view setBackgroundColor:HWF5F7FAColor];
    
    [self.toolBar setHidden:YES];
    [self.navigationBar setHidden:YES];
    [self.navBarBGView setHidden:NO];
    [self.titleLabel setText:NSLocalizedString(@"mask_view_hiden_set",nil)];
    
    /*进程隐藏设置*/
    UIView *bgView = [[UIView alloc] init];
    [bgView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:bgView];
    [bgView.layer setCornerRadius:8.f];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16.f);
        make.right.mas_equalTo(-16.f);
        make.height.mas_equalTo(60.f);
        make.top.equalTo(self.navBarBGView.mas_bottom).offset(12.f);
    }];
    
    UIImageView *leftImage = [[UIImageView alloc] init];
    [leftImage setImage:[UIImage imageNamed:@"icon_mask_hiden_set"]];
    [bgView addSubview:leftImage];
    [leftImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(14.f);
        make.width.mas_equalTo(28.f);
        make.height.mas_equalTo(28.f);
        make.centerY.equalTo(bgView.mas_centerY);
    }];
    
    UILabel *tipsLabel = [[UILabel alloc] init];
    [tipsLabel setText:NSLocalizedString(@"mask_view_hiden_set_hiden",nil)];
    [tipsLabel setTextColor:HW0A132BColor];
    [tipsLabel setFont:[UIFont systemFontOfSize:13.f]];
    [bgView addSubview:tipsLabel];
    [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(47.f);
        make.width.mas_equalTo(100.f);
        make.height.mas_equalTo(18.f);
        make.centerY.equalTo(bgView.mas_centerY);
    }];
    
    UISwitch *maskSwitch = [[UISwitch alloc] init];
    [bgView addSubview:maskSwitch];
    [maskSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-16.f);
        make.centerY.equalTo(bgView.mas_centerY);
    }];
    [maskSwitch setOnTintColor:HW13B2EBColor];
    [maskSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:(UIControlEventValueChanged)];
    
    BOOL haveOpenMask = [HWDataManager getBoolWithKey:Const_Mask_View_Open];
    [maskSwitch setOn:haveOpenMask];
    
    /*功能说明*/
    UILabel *strTipsLabel = [[UILabel alloc] init];
    [strTipsLabel setText:NSLocalizedString(@"mask_view_hiden_funct_struct",nil)];
    [strTipsLabel setTextColor:HW0A132BColor];
    [strTipsLabel setFont:[UIFont boldSystemFontOfSize:16.f]];
    [self.view addSubview:strTipsLabel];
    [strTipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16.f);
        make.width.mas_equalTo(100.f);
        make.height.mas_equalTo(22.f);
        make.top.equalTo(bgView.mas_bottom).offset(24.f);
    }];
    
    /*底部提示视图*/
    UIView *bgDownView = [[UIView alloc] init];
    [bgDownView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:bgDownView];
    [bgDownView.layer setCornerRadius:8.f];
    [bgDownView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16.f);
        make.right.mas_equalTo(-16.f);
        make.height.mas_equalTo(329.f);
        make.top.equalTo(strTipsLabel.mas_bottom).offset(12.f);
    }];
    
    UIImageView *downImage = [[UIImageView alloc] init];
    [downImage setImage:[UIImage imageNamed:@"mask_tips_down_img"]];
    [bgDownView addSubview:downImage];
    [downImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(30.f);
        make.width.mas_equalTo(286.f);
        make.height.mas_equalTo(236.f);
        make.centerX.equalTo(bgDownView.mas_centerX);
    }];
    
    UILabel *tipsDownLeftLabel = [[UILabel alloc] init];
    [tipsDownLeftLabel setText:NSLocalizedString(@"mask_view_hiden_up_swipe",nil)];
    [tipsDownLeftLabel setTextColor:HW0A132BColor];
    [tipsDownLeftLabel setFont:[UIFont systemFontOfSize:13.f]];
    [tipsDownLeftLabel setTextAlignment:(NSTextAlignmentCenter)];
    [bgDownView addSubview:tipsDownLeftLabel];
    [tipsDownLeftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(downImage.mas_bottom).offset(15.f);
        make.width.mas_equalTo(100.f);
        make.height.mas_equalTo(18.f);
        make.centerX.equalTo(downImage.mas_centerX).offset(-76);
    }];
    
    UILabel *tipsDownRightLabel = [[UILabel alloc] init];
    [tipsDownRightLabel setText:NSLocalizedString(@"mask_view_hiden_app_window",nil)];
    [tipsDownRightLabel setTextColor:HW0A132BColor];
    [tipsDownRightLabel setFont:[UIFont systemFontOfSize:13.f]];
    [tipsDownRightLabel setTextAlignment:(NSTextAlignmentCenter)];
    [bgDownView addSubview:tipsDownRightLabel];
    [tipsDownRightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(downImage.mas_bottom).offset(15.f);
        make.width.mas_equalTo(100.f);
        make.height.mas_equalTo(18.f);
        make.centerX.equalTo(downImage.mas_centerX).offset(76);
    }];
    
    UILabel *downTipsLabel = [[UILabel alloc] init];
    [downTipsLabel setText:NSLocalizedString(@"mask_view_hiden_app_window_detail",nil)];
    [downTipsLabel setNumberOfLines:0];
    [downTipsLabel setTextColor:HW666666Color];
    [downTipsLabel setFont:[UIFont systemFontOfSize:13.f]];
    [self.view addSubview:downTipsLabel];
    [downTipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16.f);
        make.right.mas_equalTo(-16.f);
        make.height.mas_equalTo(36.f);
        make.top.equalTo(bgDownView.mas_bottom).offset(12.f);
    }];
}

- (void)maskSwitchPressed:(UISwitch *)maskSwitch{
    [HWDataManager setBoolWithKey:Const_Mask_View_Open value:maskSwitch.on];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
