//
//  mySetHeadView.m
//  隐私保护
//
//  Created by xd h on 2023/11/9.
//

#import "mySetHeadView.h"

@implementation mySetHeadView

- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    [self drawAnyView];
    
    return self;
}

- (void)drawAnyView{
    [self setBackgroundColor:[UIColor whiteColor]];
    
    //文件上传
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.text = NSLocalizedString(@"my_set_no_File_upload",nil) ;
    titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
    [self addSubview:titleLabel];
    
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    //上传记录
    UIImageView *arrowImageView = [[UIImageView alloc] init];
    arrowImageView.image = [UIImage imageNamed:@"cell_right_access"];
    [self addSubview:arrowImageView];
    
    [arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(20);
        make.height.mas_equalTo(20);
    }];
    
    UILabel *rightLabel = [[UILabel alloc] init];
    rightLabel.text = NSLocalizedString(@"my_set_no_File_upload_record",nil) ;
    rightLabel.font = [UIFont systemFontOfSize:14.0];
    rightLabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
    rightLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:rightLabel];
    
    [rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(arrowImageView.mas_left).offset(-2);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
    }];
    
    UIButton *recordBut = [[UIButton alloc] init];
    //recordBut.backgroundColor = [UIColor greenColor];
    recordBut.tag = 1;
    [recordBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:recordBut];
    
    [recordBut mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.width.mas_equalTo(150);
        make.height.mas_equalTo(40);
    }];
    
    //图片上传
    NSString* curImgUploadStr = [[NSString alloc] initWithFormat:@"%@ %@",@"  ",NSLocalizedString(@"my_set_no_image_upload",nil)];
    UIButton *imageUploadBut = [[UIButton alloc] init];
    [imageUploadBut setImage:[UIImage imageNamed:@"icon_image_upload"] forState:UIControlStateNormal];
    [imageUploadBut setTitle:curImgUploadStr forState:UIControlStateNormal];
    imageUploadBut.backgroundColor = [UIColor hwColor:@"#00D1C1" alpha:0.1];
    imageUploadBut.layer.cornerRadius = 4;
    [imageUploadBut setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    imageUploadBut.titleLabel.font = [UIFont systemFontOfSize:13.0];
    imageUploadBut.tag = 2;
    [imageUploadBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:imageUploadBut];
    
    [imageUploadBut mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.right.mas_equalTo(self.mas_centerX).offset(-10);
        make.bottom.mas_equalTo(-10);
        make.height.mas_equalTo(48);
    }];
    
    //视频上传
    NSString* curVidelUploadStr = [[NSString alloc] initWithFormat:@"%@ %@",@"  ",NSLocalizedString(@"my_set_no_video_upload",nil)];
    UIButton *videoUploadBut = [[UIButton alloc] init];
    [videoUploadBut setImage:[UIImage imageNamed:@"icon_video_upload"] forState:UIControlStateNormal];
    [videoUploadBut setTitle:curVidelUploadStr forState:UIControlStateNormal];
    videoUploadBut.backgroundColor = [UIColor hwColor:@"#00D8FF" alpha:0.1];
    videoUploadBut.layer.cornerRadius = 4;
    [videoUploadBut setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    videoUploadBut.titleLabel.font = [UIFont systemFontOfSize:13.0];
    videoUploadBut.tag = 3;
    [videoUploadBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:videoUploadBut];
    
    [videoUploadBut mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.left.mas_equalTo(self.mas_centerX).offset(10);
        make.bottom.mas_equalTo(-10);
        make.height.mas_equalTo(48);
    }];
}


#pragma mark  按钮点击事件
- (void)didClickButFun:(UIButton*)but
{
    NSInteger tag = but.tag;
    
    //HLog(@"xxxx:%ld",tag)
    
    if(_didClickBut){
        _didClickBut(tag);
    }
}

@end
