|
|
@ -59,7 +59,7 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
|
|
|
|
// ensure images at the end of the list can be scrolled above the bottom buttons
|
|
|
|
// ensure images at the end of the list can be scrolled above the bottom buttons
|
|
|
|
let bottomButtonInset = -1 * SendMediaNavigationController.bottomButtonsCenterOffset + SendMediaNavigationController.bottomButtonWidth / 2
|
|
|
|
let bottomButtonInset = -1 * SendMediaNavigationController.bottomButtonsCenterOffset + SendMediaNavigationController.bottomButtonWidth / 2
|
|
|
|
collectionView.contentInset.bottom = bottomButtonInset + 8
|
|
|
|
collectionView.contentInset.bottom = bottomButtonInset + 8
|
|
|
|
view.backgroundColor = Colors.navigationBarBackground
|
|
|
|
view.backgroundColor = .white
|
|
|
|
|
|
|
|
|
|
|
|
// The PhotoCaptureVC needs a shadow behind it's cancel button, so we use a custom icon.
|
|
|
|
// The PhotoCaptureVC needs a shadow behind it's cancel button, so we use a custom icon.
|
|
|
|
// This VC has a visible navbar so doesn't need the shadow, but because the user can
|
|
|
|
// This VC has a visible navbar so doesn't need the shadow, but because the user can
|
|
|
@ -69,20 +69,13 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
|
|
|
|
let cancelImage = UIImage(imageLiteralResourceName: "X")
|
|
|
|
let cancelImage = UIImage(imageLiteralResourceName: "X")
|
|
|
|
let cancelButton = UIBarButtonItem(image: cancelImage, style: .plain, target: self, action: #selector(didPressCancel))
|
|
|
|
let cancelButton = UIBarButtonItem(image: cancelImage, style: .plain, target: self, action: #selector(didPressCancel))
|
|
|
|
|
|
|
|
|
|
|
|
cancelButton.tintColor = Colors.text
|
|
|
|
cancelButton.tintColor = .black
|
|
|
|
navigationItem.leftBarButtonItem = cancelButton
|
|
|
|
navigationItem.leftBarButtonItem = cancelButton
|
|
|
|
|
|
|
|
|
|
|
|
let titleView = TitleView()
|
|
|
|
let titleView = TitleView()
|
|
|
|
titleView.delegate = self
|
|
|
|
titleView.delegate = self
|
|
|
|
titleView.text = photoCollection.localizedTitle()
|
|
|
|
titleView.text = photoCollection.localizedTitle()
|
|
|
|
|
|
|
|
|
|
|
|
// Loki: Set navigation bar background color
|
|
|
|
|
|
|
|
let navigationBar = navigationController!.navigationBar
|
|
|
|
|
|
|
|
navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
|
|
|
|
|
|
|
|
navigationBar.shadowImage = UIImage()
|
|
|
|
|
|
|
|
navigationBar.isTranslucent = false
|
|
|
|
|
|
|
|
navigationBar.barTintColor = Colors.navigationBarBackground
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if #available(iOS 11, *) {
|
|
|
|
if #available(iOS 11, *) {
|
|
|
|
// do nothing
|
|
|
|
// do nothing
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -93,7 +86,7 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
|
|
|
|
navigationItem.titleView = titleView
|
|
|
|
navigationItem.titleView = titleView
|
|
|
|
self.titleView = titleView
|
|
|
|
self.titleView = titleView
|
|
|
|
|
|
|
|
|
|
|
|
collectionView.backgroundColor = Colors.navigationBarBackground
|
|
|
|
collectionView.backgroundColor = .white
|
|
|
|
|
|
|
|
|
|
|
|
let selectionPanGesture = DirectionalPanGestureRecognizer(direction: [.horizontal], target: self, action: #selector(didPanSelection))
|
|
|
|
let selectionPanGesture = DirectionalPanGestureRecognizer(direction: [.horizontal], target: self, action: #selector(didPanSelection))
|
|
|
|
selectionPanGesture.delegate = self
|
|
|
|
selectionPanGesture.delegate = self
|
|
|
@ -194,6 +187,17 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
|
|
|
|
override func viewWillAppear(_ animated: Bool) {
|
|
|
|
override func viewWillAppear(_ animated: Bool) {
|
|
|
|
super.viewWillAppear(animated)
|
|
|
|
super.viewWillAppear(animated)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Loki: Set navigation bar background color
|
|
|
|
|
|
|
|
let navigationBar = navigationController!.navigationBar
|
|
|
|
|
|
|
|
navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
|
|
|
|
|
|
|
|
navigationBar.shadowImage = UIImage()
|
|
|
|
|
|
|
|
navigationBar.isTranslucent = false
|
|
|
|
|
|
|
|
navigationBar.barTintColor = .white
|
|
|
|
|
|
|
|
(navigationBar as! OWSNavigationBar).respectsTheme = false
|
|
|
|
|
|
|
|
navigationBar.backgroundColor = .white
|
|
|
|
|
|
|
|
let backgroundImage = UIImage(color: .white)
|
|
|
|
|
|
|
|
navigationBar.setBackgroundImage(backgroundImage, for: .default)
|
|
|
|
|
|
|
|
|
|
|
|
// Determine the size of the thumbnails to request
|
|
|
|
// Determine the size of the thumbnails to request
|
|
|
|
let scale = UIScreen.main.scale
|
|
|
|
let scale = UIScreen.main.scale
|
|
|
|
let cellSize = collectionViewFlowLayout.itemSize
|
|
|
|
let cellSize = collectionViewFlowLayout.itemSize
|
|
|
@ -440,6 +444,7 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
|
|
|
|
collectionPickerView.autoPinEdgesToSuperviewEdges(with: .zero, excludingEdge: .top)
|
|
|
|
collectionPickerView.autoPinEdgesToSuperviewEdges(with: .zero, excludingEdge: .top)
|
|
|
|
collectionPickerView.autoPinEdge(toSuperviewSafeArea: .top)
|
|
|
|
collectionPickerView.autoPinEdge(toSuperviewSafeArea: .top)
|
|
|
|
collectionPickerView.layoutIfNeeded()
|
|
|
|
collectionPickerView.layoutIfNeeded()
|
|
|
|
|
|
|
|
collectionPickerView.backgroundColor = .white
|
|
|
|
|
|
|
|
|
|
|
|
// Initially position offscreen, we'll animate it in.
|
|
|
|
// Initially position offscreen, we'll animate it in.
|
|
|
|
collectionPickerView.frame = collectionPickerView.frame.offsetBy(dx: 0, dy: collectionPickerView.frame.height)
|
|
|
|
collectionPickerView.frame = collectionPickerView.frame.offsetBy(dx: 0, dy: collectionPickerView.frame.height)
|
|
|
@ -602,10 +607,10 @@ class TitleView: UIView {
|
|
|
|
addSubview(stackView)
|
|
|
|
addSubview(stackView)
|
|
|
|
stackView.autoPinEdgesToSuperviewEdges()
|
|
|
|
stackView.autoPinEdgesToSuperviewEdges()
|
|
|
|
|
|
|
|
|
|
|
|
label.textColor = Colors.text
|
|
|
|
label.textColor = .black
|
|
|
|
label.font = .boldSystemFont(ofSize: Values.mediumFontSize)
|
|
|
|
label.font = .boldSystemFont(ofSize: Values.mediumFontSize)
|
|
|
|
|
|
|
|
|
|
|
|
iconView.tintColor = Colors.text
|
|
|
|
iconView.tintColor = .black
|
|
|
|
iconView.image = UIImage(named: "navbar_disclosure_down")?.withRenderingMode(.alwaysTemplate)
|
|
|
|
iconView.image = UIImage(named: "navbar_disclosure_down")?.withRenderingMode(.alwaysTemplate)
|
|
|
|
|
|
|
|
|
|
|
|
addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(titleTapped)))
|
|
|
|
addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(titleTapped)))
|
|
|
|