mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Adding saved/shared icons to story titles on iOS.
This commit is contained in:
parent
36959a1b9d
commit
e9e2d9f729
8 changed files with 54 additions and 14 deletions
|
@ -18,6 +18,8 @@
|
|||
NSString *storyAuthor;
|
||||
NSString *storyDate;
|
||||
int storyScore;
|
||||
BOOL isStarred;
|
||||
BOOL isShared;
|
||||
|
||||
// River view
|
||||
NSString *siteTitle;
|
||||
|
@ -35,6 +37,8 @@
|
|||
@property (nonatomic) UIImage *siteFavicon;
|
||||
|
||||
@property (readwrite) int storyScore;
|
||||
@property (readwrite) BOOL isStarred;
|
||||
@property (readwrite) BOOL isShared;
|
||||
|
||||
@property (nonatomic) NSString *storyTitle;
|
||||
@property (nonatomic) NSString *storyAuthor;
|
||||
|
|
|
@ -110,23 +110,32 @@ static UIFont *indicatorFont = nil;
|
|||
CGSize theSize = [self.storyTitle sizeWithFont:font constrainedToSize:CGSizeMake(rect.size.width, 30.0) lineBreakMode:NSLineBreakByTruncatingTail];
|
||||
|
||||
int storyTitleY = 7 + adjustForSocial + ((30 - theSize.height)/2);
|
||||
if (self.isShort){
|
||||
if (self.isShort) {
|
||||
storyTitleY = 7 + adjustForSocial + 2;
|
||||
}
|
||||
|
||||
int storyTitleX = leftMargin;
|
||||
if (self.isStarred) {
|
||||
UIImage *savedIcon = [UIImage imageNamed:@"clock"];
|
||||
[savedIcon drawInRect:CGRectMake(storyTitleX, storyTitleY - 1, 16, 16) blendMode:nil alpha:1];
|
||||
storyTitleX += 20;
|
||||
}
|
||||
if (self.isShared) {
|
||||
UIImage *savedIcon = [UIImage imageNamed:@"menu_icn_share"];
|
||||
[savedIcon drawInRect:CGRectMake(storyTitleX, storyTitleY - 1, 16, 16) blendMode:nil alpha:1];
|
||||
storyTitleX += 20;
|
||||
}
|
||||
[self.storyTitle
|
||||
drawInRect:CGRectMake(leftMargin, storyTitleY, rect.size.width, theSize.height)
|
||||
drawInRect:CGRectMake(storyTitleX, storyTitleY, rect.size.width - storyTitleX + leftMargin, theSize.height)
|
||||
withFont:font
|
||||
lineBreakMode:NSLineBreakByTruncatingTail
|
||||
alignment:NSTextAlignmentLeft];
|
||||
|
||||
int storyAuthorDateY = 41 + adjustForSocial;
|
||||
if (self.isShort){
|
||||
if (self.isShort) {
|
||||
storyAuthorDateY -= 13;
|
||||
}
|
||||
|
||||
// story author style
|
||||
|
||||
if (self.isRead) {
|
||||
textColor = UIColorFromRGB(0x808080);
|
||||
font = [UIFont fontWithName:@"Helvetica" size:10];
|
||||
|
|
|
@ -886,6 +886,8 @@
|
|||
cell.storyTitle = [title stringByDecodingHTMLEntities];
|
||||
|
||||
cell.storyDate = [story objectForKey:@"short_parsed_date"];
|
||||
cell.isStarred = [story objectForKey:@"starred"];
|
||||
cell.isShared = [story objectForKey:@"shared"];
|
||||
|
||||
if ([[story objectForKey:@"story_authors"] class] != [NSNull class]) {
|
||||
cell.storyAuthor = [[story objectForKey:@"story_authors"] uppercaseString];
|
||||
|
@ -967,6 +969,8 @@
|
|||
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0];
|
||||
FeedDetailTableCell *cell = (FeedDetailTableCell*) [self.storyTitlesTable cellForRowAtIndexPath:indexPath];
|
||||
cell.isRead = [[appDelegate.activeStory objectForKey:@"read_status"] boolValue];
|
||||
cell.isShared = [[appDelegate.activeStory objectForKey:@"shared"] boolValue];
|
||||
cell.isStarred = [[appDelegate.activeStory objectForKey:@"starred"] boolValue];
|
||||
[cell setNeedsDisplay];
|
||||
}
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@
|
|||
appDelegate.activeFeedUserProfiles = [DataUtilities
|
||||
updateUserProfiles:appDelegate.activeFeedUserProfiles
|
||||
withNewUserProfiles:userProfiles];
|
||||
|
||||
[appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
[self replaceStory:[results objectForKey:@"story"] withReplyId:nil];
|
||||
}
|
||||
|
||||
|
|
|
@ -316,10 +316,10 @@
|
|||
objectForKey:@"tags"]
|
||||
objectForKey:tag] intValue];
|
||||
NSString *tagHtml = [NSString stringWithFormat:@"<a href=\"http://ios.newsblur.com/classify-tag/%@\" "
|
||||
"class=\"NB-story-tag %@\"><div class=\"NB-highlight\"></div>%@</a>",
|
||||
tag,
|
||||
tagScore > 0 ? @"NB-story-tag-positive" : tagScore < 0 ? @"NB-story-tag-negative" : @"",
|
||||
tag];
|
||||
"class=\"NB-story-tag %@\"><div class=\"NB-highlight\"></div>%@</a>",
|
||||
tag,
|
||||
tagScore > 0 ? @"NB-story-tag-positive" : tagScore < 0 ? @"NB-story-tag-negative" : @"",
|
||||
tag];
|
||||
[tagStrings addObject:tagHtml];
|
||||
}
|
||||
storyTags = [NSString
|
||||
|
@ -329,6 +329,11 @@
|
|||
[tagStrings componentsJoinedByString:@""]];
|
||||
}
|
||||
}
|
||||
NSString *storyStarred = @"";
|
||||
if ([self.activeStory objectForKey:@"starred"] && [self.activeStory objectForKey:@"starred_date"]) {
|
||||
storyStarred = [NSString stringWithFormat:@"<div class=\"NB-story-starred-date\">%@</div>",
|
||||
[self.activeStory objectForKey:@"starred_date"]];
|
||||
}
|
||||
|
||||
NSString *storyTitle = [self.activeStory objectForKey:@"story_title"];
|
||||
NSMutableDictionary *titleClassifiers = [[appDelegate.activeClassifiers objectForKey:feedId]
|
||||
|
@ -350,11 +355,13 @@
|
|||
"<div class=\"NB-story-date\">%@</div>"
|
||||
"%@"
|
||||
"%@"
|
||||
"%@"
|
||||
"</div></div>",
|
||||
storyTitle,
|
||||
[self.activeStory objectForKey:@"long_parsed_date"],
|
||||
storyAuthor,
|
||||
storyTags];
|
||||
storyTags,
|
||||
storyStarred];
|
||||
return storyHeader;
|
||||
}
|
||||
|
||||
|
|
|
@ -839,6 +839,8 @@
|
|||
}
|
||||
|
||||
[appDelegate markActiveStorySaved:YES];
|
||||
[appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
[self refreshHeaders];
|
||||
[self.currentPage flashCheckmarkHud:@"saved"];
|
||||
}
|
||||
|
||||
|
@ -868,10 +870,9 @@
|
|||
return [self requestFailed:request];
|
||||
}
|
||||
|
||||
// [appDelegate markActiveStoryUnread];
|
||||
// [appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
|
||||
[appDelegate markActiveStorySaved:NO];
|
||||
[appDelegate.feedDetailViewController redrawUnreadStory];
|
||||
[self refreshHeaders];
|
||||
[self.currentPage flashCheckmarkHud:@"unsaved"];
|
||||
}
|
||||
|
||||
|
|
|
@ -289,6 +289,17 @@ body.NB-iphone {
|
|||
display: block;
|
||||
|
||||
}
|
||||
.NB-story-starred-date {
|
||||
margin: 4px 0 0 0;
|
||||
padding: 0 0 0 20px;
|
||||
background: transparent url("data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAEx0lEQVRYCc1YQWhcRRj+Z95umwRJIRgREQ3VU0XjTfSkEbF681TUigdBIXTT3ZCm7aVLDlKbDdlttyxW8CBqtCdvKorWm3gSFT1piR4UDCx0kWaT7Jvp/+17Mzvv7du3L5pgB5aZ+eefb77M/PO/byK01nQ7FXk7kQGX3G4JXXjnwqGRbXlUkJzRpKdJ02HGGA9xWiToOtt+JKG/ah9Qn59+/fSN3awhsh5ZtVF9UCr/DC/2Mi8wknGRtiCx5nvyfGm29GuWOUMJVavVUZnzlxisyL98FtAEnx221VTHK5dKpc2EcWtKJVSvVx7QJD/ho3nYzvgPDd6tnwSpFwqFU78NghlIaLW+Ou2R+pInTvZPFutE+qoi/XWO9C9EoxuBz+Zkh8QRSWKGSBxjn6n+ubThk3xmvjD/Q8IYh17CtcfOKBLf8oQIGUH0O5M4e6N582q5XFZJgMa2tLQkD02MHeNdeYtt9xl7WG9I0o8n7VQfIcSMl1Pf9R2ToLW8HHtjdnb2nxh4arfRaNyxo25e4cvwkuuI4/M78rF4TPVdewQwp8pIzPDOrM6dWFhgwF1n0fAPOH7p8sqffBjA6Bb8weFlWTQ21JEd6l5t3+eYcG4T78zJEwvH2ZZIpnZp+RUh5CrAtFbzxbnF99FOKOLi5ZUPYju1ozzviJsSIpna89VZBnKv9h84JrYlksGiTOYKV3fix+23YRtQNLAQh854vpvbHIMlhAzM2xg5Z+6fyRAzow7emNPuawILlyIywIkWaxubJYTPARudDCzWcZuM417VASbShi0jB9rec6ZnCZEWTxtjUOuhVzvqn63XTReCPna9paAZ0+8REvSIMaJG0nP7e9lWWl1z8TgFTJt+j1Dw1TZ2lgHIwPtT4tgcq4fNSj1CRDawgkHzOTCu2epafRlqILU0m5t/xxyMfCGXUMSn2WwOvOoRR6LI15t10ntZSMUwbNclFBFSExOjd1mvlAYnQ+SpLcfFG0YqAbtl5vcIQek5BV9tpzuwicysSb3GDr7jlEoqjs1BbdfuEYLsdEogIRxDSrNYWPyQSb3KLplIeUI86cJxUFsp0iPEGth1gp6BhIjaBvdSSL1baVTuNjOBqbV40fRRK002xdgFIch5rN1z1FPQM73+8NYAUvn8dp4/YUEJMPWU6XPd3h7xPzN9SwivAz7LNTOAmo/tPPSMaxvWdkgh0BVLjnPFYvEvzAMWMF0MrOm+TCwhOOF1wBUEebfwvb+/K674/IwtSw1S256e0n7u3uLcwpvhHAEsYDoYO+Ga1hTRQ7BerK8sc3XKenBDCFphgQYhxXj/qggWaMuuQAtRKicLXVwL2qcY8VRhCXuUI9+qRgCxuLpnHyRs2TIJG307BPteinzETOyYsMQGK8UnXKUII0oiIQzUapVHhSe+4Gbk5YExnrYuhP7I1/ob6uR+brVa3WfQ+Pj4JOU6DyHPBFc7cpuCqUxGkny2UJj/3hjceiAhOP0fD8XILXOZoo13E54q3Kzwz94+jO2yYG4FWElvMRcrdYdcR7xI8AjgYIfudqSu69XX3vt/NsSXgCA/uCWf54T2FP+mQ3FltBSS63V8m/h3beug+tRNenGspH7mHUqavB+21BjajwWHYd4CVCEE1ECzPqUAAAAASUVORK5CYII=") no-repeat 0 0;
|
||||
background-size: 16px;
|
||||
font-weight: bold;
|
||||
font-size: 10px;
|
||||
color: #818776;
|
||||
line-height: 17px;
|
||||
}
|
||||
|
||||
|
||||
.NB-story h1,
|
||||
.NB-story h2,
|
||||
|
|
|
@ -1585,6 +1585,10 @@ background: transparent;
|
|||
top: 2px;
|
||||
max-width: 56px;
|
||||
}
|
||||
.NB-story-pane-west #story_titles .NB-storytitles-shares {
|
||||
top: none;
|
||||
bottom: 4px;
|
||||
}
|
||||
#story_titles .NB-storytitles-shares .NB-icon {
|
||||
float: right;
|
||||
width: 12px;
|
||||
|
|
Loading…
Add table
Reference in a new issue