Skip to content

Commit 2d60cc7

Browse files
author
Joey Lorich
committed
Change add icon, minor bugfixes
1 parent 688603e commit 2d60cc7

12 files changed

Lines changed: 131 additions & 10 deletions

File tree

EasyReader/Application/Controllers/Home/EZRHomeViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ - (void)selectedFeedDidChange:(NSNotification *)notification
325325
Feed *feed = notification.object;
326326

327327
if ((!feed || feed != lastSelectedFeed) && [self.collectionView_feedItems numberOfItemsInSection:0] > 0) {
328-
[self.collectionView_feedItems scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] atScrollPosition:UICollectionViewScrollPositionLeft animated:YES];
328+
[self.collectionView_feedItems scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] atScrollPosition:UICollectionViewScrollPositionLeft animated:NO];
329329
}
330330
}
331331

EasyReader/Application/Controllers/Menu/EZRMenuSearchController.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ - (void)postSearchStateChangeNotification:(EZRSearchState)state
119119
{
120120
[[NSNotificationCenter defaultCenter] postNotificationName:kEZRFeedSearchStateChangedNotification
121121
object:nil
122-
userInfo:@{@"searchState": [NSNumber numberWithInt:state]}];
122+
userInfo:@{
123+
@"searchState": [NSNumber numberWithInt:state],
124+
@"searchText": self.searchBar.text
125+
}];
123126
}
124127

125128
#pragma mark - UISearchBarDelegate Methods

EasyReader/Application/Controllers/Menu/EZRMenuTableViewDelegate.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ @interface EZRMenuTableViewDelegate ()
3232

3333
@implementation EZRMenuTableViewDelegate
3434

35+
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
36+
{
37+
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
38+
39+
if ([cell isKindOfClass:[EZRMenuFeedCell class]]) {
40+
EZRMenuFeedCell *ezrcell = (EZRMenuFeedCell *)cell;
41+
if (!ezrcell.feed) {
42+
return UITableViewCellEditingStyleNone;
43+
}
44+
}
45+
46+
return UITableViewCellEditingStyleDelete;
47+
}
48+
49+
3550
/**
3651
* Handles selection of a row
3752
*/

EasyReader/Application/Controllers/Menu/EZRMenuViewController.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ - (void)searchStateChanged:(NSNotification *)notification {
118118
originalMenuHeight = self.menuHeight.constant;
119119

120120
self.tableView_menu.dataSource = self.searchFeedDataSource;
121+
self.searchFeedDataSource.source = @[];
122+
[self.searchFeedDataSource setLastSearchTerm:nil];
121123
self.menuHeight.constant = originalMenuHeight - 216;
122124
break;
123125
}
@@ -128,7 +130,9 @@ - (void)searchStateChanged:(NSNotification *)notification {
128130
break;
129131
}
130132
case kEZRSearchStateResultsAvailable:
131-
// Do nothing, just need to realod
133+
[self.searchFeedDataSource setLastSearchTerm:[[notification userInfo] objectForKey:@"searchText"]];
134+
135+
// Do nothing, just need to reload
132136
break;
133137
}
134138

EasyReader/Application/Controllers/Menu/MenuCells/EZRSearchFeedCell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ @implementation EZRSearchFeedCell
2020
- (void)setFeedData:(NSDictionary *)feedData
2121
{
2222
_feedData = feedData;
23-
self.imageView_icon.image = [UIImage imageNamed:@"icon_plus"];
23+
//self.imageView_icon.image = [UIImage imageNamed:@"icon_plus"];
2424
self.label_name.text = [feedData objectForKey:@"name"];
2525
}
2626

EasyReader/Application/Controllers/Menu/MenuDataSources/EZRMenuSearchFeedDataSource.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,20 @@
1414
*/
1515
@interface EZRMenuSearchFeedDataSource : CSArrayTableViewDataSource
1616

17+
#pragma mark - Properties
18+
1719
/// A dictionary of feed data to use as the base for this data source
1820
@property (nonatomic, retain) NSDictionary *feedData;
1921

22+
23+
#pragma mark - Methods
24+
25+
/**
26+
* Sets the last search term used. This is used to determine which cell to display (no results, or empty).
27+
*
28+
* @param lastSearchTerm The most recent search term
29+
*/
30+
- (void) setLastSearchTerm:(NSString *)lastSearchTerm;
31+
32+
2033
@end

EasyReader/Application/Controllers/Menu/MenuDataSources/EZRMenuSearchFeedDataSource.m

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#import "EZRSearchFeedCell.h"
1414

1515
@implementation EZRMenuSearchFeedDataSource
16+
{
17+
NSString *_lastSearchTerm;
18+
}
1619

