Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Notare.xcodeproj/project.pbxproj
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
objects = {

/* Begin PBXBuildFile section */
1385C2952411B804002FAA2C /* ThemeSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1385C2942411B804002FAA2C /* ThemeSelectionViewController.swift */; };
13E26AD3241088A800D2BC08 /* ThemeProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13E26AD2241088A800D2BC08 /* ThemeProtocol.swift */; };
13E26AD52410896300D2BC08 /* DarkTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13E26AD42410896300D2BC08 /* DarkTheme.swift */; };
13E26AD724108B5300D2BC08 /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13E26AD624108B5300D2BC08 /* Theme.swift */; };
13E26AD924108D9100D2BC08 /* LightTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13E26AD824108D9100D2BC08 /* LightTheme.swift */; };
1FB17190240DC53B00F8EC0F /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB1718F240DC53B00F8EC0F /* DetailViewController.swift */; };
1FB17195240DE8DF00F8EC0F /* Notes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB17194240DE8DF00F8EC0F /* Notes.swift */; };
1FC510B9240D8C54006BD691 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FC510B8240D8C54006BD691 /* AppDelegate.swift */; };
Expand All @@ -18,6 +23,11 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
1385C2942411B804002FAA2C /* ThemeSelectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeSelectionViewController.swift; sourceTree = "<group>"; };
13E26AD2241088A800D2BC08 /* ThemeProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeProtocol.swift; sourceTree = "<group>"; };
13E26AD42410896300D2BC08 /* DarkTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DarkTheme.swift; sourceTree = "<group>"; };
13E26AD624108B5300D2BC08 /* Theme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = "<group>"; };
13E26AD824108D9100D2BC08 /* LightTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightTheme.swift; sourceTree = "<group>"; };
1FB1718F240DC53B00F8EC0F /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
1FB17194240DE8DF00F8EC0F /* Notes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notes.swift; sourceTree = "<group>"; };
1FC510B5240D8C54006BD691 /* Notare.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Notare.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -75,8 +85,13 @@
1FB17194240DE8DF00F8EC0F /* Notes.swift */,
1FC510BC240D8C54006BD691 /* ViewController.swift */,
1FB1718F240DC53B00F8EC0F /* DetailViewController.swift */,
1385C2942411B804002FAA2C /* ThemeSelectionViewController.swift */,
1FC510BE240D8C54006BD691 /* Main.storyboard */,
1FC510C6240D8C58006BD691 /* Info.plist */,
13E26AD2241088A800D2BC08 /* ThemeProtocol.swift */,
13E26AD42410896300D2BC08 /* DarkTheme.swift */,
13E26AD824108D9100D2BC08 /* LightTheme.swift */,
13E26AD624108B5300D2BC08 /* Theme.swift */,
);
path = Notare;
sourceTree = "<group>";
Expand Down Expand Up @@ -153,10 +168,15 @@
buildActionMask = 2147483647;
files = (
1FC510BD240D8C54006BD691 /* ViewController.swift in Sources */,
13E26AD724108B5300D2BC08 /* Theme.swift in Sources */,
1FC510B9240D8C54006BD691 /* AppDelegate.swift in Sources */,
1FC510BB240D8C54006BD691 /* SceneDelegate.swift in Sources */,
13E26AD924108D9100D2BC08 /* LightTheme.swift in Sources */,
13E26AD3241088A800D2BC08 /* ThemeProtocol.swift in Sources */,
1FB17190240DC53B00F8EC0F /* DetailViewController.swift in Sources */,
13E26AD52410896300D2BC08 /* DarkTheme.swift in Sources */,
1FB17195240DE8DF00F8EC0F /* Notes.swift in Sources */,
1385C2952411B804002FAA2C /* ThemeSelectionViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
526 changes: 452 additions & 74 deletions Notare/Base.lproj/Main.storyboard
100644 → 100755

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions Notare/DarkTheme.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// DarkTheme.swift
// Notare
//
// Created by conner on 3/3/20.
// Copyright © 2020 conner. All rights reserved.
//
import UIKit

class DarkTheme: ThemeProtocol {
var fontColor: UIColor = UIColor.white
var buttonColor: UIColor = UIColor.systemGreen
var backgroundColor: UIColor = UIColor.black
}
38 changes: 18 additions & 20 deletions Notare/DetailViewController.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
import UIKit

class DetailViewController: UIViewController {
@IBOutlet var detailView: UIView!
@IBOutlet weak var detailTextView: UITextView!
@IBOutlet weak var cancelButton: UIBarButtonItem!
@IBOutlet weak var saveButton: UIBarButtonItem!
@IBAction func shareTapped(_ sender: UIBarButtonItem) {
let activityVC = UIActivityViewController(activityItems: [detailTextView.text ?? ""], applicationActivities: nil)
activityVC.popoverPresentationController?.sourceView = self.view
self.present(activityVC, animated: true, completion: nil)
}

var text: String = ""

Expand All @@ -20,49 +28,39 @@ class DetailViewController: UIViewController {

detailTextView.text = text
self.navigationItem.largeTitleDisplayMode = .never

}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
detailTextView.becomeFirstResponder() // function to bring up software keyboard by automatically selecting text view
setTheme()
}

func setText(t: String) {
text = t

// verifying to see if the view is loaded before we perform any modifications

if isViewLoaded {
// modify text view after view has loaded
detailTextView.text = t
}
if isViewLoaded { detailTextView.text = t }
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
masterView.newRowText = detailTextView.text
detailTextView.resignFirstResponder()

}

@IBAction func saveTapped(_ sender: UIBarButtonItem) {
navigationController?.popViewController(animated: true)
masterView.newRowText = detailTextView.text
viewWillDisappear(true)
}

@IBAction func cancelTapped(_ sender: UIBarButtonItem) {
navigationController?.popViewController(animated: true)
}

/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.

func setTheme() {
detailTextView.backgroundColor = Theme.current.backgroundColor
detailTextView.textColor = Theme.current.fontColor
cancelButton.tintColor = Theme.current.buttonColor
saveButton.tintColor = Theme.current.buttonColor
detailView.backgroundColor = Theme.current.backgroundColor
}
*/

}
Empty file modified Notare/Info.plist
100644 → 100755
Empty file.
15 changes: 15 additions & 0 deletions Notare/LightTheme.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// LightTheme.swift
// Notare
//
// Created by conner on 3/3/20.
// Copyright © 2020 conner. All rights reserved.
//

