<commit_before>//
//  ABEReporterViewController.swift
//  Pods
//
//  Created by <NAME> on 10/9/16.
//
//

import Foundation
import UIKit
import CoreGraphics

internal class ABEReporterViewController: UIViewController {
    
    private static let kABETextFieldInset = 14
    
    private static let kABEdescriptionTextViewCornerRadius = CGFloat(4);
    private static let kABEdescriptionTextViewBorderWidth = CGFloat(0.5);
    
    private static let kABETableName = "IssueReporter-Localizable"
    
    @IBOutlet weak var descriptionTextView: UITextView!
    @IBOutlet weak var titleTextField: UITextField!
    @IBOutlet weak var placeHolderLabel: UILabel!
    
    fileprivate var imageCollectionViewController: ABEImageCollectionViewController!
    
    var issueManager: ABEIssueManager! {
        didSet {
            issueManager.delegate = self
        }
    }
    
    class func instance(withIssueManager manager: ABEIssueManager) -> ABEReporterViewController {
        let storyboard = UIStoryboard(name: String(describing: self), bundle: Bundle.bundleForLibrary())
        let reporterViewController = storyboard.instantiateInitialViewController() as! ABEReporterViewController
        
        reporterViewController.issueManager = manager
        
        return reporterViewController
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        configureTextView()
        setupLocalization()
        
        navigationController?.navigationBar.barTintColor = UIColor.blueNavigationBarColor()
        navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
    }
    
    private func configureTextView() {
        
        let spacerView = UIView(frame: CGRect(x: 0, y: 0, width: ABEReporterViewController.kABETextFieldInset, height: ABEReporterViewController.kABETextFieldInset))
        
        titleTextField.leftViewMode = .always
        titleTextField.leftView = spacerView
        
        descriptionTextView.layer.borderColor = UIColor.greyBorderColor().cgColor
        descriptionTextView.layer.cornerRadius = ABEReporterViewController.kABEdescriptionTextViewCornerRadius
        descriptionTextView.layer.borderWidth = ABEReporterViewController.kABEdescriptionTextViewBorderWidth
        
        let textFieldInset = CGFloat(ABEReporterViewController.kABETextFieldInset)
        descriptionTextView.textContainerInset = UIEdgeInsets(top: textFieldInset, left: textFieldInset, bottom: 0, right: textFieldInset)
        descriptionTextView.delegate = self
    }
    
    private func setupLocalization() {
        titleTextField.text = NSLocalizedString(titleTextField.text!, tableName: ABEReporterViewController.kABETableName, bundle: Bundle.bundleForLibrary(), comment: "title of issue")<commit_msg>Not translucent.<commit_after>//
//  ABEReporterViewController.swift
//  Pods
//
//  Created by <NAME> on 10/9/16.
//
//

import Foundation
import UIKit
import CoreGraphics

internal class ABEReporterViewController: UIViewController {
    
    private static let kABETextFieldInset = 14
    
    private static let kABEdescriptionTextViewCornerRadius = CGFloat(4);
    private static let kABEdescriptionTextViewBorderWidth = CGFloat(0.5);
    
    private static let kABETableName = "IssueReporter-Localizable"
    
    @IBOutlet weak var descriptionTextView: UITextView!
    @IBOutlet weak var titleTextField: UITextField!
    @IBOutlet weak var placeHolderLabel: UILabel!
    
    fileprivate var imageCollectionViewController: ABEImageCollectionViewController!
    
    var issueManager: ABEIssueManager! {
        didSet {
            issueManager.delegate = self
        }
    }
    
    class func instance(withIssueManager manager: ABEIssueManager) -> ABEReporterViewController {
        let storyboard = UIStoryboard(name: String(describing: self), bundle: Bundle.bundleForLibrary())
        let reporterViewController = storyboard.instantiateInitialViewController() as! ABEReporterViewController
        
        reporterViewController.issueManager = manager
        
        return reporterViewController
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        configureTextView()
        setupLocalization()
        
        navigationController?.navigationBar.barTintColor = UIColor.blueNavigationBarColor()
        navigationController?.navigationBar.isTranslucent = false
        navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]
    }
    
    private func configureTextView() {
        
        let spacerView = UIView(frame: CGRect(x: 0, y: 0, width: ABEReporterViewController.kABETextFieldInset, height: ABEReporterViewController.kABETextFieldInset))
        
        titleTextField.leftViewMode = .always
        titleTextField.leftView = spacerView
        
        descriptionTextView.layer.borderColor = UIColor.greyBorderColor().cgColor
        descriptionTextView.layer.cornerRadius = ABEReporterViewController.kABEdescriptionTextViewCornerRadius
        descriptionTextView.layer.borderWidth = ABEReporterViewController.kABEdescriptionTextViewBorderWidth
        
        let textFieldInset = CGFloat(ABEReporterViewController.kABETextFieldInset)
        descriptionTextView.textContainerInset = UIEdgeInsets(top: textFieldInset, left: textFieldInset, bottom: 0, right: textFieldInset)
        descriptionTextView.delegate = self
    }
    
    private func setupLocalization() {
        titleTextField.text = NSLocalizedString(titleTextField.text!, tableName: ABEReporterViewController.kABETableName, bundle: Bundle.bundleForLibrary(), comment: "title of issue")
{'fraction_non_alphanumeric': 0.06661979258217612, 'fraction_numerical': 0.004570223237827386, 'mean_word_length': 3.56661316211878, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7054527', 'n_tokens_mistral': 1534, 'n_tokens_neox': 1462, 'n_words': 296}