Skip to content

Commit

Permalink
Lots and lots of UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed Aug 1, 2014
1 parent 159fab8 commit 8c5c35a
Show file tree
Hide file tree
Showing 19 changed files with 358 additions and 71 deletions.
4 changes: 3 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ inhibit_all_warnings!
pod 'Mapbox-iOS-SDK', '~> 1.2'
pod 'YapDatabase', '~> 2.4'
pod 'Mantle', '~> 1.5'
pod 'ActionSheetPicker-3.0', '~> 1.0'
pod 'ActionSheetPicker-3.0', '~> 1.0'
pod 'FormatterKit/LocationFormatter', '~> 1.6'
pod 'FormatterKit/TimeIntervalFormatter', '~> 1.6'
5 changes: 5 additions & 0 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ PODS:
- FMDB/common (2.3)
- FMDB/standard (2.3):
- FMDB/common
- FormatterKit/LocationFormatter (1.6.0)
- FormatterKit/TimeIntervalFormatter (1.6.0)
- GRMustache (6.8.3):
- JRSwizzle (~> 1.0)
- JRSwizzle (1.0)
Expand All @@ -31,6 +33,8 @@ PODS:

DEPENDENCIES:
- ActionSheetPicker-3.0 (~> 1.0)
- FormatterKit/LocationFormatter (~> 1.6)
- FormatterKit/TimeIntervalFormatter (~> 1.6)
- Mantle (~> 1.5)
- Mapbox-iOS-SDK (~> 1.2)
- YapDatabase (~> 2.4)
Expand All @@ -39,6 +43,7 @@ SPEC CHECKSUMS:
ActionSheetPicker-3.0: bc24c9fd9f8e8a8c7d3c266fd00d20f4a78889eb
CocoaLumberjack: baf4a09a3bcbdfea3363556a90104e026d3504e2
FMDB: 31ec26773c7f7b7890a6038235a1f2bbd933a7cb
FormatterKit: 534b21b52b9b822a9ec884a14e2debf92e7a3126
GRMustache: ab96109b7ba4b9568425bea40d6cd2cdc7582b6c
JRSwizzle: 30da7a2c539a4ebf954b16d15f6dd8221c9f6fa5
Mantle: c67a7e45e14196ed42b2a7cbb98ff6a9920e6b92
Expand Down
44 changes: 35 additions & 9 deletions iBurn.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
D97D7A31198ADBE400CA7828 /* NSDateFormatter+iBurn.m in Sources */ = {isa = PBXBuildFile; fileRef = D97D7A30198ADBE400CA7828 /* NSDateFormatter+iBurn.m */; };
D97D7A34198AF7BD00CA7828 /* NSDate+iBurn.m in Sources */ = {isa = PBXBuildFile; fileRef = D97D7A33198AF7BD00CA7828 /* NSDate+iBurn.m */; };
D97D7A37198B019A00CA7828 /* BRCActionSheetStringPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = D97D7A36198B019A00CA7828 /* BRCActionSheetStringPicker.m */; };
D99395A8198B897B00E9ADD2 /* BRCDetailInfoTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D99395A7198B897B00E9ADD2 /* BRCDetailInfoTableViewCell.m */; };
D99395AB198B986B00E9ADD2 /* TTTTimeIntervalFormatter+iBurn.m in Sources */ = {isa = PBXBuildFile; fileRef = D99395AA198B986B00E9ADD2 /* TTTTimeIntervalFormatter+iBurn.m */; };
D99395AE198B991900E9ADD2 /* TTTLocationFormatter+iBurn.m in Sources */ = {isa = PBXBuildFile; fileRef = D99395AD198B991900E9ADD2 /* TTTLocationFormatter+iBurn.m */; };
D994155719871D1500D245C7 /* BRCFilteredTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D994155619871D1500D245C7 /* BRCFilteredTableViewController.m */; };
D994156119871E8400D245C7 /* BRCEventsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D994156019871E8400D245C7 /* BRCEventsTableViewController.m */; };
D99415641987222800D245C7 /* BRCDataObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D99415631987222800D245C7 /* BRCDataObject.m */; };
Expand Down Expand Up @@ -99,6 +102,12 @@
D97D7A33198AF7BD00CA7828 /* NSDate+iBurn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+iBurn.m"; sourceTree = "<group>"; };
D97D7A35198B019A00CA7828 /* BRCActionSheetStringPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCActionSheetStringPicker.h; sourceTree = "<group>"; };
D97D7A36198B019A00CA7828 /* BRCActionSheetStringPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BRCActionSheetStringPicker.m; sourceTree = "<group>"; };
D99395A6198B897B00E9ADD2 /* BRCDetailInfoTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCDetailInfoTableViewCell.h; sourceTree = "<group>"; };
D99395A7198B897B00E9ADD2 /* BRCDetailInfoTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BRCDetailInfoTableViewCell.m; sourceTree = "<group>"; };
D99395A9198B986B00E9ADD2 /* TTTTimeIntervalFormatter+iBurn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TTTTimeIntervalFormatter+iBurn.h"; sourceTree = "<group>"; };
D99395AA198B986B00E9ADD2 /* TTTTimeIntervalFormatter+iBurn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TTTTimeIntervalFormatter+iBurn.m"; sourceTree = "<group>"; };
D99395AC198B991900E9ADD2 /* TTTLocationFormatter+iBurn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TTTLocationFormatter+iBurn.h"; sourceTree = "<group>"; };
D99395AD198B991900E9ADD2 /* TTTLocationFormatter+iBurn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TTTLocationFormatter+iBurn.m"; sourceTree = "<group>"; };
D994155519871D1500D245C7 /* BRCFilteredTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCFilteredTableViewController.h; sourceTree = "<group>"; };
D994155619871D1500D245C7 /* BRCFilteredTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BRCFilteredTableViewController.m; sourceTree = "<group>"; };
D994155F19871E8400D245C7 /* BRCEventsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BRCEventsTableViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -141,17 +150,23 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
6322830219881E27009E472B /* DetailViewController */ = {
6322830219881E27009E472B /* DetailViewControllers */ = {
isa = PBXGroup;
children = (
D99395AC198B991900E9ADD2 /* TTTLocationFormatter+iBurn.h */,
D99395AD198B991900E9ADD2 /* TTTLocationFormatter+iBurn.m */,
D99395A9198B986B00E9ADD2 /* TTTTimeIntervalFormatter+iBurn.h */,
D99395AA198B986B00E9ADD2 /* TTTTimeIntervalFormatter+iBurn.m */,
632282FF19881DDE009E472B /* BRCDetailViewController.h */,
6322830019881DDE009E472B /* BRCDetailViewController.m */,
D99395A6198B897B00E9ADD2 /* BRCDetailInfoTableViewCell.h */,
D99395A7198B897B00E9ADD2 /* BRCDetailInfoTableViewCell.m */,
6322830319881F41009E472B /* BRCDetailCellInfo.h */,
6322830419881F41009E472B /* BRCDetailCellInfo.m */,
6322830919882153009E472B /* BRCRelationshipDetailInfoCell.h */,
6322830A19882153009E472B /* BRCRelationshipDetailInfoCell.m */,
);
name = DetailViewController;
name = DetailViewControllers;
sourceTree = "<group>";
};
6322830C1989836F009E472B /* MapClasses */ = {
Expand Down Expand Up @@ -204,7 +219,6 @@
63CE2A661987140F00F65B01 /* BRCAppDelegate.h */,
63CE2A671987140F00F65B01 /* BRCAppDelegate.m */,
6322830C1989836F009E472B /* MapClasses */,
6322830219881E27009E472B /* DetailViewController */,
63D270F61987157900204954 /* ViewControllers */,
63CE2A691987140F00F65B01 /* Images.xcassets */,
63D270FA198716C600204954 /* Resources */,
Expand All @@ -227,13 +241,9 @@
63D270F61987157900204954 /* ViewControllers */ = {
isa = PBXGroup;
children = (
6322830219881E27009E472B /* DetailViewControllers */,
D994155E19871D9000D245C7 /* Filtered Tables */,
63D270F71987159A00204954 /* BRCMapViewController.h */,
63D270F81987159A00204954 /* BRCMapViewController.m */,
632283191989B139009E472B /* BRCDetailMapViewController.h */,
6322831A1989B139009E472B /* BRCDetailMapViewController.m */,
632283131989AF92009E472B /* BRCBaseMapViewController.h */,
632283141989AF92009E472B /* BRCBaseMapViewController.m */,
D99395A5198B806800E9ADD2 /* MapViewControllers */,
);
name = ViewControllers;
sourceTree = "<group>";
Expand Down Expand Up @@ -263,6 +273,19 @@
name = Cells;
sourceTree = "<group>";
};
D99395A5198B806800E9ADD2 /* MapViewControllers */ = {
isa = PBXGroup;
children = (
63D270F71987159A00204954 /* BRCMapViewController.h */,
63D270F81987159A00204954 /* BRCMapViewController.m */,
632283191989B139009E472B /* BRCDetailMapViewController.h */,
6322831A1989B139009E472B /* BRCDetailMapViewController.m */,
632283131989AF92009E472B /* BRCBaseMapViewController.h */,
632283141989AF92009E472B /* BRCBaseMapViewController.m */,
);
name = MapViewControllers;
sourceTree = "<group>";
};
D994155E19871D9000D245C7 /* Filtered Tables */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -427,10 +450,12 @@
D97D7A31198ADBE400CA7828 /* NSDateFormatter+iBurn.m in Sources */,
D92562C6198876C400ED6B50 /* BRCEventObjectTableViewCell.m in Sources */,
6322830B19882153009E472B /* BRCRelationshipDetailInfoCell.m in Sources */,
D99395A8198B897B00E9ADD2 /* BRCDetailInfoTableViewCell.m in Sources */,
6322830119881DDE009E472B /* BRCDetailViewController.m in Sources */,
D9941568198726A700D245C7 /* BRCArtObject.m in Sources */,
6322830519881F41009E472B /* BRCDetailCellInfo.m in Sources */,
D97D7A37198B019A00CA7828 /* BRCActionSheetStringPicker.m in Sources */,
D99395AE198B991900E9ADD2 /* TTTLocationFormatter+iBurn.m in Sources */,
D99415641987222800D245C7 /* BRCDataObject.m in Sources */,
D994155719871D1500D245C7 /* BRCFilteredTableViewController.m in Sources */,
D9E28F86198823CC009B3A7A /* BRCRecurringEventObject.m in Sources */,
Expand All @@ -450,6 +475,7 @@
63CE2A641987140F00F65B01 /* main.m in Sources */,
D9941571198726F400D245C7 /* BRCDataImporter.m in Sources */,
63228321198AB383009E472B /* RMMarker+iBurn.m in Sources */,
D99395AB198B986B00E9ADD2 /* TTTTimeIntervalFormatter+iBurn.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
3 changes: 2 additions & 1 deletion iBurn/BRCDataObjectTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#import "BRCDataObjectTableViewCell.h"
#import "BRCDataObject.h"
#import "TTTLocationFormatter+iBurn.h"

@implementation BRCDataObjectTableViewCell

Expand All @@ -17,7 +18,7 @@ - (void) setDataObject:(BRCDataObject*)dataObject {
if (distance == CLLocationDistanceMax || distance == 0) {
self.subtitleLabel.text = nil;
} else {
self.subtitleLabel.text = [NSString stringWithFormat:@"%0.1f m away", distance];
self.subtitleLabel.attributedText = [TTTLocationFormatter brc_humanizedStringForDistance:distance];
}
}

Expand Down
4 changes: 2 additions & 2 deletions iBurn/BRCDatabaseManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ - (YapDatabaseViewSortingBlock)sortingBlockForClass:(Class)viewClass extensionTy
BRCEventObject *event2 = (BRCEventObject *)obj2;

if (event1.isAllDay && !event2.isAllDay) {
return NSOrderedAscending;
return NSOrderedDescending;
}
else if (!event1.isAllDay && event2.isAllDay) {
return NSOrderedDescending;
return NSOrderedAscending;
}

NSComparisonResult dateComparison = [event1.startDate compare:event2.startDate];
Expand Down
4 changes: 3 additions & 1 deletion iBurn/BRCDetailCellInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ typedef NS_ENUM(NSUInteger, BRCDetailCellInfoType) {
BRCDetailCellInfoTypeEmail,
BRCDetailCellInfoTypeURL,
BRCDetailCellInfoTypeCoordinates,
BRCDetailCellInfoTypeRelationship
BRCDetailCellInfoTypeRelationship,
BRCDetailCellInfoTypeDistanceFromCurrentLocation,
BRCDetailCellInfoTypeDistanceFromHomeCamp
};

@class BRCDataObject;
Expand Down
15 changes: 12 additions & 3 deletions iBurn/BRCDetailCellInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import "BRCArtObject.h"
#import "BRCEventObject.h"
#import "BRCDatabaseManager.h"
#import "NSDateFormatter+iBurn.h"

@interface BRCDetailCellInfo ()

Expand Down Expand Up @@ -52,7 +53,9 @@ + (NSArray *)defaultInfoArray

[defaultArray addObject:[self detailCellInfoWithKey:NSStringFromSelector(@selector(url)) displayName:@"URL" cellType:BRCDetailCellInfoTypeURL]];

[defaultArray addObject:[self detailCellInfoWithKey:NSStringFromSelector(@selector(coordinate)) displayName:@"Location" cellType:BRCDetailCellInfoTypeCoordinates]];
[defaultArray addObject:[self detailCellInfoWithKey:NSStringFromSelector(@selector(location)) displayName:@"Location" cellType:BRCDetailCellInfoTypeCoordinates]];

[defaultArray addObject:[self detailCellInfoWithKey:NSStringFromSelector(@selector(distanceFromUser)) displayName:@"Distance" cellType:BRCDetailCellInfoTypeDistanceFromCurrentLocation]];

[defaultArray addObject:[self detailCellInfoWithKey:NSStringFromSelector(@selector(otherLocation)) displayName:@"Other Location" cellType:BRCDetailCellInfoTypeText]];

Expand Down Expand Up @@ -113,15 +116,21 @@ + (NSArray *)infoArrayForObject:(BRCDataObject *)object
dateString = [NSString stringWithFormat:@"All Day"];
}
else {
dateString = [NSString stringWithFormat:@"Some date goes here"];
NSDateFormatter *df = [NSDateFormatter brc_timeOnlyDateFormatter];
NSString *startString = [df stringFromDate:event.startDate];
NSString *endString = [df stringFromDate:event.endDate];
if (startString && endString) {
dateString = [NSString stringWithFormat:@"%@ - %@", startString, endString];
}
}

//Camp relationship
BRCRelationshipDetailInfoCell *relationshipDetailInfoCell = nil;
if ([event.hostedByCampUniqueID length]) {
relationshipDetailInfoCell = [[BRCRelationshipDetailInfoCell alloc] init];
relationshipDetailInfoCell.displayName = @"Camp";
[[BRCDatabaseManager sharedInstance].readWriteDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
// TODO this should be refactored to share a persistent main thread connection
[[[BRCDatabaseManager sharedInstance].database newConnection] readWithBlock:^(YapDatabaseReadTransaction *transaction) {
relationshipDetailInfoCell.dataObject = [transaction objectForKey:event.hostedByCampUniqueID inCollection:[BRCCampObject collection]];
}];
}
Expand Down
19 changes: 19 additions & 0 deletions iBurn/BRCDetailInfoTableViewCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// BRCDetailInfoTableViewCell.h
// iBurn
//
// Created by Christopher Ballinger on 8/1/14.
// Copyright (c) 2014 Burning Man Earth. All rights reserved.
//

#import <UIKit/UIKit.h>

@class BRCDetailCellInfo;

@interface BRCDetailInfoTableViewCell : UITableViewCell

- (void) setDetailCellInfo:(BRCDetailCellInfo*)cellInfo;

+ (NSString*)cellIdentifier;

@end
85 changes: 85 additions & 0 deletions iBurn/BRCDetailInfoTableViewCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//
// BRCDetailInfoTableViewself.m
// iBurn
//
// Created by Christopher Ballinger on 8/1/14.
// Copyright (c) 2014 Burning Man Earth. All rights reserved.
//

#import "BRCDetailInfoTableViewCell.h"
#import "BRCDetailCellInfo.h"
#import "BRCRelationshipDetailInfoCell.h"
#import "BRCDataObject.h"
#import "BRCLocationManager.h"
#import "TTTLocationFormatter.h"
#import "TTTTimeIntervalFormatter+iBurn.h"
#import "TTTLocationFormatter+iBurn.h"

@implementation BRCDetailInfoTableViewCell

- (void) setSelectableAppearance {
self.selectionStyle = UITableViewCellSelectionStyleDefault;
self.textLabel.textColor = [UIColor blueColor];
}

- (void) setPlainTextApperance {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.textLabel.textColor = [UIColor darkTextColor];
}

- (void) setDetailCellInfo:(BRCDetailCellInfo *)cellInfo {
if (!cellInfo) {
return;
}
switch (cellInfo.cellType) {
case BRCDetailCellInfoTypeDistanceFromHomeCamp:
case BRCDetailCellInfoTypeDistanceFromCurrentLocation: {
NSNumber *distanceNumber = cellInfo.value;
CLLocationDistance distance = distanceNumber.doubleValue;
if (distance > 0) {
NSAttributedString *text = [TTTLocationFormatter brc_humanizedStringForDistance:distance];
self.textLabel.attributedText = text;
} else {
self.textLabel.text = nil;
}
self.selectionStyle = UITableViewCellSelectionStyleNone;
break;
}
case BRCDetailCellInfoTypeText: {
self.textLabel.text = cellInfo.value;
[self setPlainTextApperance];
self.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
self.textLabel.numberOfLines = 0;
break;
}
case BRCDetailCellInfoTypeEmail: {
[self setSelectableAppearance];
self.textLabel.text = cellInfo.value;
break;
}
case BRCDetailCellInfoTypeURL: {
[self setSelectableAppearance];
NSURL *url = cellInfo.value;
self.textLabel.text = [url absoluteString];
break;
}
case BRCDetailCellInfoTypeCoordinates: {
CLLocation *location = cellInfo.value;
self.textLabel.text = [NSString stringWithFormat:@"%f, %f", location.coordinate.latitude, location.coordinate.longitude];
[self setPlainTextApperance];
break;
}
case BRCDetailCellInfoTypeRelationship: {
BRCRelationshipDetailInfoCell *relationshipCellInfo = (BRCRelationshipDetailInfoCell *)cellInfo;
self.textLabel.text = relationshipCellInfo.dataObject.title;
[self setSelectableAppearance];
break;
}
}
}

+ (NSString*) cellIdentifier {
return NSStringFromClass([self class]);
}

@end
Loading

0 comments on commit 8c5c35a

Please sign in to comment.