<commit_before>//
//  CourseChoosingClassScheduleCell.swift
//  mala-ios
//
//  Created by 王新宇 on 1/22/16.
//  Copyright © 2016 Mala Online. All rights reserved.
//

import UIKit

class CourseChoosingClassScheduleCell: MalaBaseCell {

    // MARK: - Property
    /// 课程表数据模型
    var classScheduleModel: [[ClassScheduleDayModel]] = [] {
        didSet {
            self.classSchedule.model = classScheduleModel
        }
    }
    
    // MARK: - Components
    private lazy var classSchedule: ThemeClassSchedule = {
        let frame = CGRect(x: 0, y: 0, width: MalaLayout_CardCellWidth, height: MalaLayout_CardCellWidth*0.65)
        let classSchedule = ThemeClassSchedule(frame: frame, collectionViewLayout: ThemeClassScheduleFlowLayout(frame: frame))
        classSchedule.bounces = false
        return classSchedule
    }()
    private lazy var legendView: LegendView = {
        let legendView = LegendView()
        return legendView
    }()
    
    // MARK: - Contructed
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUserInterface()
        setupLegends()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    // MARK: - Private Method
    private func setupUserInterface() {
        // SubViews
        content.addSubview(classSchedule)
        content.addSubview(legendView)
        
        // Autolayout
        // Remove margin
        content.snp_updateConstraints { (make) -> Void in
            make.top.equalTo(self.title.snp_bottom)
            make.bottom.equalTo(self.contentView.snp_bottom)
        }
        
        classSchedule.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self.content.snp_top).offset(MalaLayout_Margin_14)
            make.left.equalTo(self.content.snp_left)
            make.right.equalTo(self.content.snp_right)
            make.height.equalTo(MalaLayout_CardCellWidth*0.65)
        }
        legendView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self.classSchedule.snp_bottom).offset(MalaLayout_Margin_14)
            make.left.equalTo(classSchedule.snp_left)
            make.height.equalTo(MalaLayout_Margin_13)
            make.right.equalTo(classSchedule.snp_right)
            make.bottom.equalTo(self.content.snp_bottom).offset(-MalaLayout_Margin_14)
        }
    }
    
    private func setupLegends() {
        legendView.addLegend(image: "legend_disabled", title: "已被约课")<commit_msg>IOS-104 Bug fixed, TableView didn't Scorll when touchesBeganPoint in ClassScheduleView<commit_after>//
//  CourseChoosingClassScheduleCell.swift
//  mala-ios
//
//  Created by 王新宇 on 1/22/16.
//  Copyright © 2016 Mala Online. All rights reserved.
//

import UIKit

class CourseChoosingClassScheduleCell: MalaBaseCell {

    // MARK: - Property
    /// 课程表数据模型
    var classScheduleModel: [[ClassScheduleDayModel]] = [] {
        didSet {
            self.classSchedule.model = classScheduleModel
        }
    }
    
    
    // MARK: - Components
    private lazy var classSchedule: ThemeClassSchedule = {
        let frame = CGRect(x: 0, y: 0, width: MalaLayout_CardCellWidth, height: MalaLayout_CardCellWidth*0.65)
        let classSchedule = ThemeClassSchedule(frame: frame, collectionViewLayout: ThemeClassScheduleFlowLayout(frame: frame))
        classSchedule.bounces = false
        classSchedule.scrollEnabled = false
        return classSchedule
    }()
    private lazy var legendView: LegendView = {
        let legendView = LegendView()
        return legendView
    }()
    
    
    // MARK: - Contructed
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        setupUserInterface()
        setupLegends()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    // MARK: - Private Method
    private func setupUserInterface() {
        // SubViews
        content.addSubview(classSchedule)
        content.addSubview(legendView)
        
        // Autolayout
        // Remove margin
        content.snp_updateConstraints { (make) -> Void in
            make.top.equalTo(self.title.snp_bottom)
            make.bottom.equalTo(self.contentView.snp_bottom)
        }
        
        classSchedule.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self.content.snp_top).offset(MalaLayout_Margin_14)
            make.left.equalTo(self.content.snp_left)
            make.right.equalTo(self.content.snp_right)
            make.height.equalTo(classSchedule.snp_width).multipliedBy(0.65)
            make.bottom.equalTo(legendView.snp_top).offset(-MalaLayout_Margin_14)
        }
        legendView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self.classSchedule.snp_bottom).offset(MalaLayout_Margin_14)
            make.left.equalTo(classSchedule.snp_left)
            make.height.equalTo(MalaLayout_FontSize_13)
            make.right.equalTo(classSchedule.snp_right)
            make.bottom.equalTo(self.content.snp_bottom).offset(-MalaLayout_Margin_14)
        }
    }
    
    private func setupLegends() {
        legendView.addLegend(image: "legend_disabled", title: "已被约课")
{'fraction_non_alphanumeric': 0.09666048237476808, 'fraction_numerical': 0.01020408163265306, 'mean_word_length': 2.493843162670123, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5219483', 'n_tokens_mistral': 1670, 'n_tokens_neox': 1610, 'n_words': 275}