1720
- (instancetype) init{
1821
self = [super init];
@@ -30,12 +33,40 @@ - (instancetype) init{
3033

3134
#pragma mark - Public methods
3235

36+
- (void) setLastSearchTerm:(NSString *)lastSearchTerm {
37+
_lastSearchTerm = lastSearchTerm;
38+
}
39+
3340
- (void)setFeedData:(NSDictionary *)feedData
3441
{
3542
NSSet *feedSet = [NSSet setWithArray:feedData[@"feeds"]];
3643

3744
self.source = [feedSet sortedArrayByAttributes:@[@"name"] ascending:YES];
3845
}
3946

47+
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
48+
int numberOfResults = [super tableView:tableView numberOfRowsInSection:section];
49+
50+
if (numberOfResults == 0 && self.source.count == 0) {
51+
return 1;
52+
}
53+
54+
return numberOfResults;
55+
}
56+
57+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
58+
UITableViewCell *cell;
59+
60+
if (indexPath.section == 0 && indexPath.row == 0 && self.source.count == 0 && _lastSearchTerm.length > 0) {
61+
cell = [tableView dequeueReusableCellWithIdentifier:@"NoResultsFoundCell"];
62+
} else if (indexPath.section == 0 && indexPath.row == 0 && self.source.count == 0 && _lastSearchTerm.length == 0) {
63+
cell = [tableView dequeueReusableCellWithIdentifier:@"NoSearchTextCell"];
64+
} else {
65+
cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
66+
}
67+
68+
return cell;
69+
}
70+
4071

4172
@end

EasyReader/Application/Controllers/Menu/MenuDataSources/EZRMenuUserFeedDataSource.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
5858
UITableViewCell *cell;
5959

6060
if (indexPath.row == 0) {
61-
cell = [tableView dequeueReusableCellWithIdentifier:self.reusableCellIdentifier];
61+
cell = [tableView dequeueReusableCellWithIdentifier:self.reusableCellIdentifier];;
6262
((EZRMenuFeedCell*)cell).feed = nil;
6363
((EZRMenuFeedCell*)cell).label_name.text = @"All Feeds";
6464
if (self.currentFeedsProvider.currentFeed == nil) {

EasyReader/Application/Services/EZRFeedImageService.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
static EZRFeedImageService *sharedInstance;
2424

2525

26-
27-
2826
@implementation EZRFeedImageService
2927
{
3028
/// A cache of feed item images
@@ -42,6 +40,7 @@ @implementation EZRFeedImageService
4240
/// An array of URLs that are currently being processed
4341
NSMutableArray *imageURLsCurrentlyBeingProcessed;
4442

43+
/// A list of prefetched images
4544
NSMutableArray *prefetched;
4645
}
4746

EasyReader/Application/Views/Main_iPhone.storyboard

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,12 @@
278278
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
279279
<autoresizingMask key="autoresizingMask"/>
280280
<subviews>
281-
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ptb-Kv-s5O">
282-
<rect key="frame" x="20" y="14" width="16" height="16"/>
281+
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="icon_addFeed" translatesAutoresizingMaskIntoConstraints="NO" id="Ptb-Kv-s5O">
282+
<rect key="frame" x="240" y="14" width="15" height="15"/>
283283
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
284284
</imageView>
285285
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SoB-0g-JfK">
286-
<rect key="frame" x="51" y="11" width="204" height="21"/>
286+
<rect key="frame" x="20" y="11" width="204" height="21"/>
287287
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
288288
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
289289
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="16"/>
@@ -298,6 +298,44 @@
298298
<outlet property="label_name" destination="SoB-0g-JfK" id="tc1-yU-AWq"/>
299299
</connections>
300300
</tableViewCell>
301+
<tableViewCell userInteractionEnabled="NO" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" shouldIndentWhileEditing="NO" reuseIdentifier="NoResultsFoundCell" rowHeight="91" id="dUz-bt-mor">
302+
<rect key="frame" x="0.0" y="154" width="320" height="91"/>
303+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
304+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="dUz-bt-mor" id="SKa-XC-6mc">
305+
<rect key="frame" x="0.0" y="0.0" width="320" height="91"/>
306+
<autoresizingMask key="autoresizingMask"/>
307+
<subviews>
308+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="No results found." lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oN8-ml-mIo">
309+
<rect key="frame" x="20" y="11" width="265" height="21"/>
310+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
311+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
312+
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="16"/>
313+
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
314+
<nil key="highlightedColor"/>
315+
</label>
316+
</subviews>
317+
</tableViewCellContentView>
318+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
319+
</tableViewCell>
320+
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="NoSearchTextCell" rowHeight="91" id="8BG-5Q-34X">
321+
<rect key="frame" x="0.0" y="245" width="320" height="91"/>
322+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
323+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="8BG-5Q-34X" id="ZzY-xb-OXn">
324+
<rect key="frame" x="0.0" y="0.0" width="320" height="91"/>
325+
<autoresizingMask key="autoresizingMask"/>
326+
<subviews>
327+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="e7H-J1-LqO">
328+
<rect key="frame" x="6" y="35" width="265" height="21"/>
329+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
330+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
331+
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="16"/>
332+
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
333+
<nil key="highlightedColor"/>
334+
</label>
335+
</subviews>
336+
</tableViewCellContentView>
337+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
338+
</tableViewCell>
301339
</prototypes>
302340
<connections>
303341
<outlet property="dataSource" destination="sJh-MY-rG4" id="me7-tU-DuK"/>
@@ -346,6 +384,7 @@
346384
</scenes>
347385
<resources>
348386
<image name="button_menu" width="44" height="44"/>
387+
<image name="icon_addFeed" width="15" height="15"/>
349388
</resources>
350389
<simulatedMetricsContainer key="defaultSimulatedMetrics">
351390
<simulatedStatusBarMetrics key="statusBar"/>

0 commit comments

Comments
 (0)