teachers-assistant

[RADIOACTIVE] oh boy did i make bad apps back in the day
git clone git://git.figbert.com/teachers-assistant.git
Log | Files | Refs

ViewControllerHome.swift (11834B)


      1 //
      2 //  ViewControllerHome.swift
      3 //  Teachers' Assistant
      4 //
      5 //  Created by Benjamin Welner on 2/9/19.
      6 //  Copyright © 2019 FIGBERT Inc. All rights reserved.
      7 //
      8 
      9 import UIKit
     10 
     11 class ViewControllerHome: UIViewController {
     12     
     13     /*  PRELIMINARY COLOR THEME START */
     14     
     15     //Naming all colored buttons so I can change colors
     16     @IBOutlet weak var liveList: UIButton!
     17     @IBOutlet weak var homeLogo: UIImageView!
     18     @IBOutlet weak var settingsCog: UIButton!
     19     
     20     /*  PRELIMINARY COLOR THEME END */
     21     
     22     /*  SIGN IN-OUT BUTTON START  */
     23     
     24     //Naming signInOut button so I can modify it on press
     25     @IBOutlet weak var signInOut: UIButton!
     26     var signedOut: Bool = true
     27     //Making a function to decide button color when signInOut button pressed
     28     func inOutButtonSet (color: String, state: Bool) -> UIImage {
     29         if (color=="Dark Blue" && state){
     30             return #imageLiteral(resourceName: "Sign-In (Dark Blue).png")
     31         } else if (color=="Dark Blue" && !state){
     32             return #imageLiteral(resourceName: "Sign-Out (Dark Blue).png")
     33         } else if (color=="Green" && state){
     34             return #imageLiteral(resourceName: "Sign-In (Green).png")
     35         } else if (color=="Green" && !state){
     36             return #imageLiteral(resourceName: "Sign-Out (Green).png")
     37         } else if (color=="Gray" && state){
     38             return #imageLiteral(resourceName: "Sign-In (Gray).png")
     39         } else if (color=="Gray" && !state){
     40             return #imageLiteral(resourceName: "Sign-Out (Gray).png")
     41         } else if (color=="Light Blue" && state){
     42             return #imageLiteral(resourceName: "Sign-In (Light Blue).png")
     43         } else if (color=="Light Blue" && !state){
     44             return #imageLiteral(resourceName: "Sign-Out (Light Blue).png")
     45         } else if (color=="Orange" && state){
     46             return #imageLiteral(resourceName: "Sign-In (Orange).png")
     47         } else if (color=="Orange" && !state){
     48             return #imageLiteral(resourceName: "Sign-Out (Orange).png")
     49         } else if (color=="Pink" && state){
     50             return #imageLiteral(resourceName: "Sign-In (Pink).png")
     51         } else if (color=="Pink" && !state){
     52             return #imageLiteral(resourceName: "Sign-Out (Pink).png")
     53         } else if (color=="Inverted Orange" && state){
     54             return #imageLiteral(resourceName: "Sign-In (Orange Inv).png")
     55         } else if (color=="Inverted Orange" && !state){
     56             return #imageLiteral(resourceName: "Sign-Out (Orange Inv).png")
     57         } else if (color=="Inverted Dark Blue" && state){
     58            return  #imageLiteral(resourceName: "Sign-In (Dark Blue Inv).png")
     59         } else if (color=="Inverted Dark Blue" && !state){
     60             return #imageLiteral(resourceName: "Sign-Out (Dark Blue Inv).png")
     61         } else if (color=="Inverted Light Blue" && state){
     62             return #imageLiteral(resourceName: "Sign-In (Light Blue Inv).png")
     63         } else if (color=="Inverted Light Blue" && !state){
     64             return #imageLiteral(resourceName: "Sign-Out (Light Blue Inv).png")
     65         } else if (color=="Inverted Gray" && state){
     66             return #imageLiteral(resourceName: "Sign-In (Gray Inv).png")
     67         } else if (color=="Inverted Gray" && !state){
     68             return #imageLiteral(resourceName: "Sign-Out (Gray Inv).png")
     69         } else if (color=="Inverted Green" && state){
     70             return #imageLiteral(resourceName: "Sign-In (Green Inv).png")
     71         } else if (color=="Inverted Green" && !state){
     72             return #imageLiteral(resourceName: "Sign-Out (Green Inv).png")
     73         } else if (color=="Inverted Pink" && state){
     74             return #imageLiteral(resourceName: "Sign-In (Pink Inv).png")
     75         } else if (color=="Inverted Pink" && !state){
     76             return #imageLiteral(resourceName: "Sign-Out (Pink Inv).png")
     77         }else {
     78             return #imageLiteral(resourceName: "Sign-In (Orange).png")
     79         }
     80     }
     81     //Defining a variable to use on button press to determine color/state
     82     var properButton: UIImage = #imageLiteral(resourceName: "Sign-In (Orange).png")
     83     //signInOut button functionality
     84     @IBAction func signInOutPress(_ sender: Any) {
     85         //Invert button graphic
     86         signedOut = !signedOut
     87         properButton = inOutButtonSet(color: ViewController.globalVariables.activeColorTheme, state: signedOut)
     88         signInOut.setImage(properButton, for: .normal)
     89         ViewController.globalVariables.globalOut = signedOut
     90         //Google
     91     }
     92     
     93     /*  SIGN IN-OUT BUTTON END */
     94     
     95     //Settings button segue to settings page
     96     @IBAction func homeToSettings(_ sender: Any) {
     97         performSegue(withIdentifier: "homeToSettings", sender: self)
     98     }
     99     
    100     override func viewDidLoad() {
    101         super.viewDidLoad()
    102         
    103         /* REGULAR BUTTON COLOR THEME START */
    104         
    105         if ViewController.globalVariables.activeColorTheme=="Dark Blue"{
    106             liveList.setImage(#imageLiteral(resourceName: "LiveList (Dark Blue).png"), for: .normal)
    107             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_DarkBlue.png")
    108             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button.png"), for: .normal)
    109             self.view.backgroundColor = UIColor(displayP3Red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
    110         } else if ViewController.globalVariables.activeColorTheme=="Green"{
    111             liveList.setImage(#imageLiteral(resourceName: "LiveList (Green).png"), for: .normal)
    112             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_Green.png")
    113             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button.png"), for: .normal)
    114             self.view.backgroundColor = UIColor(displayP3Red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
    115         } else if ViewController.globalVariables.activeColorTheme=="Gray"{
    116             liveList.setImage(#imageLiteral(resourceName: "LiveList (Gray).png"), for: .normal)
    117             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_Gray.png")
    118             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button.png"), for: .normal)
    119             self.view.backgroundColor = UIColor(displayP3Red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
    120         } else if ViewController.globalVariables.activeColorTheme=="Light Blue"{
    121             liveList.setImage(#imageLiteral(resourceName: "LiveList (Light Blue).png"), for: .normal)
    122             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_LightBlue.png")
    123             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button.png"), for: .normal)
    124             self.view.backgroundColor = UIColor(displayP3Red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
    125         } else if ViewController.globalVariables.activeColorTheme=="Orange"{
    126             liveList.setImage(#imageLiteral(resourceName: "LiveList (Orange).png"), for: .normal)
    127             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_Orange.png")
    128             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button.png"), for: .normal)
    129             self.view.backgroundColor = UIColor(displayP3Red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
    130         } else if ViewController.globalVariables.activeColorTheme=="Pink"{
    131             liveList.setImage(#imageLiteral(resourceName: "LiveList (Pink).png"), for: .normal)
    132             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_Pink")
    133             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button.png"), for: .normal)
    134             self.view.backgroundColor = UIColor(displayP3Red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
    135         } else if ViewController.globalVariables.activeColorTheme=="Inverted Orange"{
    136             liveList.setImage(#imageLiteral(resourceName: "LiveList (Orange Inv).png"), for: .normal)
    137             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_Orange_Inv.png")
    138             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button Inv.png"), for: .normal)
    139             self.view.backgroundColor = UIColor(displayP3Red: 252/255, green: 88/255, blue: 43/255, alpha: 1)
    140         } else if ViewController.globalVariables.activeColorTheme=="Inverted Dark Blue"{
    141             liveList.setImage(#imageLiteral(resourceName: "LiveList (Dark Blue Inv).png"), for: .normal)
    142             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_DarkBlue_Inv.png")
    143             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button Inv.png"), for: .normal)
    144             self.view.backgroundColor = UIColor(displayP3Red: 33/255, green: 94/255, blue: 172/255, alpha: 1)
    145         } else if ViewController.globalVariables.activeColorTheme=="Inverted Light Blue"{
    146             liveList.setImage(#imageLiteral(resourceName: "LiveList (Light Blue Inv).png"), for: .normal)
    147             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_LightBlue_Inv.png")
    148             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button Inv.png"), for: .normal)
    149             self.view.backgroundColor = UIColor(displayP3Red: 36/255, green: 171/255, blue: 226/255, alpha: 1)
    150         } else if ViewController.globalVariables.activeColorTheme=="Inverted Gray"{
    151             liveList.setImage(#imageLiteral(resourceName: "LiveList (Gray Inv).png"), for: .normal)
    152             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_Gray_Inv.png")
    153             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button Inv.png"), for: .normal)
    154             self.view.backgroundColor = UIColor(displayP3Red: 102/255, green: 102/255, blue: 102/255, alpha: 1)
    155         } else if ViewController.globalVariables.activeColorTheme=="Inverted Green"{
    156             liveList.setImage(#imageLiteral(resourceName: "LiveList (Green Inv).png"), for: .normal)
    157             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_Green_Inv.png")
    158             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button Inv.png"), for: .normal)
    159             self.view.backgroundColor = UIColor(displayP3Red: 141/255, green: 198/255, blue: 64/255, alpha: 1)
    160         } else if ViewController.globalVariables.activeColorTheme=="Inverted Pink"{
    161             liveList.setImage(#imageLiteral(resourceName: "LiveList (Pink Inv).png"), for: .normal)
    162             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_Pink_Inv.png")
    163             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button Inv.png"), for: .normal)
    164             self.view.backgroundColor = UIColor(displayP3Red: 234/255, green: 43/255, blue: 123/255, alpha: 1)
    165         } else {
    166             liveList.setImage(#imageLiteral(resourceName: "LiveList (Orange).png"), for: .normal)
    167             homeLogo.image = UIImage(named: "Brandeis_Web_HiRes_Orange.png")
    168             settingsCog.setImage(#imageLiteral(resourceName: "Settings Button.png"), for: .normal)
    169             self.view.backgroundColor = UIColor(displayP3Red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
    170         }
    171         
    172         /* REGULAR BUTTON COLOR THEME END */
    173         
    174         /* SIGN IN BUTTON LOAD THEME START */
    175         
    176         properButton = inOutButtonSet(color: ViewController.globalVariables.activeColorTheme, state: ViewController.globalVariables.globalOut)
    177         signInOut.setImage(properButton, for: .normal)
    178         
    179         /* SIGN IN BUTTON LOAD THEME END */
    180         
    181     }
    182 
    183     override func didReceiveMemoryWarning() {
    184         super.didReceiveMemoryWarning()
    185         // Dispose of any resources that can be recreated.
    186     }
    187     
    188 
    189     /*
    190     // MARK: - Navigation
    191 
    192     // In a storyboard-based application, you will often want to do a little preparation before navigation
    193     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    194         // Get the new view controller using segue.destinationViewController.
    195         // Pass the selected object to the new view controller.
    196     }
    197     */
    198 
    199 }