<commit_before>//
//  QuickViewController.swift
//  Spendy
//
//  Created by <NAME> on 9/16/15.
//  Copyright (c) 2015 Cheetah. All rights reserved.
//

import UIKit

class QuickViewController: UIViewController {


    @IBOutlet weak var tableView: UITableView!

    @IBOutlet weak var popupSuperView: UIView!

    @IBOutlet weak var popupView: UIView!

    @IBOutlet weak var popupTitleLabel: UILabel!

    @IBOutlet weak var amountText: UITextField!

    @IBOutlet weak var cancelPopupButton: UIButton!

    @IBOutlet weak var donePopupButton: UIButton!
    
    @IBOutlet weak var primaryButton: UIButton!

    var addButton: UIButton?
    var cancelButton: UIButton?

    var commonTracsations = [String]() // transaction object
    var selectedIndexPath: NSIndexPath?
    var oldSelectedSegmentIndex: Int?

    override func viewDidLoad() {
        super.viewDidLoad()

        // Load common transactions
        commonTracsations = ["Meal", "Drink", "Transport"]

        tableView.dataSource = self
        tableView.delegate = self
        tableView.tableFooterView = UIView()

        // Swipe up to close Quick mode
        if (tableView.contentSize.height <= tableView.frame.size.height) {
            tableView.scrollEnabled = false

            let swipeUp = UISwipeGestureRecognizer(target: self, action: Selector("handleSwipe:"))
            swipeUp.direction = .Up
            swipeUp.delegate = self
            tableView.addGestureRecognizer(swipeUp)
        }

        addBarButton()

        configPopup()

    }

    override func viewWillAppear(animated: Bool) {
        setColor()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    func setColor() {
        primaryButton.backgroundColor = Color.quickSegmentColor
        primaryButton.setTitleColor(UIColor.whiteColor(), forState: .Normal)
        primaryButton.layer.cornerRadius = 5
        primaryButton.layer.masksToBounds = true
        
        popupView.backgroundColor = Color.popupBackgroundColor
        cancelPopupButton.setTitleColor(Color.popupButtonColor, forState: UIControlState.Normal)
        donePopupButton.setTitleColor(Color.popupButtonColor, forState: UIControlState.Normal)
    }

    // MARK: Button

    func addBarButton() {

        addButton = UIButton()
        Helper.sharedInstance.customizeBarButton(self, button: addButton!, imageName: "Bar-Tick", isLeft: false)
        addButton!.addTarget(self, action: "onAddButton:", forControlEvents: UIControlEvents.TouchUpInside)

        cancelButton = UIButton()
        Helper.sharedInstance.customizeBarButton(self, button: cancelButton!, imageName: "Bar-Cancel", isLeft: true)
        cancelButton!.addTarget(self, action: "onCancelButton:", forControlEvents: UIControlEvents.TouchUpInside)
    }

    func onAddButton(sender: UIButton!) {
        addQuickTransactions()
    }<commit_msg>Change primary button's color in Quick add view<commit_after>//
//  QuickViewController.swift
//  Spendy
//
//  Created by <NAME> on 9/16/15.
//  Copyright (c) 2015 Cheetah. All rights reserved.
//

import UIKit

class QuickViewController: UIViewController {


    @IBOutlet weak var tableView: UITableView!

    @IBOutlet weak var popupSuperView: UIView!

    @IBOutlet weak var popupView: UIView!

    @IBOutlet weak var popupTitleLabel: UILabel!

    @IBOutlet weak var amountText: UITextField!

    @IBOutlet weak var cancelPopupButton: UIButton!

    @IBOutlet weak var donePopupButton: UIButton!
    
    @IBOutlet weak var primaryButton: UIButton!

    var addButton: UIButton?
    var cancelButton: UIButton?

    var commonTracsations = [String]() // transaction object
    var selectedIndexPath: NSIndexPath?
    var oldSelectedSegmentIndex: Int?

    override func viewDidLoad() {
        super.viewDidLoad()

        // Load common transactions
        commonTracsations = ["Meal", "Drink", "Transport"]

        tableView.dataSource = self
        tableView.delegate = self
        tableView.tableFooterView = UIView()

        // Swipe up to close Quick mode
        if (tableView.contentSize.height <= tableView.frame.size.height) {
            tableView.scrollEnabled = false

            let swipeUp = UISwipeGestureRecognizer(target: self, action: Selector("handleSwipe:"))
            swipeUp.direction = .Up
            swipeUp.delegate = self
            tableView.addGestureRecognizer(swipeUp)
        }

        addBarButton()

        configPopup()

    }

    override func viewWillAppear(animated: Bool) {
        setColor()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    func setColor() {
        primaryButton.backgroundColor = Color.strongColor
        primaryButton.setTitleColor(UIColor.whiteColor(), forState: .Normal)
        primaryButton.layer.cornerRadius = 5
        primaryButton.layer.masksToBounds = true
        
        popupView.backgroundColor = Color.popupBackgroundColor
        cancelPopupButton.setTitleColor(Color.popupButtonColor, forState: UIControlState.Normal)
        donePopupButton.setTitleColor(Color.popupButtonColor, forState: UIControlState.Normal)
    }

    // MARK: Button

    func addBarButton() {

        addButton = UIButton()
        Helper.sharedInstance.customizeBarButton(self, button: addButton!, imageName: "Bar-Tick", isLeft: false)
        addButton!.addTarget(self, action: "onAddButton:", forControlEvents: UIControlEvents.TouchUpInside)

        cancelButton = UIButton()
        Helper.sharedInstance.customizeBarButton(self, button: cancelButton!, imageName: "Bar-Cancel", isLeft: true)
        cancelButton!.addTarget(self, action: "onCancelButton:", forControlEvents: UIControlEvents.TouchUpInside)
    }

    func onAddButton(sender: UIButton!) {
        addQuickTransactions()
    }
{'fraction_non_alphanumeric': 0.0887504210171775, 'fraction_numerical': 0.003368137420006736, 'mean_word_length': 3.002021563342318, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '6252328', 'n_tokens_mistral': 1749, 'n_tokens_neox': 1640, 'n_words': 387}