summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
Diffstat (limited to 'Juick')
-rw-r--r--Juick/AppDelegate.m10
-rw-r--r--Juick/ColorScheme.h (renamed from Juick/ColorsAndButtons.h)5
-rw-r--r--Juick/ColorScheme.m (renamed from Juick/ColorsAndButtons.m)22
-rw-r--r--Juick/Juick-Info.plist16
-rw-r--r--Juick/Juick-Prefix.pch1
-rw-r--r--Juick/Juick.ipabin0 -> 1052917 bytes
-rw-r--r--Juick/MessageCell.m28
-rw-r--r--Juick/MessagesViewController.m32
-rw-r--r--Juick/NavCell.h14
-rw-r--r--Juick/NavCell.m53
-rw-r--r--Juick/RevealPanelViewController.m53
-rw-r--r--Juick/UIImage+Crop.h15
-rw-r--r--Juick/UIImage+Crop.m28
13 files changed, 150 insertions, 127 deletions
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m
index a776b43..7ccaf13 100644
--- a/Juick/AppDelegate.m
+++ b/Juick/AppDelegate.m
@@ -11,7 +11,7 @@
#import "RevealPanelViewController.h"
#import "SWRevealViewController.h"
-#import "ColorsAndButtons.h"
+#import "ColorScheme.h"
#import "Message.h"
@implementation AppDelegate
@@ -20,10 +20,10 @@
{
// style the navigation bar
if (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_6_1) {
- [[UINavigationBar appearance] setBarTintColor:[ColorsAndButtons navbarBackground]];
- }
- [[UINavigationBar appearance] setTintColor:[ColorsAndButtons navbarFont]];
- [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorsAndButtons navbarFont]}];
+ [[UINavigationBar appearance] setBarTintColor:[ColorScheme navbarBackground]];
+ [[UINavigationBar appearance] setTintColor:[ColorScheme navbarFont]];
+ [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorScheme navbarFont]}];
+ }
// make the status bar white
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
diff --git a/Juick/ColorsAndButtons.h b/Juick/ColorScheme.h
index 260bff1..275962c 100644
--- a/Juick/ColorsAndButtons.h
+++ b/Juick/ColorScheme.h
@@ -8,13 +8,10 @@
#import <Foundation/Foundation.h>
-@interface ColorsAndButtons : NSObject
+@interface ColorScheme : NSObject
+(UIColor *) navbarBackground;
+(UIColor *) mainBackground;
+(UIColor *) navbarFont;
+(UIColor *) linkColor;
-+(UIImage *) homeImage;
-+(UIImage *) discoverImage;
-+(UIImage *) logo;
@end
diff --git a/Juick/ColorsAndButtons.m b/Juick/ColorScheme.m
index c99707d..257cc72 100644
--- a/Juick/ColorsAndButtons.m
+++ b/Juick/ColorScheme.m
@@ -6,17 +6,13 @@
// Copyright (c) 2013 com.juick. All rights reserved.
//
-#import "ColorsAndButtons.h"
-#import "UIImage+Crop.h"
+#import "ColorScheme.h"
-UIImage *buttons;
-
-@implementation ColorsAndButtons
+@implementation ColorScheme
+ (void) initialize
{
[super initialize];
- buttons = [UIImage imageNamed:@"buttons.png"];
}
@@ -29,22 +25,12 @@ UIImage *buttons;
}
+ (UIColor *) navbarBackground {
- return [UIColor colorWithRed:51/255.0f green:51/255.0f blue:51/255.0f alpha:1];
+ return [UIColor colorWithRed:51/255.0f green:51/255.0f blue:51/255.0f alpha:1.0f];
}
+ (UIColor *) navbarFont {
- return [UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1];
+ return [UIColor colorWithRed:153/255.0f green:154/255.0f blue:153/255.0f alpha:1.0f];
}
-+(UIImage *) homeImage {
- return [buttons crop:CGRectMake(142, 0, 32, 32)];
-}
-+ (UIImage *) discoverImage {
- return [buttons crop:CGRectMake(174, 0, 32, 32)];
-}
-
-+ (UIImage *) logo {
- return [buttons crop:CGRectMake(0, 0, 109, 32)];
-}
@end
diff --git a/Juick/Juick-Info.plist b/Juick/Juick-Info.plist
index 2f29b33..33830ba 100644
--- a/Juick/Juick-Info.plist
+++ b/Juick/Juick-Info.plist
@@ -17,15 +17,21 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.0.1</string>
+ <string>1.0.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>1.0.1</string>
+ <string>1.0.4</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.social-networking</string>
<key>LSRequiresIPhoneOS</key>
<true/>
+ <key>NSHumanReadableCopyright</key>
+ <string></string>
+ <key>UIAppFonts</key>
+ <array>
+ <string>FontAwesome.ttf</string>
+ </array>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
@@ -48,12 +54,6 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
- <key>UIAppFonts</key>
- <array>
- <string>FontAwesome.ttf</string>
- </array>
- <key>NSHumanReadableCopyright</key>
- <string></string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
diff --git a/Juick/Juick-Prefix.pch b/Juick/Juick-Prefix.pch
index 1bd0628..ad49a41 100644
--- a/Juick/Juick-Prefix.pch
+++ b/Juick/Juick-Prefix.pch
@@ -16,4 +16,5 @@
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#define MAS_SHORTHAND
+ #import "Masonry.h"
#endif
diff --git a/Juick/Juick.ipa b/Juick/Juick.ipa
new file mode 100644
index 0000000..e3ffdbf
--- /dev/null
+++ b/Juick/Juick.ipa
Binary files differ
diff --git a/Juick/MessageCell.m b/Juick/MessageCell.m
index 3f06436..0dea69a 100644
--- a/Juick/MessageCell.m
+++ b/Juick/MessageCell.m
@@ -7,9 +7,8 @@
//
#import "MessageCell.h"
-#import "ColorsAndButtons.h"
-#import "Masonry.h"
-#import "JMImageCache.h"
+#import "ColorScheme.h"
+#import <SDWebImage/UIImageView+WebCache.h>
@interface MessageCell ()
@@ -23,7 +22,7 @@
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
- [self setBackgroundColor:[UIColor whiteColor]];
+ [self.contentView setBackgroundColor:[UIColor whiteColor]];
self.avatar = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
[self.avatar setBackgroundColor:[UIColor clearColor]];
@@ -31,7 +30,7 @@
[self.titleLabel setLineBreakMode:NSLineBreakByTruncatingTail];
[self.titleLabel setNumberOfLines:1];
[self.titleLabel setTextAlignment:NSTextAlignmentLeft];
- [self.titleLabel setTextColor:[ColorsAndButtons linkColor]];
+ [self.titleLabel setTextColor:[ColorScheme linkColor]];
[self.titleLabel setBackgroundColor:[UIColor clearColor]];
self.timestampLabel = [[UILabel alloc] initWithFrame:CGRectZero];
@@ -105,19 +104,16 @@
make.left.equalTo(self.avatar.right).with.offset(padding.left);
make.top.equalTo(self.titleLabel.bottom).with.offset(padding.top /2);
make.right.equalTo(self.contentView.right).with.offset(-padding.right);
- make.bottom.equalTo(self.bodyLabel.top).with.offset(-padding.bottom);
}];
[self.bodyLabel makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.left).with.offset(padding.left);
make.top.equalTo(self.timestampLabel.bottom).with.offset(padding.top);
make.right.equalTo(self.contentView.right).with.offset(-padding.right);
- make.bottom.equalTo(self.attach.top).with.offset(-padding.bottom);
}];
[self.attach makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.left).with.offset(padding.left);
- make.bottom.equalTo(self.summaryLabel.top).with.offset(-padding.bottom);
make.right.equalTo(self.contentView.right).with.offset(-padding.right);
make.top.equalTo(self.bodyLabel.bottom).with.offset(padding.top);
}];
@@ -147,7 +143,7 @@
- (void) bind:(Message *)msg {
[self.avatar setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://i.juick.com/as/%d.png", [msg.userID intValue]]]];
-
+ __weak MessageCell *weakSelf = self;
self.titleLabel.text = msg.user;
self.timestampLabel.text = msg.timestamp;
if (msg.repliesCount > 0) {
@@ -165,10 +161,22 @@
[msg.text stringByDecodingHTMLEntities]];
}
if ([msg.attach length] > 0) {
- [self.attach setImageWithURL:[NSURL URLWithString:msg.attach] key:[NSString stringWithFormat:@"%d", [msg.MID intValue]] placeholder:[UIImage imageNamed:@"AttachPlaceholder.png"]];
+ [self.attach setImageWithURL:[NSURL URLWithString:msg.attach] placeholderImage:[UIImage imageNamed:@"AttachPlaceholder.png"] options:SDWebImageContinueInBackground
+ progress:^(NSUInteger receivedSize, long long expectedSize) {
+ // <#code#>
+ } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
+ [weakSelf setNeedsUpdateConstraints];
+ [weakSelf updateConstraintsIfNeeded];
+ [weakSelf.contentView setNeedsLayout];
+ [weakSelf.contentView layoutIfNeeded];
+ }];
} else {
self.attach.image = nil;
}
+ [weakSelf setNeedsUpdateConstraints];
+ [weakSelf updateConstraintsIfNeeded];
+ [weakSelf.contentView setNeedsLayout];
+ [weakSelf.contentView layoutIfNeeded];
}
- (void) attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url {
diff --git a/Juick/MessagesViewController.m b/Juick/MessagesViewController.m
index 4361148..b77901b 100644
--- a/Juick/MessagesViewController.m
+++ b/Juick/MessagesViewController.m
@@ -12,7 +12,7 @@
#import "MessageCell.h"
#import "Message.h"
-#import "ColorsAndButtons.h"
+#import "ColorScheme.h"
#import "NewPostViewController.h"
@@ -80,14 +80,20 @@ static NSString *CellIdentifier = @"MessageCell";
{
[super viewDidLoad];
self.dataLoading = NO;
- [self.view setBackgroundColor:[ColorsAndButtons mainBackground]];
+ [self.view setBackgroundColor:[ColorScheme mainBackground]];
self.messages = [NSMutableArray array];
UIRefreshControl *refresh = [[UIRefreshControl alloc] init];
[refresh addTarget:self action:@selector(refreshData:) forControlEvents:UIControlEventValueChanged];
self.refreshControl = refresh;
-
- //UINib *cellNib = [UINib nibWithNibName:@"MessageCell" bundle:nil];
- //[self.tableView registerNib:cellNib forCellReuseIdentifier:@"MessageCell"];
+ SWRevealViewController *revealController = [self revealViewController];
+ if (revealController) {
+ // TODO: add to thread view too
+ [self.view addGestureRecognizer:[revealController panGestureRecognizer]];
+ }
+ if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1) {
+ self.navigationController.navigationBar.tintColor = [ColorScheme navbarBackground];
+ }
+
[self.tableView registerClass:[MessageCell class] forCellReuseIdentifier:CellIdentifier];
}
@@ -142,14 +148,10 @@ static NSString *CellIdentifier = @"MessageCell";
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
+ MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
[cell updateFonts];
Message *msg = [_messages objectAtIndex:indexPath.row];
[cell bind:msg];
- [cell setNeedsUpdateConstraints];
- [cell updateConstraintsIfNeeded];
- [cell.contentView setNeedsLayout];
- [cell.contentView layoutIfNeeded];
cell.bodyLabel.preferredMaxLayoutWidth = CGRectGetWidth(cell.bodyLabel.frame);
[cell.contentView layoutIfNeeded];
@@ -166,12 +168,6 @@ static NSString *CellIdentifier = @"MessageCell";
[cell bind:msg];
- [cell setNeedsUpdateConstraints];
- [cell updateConstraintsIfNeeded];
-
- [cell.contentView setNeedsLayout];
- [cell.contentView layoutIfNeeded];
-
cell.bodyLabel.preferredMaxLayoutWidth = CGRectGetWidth(cell.bodyLabel.frame);
[cell.contentView layoutIfNeeded];
@@ -182,9 +178,9 @@ static NSString *CellIdentifier = @"MessageCell";
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
- if (self.dataLoading) {
+ /* if (self.dataLoading) {
return [self tableView:tableView heightForRowAtIndexPath:indexPath];
- }
+ }*/
return 500.0f;
}
diff --git a/Juick/NavCell.h b/Juick/NavCell.h
new file mode 100644
index 0000000..50eec8d
--- /dev/null
+++ b/Juick/NavCell.h
@@ -0,0 +1,14 @@
+//
+// NavCell.h
+// Juick
+//
+// Created by Vitaly on 17.12.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface NavCell : UITableViewCell
+@property (strong, nonatomic) IBOutlet UILabel *iconLabel;
+@property (strong, nonatomic) IBOutlet UILabel *descriptionTextLabel;
+@end
diff --git a/Juick/NavCell.m b/Juick/NavCell.m
new file mode 100644
index 0000000..0b16e43
--- /dev/null
+++ b/Juick/NavCell.m
@@ -0,0 +1,53 @@
+//
+// NavCell.m
+// Juick
+//
+// Created by Vitaly on 17.12.13.
+// Copyright (c) 2013 com.juick. All rights reserved.
+//
+
+#import "NavCell.h"
+
+@interface NavCell ()
+
+@property (nonatomic, assign) BOOL didSetupConstraints;
+
+@end
+
+@implementation NavCell
+
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
+{
+ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+ if (self) {
+ self.backgroundColor = [UIColor blackColor];
+ self.iconLabel = [[UILabel alloc] initWithFrame:CGRectZero];
+ self.descriptionTextLabel = [[UILabel alloc] initWithFrame:CGRectZero];
+ [self.contentView addSubview:self.iconLabel];
+ [self.contentView addSubview:self.descriptionTextLabel];
+ }
+ return self;
+}
+
+- (void)updateConstraints {
+ [super updateConstraints];
+
+ if (self.didSetupConstraints) return;
+ [self.iconLabel makeConstraints:^(MASConstraintMaker *make) {
+ make.left.equalTo(self.contentView.left).with.offset(20.f);
+ make.top.equalTo(self.contentView.top).with.offset(10.f);
+ make.width.equalTo(@36);
+ make.height.equalTo(@36);
+
+ }];
+
+ [self.descriptionTextLabel makeConstraints:^(MASConstraintMaker *make) {
+ make.left.equalTo(self.iconLabel.right).with.offset(10.f);
+ make.top.equalTo(self.contentView.top).with.offset(15.f);
+ make.right.equalTo(self.contentView.right).with.offset(-20.f);
+ }];
+
+ self.didSetupConstraints = YES;
+}
+
+@end
diff --git a/Juick/RevealPanelViewController.m b/Juick/RevealPanelViewController.m
index ecac5df..a9c71e8 100644
--- a/Juick/RevealPanelViewController.m
+++ b/Juick/RevealPanelViewController.m
@@ -11,8 +11,13 @@
#import "RevealPanelViewController.h"
#import "MessagesViewController.h"
-#import "ColorsAndButtons.h"
+#import "ColorScheme.h"
#import "NSURL+PathParameters.h"
+#import "NavCell.h"
+
+
+
+static NSString *CellIdentifier = @"NavCell";
@interface RevealPanelViewController ()
@@ -32,11 +37,15 @@
- (void)viewDidLoad
{
[super viewDidLoad];
- [self.navigationController.navigationBar.topItem
- setTitleView:[[UIImageView alloc] initWithImage:[ColorsAndButtons logo]]];
- [self.view setBackgroundColor:[ColorsAndButtons navbarBackground]];
+ self.title = @"Juick";
+
+ if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1) {
+ self.navigationController.navigationBar.tintColor = [ColorScheme navbarBackground];
+ }
+ [self.view setBackgroundColor:[ColorScheme navbarBackground]];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.separatorColor =[UIColor blackColor];
+ [self.tableView registerClass:[NavCell class] forCellReuseIdentifier:CellIdentifier];
}
- (void)didReceiveMemoryWarning
@@ -55,30 +64,32 @@
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *cellIdentifier = @"MenuCell";
- UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
+ NavCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
NSInteger row = indexPath.row;
- if (cell == nil) {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:cellIdentifier];
- [cell setBackgroundColor:[ColorsAndButtons navbarBackground]];
- cell.textLabel.font = [UIFont fontWithName:kFontAwesomeFamilyName size:20.f];
- cell.textLabel.textColor = [ColorsAndButtons navbarFont];
- cell.detailTextLabel.textColor = [ColorsAndButtons navbarFont];
- }
+ [cell.contentView setBackgroundColor:[ColorScheme navbarBackground]];
+ cell.iconLabel.font = [UIFont fontWithName:kFontAwesomeFamilyName size:32.f];
+ cell.iconLabel.textColor = [ColorScheme navbarFont];
+ cell.iconLabel.backgroundColor = [ColorScheme navbarBackground];
+ cell.descriptionTextLabel.backgroundColor = [ColorScheme navbarBackground];
+ cell.descriptionTextLabel.textColor = [ColorScheme navbarFont];
if (row == 0) {
- cell.detailTextLabel.text = @"My feed";
- cell.textLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconHome];
+ cell.descriptionTextLabel.text = @"My feed";
+ cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconHome];
} else if (row == 1) {
- cell.detailTextLabel.text = @"Popular";
- cell.textLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconComments];
+ cell.descriptionTextLabel.text = @"Popular";
+ cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconComments];
} else if (row == 2) {
- cell.detailTextLabel.text = @"Discover";
- cell.textLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconSearch];
+ cell.descriptionTextLabel.text = @"Discover";
+ cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconSearch];
} else if (row == 3) {
- cell.detailTextLabel.text = @"Images";
- cell.textLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconPicture];
+ cell.descriptionTextLabel.text = @"Images";
+ cell.iconLabel.text = [NSString fontAwesomeIconStringForEnum:FAIconPicture];
}
+ [cell setNeedsUpdateConstraints];
+ [cell updateConstraintsIfNeeded];
+ [cell.contentView setNeedsLayout];
+ [cell.contentView layoutIfNeeded];
return cell;
}
diff --git a/Juick/UIImage+Crop.h b/Juick/UIImage+Crop.h
deleted file mode 100644
index 4eeaed2..0000000
--- a/Juick/UIImage+Crop.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-// UIImage+Crop.h
-// Juick
-//
-// Created by Vitaly Takmazov on 05.11.13.
-// Copyright (c) 2013 com.juick. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface UIImage (Crop)
-
-- (UIImage *)crop:(CGRect)rect;
-
-@end
diff --git a/Juick/UIImage+Crop.m b/Juick/UIImage+Crop.m
deleted file mode 100644
index d51b94e..0000000
--- a/Juick/UIImage+Crop.m
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// UIImage+Crop.m
-// Juick
-//
-// Created by Vitaly Takmazov on 05.11.13.
-// Copyright (c) 2013 com.juick. All rights reserved.
-//
-
-#import "UIImage+Crop.h"
-
-@implementation UIImage (Crop)
-
-- (UIImage *)crop:(CGRect)rect {
-
- rect = CGRectMake(rect.origin.x*self.scale,
- rect.origin.y*self.scale,
- rect.size.width*self.scale,
- rect.size.height*self.scale);
-
- CGImageRef imageRef = CGImageCreateWithImageInRect([self CGImage], rect);
- UIImage *result = [UIImage imageWithCGImage:imageRef
- scale:self.scale
- orientation:self.imageOrientation];
- CGImageRelease(imageRef);
- return result;
-}
-
-@end