Update podspec only Source
This commit is contained in:
1 parent
3c2848ffd1
commit
f2e8d4411f
159 files changed
+2
-12319
No files matched your search
-141
@@ -1,141 +0,0 @@
|
||||
//
|
||||
// LocationContainerController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 04/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class LocationContainerController: ContainerController, ContainerControllerDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var locationDelegate: LocationContainerControllerDelegate?
|
||||
|
||||
var tableView: TableAdapterView!
|
||||
var items: [TableAdapterItem] = []
|
||||
|
||||
var darkStyle: Bool = false
|
||||
|
||||
var header: HeaderDetailsView!
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(addTo controller: UIViewController, darkStyle: Bool) {
|
||||
super.init(addTo: controller,
|
||||
layout: MapsMainContainerLayout())
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
self.delegate = self
|
||||
|
||||
loadItems()
|
||||
updateTableView()
|
||||
updateContainerView()
|
||||
updateHeaderView()
|
||||
|
||||
add(scrollView: tableView)
|
||||
add(headerView: header)
|
||||
}
|
||||
|
||||
// MARK: - Delegate
|
||||
|
||||
func containerControllerMove(_ controller: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
locationDelegate?.locationContainerController(move: self, position: position, type: type, animation: animation)
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateContainerView() {
|
||||
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
view.cornerRadius = 12
|
||||
view.addShadow()
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateHeaderView() {
|
||||
|
||||
header = HeaderDetailsView()
|
||||
header.height = 60
|
||||
header.titleLabel.text = _L("LNG_MAPS_MARKED_LOCATION")
|
||||
header.subtitle.text = "27 \(_L("LNG_MAPS_KM"))"
|
||||
header.add(darkStyle: darkStyle)
|
||||
header.buttonCloseClickCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.remove(completion: { [weak self] in
|
||||
guard let __self = self else { return }
|
||||
|
||||
_self.locationDelegate?.locationContainerController(closeComplection: __self)
|
||||
})
|
||||
_self.locationDelegate?.locationContainerController(close: _self)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update DarkStyle
|
||||
|
||||
func update(darkStyle: Bool) {
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
header.add(darkStyle: darkStyle)
|
||||
|
||||
loadItems()
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
//MARK: - Update TableView
|
||||
|
||||
func updateTableView() {
|
||||
|
||||
tableView = TableAdapterView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 0), style: .plain)
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 18))
|
||||
tableView.set(items: items, animated: true)
|
||||
|
||||
tableView.didScrollCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.header.separatorView?.alpha = (_self.tableView.contentOffset.y <= 0) ? 0.0 : 1.0
|
||||
}
|
||||
tableView.separatorColor = Colors.rgba(128, 128, 128, 0.6)
|
||||
}
|
||||
|
||||
func loadItems() {
|
||||
|
||||
items = []
|
||||
|
||||
|
||||
|
||||
items.append( LocationButtonCellItem(title: _L("LNG_MAPS_LOCATION_DIRECTIONS"),
|
||||
subtitle: "25 \(_L("LNG_MAPS_MIN")) drive",
|
||||
type: .blue, clickCallback: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.presentRoute()
|
||||
}) )
|
||||
items.append( LocationButtonCellItem(title: _L("LNG_MAPS_LOCATION_EDIT"), type: .gray) )
|
||||
|
||||
items.append( LocationAddressCellItem(darkStyle: darkStyle) )
|
||||
items.append( LocationCollectionsButtonCellItem() )
|
||||
items.append( LocationCoordinateCellItem(darkStyle: darkStyle) )
|
||||
|
||||
items.append( LocationTextCellItem(title: _L("LNG_MAPS_LOCATION_ADD_TO_FAVORITES"), image: UIImage(systemName: "star.fill")) )
|
||||
items.append( LocationTextCellItem(title: _L("LNG_MAPS_LOCATION_CREATE_NEW_CONTACT"), image: UIImage(systemName: "person.crop.circle")) )
|
||||
items.append( LocationTextCellItem(title: _L("LNG_MAPS_LOCATION_ADD_TO_EXISTING_CONTACT"), image: UIImage(systemName: "person.crop.circle.badge.plus")) )
|
||||
items.append( LocationTextCellItem(title: _L("LNG_MAPS_LOCATION_ADD_A_MISSING_PLACE"), image: UIImage(systemName: "plus")) )
|
||||
|
||||
}
|
||||
|
||||
//MARK: - Show Route
|
||||
|
||||
func presentRoute() {
|
||||
locationDelegate?.locationContainerController(showRoute: self)
|
||||
}
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// LocationContainerControllerDelegate.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 26/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
protocol LocationContainerControllerDelegate {
|
||||
|
||||
func locationContainerController(showRoute locationContainerController: LocationContainerController)
|
||||
|
||||
func locationContainerController(close locationContainerController: LocationContainerController)
|
||||
|
||||
func locationContainerController(closeComplection locationContainerController: LocationContainerController)
|
||||
|
||||
func locationContainerController(move locationContainerController: LocationContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool)
|
||||
}
|
||||
-206
@@ -1,206 +0,0 @@
|
||||
//
|
||||
// MapsContainerController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 04/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class MapsContainerController: ContainerController, ContainerControllerDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var mapsDelegate: MapsContainerControllerDelegate?
|
||||
|
||||
var tableView: TableAdapterView!
|
||||
var items: [TableAdapterItem] = []
|
||||
|
||||
var darkStyle: Bool = false
|
||||
var searchSelected: Bool = false
|
||||
|
||||
var headerSearchBarView: HeaderSearchBarView!
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(addTo controller: UIViewController, darkStyle: Bool) {
|
||||
super.init(addTo: controller,
|
||||
layout: MapsMainContainerLayout())
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
self.delegate = self
|
||||
|
||||
loadItems()
|
||||
updateTableView()
|
||||
updateContainerView()
|
||||
updateHeaderView()
|
||||
|
||||
add(scrollView: tableView)
|
||||
add(headerView: headerSearchBarView)
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Delegate
|
||||
|
||||
func containerControllerMove(_ controller: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
|
||||
mapsDelegate?.mapsContainerController(move: self, position: position, type: type, animation: animation)
|
||||
|
||||
if animation, type != .top {
|
||||
headerSearchBarView.searchBar.setShowsCancelButton(false, animated: true)
|
||||
updateTableView(searchSelected: false)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateContainerView() {
|
||||
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
view.cornerRadius = 12
|
||||
view.addShadow()
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateHeaderView() {
|
||||
|
||||
headerSearchBarView = HeaderSearchBarView()
|
||||
headerSearchBarView.searchBarBeginEditingCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.updateTableView(searchSelected: true)
|
||||
_self.move(type: .top)
|
||||
}
|
||||
headerSearchBarView.searchBarCancelButtonClickedCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.controller?.view.endEditing(true)
|
||||
_self.updateTableView(searchSelected: false)
|
||||
_self.move(type: .middle)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update DarkStyle
|
||||
|
||||
func update(darkStyle: Bool) {
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
headerSearchBarView.set(darkStyle: darkStyle)
|
||||
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
|
||||
|
||||
loadItems()
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
func updateTableView(searchSelected: Bool) {
|
||||
if self.searchSelected == searchSelected { return }
|
||||
|
||||
self.searchSelected = searchSelected
|
||||
|
||||
loadItems()
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
//MARK: - Update TableView
|
||||
|
||||
func updateTableView() {
|
||||
|
||||
tableView = TableAdapterView()
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.set(items: items, animated: true)
|
||||
tableView.selectIndexCallback = { [weak self] (index: Int) -> Void in
|
||||
guard let _self = self, _self.items[index] is MapsLocationCellItem else { return }
|
||||
|
||||
_self.showLocationDetails()
|
||||
}
|
||||
tableView.didScrollCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.controller?.view.endEditing(true)
|
||||
// let state = _self.tableView.panGestureRecognizer.state
|
||||
// print("\(state)")
|
||||
//
|
||||
// switch _self.tableView.panGestureRecognizer.state {
|
||||
// case .began:
|
||||
// default: break
|
||||
// }
|
||||
|
||||
_self.headerSearchBarView.separatorView?.alpha = (_self.tableView.contentOffset.y <= 0) ? 0.0 : 1.0
|
||||
}
|
||||
tableView.separatorColor = Colors.rgba(128, 128, 128, 0.6)
|
||||
}
|
||||
|
||||
func loadItems() {
|
||||
|
||||
items = []
|
||||
|
||||
if searchSelected {
|
||||
|
||||
let orange: UIColor = Colors.rgb(248, 149, 64)
|
||||
let yellow: UIColor = Colors.rgb(255, 179, 0)
|
||||
let blue: UIColor = Colors.rgb(29, 160, 255)
|
||||
let red: UIColor = Colors.rgb(255, 93, 90)
|
||||
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_RECENT_SEARCH"), textButton: _L("LNG_MAPS_SECTION_SEE_ALL")) )
|
||||
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_RECENT_CITY"), color: .clear, separator: false) )
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_NEARBY_SEARCH"), textButton: "") )
|
||||
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_RESTAURANTS"), color: orange) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_FOOD_DELIVERY"), color: orange) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_GROCERIES"), color: yellow) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_GAS_STATION"), color: blue) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_PHARMACIES"), color: red) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_HOSPITALS"), color: red) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_URGENT_CARE"), color: red) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_SUBWAY"), color: blue) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_TRAIN_STATION"), color: blue) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_SHOPPING_CENTERS"), color: yellow) )
|
||||
|
||||
} else {
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_SECTION_FAVORITES")) )
|
||||
items.append( MapsFavoritesCellItem(darkStyle: darkStyle, clickCallback: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.showLocationDetails()
|
||||
}) )
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_SECTION_COLLECTIONS")) )
|
||||
items.append( MapsCollectionsCellItem() )
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_SECTION_RECENTLY_VIEWED")) )
|
||||
|
||||
for index in 1...7 {
|
||||
let title = String(format: "%@ %d", _L("LNG_MAPS_MARKED_LOCATION"), index)
|
||||
let subtitle = String(format: "%@, %d/2, %@", _L("LNG_MAPS_STREET"), index, _L("LNG_MAPS_CITY"))
|
||||
items.append( MapsLocationCellItem(title: title, subtitle: subtitle, colorType: .red, darkStyle: darkStyle) )
|
||||
}
|
||||
for index in 8...11 {
|
||||
let title = String(format: "%@ %d", _L("LNG_MAPS_MARKED_LOCATION"), index)
|
||||
let subtitle = _L("LNG_MAPS_DIRECTIONS_MY_LOCATION")
|
||||
items.append( MapsLocationCellItem(title: title, subtitle: subtitle, colorType: .black, darkStyle: darkStyle) )
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Show Location-Details
|
||||
|
||||
func showLocationDetails() {
|
||||
|
||||
mapsDelegate?.mapsContainerController(showLocationDetails: self)
|
||||
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
//
|
||||
// MapsContainerControllerDelegate.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 25/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
protocol MapsContainerControllerDelegate {
|
||||
|
||||
func mapsContainerController(showLocationDetails mapsContainerController: MapsContainerController)
|
||||
|
||||
func mapsContainerController(move mapsContainerController: MapsContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool)
|
||||
|
||||
}
|
||||
-126
@@ -1,126 +0,0 @@
|
||||
//
|
||||
// LocationContainerController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 04/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class MenuContainerController: ContainerController, ContainerControllerDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var menuDelegate: MenuContainerControllerDelegate?
|
||||
|
||||
var tableView: TableAdapterView!
|
||||
var items: [TableAdapterItem] = []
|
||||
var header: MapsMenuHeader!
|
||||
|
||||
var selectedIndex: Int = 0
|
||||
var darkStyle: Bool = false
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(addTo controller: UIViewController, darkStyle: Bool, selectedIndex: Int) {
|
||||
super.init(addTo: controller,
|
||||
layout: MapsMenuContainerLayout())
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
self.selectedIndex = selectedIndex
|
||||
|
||||
self.delegate = self
|
||||
|
||||
loadItems()
|
||||
updateTableView()
|
||||
updateContainerView()
|
||||
updateHeaderView()
|
||||
|
||||
add(scrollView: tableView)
|
||||
add(headerView: header)
|
||||
|
||||
move(type: .top)
|
||||
}
|
||||
|
||||
// MARK: - Delegate
|
||||
|
||||
func containerControllerShadowClick(_ containerController: ContainerController) {
|
||||
closeContainer()
|
||||
}
|
||||
|
||||
func closeContainer() {
|
||||
remove(completion: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
_self.menuDelegate?.menuContainerController(closeComplection: _self)
|
||||
})
|
||||
menuDelegate?.menuContainerController(close: self)
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateContainerView() {
|
||||
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
view.cornerRadius = 12
|
||||
view.addShadow()
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateHeaderView() {
|
||||
|
||||
header = MapsMenuHeader()
|
||||
|
||||
header.set(darkStyle: darkStyle)
|
||||
header.buttonCloseClickCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
_self.closeContainer()
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update TableView
|
||||
|
||||
func updateTableView() {
|
||||
|
||||
tableView = TableAdapterView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 0), style: .plain)
|
||||
tableView.set(items: items, animated: true)
|
||||
tableView.separatorColor = Colors.rgba(128, 128, 128, 0.6)
|
||||
}
|
||||
|
||||
|
||||
func loadItems() {
|
||||
|
||||
items = []
|
||||
|
||||
items.append( MapsMenuSegmentCellItem(selected: selectedIndex, darkStyle: darkStyle, selectIndexCallback: { [weak self] (_ index: Int) in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.selectedIndex = index
|
||||
|
||||
_self.menuDelegate?.menuContainerController(segment: _self, selectedIndex: index)
|
||||
|
||||
_self.darkStyle = (index == 2)
|
||||
|
||||
_self.view.addBlur(darkStyle: _self.darkStyle)
|
||||
_self.header.set(darkStyle: _self.darkStyle)
|
||||
|
||||
_self.loadItems()
|
||||
_self.tableView.set(items: _self.items, animated: true)
|
||||
}) )
|
||||
|
||||
items.append( MapsMenuTextCellItem(title: _L("LNG_MAPS_MENU_TRAFFIC"), switchShow: true, darkStyle: darkStyle, separator: false) )
|
||||
|
||||
items.append( MapsMenuSpaceCellItem() )
|
||||
|
||||
items.append( MapsMenuTextCellItem(title: _L("LNG_MAPS_SECTION_MARK_MY_LOCATION")) )
|
||||
items.append( MapsMenuTextCellItem(title: _L("LNG_MAPS_LOCATION_ADD_A_MISSING_PLACE")) )
|
||||
items.append( MapsMenuTextCellItem(title: _L("LNG_MAPS_SECTION_REPORT_AN_ISSUE"), separator: false) )
|
||||
|
||||
items.append( MapsMenuSpaceCellItem() )
|
||||
// items.append( MapsMenuSpaceCellItem(cellHeight: 100) )
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// MenuContainerControllerDelegate.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 26/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
protocol MenuContainerControllerDelegate {
|
||||
|
||||
func menuContainerController(close menuContainerController: MenuContainerController)
|
||||
|
||||
func menuContainerController(closeComplection menuContainerController: MenuContainerController)
|
||||
|
||||
func menuContainerController(segment menuContainerController: MenuContainerController, selectedIndex: Int)
|
||||
}
|
||||
-181
@@ -1,181 +0,0 @@
|
||||
//
|
||||
// LocationContainerController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 04/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
open class RouteContainerController: ContainerController, ContainerControllerDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var routeDelegate: RouteContainerControllerDelegate?
|
||||
|
||||
var tableView: TableAdapterView!
|
||||
var items: [TableAdapterItem] = []
|
||||
|
||||
var darkStyle: Bool = false
|
||||
|
||||
var tabbar: HeaderTabBarView!
|
||||
var header: HeaderDetailsView!
|
||||
var tableHeader: TableHeaderSpinerView?
|
||||
var routeLayout: MapsRouteContainerLayout
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(addTo controller: UIViewController, darkStyle: Bool) {
|
||||
|
||||
routeLayout = MapsRouteContainerLayout()
|
||||
|
||||
super.init(addTo: controller,
|
||||
layout: routeLayout)
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
self.delegate = self
|
||||
|
||||
loadTableItems()
|
||||
loadTableView()
|
||||
|
||||
loadContainerView()
|
||||
loadHeaderView()
|
||||
loadTabBarBottom()
|
||||
|
||||
add(scrollView: tableView)
|
||||
add(headerView: header)
|
||||
add(footerView: tabbar)
|
||||
}
|
||||
|
||||
// MARK: - Delegate
|
||||
|
||||
public func containerControllerMove(_ controller: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
routeDelegate?.routeContainerController(move: self, position: position, type: type, animation: animation)
|
||||
|
||||
if let tableHeader = tableHeader {
|
||||
|
||||
if animation {
|
||||
UIView.animate(withDuration: 0.55, animations: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
switch type {
|
||||
case .top: tableHeader.height = (ContainerDevice.height - (_self.layout.positions.top + _self.header.height + _self.tabbar.height))
|
||||
case .middle: tableHeader.height = MapsRouteCellData.height()
|
||||
case .bottom: tableHeader.height = 0.0
|
||||
default: break
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
tableHeader.height = tableView.height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func loadContainerView() {
|
||||
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
view.cornerRadius = 12
|
||||
view.addShadow()
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func loadTabBarBottom() {
|
||||
|
||||
tabbar = HeaderTabBarView()
|
||||
tabbar.height = (49.0 + ContainerDevice.isIphoneXBottom)
|
||||
tabbar.addBlur(darkStyle: darkStyle)
|
||||
|
||||
}
|
||||
|
||||
func loadHeaderView() {
|
||||
|
||||
header = HeaderDetailsView()
|
||||
header.height = 78
|
||||
header.separatorView?.alpha = 1.0
|
||||
header.titleLabel.text = "\(_L("LNG_MAPS_WHERE")) \(_L("LNG_MAPS_MARKED_LOCATION"))"
|
||||
header.subtitle.text = _L("LNG_MAPS_FROM")
|
||||
header.textButton.setTitle(_L("LNG_MAPS_MY_LOCATION"), for: .normal)
|
||||
header.add(darkStyle: darkStyle)
|
||||
header.buttonCloseClickCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
if let tab = _self.tabbar {
|
||||
tab.removeFromSuperview()
|
||||
}
|
||||
_self.remove(completion: { [weak self] in
|
||||
guard let __self = self else { return }
|
||||
_self.routeDelegate?.routeContainerController(closeComplection: __self)
|
||||
})
|
||||
_self.routeDelegate?.routeContainerController(close: _self)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update DarkStyle
|
||||
|
||||
func update(darkStyle: Bool) {
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
header.add(darkStyle: darkStyle)
|
||||
tabbar?.addBlur(darkStyle: darkStyle)
|
||||
|
||||
loadTableItems()
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
|
||||
//MARK: - Update TableView
|
||||
|
||||
func loadTableView() {
|
||||
|
||||
tableView = TableAdapterView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 0), style: .plain)
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.separatorColor = Colors.rgba(128, 128, 128, 0.6)
|
||||
|
||||
tableHeader = TableHeaderSpinerView()
|
||||
tableHeader?.width = ContainerDevice.width
|
||||
tableHeader?.backgroundColor = .clear
|
||||
tableView.tableHeaderView = tableHeader
|
||||
|
||||
main(delay: 2.5) { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.tableView.tableHeaderView = nil
|
||||
_self.tableHeader?.removeFromSuperview()
|
||||
_self.tableHeader = nil
|
||||
|
||||
_self.routeLayout.footerPadding = MapsRouteCellData.height()
|
||||
|
||||
_self.tableView.set(items: _self.items, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
public func main(delay: Double, work: @escaping () -> Void) {
|
||||
let deadline = DispatchTime.now() + delay
|
||||
DispatchQueue.main.asyncAfter(deadline: deadline) {
|
||||
work()
|
||||
}
|
||||
}
|
||||
|
||||
func loadTableItems() {
|
||||
|
||||
items = []
|
||||
|
||||
items.append( MapsRouteCellItem(darkStyle: darkStyle, title: "15 \(_L("LNG_MAPS_MIN"))", subtitle: "24 \(_L("LNG_MAPS_KM")) · \(_L("LNG_MAPS_STREET")) 1234541\n\(_L("LNG_ROUTE_FASTEST"))", selected: true) )
|
||||
items.append( MapsRouteCellItem(darkStyle: darkStyle, title: "40 \(_L("LNG_MAPS_MIN"))", subtitle: "31 \(_L("LNG_MAPS_KM")) · \(_L("LNG_MAPS_STREET")) \(_L("LNG_ROUTE_UNKNOWN"))...\n№ 7029") )
|
||||
items.append( MapsRouteCellItem(darkStyle: darkStyle, title: "45 \(_L("LNG_MAPS_MIN"))", subtitle: "29 \(_L("LNG_MAPS_KM")) · \(_L("LNG_MAPS_STREET")) \(_L("LNG_ROUTE_UNKNOWN"))\n\(_L("LNG_ROUTE_SIMPLEST"))") )
|
||||
items.append( MapsRouteCellItem(darkStyle: darkStyle, title: "45 \(_L("LNG_MAPS_MIN"))", subtitle: "29 \(_L("LNG_MAPS_KM")) · \(_L("LNG_MAPS_STREET")) \(_L("LNG_ROUTE_UNKNOWN"))\n\(_L("LNG_ROUTE_SIMPLEST"))") )
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_SECTION_DRIVING_OPTIONS"), textButton: "") )
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_SECTION_REPORT_AN_ISSUE"), textButton: "") )
|
||||
}
|
||||
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
//
|
||||
// RouteContainerControllerDelegate.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 26/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
public protocol RouteContainerControllerDelegate {
|
||||
|
||||
func routeContainerController(close routeContainerController: RouteContainerController)
|
||||
|
||||
func routeContainerController(closeComplection routeContainerController: RouteContainerController)
|
||||
|
||||
func routeContainerController(move routeContainerController: RouteContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool)
|
||||
}
|
||||
Reference in new issue
Block a user