//
//  SHRecordGuideView.swift
//  CallRecording
//
//  Created by 明津李 on 2020/7/13.
//  Copyright © 2020 Mazy. All rights reserved.
//

import UIKit

class SHRecordGuideView: UIView {
    
    var selectedControl: UIView?
    
    private var recordingBtn : UIButton!
    private var holedView: SwiftHoledView!
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        prepare()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
        prepare()
    }

    func prepare(){
        
        self.backgroundColor = UIColor.init(red: 1, green: 1, blue: 1, alpha: 0.3)
        
        holedView = SwiftHoledView(frame: self.bounds)
        self.addSubview(holedView)
        
        holedView.addHoleRect(CGRect.init(x: SCREEN_WIDTH-44-10, y: kStatusBarHeight, width: 44, height: 44), cornerRadius: 4)
                               
        let hintLab = UILabel()
        hintLab.text = "点击“✓”即可结束本次会议记录"
        hintLab.textColor = UIColor.white
        hintLab.numberOfLines = 0
        hintLab.textAlignment = .center
        hintLab.font = UIFont.systemFont(ofSize: 22)
        self.addSubview(hintLab)
        hintLab.snp.makeConstraints { (make) in
            make.centerX.equalTo(self.snp_centerX)
            make.centerY.equalTo(self.snp_centerY).offset(-100)
        }
        
        let confirmBtn = UIButton()
        confirmBtn.setTitle("我知道了", for: .normal)
        confirmBtn.setTitleColor(UIColor.white, for: .normal)
        confirmBtn.titleLabel?.font = UIFont.systemFont(ofSize: 18)
        confirmBtn.layer.cornerRadius = 5
        confirmBtn.layer.borderColor = UIColor.white.cgColor
        confirmBtn.layer.borderWidth = 1
        confirmBtn.addTarget(self, action: #selector(confirmBtnClick(_:)), for: .touchUpInside)
        self.addSubview(confirmBtn)
        confirmBtn.snp.makeConstraints { (make) in
            make.centerX.equalTo(self.snp_centerX)
            make.centerY.equalTo(self.snp_centerY)
            make.height.equalTo(52*kAutoWidth)
            make.width.equalTo(280*kAutoWidth)
        }
    }

    @objc func confirmBtnClick(_ sender:UIButton){
        
        self.removeFromSuperview()
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        holedView.frame = self.bounds;
    }
}

