Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New application main color #112

Merged
merged 46 commits into from
Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8a4a3b9
Added new navigation color
Ostrenkiy Sep 9, 2017
69154f8
some UI fixes
Ostrenkiy Sep 9, 2017
e61daee
Merge branch 'dev' into feature/new-color
Ostrenkiy Sep 9, 2017
7b8c525
Added dark navigation
Ostrenkiy Sep 9, 2017
bba2022
Added StepikLabel to Courses, Sections and Units
Ostrenkiy Sep 9, 2017
739f5f3
Added StepikLabel to profile
Ostrenkiy Sep 9, 2017
198b984
Added new colour to course preview and discussions
Ostrenkiy Sep 9, 2017
49b5ab8
Added new text colour to step web views
Ostrenkiy Sep 9, 2017
9d1e130
Fixed code quiz colours
Ostrenkiy Sep 9, 2017
75d5247
Added new text colour to quizzes
Ostrenkiy Sep 9, 2017
368baaa
Separated text colour from dark theme colour
Ostrenkiy Sep 11, 2017
c5db419
search bar fixes & swiftlint autocorrection
Ostrenkiy Sep 11, 2017
389e688
Added shadow view in navigation support
Ostrenkiy Sep 12, 2017
cb3ade7
Added dark icons to player
Ostrenkiy Sep 12, 2017
69558f1
Added new colour download button assets
Ostrenkiy Sep 12, 2017
d28c514
removed unnecessary comments
Ostrenkiy Sep 12, 2017
7561ede
Fixed search bar layout bug
Ostrenkiy Sep 12, 2017
199b1bf
More color fixes
Ostrenkiy Sep 12, 2017
9b3ea86
Added shadow to steps view
Ostrenkiy Sep 12, 2017
44bb2a6
swiftlint autocorrections
Ostrenkiy Sep 12, 2017
8e9f3ae
Fixed certificates and downloads color
Ostrenkiy Sep 12, 2017
a27dcdd
more colour fixes for choices, dots and video
Ostrenkiy Sep 12, 2017
e830dde
Fixed menu titleColor bugs
Ostrenkiy Sep 12, 2017
f6ebba7
fix for previous bug fix
Ostrenkiy Sep 12, 2017
d5b0408
Fixed UISearchBar controller push bug in FindViewController
Ostrenkiy Sep 12, 2017
83dbe02
swiftlint autocorrections
Ostrenkiy Sep 12, 2017
b4a9a5d
Changed HTMLParsingUtil iFrame detection
Ostrenkiy Sep 13, 2017
82db752
Added custom search & Fixed shadowView behavior
Ostrenkiy Sep 14, 2017
f5ef1d8
Added Xcode 8 compatibility
Ostrenkiy Sep 14, 2017
4319d2d
Added StepikLabels everywhere in the main app
Ostrenkiy Sep 14, 2017
afa17b5
Fixed colors in write comment controller
Ostrenkiy Sep 14, 2017
3b1091c
replaced method UIColors with properties
Ostrenkiy Sep 14, 2017
78e9e5c
Removed StepikLabel auto generated comments
Ostrenkiy Sep 14, 2017
2ef8910
Removed 'Color' from UIColor constants
Ostrenkiy Sep 14, 2017
9cfed02
Merge branch 'dev' into feature/new-color
Ostrenkiy Sep 14, 2017
4cd7fa2
Added IBInspectable and IBDesignable to StepikLabel & CustomSearchBar
Ostrenkiy Sep 14, 2017
0e57652
Added NibInitializableView
Ostrenkiy Sep 14, 2017
96ac858
swiftlint autocorrections
Ostrenkiy Sep 14, 2017
1596623
Made ArtView NibInitializableView
Ostrenkiy Sep 14, 2017
7f41994
More NibInitializableViews
Ostrenkiy Sep 14, 2017
caea941
swiftlint
Ostrenkiy Sep 14, 2017
900e71b
moved UI elements to different folder
Ostrenkiy Sep 15, 2017
140544e
added mainText color parameter to HTMLStringBuilder
Ostrenkiy Sep 15, 2017
3a2480d
minor
Ostrenkiy Sep 15, 2017
e1f6206
Refactored navigation shadow to method inside StyledNavigationController
Ostrenkiy Sep 15, 2017
97fe542
Added text colour to config
Ostrenkiy Sep 15, 2017
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
18 changes: 9 additions & 9 deletions JSQWebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,6 @@ class WebViewController: UIViewController {
super.viewDidLoad()
title = urlRequest.url?.host

if allowsToOpenInSafari {
navigationItem.rightBarButtonItem = UIBarButtonItem(
image: Images.safariBarButtonItemImage,
style: UIBarButtonItemStyle.plain,
target: self,
action: #selector(WebViewController.didTapSafariButton(_:)))
navigationItem.rightBarButtonItem?.tintColor = UIColor.stepicGreenColor()
}

// navigationItem.rightBarButtonItem = UIBarButtonItem(
// barButtonSystemItem: .Action,
// target: self,
Expand All @@ -163,6 +154,15 @@ class WebViewController: UIViewController {
assert(navigationController != nil, "\(WebViewController.self) must be presented in a \(UINavigationController.self)")
super.viewWillAppear(animated)

if allowsToOpenInSafari {
navigationItem.rightBarButtonItem = UIBarButtonItem(
image: Images.safariBarButtonItemImage,
style: UIBarButtonItemStyle.plain,
target: self,
action: #selector(WebViewController.didTapSafariButton(_:)))
navigationItem.rightBarButtonItem?.tintColor = UIColor.mainDark
}

if presentingViewController?.presentedViewController != nil {
let doneItem = backButtonStyle.barButtonItem
doneItem.target = self
Expand Down
8 changes: 8 additions & 0 deletions PagerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ open class PagerController: UIViewController, UIPageViewControllerDataSource, UI
_ = self.tabsView?.alignTrailingEdge(with: self.view, predicate: "0")
_ = self.tabsView?.constrainHeight("44")

let shadowView = UIView()
self.contentView.addSubview(shadowView)
shadowView.backgroundColor = UIColor.lightGray
_ = shadowView.constrainHeight("0.5")
_ = shadowView.alignTopEdge(with: contentView, predicate: "22")
_ = shadowView.alignLeadingEdge(with: contentView, predicate: "0")
_ = shadowView.alignTrailingEdge(with: contentView, predicate: "0")

// Set setup done
self.defaultSetupDone = true
}
Expand Down
144 changes: 107 additions & 37 deletions Stepic.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Stepic/AnalyticsEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ struct AnalyticsEvents {
static let toolbarSelected = "code_toolbar_selected"
static let hideKeyboard = "code_hide_keyboard"
}

struct Profile {
static let clickSettings = "main_choice_settings"
struct Settings {
Expand Down
3 changes: 3 additions & 0 deletions Stepic/ApplicationInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class ApplicationInfo {
static let redirect = "password.redirect_uri"
}
}
struct Colors {
static let mainText = "colors.mainText"
}
}

private var settings: NSDictionary?
Expand Down
47 changes: 8 additions & 39 deletions Stepic/ArtView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@

import Foundation

class ArtView: UIView {
class ArtView: NibInitializableView {

@IBOutlet weak var artImageView: UIImageView!
@IBOutlet weak var artImageViewWidth: NSLayoutConstraint!

var onTap : ((Void) -> Void)?
var onTap : (() -> Void)?

var art: UIImage? {
didSet {
artImageView.image = art
Expand All @@ -27,7 +27,11 @@ class ArtView: UIView {
}
}

private func initialize() {
override var nibName: String {
return "ArtView"
}

override func setupSubviews() {
artImageView.image = art
artImageView.isUserInteractionEnabled = true
let tapG = UITapGestureRecognizer(target: self, action: #selector(ArtView.didTap))
Expand All @@ -37,39 +41,4 @@ class ArtView: UIView {
func didTap() {
onTap?()
}

private var view: UIView!

private func setup() {
view = loadViewFromNib()
view.frame = bounds
view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
addSubview(view)
initialize()
}

private func loadViewFromNib() -> UIView {
let bundle = Bundle(for: type(of: self))
let nib = UINib(nibName: "ArtView", bundle: bundle)
let view = nib.instantiate(withOwner: self, options: nil)[0] as! UIView
return view
}

override init(frame: CGRect) {
// 1. setup any properties here

// 2. call super.init(frame:)
super.init(frame: frame)
setup()
}

required init?(coder aDecoder: NSCoder) {
// 1. setup any properties here

// 2. call super.init(coder:)
super.init(coder: aDecoder)

// 3. Setup view from .xib file
setup()
}
}
32 changes: 16 additions & 16 deletions Stepic/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<!--All Courses-->
<scene sceneID="Xcs-LO-Ogd">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="hRS-2a-8JM" customClass="GreenNavigationViewController" customModule="Stepic" sceneMemberID="viewController">
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="hRS-2a-8JM" customClass="StyledNavigationViewController" customModule="Adaptive_1838" customModuleProvider="target" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="All Courses" image="tab-find-courses" selectedImage="tab-find-courses" id="D6B-Zy-xmi"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="wyf-cv-uU2">
Expand All @@ -115,7 +115,7 @@
<!--My courses-->
<scene sceneID="Eot-ep-83N">
<objects>
<navigationController id="NxB-SA-EGM" customClass="GreenNavigationViewController" customModule="Stepic" sceneMemberID="viewController">
<navigationController id="NxB-SA-EGM" customClass="StyledNavigationViewController" customModule="Adaptive_1838" customModuleProvider="target" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="My courses" image="tab-my-courses" selectedImage="tab-my-courses" id="I8C-zf-fZb"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="nen-ML-6eo">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
Expand Down Expand Up @@ -613,7 +613,7 @@
<constraint firstAttribute="height" constant="50" id="Etj-Uj-4eI"/>
<constraint firstAttribute="width" constant="50" id="ahh-oE-9Rq"/>
</constraints>
<state key="normal" image="stepic_play"/>
<state key="normal" image="play_dark"/>
<connections>
<action selector="playButtonPressed:" destination="D75-Zh-Yxy" eventType="touchUpInside" id="pJi-Xm-63s"/>
</connections>
Expand Down Expand Up @@ -641,7 +641,7 @@
<rect key="frame" x="0.0" y="0.0" width="383" height="118.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Course name" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8q0-dk-g4x">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Course name" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8q0-dk-g4x" customClass="StepikLabel" customModule="Adaptive_1838" customModuleProvider="target">
<rect key="frame" x="8" y="8" width="367" height="27"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
Expand Down Expand Up @@ -714,7 +714,7 @@
</collectionViewFlowLayout>
<cells/>
</collectionView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Teachers" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yls-tG-Jse">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Teachers" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yls-tG-Jse" customClass="StepikLabel" customModule="Adaptive_1838" customModuleProvider="target">
<rect key="frame" x="16" y="8" width="359" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
Expand Down Expand Up @@ -783,11 +783,11 @@
<viewControllerLayoutGuide type="bottom" id="L7p-o7-VTy"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="z7c-c8-8wj">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="L6O-ow-pfW">
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="554"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<navigationBar key="tableFooterView" contentMode="scaleToFill" id="OA9-cU-ctc">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
Expand Down Expand Up @@ -835,11 +835,11 @@
<viewControllerLayoutGuide type="bottom" id="dbc-fW-0PT"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="eEo-OZ-NVq">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Q7F-3H-ipp">
<rect key="frame" x="0.0" y="0.0" width="375" height="618"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="554"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="dataSource" destination="8ik-tt-HOc" id="d6o-oi-Nnu"/>
Expand Down Expand Up @@ -909,7 +909,7 @@
<constraint firstAttribute="height" constant="50" id="5LT-2m-88H"/>
<constraint firstAttribute="width" constant="50" id="Pvt-Ch-E4a"/>
</constraints>
<state key="normal" image="stepic_play"/>
<state key="normal" image="play_dark"/>
<connections>
<action selector="playButtonPressed:" destination="3W9-IK-cIE" eventType="touchUpInside" id="kVm-QE-2Cq"/>
</connections>
Expand Down Expand Up @@ -1186,7 +1186,7 @@
<!--Downloads-->
<scene sceneID="Laj-7g-BZD">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="MT9-2h-A7A" customClass="GreenNavigationViewController" customModule="Stepic" sceneMemberID="viewController">
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="MT9-2h-A7A" customClass="StyledNavigationViewController" customModule="Adaptive_1838" customModuleProvider="target" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Downloads" image="tab-downloads" selectedImage="tab-downloads" id="Wmp-3r-xny"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="W60-es-dLX">
Expand All @@ -1200,12 +1200,12 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="KcB-yW-iiN" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="917" y="2163"/>
<point key="canvasLocation" x="916" y="2163"/>
</scene>
<!--Certificates-->
<scene sceneID="3uD-23-Gsy">
<objects>
<navigationController id="4bs-eV-3LS" customClass="GreenNavigationViewController" customModule="Stepic" sceneMemberID="viewController">
<navigationController id="4bs-eV-3LS" customClass="StyledNavigationViewController" customModule="Adaptive_1838" customModuleProvider="target" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Certificates" image="tab-certificates" selectedImage="tab-certificates" id="mwm-pG-FxV"/>
<nil key="simulatedBottomBarMetrics"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="E6m-D0-KUL">
Expand Down Expand Up @@ -1274,17 +1274,17 @@
<resources>
<image name="Circled User Male" width="25" height="25"/>
<image name="Info" width="25" height="25"/>
<image name="stepic_play" width="150" height="150"/>
<image name="play_dark" width="154" height="154"/>
<image name="success" width="28" height="28"/>
<image name="tab-certificates" width="25" height="25"/>
<image name="tab-downloads" width="20" height="22"/>
<image name="tab-find-courses" width="22" height="22"/>
<image name="tab-my-courses" width="26" height="26"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="Had-eU-CRB"/>
<segue reference="ste-Lr-Bip"/>
<segue reference="nf5-of-tUO"/>
<segue reference="bJP-cn-CC7"/>
<segue reference="gVj-jL-WXR"/>
<segue reference="LaP-cg-j2K"/>
</inferredMetricsTieBreakers>
</document>
33 changes: 4 additions & 29 deletions Stepic/Block+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,38 +74,13 @@ extension Block {
}

var image: UIImage {
var resultName = "ic_theory"
switch (name) {
case "animation" : resultName = "ic_animation"
case "video" : resultName = "video"
case "text" : resultName = "ic_theory"
case "code", "dataset", "admin" : resultName = "ic_admin"
default: resultName = "easy_quiz"
}

if let img = UIImage(named: resultName) {
return img
} else {
print("Unknown image name -> \(resultName)")
return UIImage(named: "ic_theory")!
case "video" : return #imageLiteral(resourceName: "ic_video_dark")
case "text" : return #imageLiteral(resourceName: "ic_theory_dark")
case "code", "dataset", "admin" : return #imageLiteral(resourceName: "ic_hard_dark")
default: return #imageLiteral(resourceName: "ic_easy_dark")
}
}

// var image : UIImage {
// var resultName = "ic_theory"
// switch (name) {
// case "text" : resultName = "ic_theory"
// case "schulte" : resultName = "ic_table"
// default: resultName = "ic_\(name)"
// }
//
// if let img = UIImage(named: resultName) {
// return img
// } else {
// print("Unknown image name -> \(resultName)")
// return UIImage(named: "ic_theory")!
// }
// }
}

enum BlockTypes: String {
Expand Down
14 changes: 7 additions & 7 deletions Stepic/ButtonExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ extension UIButton {
// }
//
// func setEnabledJoined() {
// let attributedTitle = NSAttributedString(string: Constants.joinCourseButtonText, attributes: [NSForegroundColorAttributeName : UIColor.stepicGreenColor()])
// let attributedTitle = NSAttributedString(string: Constants.joinCourseButtonText, attributes: [NSForegroundColorAttributeName : UIColor.stepicGreen])
// setAttributedTitle(attributedTitle, for: UIControlState() )
// //enabled = false
// layer.borderColor = UIColor.stepicGreenColor().cgColor
// self.titleLabel?.textColor = UIColor.stepicGreenColor()
// layer.borderColor = UIColor.stepicGreen.cgColor
// self.titleLabel?.textColor = UIColor.stepicGreen
// }

func setStepicGreenStyle() {
self.setRoundedCorners(cornerRadius: 8.0, borderWidth: 0.0, borderColor: UIColor.stepicGreenColor())
self.setRoundedCorners(cornerRadius: 8.0, borderWidth: 0.0, borderColor: UIColor.mainDark)
self.setTitleColor(UIColor.white, for: UIControlState())
self.backgroundColor = UIColor.stepicGreenColor()
self.backgroundColor = UIColor.mainDark
}

func setStepicWhiteStyle() {
self.setRoundedCorners(cornerRadius: 8.0, borderWidth: 1.0, borderColor: UIColor.stepicGreenColor())
self.setTitleColor(UIColor.stepicGreenColor(), for: UIControlState())
self.setRoundedCorners(cornerRadius: 8.0, borderWidth: 1.0, borderColor: UIColor.mainDark)
self.setTitleColor(UIColor.mainDark, for: UIControlState())
self.backgroundColor = UIColor.white
}

Expand Down
7 changes: 3 additions & 4 deletions Stepic/CertificateTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import UIKit

class CertificateTableViewCell: UITableViewCell {

@IBOutlet weak var courseTitle: UILabel!
@IBOutlet weak var certificateDescription: UILabel!
@IBOutlet weak var certificateResult: UILabel!
@IBOutlet weak var courseTitle: StepikLabel!
@IBOutlet weak var certificateDescription: StepikLabel!
@IBOutlet weak var certificateResult: StepikLabel!
@IBOutlet weak var shareButton: UIButton!
@IBOutlet weak var courseImage: UIImageView!

Expand All @@ -23,7 +23,6 @@ class CertificateTableViewCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code

shareButton.setTitle(NSLocalizedString("Share", comment: ""), for: .normal)
}

Expand Down
Loading