-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from StepicOrg/release/1.10
Release/1.10
- Loading branch information
Showing
65 changed files
with
3,032 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// ApiUtil.swift | ||
// Stepic | ||
// | ||
// Created by Alexander Karpov on 07.06.16. | ||
// Copyright © 2016 Alex Karpov. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
class ApiUtil { | ||
static func constructIdsString<TID>(array arr: [TID]) -> String { | ||
var result = "" | ||
for element in arr { | ||
result += "ids[]=\(element)&" | ||
} | ||
if result != "" { | ||
result.removeAtIndex(result.endIndex.predecessor()) | ||
} | ||
return result | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// CellOperationsUtil.swift | ||
// Stepic | ||
// | ||
// Created by Alexander Karpov on 14.06.16. | ||
// Copyright © 2016 Alex Karpov. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
import FLKAutoLayout | ||
|
||
/* | ||
Some custom cell operation util functions | ||
*/ | ||
class CellOperationsUtil { | ||
|
||
class func addRefreshView(view: UIView, backgroundColor: UIColor = UIColor.whiteColor()) -> UIView { | ||
let v = UIView() | ||
v.backgroundColor = backgroundColor | ||
let ind = UIActivityIndicatorView(activityIndicatorStyle: .Gray) | ||
v.addSubview(ind) | ||
ind.alignCenterWithView(v) | ||
ind.startAnimating() | ||
view.addSubview(v) | ||
v.alignToView(view) | ||
return v | ||
} | ||
|
||
//Returns the removeSelection block | ||
class func animateViewSelection(view: UIView) -> (Void->Void) { | ||
let selectedColor = UIColor(red: 217/255.0, green: 217/255.0, blue: 217/255.0, alpha: 1).CGColor | ||
UIView.animateWithDuration(0.5, animations: { | ||
view.layer.backgroundColor = selectedColor | ||
}) | ||
|
||
return { | ||
UIView.animateWithDuration(0.5, animations: { | ||
view.layer.backgroundColor = UIColor.whiteColor().CGColor | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// ChoiceQuizLabelTableViewCell.swift | ||
// Stepic | ||
// | ||
// Created by Alexander Karpov on 20.01.16. | ||
// Copyright © 2016 Alex Karpov. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import BEMCheckBox | ||
import FLKAutoLayout | ||
|
||
class ChoiceQuizLabelTableViewCell: ChoiceQuizTableViewCell { | ||
|
||
var choiceLabel: UILabel! = UILabel() | ||
|
||
override var reuseIdentifier: String? { | ||
return "ChoiceQuizLabelTableViewCell" | ||
} | ||
|
||
override init(style: UITableViewCellStyle, reuseIdentifier: String?) { | ||
super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
// let x = NSBundle.mainBundle().loadNibNamed("ChoiceQuizTableViewCell", owner: self, options: nil)[0] | ||
// print(x) | ||
initialize() | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
super.init(coder: aDecoder) | ||
initialize() | ||
} | ||
|
||
func initialize() { | ||
choiceLabel.numberOfLines = 0 | ||
choiceLabel.font = UIFont(name: "ArialMT", size: 16) | ||
choiceLabel.lineBreakMode = NSLineBreakMode.ByTruncatingTail | ||
choiceLabel.baselineAdjustment = UIBaselineAdjustment.AlignBaselines | ||
choiceLabel.textAlignment = NSTextAlignment.Natural | ||
// textContainerView.addSubview(choiceLabel) | ||
// choiceLabel.alignToView(textContainerView) | ||
// print(choiceLabel.text) | ||
} | ||
|
||
override func awakeFromNib() { | ||
super.awakeFromNib() | ||
initialize() | ||
} | ||
|
||
override func setHTMLText(text: String) -> (Void -> Int) { | ||
choiceLabel.setTextWithHTMLString(text) | ||
return { | ||
return max(27, Int(UILabel.heightForLabelWithText(text, lines: 0, fontName: "ArialMT", fontSize: 16, width: UIScreen.mainScreen().bounds.width - 60))) + 17 | ||
} | ||
} | ||
|
||
override func setSelected(selected: Bool, animated: Bool) { | ||
super.setSelected(selected, animated: animated) | ||
} | ||
} | ||
|
Oops, something went wrong.