import UIKit

class LightTheme: ThemeProtocol {
var fontColor: UIColor = UIColor.black
var buttonColor: UIColor = UIColor.systemBlue
var backgroundColor: UIColor = UIColor.white
}
2 changes: 1 addition & 1 deletion Notare/Notes.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// Created by Bree Jeune on 3/2/20.
// Copyright © 2020 Young. All rights reserved.
//
// maodmd

import Foundation

Expand Down
Empty file modified Notare/Resources/AppDelegate.swift
100644 → 100755
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified Notare/Resources/Assets.xcassets/Contents.json
100644 → 100755
Empty file.
Empty file modified Notare/Resources/Base.lproj/LaunchScreen.storyboard
100644 → 100755
Empty file.
Empty file modified Notare/Resources/SceneDelegate.swift
100644 → 100755
Empty file.
13 changes: 13 additions & 0 deletions Notare/Theme.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Theme.swift
// Notare
//
// Created by conner on 3/4/20.
// Copyright © 2020 Young. All rights reserved.
//

import Foundation
import UIKit
class Theme {
static var current: ThemeProtocol = LightTheme()
}
14 changes: 14 additions & 0 deletions Notare/ThemeProtocol.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ThemeProtocol.swift
// Notare
//
// Created by conner on 3/3/20.
// Copyright © 2020 conner. All rights reserved.
//
import UIKit

