123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- //
- // NCActivity.swift
- // Nextcloud
- //
- // Created by Marino Faggiana on 17/01/2019.
- // Copyright © 2019 Marino Faggiana. All rights reserved.
- //
- // Author Marino Faggiana <marino.faggiana@nextcloud.com>
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- import Foundation
- import UIKit
- class NCActivity: UIViewController, UITableViewDataSource, UITableViewDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate {
-
- @IBOutlet weak var tableView: UITableView!
- private let appDelegate = UIApplication.shared.delegate as! AppDelegate
- override func viewDidLoad() {
- super.viewDidLoad()
-
- // empty Data Source
- tableView.emptyDataSetDelegate = self;
- tableView.emptyDataSetSource = self;
-
- tableView.estimatedRowHeight = 120
- tableView.tableFooterView = UIView()
- }
-
- override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
-
- // Color
- appDelegate.aspectNavigationControllerBar(self.navigationController?.navigationBar, online: appDelegate.reachability.isReachable(), hidden: false)
- appDelegate.aspectTabBar(self.tabBarController?.tabBar, hidden: false)
-
- //loadDatasource()
- //loadListingTrash()
- }
-
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return 1
- }
-
-
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-
- if let cell = tableView.dequeueReusableCell(withIdentifier: "tableViewCell", for: indexPath) as? TableViewCell {
- return cell
- }
-
- return UITableViewCell()
- }
- }
- class CollectionViewCell: UICollectionViewCell {
-
- @IBOutlet weak var imageView: UIImageView!
-
- override func awakeFromNib() {
- super.awakeFromNib()
- }
-
- }
- class TableViewCell: UITableViewCell, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
-
- @IBOutlet weak var collectionView: UICollectionView!
- var imageArray = [String] ()
-
- override func awakeFromNib() {
- super.awakeFromNib()
-
- collectionView.delegate = self
- collectionView.dataSource = self
-
- imageArray = ["1.jpeg","2.jpeg","3.jpeg","4.jpeg","5.jpeg","6.jpeg","7.jpeg","8.jpeg","9.jpeg","10.jpeg"]
-
- // Initialization code
- }
-
- func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize{
- let size = CGSize(width: 120, height: 120)
- return size
- }
-
- func numberOfSections(in collectionView: UICollectionView) -> Int {
- return 1
- }
-
- func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- return 10
- }
-
- func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
-
- if let cell: CollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectionCell", for: indexPath) as? CollectionViewCell {
- let randomNumber = Int(arc4random_uniform(UInt32(imageArray.count)))
- cell.imageView.image = UIImage(named: imageArray[randomNumber])
- return cell
- }
-
- return UICollectionViewCell()
- }
- }
|