Skip to content

Commit

Permalink
Merge pull request facebookarchive#739 from facebook/development
Browse files Browse the repository at this point in the history
[Release] Three20 1.0.10
  • Loading branch information
diederich committed Jan 5, 2012
2 parents f4f9bc6 + 26b455e commit 9eb3580
Show file tree
Hide file tree
Showing 18 changed files with 307 additions and 12 deletions.
11 changes: 7 additions & 4 deletions samples/TTCatalog/Classes/TableItemTestController.m
Expand Up @@ -21,8 +21,8 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
self.title = @"Table Items";
self.variableHeightRows = YES;

// Uncomment this to see how the table looks with the grouped style
//self.tableViewStyle = UITableViewStyleGrouped;
// comment this to see how the table looks with the standard style
self.tableViewStyle = UITableViewStyleGrouped;

// Uncomment this to see how the table cells look against a custom background color
//self.tableView.backgroundColor = [UIColor yellowColor];
Expand All @@ -34,9 +34,12 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
// This demonstrates how to create a table with standard table "fields". Many of these
// fields with URLs that will be visited when the row is selected
self.dataSource = [TTSectionedDataSource dataSourceWithObjects:
@"Links and Buttons",
@"Generic Items",
[TTTableSettingsItem itemWithText:Three20Version caption:@"Three20 Version"
URL:@"tt://tableItemTest"],
[TTTableTextItem itemWithText:@"TTTableTextItem" URL:@"tt://tableItemTest"
accessoryURL:@"http://www.google.com"],
[TTTableSection sectionWithHeaderTitle:@"Links & Buttons" footerTitle:nil],
[TTTableLink itemWithText:@"TTTableLink" URL:@"tt://tableItemTest"],
[TTTableButton itemWithText:@"TTTableButton"],
[TTTableCaptionItem itemWithText:@"TTTableCaptionItem" caption:@"caption"
Expand All @@ -47,7 +50,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
text:kLoremIpsum timestamp:[NSDate date] URL:@"tt://tableItemTest"],
[TTTableMoreButton itemWithText:@"TTTableMoreButton"],

@"Images",
[TTTableSection sectionWithHeaderTitle:@"Images" footerTitle:@"Usage of images inside TTTableView"],
[TTTableImageItem itemWithText:@"TTTableImageItem" imageURL:localImage
URL:@"tt://tableItemTest"],
[TTTableRightImageItem itemWithText:@"TTTableRightImageItem" imageURL:localImage
Expand Down
Binary file modified src/Three20.bundle/he.lproj/Localizable.strings
Binary file not shown.
Binary file modified src/Three20.bundle/nl.lproj/Localizable.strings
Binary file not shown.
3 changes: 1 addition & 2 deletions src/Three20Core/Sources/TTGlobalCoreLocale.m
Expand Up @@ -22,8 +22,7 @@

///////////////////////////////////////////////////////////////////////////////////////////////////
NSLocale* TTCurrentLocale() {
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSArray* languages = [defaults objectForKey:@"AppleLanguages"];
NSArray* languages = [NSLocale preferredLanguages];
if (languages.count > 0) {
NSString* currentLanguage = [languages objectAtIndex:0];
return [[[NSLocale alloc] initWithLocaleIdentifier:currentLanguage] autorelease];
Expand Down
4 changes: 2 additions & 2 deletions src/Three20Core/Sources/Three20Version.m
Expand Up @@ -18,6 +18,6 @@

/*! \mainpage Three20 API Documentation
*
* Generated from Three20 Release <a href="http://three20.info/roadmap/1.0.9">1.0.9</a>.
* Generated from Three20 Release <a href="http://three20.info/roadmap/1.0.10">1.0.10</a>.
*/
NSString* const Three20Version = @"1.0.9";
NSString* const Three20Version = @"1.0.10";
7 changes: 7 additions & 0 deletions src/Three20Network/Sources/TTRequestLoader.m
Expand Up @@ -120,6 +120,13 @@ - (void)connectToURL:(NSURL*)URL {
TTNetworkRequestStarted();

TTURLRequest* request = _requests.count == 1 ? [_requests objectAtIndex:0] : nil;

// there are situations where urlPath is somehow nil (therefore crashing in
// createNSURLRequest:URL:, even if we checked for non-blank values before
// adding the request to the queue.
if (!request.urlPath.length)
[self cancel:request];

NSURLRequest* URLRequest = [_queue createNSURLRequest:request URL:URL];

_connection = [[NSURLConnection alloc] initWithRequest:URLRequest delegate:self];
Expand Down
31 changes: 31 additions & 0 deletions src/Three20UI/Headers/TTTableSection.h
@@ -0,0 +1,31 @@
//
// Copyright 2009-2011 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import <UIKit/UIKit.h>


@interface TTTableSection : NSObject {
NSString* _headerTitle;
NSString* _footerTitle;
}

@property (nonatomic, copy) NSString* headerTitle;
@property (nonatomic, copy) NSString* footerTitle;


+ (id)sectionWithHeaderTitle:(NSString*)headerTitle footerTitle:(NSString*)footerTitle;

@end
22 changes: 22 additions & 0 deletions src/Three20UI/Headers/TTTableSettingsItem.h
@@ -0,0 +1,22 @@
//
// Copyright 2009-2011 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

// UI
#import "Three20UI/TTTableCaptionItem.h"

@interface TTTableSettingsItem : TTTableCaptionItem

@end
24 changes: 24 additions & 0 deletions src/Three20UI/Headers/TTTableSettingsItemCell.h
@@ -0,0 +1,24 @@
//
// Copyright 2009-2011 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

// UI
#import "Three20UI/TTTableLinkedItemCell.h"

@interface TTTableSettingsItemCell : TTTableLinkedItemCell

@property (nonatomic, readonly) UILabel* captionLabel;

@end
3 changes: 3 additions & 0 deletions src/Three20UI/Headers/Three20UI.h
Expand Up @@ -90,6 +90,7 @@
#import "Three20UI/TTListDataSource.h"
#import "Three20UI/TTSectionedDataSource.h"
#import "Three20UI/TTTableHeaderView.h"
#import "Three20UI/TTTableSection.h"
#import "Three20UI/TTTableFooterInfiniteScrollView.h"
#import "Three20UI/TTTableHeaderDragRefreshView.h"
#import "Three20UI/TTTableViewCell.h"
Expand All @@ -115,6 +116,7 @@
#import "Three20UI/TTTableStyledTextItem.h"
#import "Three20UI/TTTableControlItem.h"
#import "Three20UI/TTTableViewItem.h"
#import "Three20UI/TTTableSettingsItem.h"

// Table Item Cells
#import "Three20UI/TTTableLinkedItemCell.h"
Expand All @@ -131,6 +133,7 @@
#import "Three20UI/TTTableActivityItemCell.h"
#import "Three20UI/TTTableControlCell.h"
#import "Three20UI/TTTableFlushViewCell.h"
#import "Three20UI/TTTableSettingsItemCell.h"

#import "Three20UI/TTErrorView.h"

Expand Down
1 change: 1 addition & 0 deletions src/Three20UI/Sources/TTMessageController.m
Expand Up @@ -147,6 +147,7 @@ - (void)createFieldViews {
label.text = field.title;
label.font = TTSTYLEVAR(messageFont);
label.textColor = TTSTYLEVAR(messageFieldTextColor);
label.backgroundColor = TTSTYLEVAR(backgroundColor);
[label sizeToFit];
label.frame = CGRectInset(label.frame, -2, 0);
textField.leftView = label;
Expand Down
28 changes: 25 additions & 3 deletions src/Three20UI/Sources/TTSectionedDataSource.m
Expand Up @@ -18,6 +18,7 @@

// UI
#import "Three20UI/TTTableItem.h"
#import "Three20UI/TTTableSection.h"

// Core
#import "Three20Core/TTCorePreprocessorMacros.h"
Expand Down Expand Up @@ -67,7 +68,8 @@ + (TTSectionedDataSource*)dataSourceWithObjects:(id)object,... {
va_list ap;
va_start(ap, object);
while (object) {
if ([object isKindOfClass:[NSString class]]) {
if ([object isKindOfClass:[NSString class]] ||
[object isKindOfClass:[TTTableSection class]]) {
[sections addObject:object];
section = [NSMutableArray array];
[items addObject:section];
Expand All @@ -90,7 +92,8 @@ + (TTSectionedDataSource*)dataSourceWithArrays:(id)object,... {
va_list ap;
va_start(ap, object);
while (object) {
if ([object isKindOfClass:[NSString class]]) {
if ([object isKindOfClass:[NSString class]] ||
[object isKindOfClass:[TTTableSection class]]) {
[sections addObject:object];

} else {
Expand Down Expand Up @@ -137,7 +140,26 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
if (_sections.count) {
return [_sections objectAtIndex:section];
if ([[_sections objectAtIndex:section] isKindOfClass:[TTTableSection class]]) {
TTTableSection* sectionInfo = [_sections objectAtIndex:section];
return sectionInfo.headerTitle;

} else {
return [_sections objectAtIndex:section];
}

} else {
return nil;
}
}

///////////////////////////////////////////////////////////////////////////////////////////////////
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {
if (tableView.style==UITableViewStyleGrouped &&
_sections.count &&
[[_sections objectAtIndex:section] isKindOfClass:[TTTableSection class]]) {
TTTableSection* sectionInfo = [_sections objectAtIndex:section];
return sectionInfo.footerTitle;

} else {
return nil;
Expand Down
51 changes: 51 additions & 0 deletions src/Three20UI/Sources/TTTableSection.m
@@ -0,0 +1,51 @@
//
// Copyright 2009-2011 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "Three20UI/TTTableSection.h"

// Core
#import "Three20Core/TTCorePreprocessorMacros.h"


///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
@implementation TTTableSection

@synthesize headerTitle = _headerTitle;
@synthesize footerTitle = _footerTitle;


///////////////////////////////////////////////////////////////////////////////////////////////////
+ (id)sectionWithHeaderTitle:(NSString*)headerTitle footerTitle:(NSString*)footerTitle {
TTTableSection* item = [[[self alloc] init] autorelease];
item.headerTitle = headerTitle;
item.footerTitle = footerTitle;
return item;
}


///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)dealloc {
TT_RELEASE_SAFELY(_headerTitle);
TT_RELEASE_SAFELY(_footerTitle);

[super dealloc];
}


@end

26 changes: 26 additions & 0 deletions src/Three20UI/Sources/TTTableSettingsItem.m
@@ -0,0 +1,26 @@
//
// Copyright 2009-2011 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "Three20UI/TTTableSettingsItem.h"


///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
@implementation TTTableSettingsItem

@end

69 changes: 69 additions & 0 deletions src/Three20UI/Sources/TTTableSettingsItemCell.m
@@ -0,0 +1,69 @@
//
// Copyright 2009-2011 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "Three20UI/TTTableSettingsItemCell.h"

// UI
#import "Three20UI/TTTableSettingsItem.h"


///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
@implementation TTTableSettingsItemCell


///////////////////////////////////////////////////////////////////////////////////////////////////
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)identifier {
self = [super initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
if (self) {

}

return self;
}

///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark TTTableViewCell


///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)setObject:(id)object {
if (_item != object) {
[super setObject:object];

TTTableSettingsItem* item = object;
self.textLabel.text = item.caption;
self.detailTextLabel.text = item.text;
}
}


///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark Public


///////////////////////////////////////////////////////////////////////////////////////////////////
- (UILabel*)captionLabel {
return self.textLabel;
}


@end

0 comments on commit 9eb3580

Please sign in to comment.