protocol ThemeProtocol {
var fontColor: UIColor { get set }
var buttonColor: UIColor { get set }
var backgroundColor: UIColor { get set }
}
131 changes: 131 additions & 0 deletions Notare/ThemeSelectionViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
//
// ThemeSelectionViewController.swift
// Notare
//
// Created by conner on 3/5/20.
// Copyright © 2020 Young. All rights reserved.
//

import UIKit

class ThemeSelectionViewController: UIViewController {
var darkMode = Bool()
var lightMode = Bool()
@IBOutlet weak var donebutton: UIBarButtonItem!
@IBOutlet weak var darkThemeSwitch: UISwitch!
@IBOutlet weak var lightThemeSwitch: UISwitch!
@IBOutlet weak var DarkLabel: UILabel!
@IBOutlet weak var lightLabel: UILabel!
@IBOutlet weak var fontLabel: UILabel!
@IBOutlet weak var buttonLabel: UILabel!
@IBOutlet weak var backgroundLabel: UILabel!
@IBOutlet weak var topBar: UINavigationItem!

var colors: [UIColor] = [
.systemRed,
.systemOrange,
.systemYellow,
.systemGreen,
.systemBlue,
.systemIndigo,
.systemPurple,
.white,
.black
]

var identifiers: [String] = [
"red",
"orange",
"yellow",
"green",
"blue",
"indigo",
"purple",
"white",
"black"
]

@IBAction func colorTapped(_ sender: UIButton) {
if sender.accessibilityLabel == "font" {
for index in 0...identifiers.count {
if sender.accessibilityIdentifier == identifiers[index] {
Theme.current.fontColor = colors[index]
return;
}
}
}
if sender.accessibilityLabel == "button" {
for index in 0...identifiers.count {
if sender.accessibilityIdentifier == identifiers[index] {
Theme.current.buttonColor = colors[index]
return;
}
}
}
if sender.accessibilityLabel == "background" {
for index in 0...identifiers.count {
if sender.accessibilityIdentifier == identifiers[index] {
Theme.current.backgroundColor = colors[index]
return;
}
}
}
}

override func viewDidLoad() {
super.viewDidLoad()
let darkDefault = UserDefaults.standard
let lightDefault = UserDefaults.standard
darkMode = darkDefault.bool(forKey: "darkDefault")
lightMode = lightDefault.bool(forKey: "lightDefault")
if darkMode {
darkThemeSwitch.isOn = true
lightThemeSwitch.isOn = false
Theme.current = DarkTheme()
setTheme()
} else {
lightThemeSwitch.isOn = true
darkThemeSwitch.isOn = false
Theme.current = LightTheme()
setTheme()
}
}

@IBAction func darkSwitched(_ sender: Any) {
darkThemeSwitch.isOn = true
lightThemeSwitch.isOn = false
let darkDefault = UserDefaults.standard
darkDefault.set(true, forKey: "darkDefault")
let lightDefault = UserDefaults.standard
lightDefault.set(false, forKey: "lightDefault")
Theme.current = DarkTheme()
navigationController?.navigationBar.barStyle = .black
setTheme()
}

@IBAction func lightSwitched(_ sender: Any) {
lightThemeSwitch.isOn = true
darkThemeSwitch.isOn = false
let darkDefault = UserDefaults.standard
darkDefault.set(false, forKey: "darkDefault")
let lightDefault = UserDefaults.standard
lightDefault.set(true, forKey: "lightDefault")
Theme.current = LightTheme()
navigationController?.navigationBar.barStyle = .default
setTheme()
}
@IBAction func doneTapped(_ sender: Any) {
navigationController?.popViewController(animated: true)
}

func setTheme() {
self.view.backgroundColor = Theme.current.backgroundColor
DarkLabel.textColor = Theme.current.fontColor
lightLabel.textColor = Theme.current.fontColor
fontLabel.textColor = Theme.current.fontColor
buttonLabel.textColor = Theme.current.fontColor
backgroundLabel.textColor = Theme.current.fontColor
topBar.titleView?.tintColor = Theme.current.fontColor
donebutton.tintColor = Theme.current.buttonColor
}
}
Loading