From 11d442789efb84e7da07405a8a03ed581121fa45 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Fri, 26 Aug 2016 17:14:42 -0400 Subject: [PATCH] Color coded cell text --- .../Library/CloudBooksController.swift | 21 ++++++++++-- Kiwix-iOS/Info.plist | 2 +- Kiwix-iOS/Storyboard/Search.storyboard | 34 +++++++++---------- Kiwix-iOSWidgets/Bookmarks/Info.plist | 2 +- 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/Kiwix-iOS/Controller/Library/CloudBooksController.swift b/Kiwix-iOS/Controller/Library/CloudBooksController.swift index e4bf2661..8aa456db 100644 --- a/Kiwix-iOS/Controller/Library/CloudBooksController.swift +++ b/Kiwix-iOS/Controller/Library/CloudBooksController.swift @@ -117,11 +117,28 @@ class CloudBooksController: UITableViewController, NSFetchedResultsControllerDel guard let book = fetchedResultController.objectAtIndexPath(indexPath) as? Book else {return} guard let cell = cell as? BasicBookCell else {return} - cell.titleLabel.text = book.title + let textColor: UIColor = { + switch book.spaceState { + case .Enough: + return UIColor.blackColor() + case .Caution: + return UIColor.orangeColor() + case .NotEnough: + return UIColor.grayColor() + } + }() + cell.hasPic = book.hasPic cell.hasIndex = book.hasIndex cell.favIcon.image = UIImage(data: book.favIcon ?? NSData()) - cell.subtitleLabel.text = book.detailedDescription + cell.titleLabel.text = book.title + cell.subtitleLabel.text = [ + book.dateDescription, + book.fileSizeDescription, + book.articleCountDescription + ].flatMap({$0}).joinWithSeparator(" ") + cell.titleLabel.textColor = textColor + cell.subtitleLabel.textColor = textColor } // MARK: Other Data Source diff --git a/Kiwix-iOS/Info.plist b/Kiwix-iOS/Info.plist index 0f56704f..7ca73986 100644 --- a/Kiwix-iOS/Info.plist +++ b/Kiwix-iOS/Info.plist @@ -49,7 +49,7 @@ CFBundleVersion - 1.7.1361 + 1.7.1386 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/Kiwix-iOS/Storyboard/Search.storyboard b/Kiwix-iOS/Storyboard/Search.storyboard index a858c50f..27fad504 100644 --- a/Kiwix-iOS/Storyboard/Search.storyboard +++ b/Kiwix-iOS/Storyboard/Search.storyboard @@ -134,10 +134,6 @@ - - - - @@ -169,6 +165,10 @@ + + + + @@ -176,10 +176,6 @@ - - - - @@ -202,6 +198,10 @@ + + + + @@ -379,7 +379,7 @@ - +