Base for reusable book collection controller
@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "open-book.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "update23.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.8 KiB |
@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "down-arrow-square-button2.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 17 KiB |
@ -13,6 +13,13 @@ import DZNEmptyDataSet
|
||||
|
||||
class LibraryBooksController: CoreDataCollectionBaseController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, LibraryCollectionCellDelegate {
|
||||
private(set) var itemWidth: CGFloat = 0.0
|
||||
var isCloudTab = true {
|
||||
didSet {
|
||||
title = isCloudTab ? Localized.Library.cloudTitle : Localized.Library.localTitle
|
||||
tabBarItem.image = UIImage(named: isCloudTab ? "Cloud" : "Folder")
|
||||
tabBarItem.selectedImage = UIImage(named: isCloudTab ? "CloudFilled" : "FolderFilled")
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func dismissButtonTapped(_ sender: UIBarButtonItem) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
@ -25,9 +32,8 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
title = Localized.Library.title
|
||||
configureRefreshControl()
|
||||
|
||||
configureRefreshControl()
|
||||
if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
|
||||
layout.minimumInteritemSpacing = 1
|
||||
layout.minimumLineSpacing = 1
|
||||
@ -182,7 +188,7 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView
|
||||
var predicate: NSCompoundPredicate {
|
||||
let displayedLanguages = Language.fetch(displayed: true, context: managedObjectContext)
|
||||
return NSCompoundPredicate(andPredicateWithSubpredicates: [
|
||||
NSPredicate(format: "stateRaw == 0"),
|
||||
NSPredicate(format: "stateRaw == 0 OR stateRaw == 1"),
|
||||
displayedLanguages.count > 0 ? NSPredicate(format: "language IN %@", displayedLanguages) : NSPredicate(format: "language.name != nil")
|
||||
])
|
||||
}
|
||||
@ -197,7 +203,9 @@ class LibraryBooksController: CoreDataCollectionBaseController, UICollectionView
|
||||
|
||||
extension Localized {
|
||||
class Library {
|
||||
static let title = NSLocalizedString("Library", comment: "Library")
|
||||
static let cloudTitle = NSLocalizedString("Cloud", comment: "Library, Cloud")
|
||||
static let localTitle = NSLocalizedString("Local", comment: "Library, Local")
|
||||
|
||||
static let download = NSLocalizedString("Download", comment: "Library, more action sheet")
|
||||
static let copyURL = NSLocalizedString("Copy URL", comment: "Library, more action sheet")
|
||||
}
|
||||
|
24
Kiwix-iOS/Controller/Library/LibraryTabController.swift
Normal file
@ -0,0 +1,24 @@
|
||||
//
|
||||
// LibraryTabController.swift
|
||||
// Kiwix
|
||||
//
|
||||
// Created by Chris Li on 1/25/17.
|
||||
// Copyright © 2017 Chris Li. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class LibraryTabController: UITabBarController {
|
||||
let cloud = UIStoryboard(name: "Library", bundle: nil).instantiateViewController(withIdentifier: "LibraryBookNavController") as! UINavigationController
|
||||
let local = UIStoryboard(name: "Library", bundle: nil).instantiateViewController(withIdentifier: "LibraryBookNavController") as! UINavigationController
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
(cloud.topViewController as! LibraryBooksController).isCloudTab = true
|
||||
(local.topViewController as! LibraryBooksController).isCloudTab = false
|
||||
|
||||
viewControllers = [cloud, local]
|
||||
}
|
||||
|
||||
}
|
@ -11,25 +11,6 @@
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="TmO-ZA-fdS">
|
||||
<objects>
|
||||
<viewController id="GpW-ew-k8l" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Bgc-rM-KvM"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="mYY-8i-M9c"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="dKF-5b-BWz">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="ACB-xI-x5A"/>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="4mP-NU-wmk" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-173.59999999999999" y="-740.7796101949026"/>
|
||||
</scene>
|
||||
<!--Library Books Controller-->
|
||||
<scene sceneID="IOQ-Xf-IR9">
|
||||
<objects>
|
||||
@ -200,28 +181,24 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-173.59999999999999" y="-1395.6521739130435"/>
|
||||
</scene>
|
||||
<!--Tab Bar Controller-->
|
||||
<!--Library Tab Controller-->
|
||||
<scene sceneID="c2f-93-r3I">
|
||||
<objects>
|
||||
<tabBarController id="9Nq-QX-pIk" sceneMemberID="viewController">
|
||||
<tabBarController id="9Nq-QX-pIk" customClass="LibraryTabController" customModule="Kiwix" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tabBar key="tabBar" contentMode="scaleToFill" id="nLw-xS-F9p">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</tabBar>
|
||||
<connections>
|
||||
<segue destination="2bR-6w-Vul" kind="relationship" relationship="viewControllers" id="DI2-tI-eJc"/>
|
||||
<segue destination="nbj-rk-UMb" kind="relationship" relationship="viewControllers" id="g9O-mc-x8A"/>
|
||||
</connections>
|
||||
</tabBarController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="TLW-Ce-SBK" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-2065" y="-1067"/>
|
||||
<point key="canvasLocation" x="-1974" y="-1397"/>
|
||||
</scene>
|
||||
<!--Item 1-->
|
||||
<scene sceneID="S7w-u9-rtU">
|
||||
<objects>
|
||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="2bR-6w-Vul" sceneMemberID="viewController">
|
||||
<navigationController storyboardIdentifier="LibraryBookNavController" automaticallyAdjustsScrollViewInsets="NO" id="2bR-6w-Vul" sceneMemberID="viewController">
|
||||
<tabBarItem key="tabBarItem" title="Item 1" id="TcQ-sW-F0o"/>
|
||||
<toolbarItems/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="KLa-ld-45V">
|
||||
@ -237,25 +214,6 @@
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-1112.8" y="-1395.6521739130435"/>
|
||||
</scene>
|
||||
<!--Item 2-->
|
||||
<scene sceneID="eng-z0-qg5">
|
||||
<objects>
|
||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="nbj-rk-UMb" sceneMemberID="viewController">
|
||||
<tabBarItem key="tabBarItem" title="Item 2" id="4xZ-ki-Mf5"/>
|
||||
<toolbarItems/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="5OW-FT-xNe">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
<segue destination="GpW-ew-k8l" kind="relationship" relationship="rootViewController" id="wd7-op-cMD"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Gwr-4V-2Kp" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-1112.8" y="-740.7796101949026"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="009-Nq-Jlu">
|
||||
<objects>
|
||||
|
@ -97,6 +97,7 @@
|
||||
97BC0FC01DD90A65004BBAD1 /* MainController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97BC0FBE1DD90A65004BBAD1 /* MainController.swift */; };
|
||||
97BC0FC21DD92B62004BBAD1 /* Buttons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97BC0FC11DD92B62004BBAD1 /* Buttons.swift */; };
|
||||
97C2C26A1DDCC58500A9CC64 /* ArticleOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9764CBD21D8083AA00072D6A /* ArticleOperation.swift */; };
|
||||
97C4A2E31E3926E50004CEB2 /* LibraryTabController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97C4A2E21E3926E50004CEB2 /* LibraryTabController.swift */; };
|
||||
97C601DC1D7F15C400362D4F /* Bookmark.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C601DB1D7F15C400362D4F /* Bookmark.storyboard */; };
|
||||
97C601DE1D7F342100362D4F /* HTMLHeading.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97C601DD1D7F342100362D4F /* HTMLHeading.swift */; };
|
||||
97D048AC1E32B7BE0028F9FD /* liblzma.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 9764F5921D830EF200E0B1C4 /* liblzma.tbd */; };
|
||||
@ -264,6 +265,7 @@
|
||||
97BC0FBD1DD90A65004BBAD1 /* JSInjection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JSInjection.swift; sourceTree = "<group>"; };
|
||||
97BC0FBE1DD90A65004BBAD1 /* MainController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainController.swift; sourceTree = "<group>"; };
|
||||
97BC0FC11DD92B62004BBAD1 /* Buttons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Buttons.swift; sourceTree = "<group>"; };
|
||||
97C4A2E21E3926E50004CEB2 /* LibraryTabController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibraryTabController.swift; sourceTree = "<group>"; };
|
||||
97C601DB1D7F15C400362D4F /* Bookmark.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Bookmark.storyboard; sourceTree = "<group>"; };
|
||||
97C601DD1D7F342100362D4F /* HTMLHeading.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTMLHeading.swift; sourceTree = "<group>"; };
|
||||
97D0E9921DDA487E0029530E /* SearchBaseController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBaseController.swift; sourceTree = "<group>"; };
|
||||
@ -723,6 +725,7 @@
|
||||
97C005D41D64B369004352E8 /* Library */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C4A2E21E3926E50004CEB2 /* LibraryTabController.swift */,
|
||||
9705D5951E368712005292AC /* LibraryBooksController.swift */,
|
||||
9737F6201E379D0700961020 /* LibraryLanguageController.swift */,
|
||||
97347BB91E39056A00F56EE6 /* LibraryDownloadController.swift */,
|
||||
@ -1075,6 +1078,7 @@
|
||||
97A08C151DD263B90070D0E4 /* Book.swift in Sources */,
|
||||
97D6813A1D6F711A00E5FA99 /* Language.swift in Sources */,
|
||||
97BC0FBF1DD90A65004BBAD1 /* JSInjection.swift in Sources */,
|
||||
97C4A2E31E3926E50004CEB2 /* LibraryTabController.swift in Sources */,
|
||||
97BC0FC01DD90A65004BBAD1 /* MainController.swift in Sources */,
|
||||
97A1FD421D6F728200A80EE2 /* Extensions.swift in Sources */,
|
||||
97A1FD3A1D6F724E00A80EE2 /* reader.cpp in Sources */,
|
||||
|