mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-24 20:39:31 -04:00
BookDetail Controller
This commit is contained in:
parent
a107d9177b
commit
406a3ae31c
@ -37,6 +37,7 @@ class BookDetailController: UITableViewController {
|
||||
func configureViews() {
|
||||
guard let book = book else {return}
|
||||
|
||||
title = book.title
|
||||
favIconImageView.image = UIImage(data: book.favIcon ?? NSData())
|
||||
titleLabel.text = book.title
|
||||
|
||||
@ -49,13 +50,15 @@ class BookDetailController: UITableViewController {
|
||||
// MARK: - Table view data source
|
||||
|
||||
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
return 2
|
||||
return 4
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
switch section {
|
||||
case 0: return 3
|
||||
case 1: return 3
|
||||
case 2: return 2
|
||||
case 3: return 1
|
||||
default: return 0
|
||||
}
|
||||
}
|
||||
@ -91,12 +94,31 @@ class BookDetailController: UITableViewController {
|
||||
cell.textLabel?.text = NSLocalizedString("Article Count", comment: LocalizedStrings.BookDetail.comment)
|
||||
cell.detailTextLabel?.text = book?.articleCountFormatted
|
||||
return cell
|
||||
case (2, 0):
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier("RightDetailCell", forIndexPath: indexPath)
|
||||
cell.textLabel?.text = NSLocalizedString("Creator", comment: LocalizedStrings.BookDetail.comment)
|
||||
cell.detailTextLabel?.text = book?.creator
|
||||
return cell
|
||||
case (2, 1):
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier("RightDetailCell", forIndexPath: indexPath)
|
||||
cell.textLabel?.text = NSLocalizedString("Publisher", comment: LocalizedStrings.BookDetail.comment)
|
||||
cell.detailTextLabel?.text = book?.publisher
|
||||
return cell
|
||||
case (3, 0):
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier("DescCell", forIndexPath: indexPath)
|
||||
cell.textLabel?.text = book?.desc
|
||||
return cell
|
||||
default:
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier("RightDetailCell", forIndexPath: indexPath)
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||
guard section == 3 else {return nil}
|
||||
return NSLocalizedString("Description", comment: LocalizedStrings.BookDetail.comment)
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
||||
if section == 0 {return 25.0}
|
||||
return super.tableView(tableView, heightForHeaderInSection: section)
|
||||
|
@ -41,7 +41,7 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel
|
||||
// MARK: - Actions
|
||||
|
||||
func showLanguageFilter() {
|
||||
guard let splitViewController = splitViewController as? LibrarySplitViewController where splitViewController.isShowingLangFilter else {return}
|
||||
guard let splitViewController = splitViewController as? LibrarySplitViewController where !splitViewController.isShowingLangFilter else {return}
|
||||
guard let controller = UIStoryboard.libraryNew.initViewController(LanguageFilterController.self) else {return}
|
||||
controller.delegate = self
|
||||
let navController = UINavigationController(rootViewController: controller)
|
||||
|
@ -159,7 +159,7 @@ class LanguageFilterController: UITableViewController, NSFetchedResultsControlle
|
||||
|
||||
override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||
if showLanguages.count == 0 {
|
||||
return section == 0 ? "" : NSLocalizedString("All", comment: "Language selection: table section title") + " "
|
||||
return section == 0 ? "" : NSLocalizedString("ALL", comment: "Language selection: table section title") + " "
|
||||
} else {
|
||||
return section == 0 ? NSLocalizedString("SHOWING", comment: "Language selection: table section title") : NSLocalizedString("HIDING", comment: "Language selection: table section title")
|
||||
}
|
||||
|
@ -35,6 +35,6 @@ class LibrarySplitViewController: UISplitViewController, UISplitViewControllerDe
|
||||
}
|
||||
|
||||
var isShowingLangFilter: Bool {
|
||||
return !((viewControllers[safe: 1] as? UINavigationController)?.topViewController is LanguageFilterController)
|
||||
return ((viewControllers[safe: 1] as? UINavigationController)?.topViewController is LanguageFilterController)
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.7.1070</string>
|
||||
<string>1.7.1082</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
|
@ -40,7 +40,7 @@
|
||||
<rect key="frame" x="0.0" y="92" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="CVW-Rc-hA9" id="xiL-PL-4ko">
|
||||
<frame key="frameInset" width="414" height="43.666666666666664"/>
|
||||
<frame key="frameInset" width="414" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="" lineBreakMode="tailTruncation" minimumFontSize="8" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="epH-ai-QrA">
|
||||
@ -150,6 +150,9 @@
|
||||
</tableView>
|
||||
<tabBarItem key="tabBarItem" title="Item" id="f2P-kQ-k9n"/>
|
||||
<navigationItem key="navigationItem" id="JNh-sG-ihV"/>
|
||||
<refreshControl key="refreshControl" opaque="NO" multipleTouchEnabled="YES" contentMode="center" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="4aI-Q4-87d">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</refreshControl>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="TMf-0g-nhn" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
@ -186,7 +189,7 @@
|
||||
<rect key="frame" x="0.0" y="64" width="414" height="65"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4e2-XW-fS5">
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="16" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4e2-XW-fS5">
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="29" id="81w-4e-QwP"/>
|
||||
</constraints>
|
||||
@ -250,19 +253,19 @@
|
||||
<constraint firstItem="yJh-4P-l8s" firstAttribute="centerY" secondItem="JQU-Gb-xqS" secondAttribute="centerY" id="fnQ-CU-vOb"/>
|
||||
<constraint firstItem="HJc-XE-GVe" firstAttribute="centerY" secondItem="fEt-eR-ago" secondAttribute="centerY" id="lm2-XF-U29"/>
|
||||
<constraint firstItem="JQU-Gb-xqS" firstAttribute="leading" secondItem="FxJ-Aa-5Pk" secondAttribute="trailing" constant="2" id="naO-NP-qyM"/>
|
||||
<constraint firstItem="4e2-XW-fS5" firstAttribute="top" secondItem="xW2-eb-wOa" secondAttribute="top" constant="8" id="qmA-Nb-RFY"/>
|
||||
<constraint firstItem="4e2-XW-fS5" firstAttribute="top" secondItem="xW2-eb-wOa" secondAttribute="top" constant="16" id="qmA-Nb-RFY"/>
|
||||
<constraint firstItem="vSn-bw-OUc" firstAttribute="leading" secondItem="xW2-eb-wOa" secondAttribute="leading" constant="8" id="rOL-t3-qNG"/>
|
||||
<constraint firstItem="yJh-4P-l8s" firstAttribute="leading" secondItem="JQU-Gb-xqS" secondAttribute="trailing" constant="2" id="s0x-bK-qks"/>
|
||||
<constraint firstItem="vSn-bw-OUc" firstAttribute="top" secondItem="xW2-eb-wOa" secondAttribute="top" constant="12" id="ubP-iG-piZ"/>
|
||||
<constraint firstItem="vSn-bw-OUc" firstAttribute="top" secondItem="xW2-eb-wOa" secondAttribute="top" constant="20" id="ubP-iG-piZ"/>
|
||||
<constraint firstItem="FxJ-Aa-5Pk" firstAttribute="centerX" secondItem="xW2-eb-wOa" secondAttribute="centerX" constant="10" id="wDl-Hb-oK4"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="RightDetailCell" textLabel="iyO-rf-lDN" detailTextLabel="iHv-oK-qrR" style="IBUITableViewCellStyleValue1" id="eB8-dt-BPR">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="RightDetailCell" textLabel="iyO-rf-lDN" detailTextLabel="iHv-oK-qrR" style="IBUITableViewCellStyleValue1" id="eB8-dt-BPR">
|
||||
<rect key="frame" x="0.0" y="184.5" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="eB8-dt-BPR" id="KR4-kV-SZd">
|
||||
<frame key="frameInset" width="414" height="43.666666666666664"/>
|
||||
<frame key="frameInset" width="414" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="iyO-rf-lDN">
|
||||
@ -282,11 +285,11 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="CenterTextCell" textLabel="JyF-th-fCw" style="IBUITableViewCellStyleDefault" id="B0D-Hu-sVM">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="CenterTextCell" textLabel="JyF-th-fCw" style="IBUITableViewCellStyleDefault" id="B0D-Hu-sVM">
|
||||
<rect key="frame" x="0.0" y="228.5" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="B0D-Hu-sVM" id="Fhf-jb-Urf">
|
||||
<frame key="frameInset" width="414" height="43.666666666666664"/>
|
||||
<frame key="frameInset" width="414" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="JyF-th-fCw">
|
||||
@ -299,11 +302,11 @@
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="TextSwitchCell" id="c4v-9p-eEF" customClass="TextSwitchCell" customModule="Kiwix" customModuleProvider="target">
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="TextSwitchCell" id="c4v-9p-eEF" customClass="TextSwitchCell" customModule="Kiwix" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="272.5" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="c4v-9p-eEF" id="Lt6-0C-r4i">
|
||||
<frame key="frameInset" width="414" height="43.666666666666664"/>
|
||||
<frame key="frameInset" width="414" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ksx-E1-lZ2">
|
||||
@ -326,6 +329,23 @@
|
||||
<outlet property="titleLabel" destination="Ksx-E1-lZ2" id="2c2-zU-Ekv"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="DescCell" textLabel="noJ-ab-bVV" style="IBUITableViewCellStyleDefault" id="J0v-iU-gZ5">
|
||||
<rect key="frame" x="0.0" y="316.5" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="J0v-iU-gZ5" id="bXv-ic-E7x">
|
||||
<frame key="frameInset" width="414" height="43.666666666666664"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="noJ-ab-bVV">
|
||||
<frame key="frameInset" minX="15" width="384" height="43.666666666666664"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="baD-NX-PQT" id="euZ-wN-6yy"/>
|
||||
@ -344,7 +364,7 @@
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="mqT-2V-BJm" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="549" y="-1657"/>
|
||||
<point key="canvasLocation" x="547.82608695652175" y="-1657.3369565217392"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="gvc-DO-J6G">
|
||||
|
@ -21,7 +21,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.7.1190</string>
|
||||
<string>1.7.1203</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionMainStoryboard</key>
|
||||
|
@ -33,12 +33,12 @@ import Foundation
|
||||
extension NSLocale {
|
||||
class var preferredLangCodes: [String] {
|
||||
let preferredLangNames = self.preferredLanguages()
|
||||
var preferredLangCodes = Set<String>()
|
||||
var preferredLangCodes = NSMutableOrderedSet()
|
||||
for lang in preferredLangNames {
|
||||
guard let code = lang.componentsSeparatedByString("-").first else {continue}
|
||||
preferredLangCodes.insert(NSLocale.canonicalLanguageIdentifierFromString(code))
|
||||
preferredLangCodes.addObject(NSLocale.canonicalLanguageIdentifierFromString(code))
|
||||
}
|
||||
return Array(preferredLangCodes)
|
||||
return preferredLangCodes.flatMap({ $0 as? String})
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user