Tightening up iphone app icons and the original story view's close button.

This commit is contained in:
Samuel Clay 2011-08-14 00:16:25 -07:00
parent 394c387f2f
commit 405c525d8f
9 changed files with 96 additions and 60 deletions

View file

@ -64,6 +64,7 @@
- (void)checkPassword {
[self.authenticatingLabel setHidden:NO];
[self.errorLabel setHidden:YES];
[self.activityIndicator startAnimating];
NSLog(@"appdelegate:: %@", [self appDelegate]);
NSString *urlString = @"http://www.newsblur.com/reader/login";

View file

@ -10,12 +10,12 @@
@class NewsBlurAppDelegate;
static const CGFloat kNavBarHeight = 60.0f;
static const CGFloat kNavBarHeight = 58.0f;
static const CGFloat kLabelHeight = 18.0f;
static const CGFloat kMargin = 10.0f;
static const CGFloat kMargin = 6.0f;
static const CGFloat kSpacer = 2.0f;
static const CGFloat kLabelFontSize = 12.0f;
static const CGFloat kAddressHeight = 28.0f;
static const CGFloat kAddressHeight = 30.0f;
static const CGFloat kButtonWidth = 48.0f;
@interface OriginalStoryViewController : UIViewController {

View file

@ -92,18 +92,16 @@
action:@selector(doCloseOriginalStoryViewController)];
close.width = kButtonWidth;
CGRect closeButtonFrame = CGRectMake(addressFrame.origin.x +
addressFrame.size.width + kMargin,
addressFrame.origin.y,
kButtonWidth - kMargin,
kAddressHeight - 1);
addressFrame.size.width,
addressFrame.origin.y - 7.0f,
kButtonWidth + kMargin,
44.0);
TransparentToolbar* tools = [[TransparentToolbar alloc]
initWithFrame:closeButtonFrame];
NSArray* buttons = [[NSArray alloc] initWithObjects:close, nil];
[tools setItems:buttons animated:NO];
[tools setItems:[NSArray arrayWithObject:close] animated:NO];
[tools setTintColor:[UIColor colorWithRed:0.16f green:0.36f blue:0.46 alpha:0.9]];
[navBar addSubview:tools];
[close release];
[buttons release];
[tools release];
navBar.tintColor = [UIColor colorWithRed:0.16f green:0.36f blue:0.46 alpha:0.9];
@ -127,9 +125,12 @@
[self.webView loadRequest:request];
}
// MARK: -
// MARK: UIWebViewDelegate protocol
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
# pragma mark: -
# pragma mark: UIWebViewDelegate protocol
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType
{
[self updateAddress:request];
return YES;

View file

@ -13,7 +13,8 @@
@interface StoryDetailViewController : UIViewController
<UIScrollViewDelegate> {
NewsBlurAppDelegate *appDelegate;
NSString *activeStoryId;
UIProgressView *progressView;
UIWebView *webView;
UIToolbar *toolbar;
@ -22,6 +23,7 @@
}
@property (nonatomic, retain) NSString *activeStoryId;
@property (nonatomic, retain) IBOutlet UIProgressView *progressView;
@property (nonatomic, retain) IBOutlet UIWebView *webView;
@property (nonatomic, retain) IBOutlet UIToolbar *toolbar;
@ -36,5 +38,6 @@
- (IBAction)doNextUnreadStory;
- (IBAction)doPreviousStory;
- (void)markedAsRead;
- (void)setActiveStory;
@end

View file

@ -14,6 +14,7 @@
@implementation StoryDetailViewController
@synthesize activeStoryId;
@synthesize appDelegate;
@synthesize progressView;
@synthesize webView;
@ -29,22 +30,39 @@
return self;
}
- (void)dealloc {
[activeStoryId release];
[appDelegate release];
[progressView release];
[webView release];
[toolbar release];
[buttonNext release];
[buttonPrevious release];
[super dealloc];
}
- (void)viewWillAppear:(BOOL)animated {
[self showStory];
[self markStoryAsRead];
[self setNextPreviousButtons];
self.webView.scalesPageToFit = YES;
NSLog(@"Stories; %@ -- %@ (%d)", self.activeStoryId, [appDelegate.activeStory objectForKey:@"id"], self.activeStoryId == [appDelegate.activeStory objectForKey:@"id"]);
if (self.activeStoryId != [appDelegate.activeStory objectForKey:@"id"]) {
[self setActiveStory];
[self showStory];
[self markStoryAsRead];
[self setNextPreviousButtons];
self.webView.scalesPageToFit = YES;
}
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated {
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
initWithTitle:@"Original"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(showOriginalSubview:)
] autorelease];
UIBarButtonItem *originalButton = [[UIBarButtonItem alloc]
initWithTitle:@"Original"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(showOriginalSubview:)
];
self.navigationItem.rightBarButtonItem = originalButton;
[originalButton release];
[super viewDidAppear:animated];
}
@ -66,7 +84,7 @@
float unreads = [appDelegate unreadCount];
float total = [appDelegate originalStoryCount];
float progress = (total - unreads) / total;
NSLog(@"Total: %f / %f = %f", unreads, total, progress);
// NSLog(@"Total: %f / %f = %f", unreads, total, progress);
[progressView setProgress:progress];
}
@ -77,12 +95,17 @@
NSString *urlString = @"http://www.newsblur.com/reader/mark_story_as_read";
NSURL *url = [NSURL URLWithString:urlString];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:[appDelegate.activeStory objectForKey:@"id"] forKey:@"story_id"];
[request setPostValue:[appDelegate.activeFeed objectForKey:@"id"] forKey:@"feed_id"];
[request setPostValue:[appDelegate.activeStory
objectForKey:@"id"]
forKey:@"story_id"];
[request setPostValue:[appDelegate.activeFeed
objectForKey:@"id"]
forKey:@"feed_id"];
[request setDidFinishSelector:@selector(markedAsRead)];
[request setDidFailSelector:@selector(markedAsRead)];
[request setDelegate:self];
[request startAsynchronous];
[urlString release];
}
}
@ -173,7 +196,8 @@
"<meta name=\"viewport\" content=\"width=320\"/>"];
NSString *story_author = @"";
if ([appDelegate.activeStory objectForKey:@"story_authors"]) {
NSString *author = [NSString stringWithFormat:@"%@",[appDelegate.activeStory objectForKey:@"story_authors"]];
NSString *author = [NSString stringWithFormat:@"%@",
[appDelegate.activeStory objectForKey:@"story_authors"]];
if (author && ![author isEqualToString:@"<null>"]) {
story_author = [NSString stringWithFormat:@"<div class=\"NB-story-author\">%@</div>",author];
}
@ -182,7 +206,10 @@
if ([appDelegate.activeStory objectForKey:@"story_tags"]) {
NSArray *tag_array = [appDelegate.activeStory objectForKey:@"story_tags"];
if ([tag_array count] > 0) {
story_tags = [NSString stringWithFormat:@"<div class=\"NB-story-tags\"><div class=\"NB-story-tag\">%@</div></div>",
story_tags = [NSString
stringWithFormat:@"<div class=\"NB-story-tags\">"
"<div class=\"NB-story-tag\">"
"%@</div></div>",
[tag_array componentsJoinedByString:@"</div><div class=\"NB-story-tag\">"]];
}
}
@ -192,7 +219,11 @@
"%@"
"%@"
"</div>",
[story_tags length] ? [appDelegate.activeStory objectForKey:@"long_parsed_date"] : [appDelegate.activeStory objectForKey:@"short_parsed_date"],
[story_tags length] ?
[appDelegate.activeStory
objectForKey:@"long_parsed_date"] :
[appDelegate.activeStory
objectForKey:@"short_parsed_date"],
[appDelegate.activeStory objectForKey:@"story_title"],
story_author,
story_tags];
@ -208,9 +239,14 @@
- (IBAction)doNextUnreadStory {
int nextIndex = [appDelegate indexOfNextStory];
if (nextIndex == -1) {
[appDelegate.navigationController popToViewController:[appDelegate.navigationController.viewControllers objectAtIndex:0] animated:YES];
[appDelegate.navigationController
popToViewController:[appDelegate.navigationController.viewControllers
objectAtIndex:0]
animated:YES];
} else {
[appDelegate setActiveStory:[[appDelegate activeFeedStories] objectAtIndex:nextIndex]];
[appDelegate setActiveStory:[[appDelegate activeFeedStories]
objectAtIndex:nextIndex]];
[self setActiveStory];
[self showStory];
[self markStoryAsRead];
[self setNextPreviousButtons];
@ -218,7 +254,9 @@
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.5];
[UIView setAnimationBeginsFromCurrentState:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp
forView:self.view
cache:NO];
[UIView commitAnimations];
}
}
@ -226,9 +264,14 @@
- (IBAction)doPreviousStory {
int previousIndex = [appDelegate indexOfPreviousStory];
if (previousIndex == -1) {
[appDelegate.navigationController popToViewController:[appDelegate.navigationController.viewControllers objectAtIndex:0] animated:YES];
[appDelegate.navigationController
popToViewController:[appDelegate.navigationController.viewControllers
objectAtIndex:0]
animated:YES];
} else {
[appDelegate setActiveStory:[[appDelegate activeFeedStories] objectAtIndex:previousIndex]];
[appDelegate setActiveStory:[[appDelegate activeFeedStories]
objectAtIndex:previousIndex]];
[self setActiveStory];
[self showStory];
[self markStoryAsRead];
[self setNextPreviousButtons];
@ -236,7 +279,9 @@
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:.5];
[UIView setAnimationBeginsFromCurrentState:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
forView:self.view
cache:NO];
[UIView commitAnimations];
}
}
@ -247,6 +292,10 @@
[appDelegate showOriginalStory:url];
}
- (void)setActiveStory {
self.activeStoryId = [appDelegate.activeStory objectForKey:@"id"];
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
@ -254,21 +303,12 @@
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
self.webView = nil;
self.appDelegate = nil;
self.progressView = nil;
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
- (BOOL)webView:(UIWebView *)webView
shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSURL *url = [request URL];
[appDelegate showOriginalStory:url];
//[url release];
return NO;
}
@ -281,15 +321,4 @@
- (void)webViewDidFinishLoad:(UIWebView *)webView {
}
- (void)dealloc {
[appDelegate release];
[webView release];
[progressView release];
[toolbar release];
[buttonNext release];
[buttonPrevious release];
[super dealloc];
}
@end

View file

@ -37,5 +37,7 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</plist>

View file

@ -114,7 +114,7 @@
78095E44128EF37E00230C8E /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
78095E46128EF37F00230C8E /* libz.1.2.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.2.3.dylib; path = usr/lib/libz.1.2.3.dylib; sourceTree = SDKROOT; };
78095EC6128F30B500230C8E /* OriginalStoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OriginalStoryViewController.h; sourceTree = "<group>"; };
78095EC7128F30B500230C8E /* OriginalStoryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OriginalStoryViewController.m; sourceTree = "<group>"; };
78095EC7128F30B500230C8E /* OriginalStoryViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 3; lastKnownFileType = sourcecode.c.objc; path = OriginalStoryViewController.m; sourceTree = "<group>"; };
78095EC8128F30B500230C8E /* OriginalStoryViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = OriginalStoryViewController.xib; sourceTree = "<group>"; };
7842ECF511D44A530066CF9D /* StoryDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StoryDetailViewController.h; sourceTree = "<group>"; };
7842ECF611D44A530066CF9D /* StoryDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StoryDetailViewController.m; sourceTree = "<group>"; };

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB