Skip to content

Commit

Permalink
Merge pull request #22 from Athlee/develop-v0.1.2
Browse files Browse the repository at this point in the history
[ATHImagePickerController] Develop 0.1.2
  • Loading branch information
mozharovsky authored Jan 30, 2017
2 parents b4ff82f + 73bed98 commit 97a917e
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 21 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Source/ATHImagePickerAssetsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ extension ATHImagePickerAssetsViewController: PhotoCachable {
}
}

// MARK: - UIScrollView management

extension ATHImagePickerAssetsViewController {
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView == collectionView {
Expand All @@ -204,6 +206,8 @@ extension ATHImagePickerAssetsViewController {
}
}

// MARK: - UICollectionView management

extension ATHImagePickerAssetsViewController: UICollectionViewDataSource, UICollectionViewDelegate {
public func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
Expand Down
10 changes: 5 additions & 5 deletions Source/ATHImagePickerCaptureViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ final public class ATHImagePickerCaptureViewController: UIViewController, PhotoC
}

public var videoInput: AVCaptureDeviceInput?

public var imageOutput: AVCaptureStillImageOutput?

public var focusView: UIView?
Expand Down Expand Up @@ -63,19 +64,19 @@ final public class ATHImagePickerCaptureViewController: UIViewController, PhotoC

switch flashMode {
case .on:
let image = /*config.assets?.flashOnImage ??*/
let image = config.assets?.flashOnImage ??
UIImage(named: "Flash", in: bundle, compatibleWith: nil)

flashButton.setImage(image, for: .normal)

case .off:
let image = /*config.assets?.flashOffImage ??*/
let image = config.assets?.flashOffImage ??
UIImage(named: "FlashOff", in: bundle, compatibleWith: nil)

flashButton.setImage(image, for: .normal)

case .auto:
let image = /*config.assets?.flashAutoImage ??*/
let image = config.assets?.flashAutoImage ??
UIImage(named: "FlashAuto", in: bundle, compatibleWith: nil)

flashButton.setImage(image, for: .normal)
Expand Down Expand Up @@ -162,12 +163,11 @@ final public class ATHImagePickerCaptureViewController: UIViewController, PhotoC
statusBarAnimation = config.statusBarConfig.statusBarAnimation

let bundle = Bundle(for: self.classForCoder)
let image = /*config.assets?.switchCameraIcon ??*/
let image = config.assets?.switchCameraIcon ??
UIImage(named: "FlipCamera", in: bundle, compatibleWith: nil)
switchButton.setImage(image, for: .normal)
}


// MARK: - IBActions

@IBAction func recognizedTapGesture(_ rec: UITapGestureRecognizer) {
Expand Down
27 changes: 21 additions & 6 deletions Source/ATHImagePickerPreviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public protocol PreviewController: FloatingViewLayout {

open class ATHImagePickerPreviewViewController: UIViewController, EmbededController, PreviewController, Cropable {

// MARK: - Outlets
// MARK: Outlets

@IBOutlet weak var cropContainerView: UIView!

Expand Down Expand Up @@ -64,7 +64,7 @@ open class ATHImagePickerPreviewViewController: UIViewController, EmbededControl

open var allowPanOutside = false

// MARK: - PickerController properties
// MARK: PickerController properties

public var image: UIImage? {
didSet {
Expand All @@ -74,11 +74,11 @@ open class ATHImagePickerPreviewViewController: UIViewController, EmbededControl
}
}

// MARK: - EmbededController properties
// MARK: EmbededController properties

internal weak var holder: SelectionController!

// MARK: - Cropable properties
// MARK: Cropable properties

public var cropView = UIScrollView()
public var childContainerView = UIView()
Expand All @@ -97,7 +97,7 @@ open class ATHImagePickerPreviewViewController: UIViewController, EmbededControl
return CropableScrollViewDelegate(cropable: self)
}()

// MARK: - Properties
// MARK: Properties

fileprivate var isZooming = false
fileprivate var isChecking = false
Expand All @@ -121,7 +121,7 @@ open class ATHImagePickerPreviewViewController: UIViewController, EmbededControl
}
}

// MARK: - Life cycle
// MARK: Life cycle

override open func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -144,6 +144,21 @@ open class ATHImagePickerPreviewViewController: UIViewController, EmbededControl
addedRecognizers = true
addGestureRecognizers()
}

// Prevent instant velocity behavior.
if state == .unfolded {
previousPoint = nil
}
}

// MARK: Touches

open override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
holder.isScrollEnabled = false
}

open override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
holder.isScrollEnabled = true
}
}

Expand Down

0 comments on commit 97a917e

Please sign in to comment.