diff options
Diffstat (limited to 'iphone/FixMyStreet/Classes')
-rw-r--r-- | iphone/FixMyStreet/Classes/EditSubjectViewController.m | 31 | ||||
-rw-r--r-- | iphone/FixMyStreet/Classes/InputTableViewController.h | 4 | ||||
-rw-r--r-- | iphone/FixMyStreet/Classes/InputTableViewController.m | 25 |
3 files changed, 44 insertions, 16 deletions
diff --git a/iphone/FixMyStreet/Classes/EditSubjectViewController.m b/iphone/FixMyStreet/Classes/EditSubjectViewController.m index 3abece54e..614aa7f7b 100644 --- a/iphone/FixMyStreet/Classes/EditSubjectViewController.m +++ b/iphone/FixMyStreet/Classes/EditSubjectViewController.m @@ -45,6 +45,9 @@ } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + if (cell.textField.placeholder == @"Subject") { + return 2; + } return 1; } @@ -53,9 +56,31 @@ return 1; } +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + if (indexPath.section == 1) { + return 54.0; + } + return 44.0; +} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - return cell; + if (indexPath.section == 1) { + static NSString *CellIdentifier = @"InfoCell"; + UITableViewCell *infoCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + if (infoCell == nil) { + infoCell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; + UITextView *blurb = [[UITextView alloc] initWithFrame:CGRectMake(10, 0, 280, 44)]; + blurb.font = [UIFont italicSystemFontOfSize:14]; + blurb.textAlignment = UITextAlignmentCenter; + blurb.editable = NO; + blurb.text = @"You can provide more details\nlater on at the website"; + [infoCell.contentView addSubview:blurb]; + [blurb release]; + } + return infoCell; + } + + return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { @@ -99,7 +124,7 @@ FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; // This is yucky, but I can't think of a better way that wouldn't just waste time. NSString* placeholder = cell.textField.placeholder; - if (placeholder == @"Summary") { + if (placeholder == @"Subject") { if (text.length) { delegate.subject = text; } else { @@ -128,7 +153,7 @@ } -(BOOL)textFieldShouldReturn:(UITextField*)theTextField { - //if (theTextField == summaryTextField) { + //if (theTextField == subjectTextField) { [theTextField resignFirstResponder]; [self updateText:theTextField.text]; //} diff --git a/iphone/FixMyStreet/Classes/InputTableViewController.h b/iphone/FixMyStreet/Classes/InputTableViewController.h index 17af251aa..f902c4017 100644 --- a/iphone/FixMyStreet/Classes/InputTableViewController.h +++ b/iphone/FixMyStreet/Classes/InputTableViewController.h @@ -18,7 +18,7 @@ // Not sure what I made these for UITableViewCell* actionTakePhotoCell; UITableViewCell* actionFetchLocationCell; - UITableViewCell* actionSummaryCell; + UITableViewCell* actionSubjectCell; UILabel* subjectLabel; UILabel* subjectContent; @@ -36,7 +36,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo; - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker; --(void)startLocation; +-(BOOL)startLocation; //MyCLControllerDelegate -(void)newLocationUpdate:(CLLocation *)location; diff --git a/iphone/FixMyStreet/Classes/InputTableViewController.m b/iphone/FixMyStreet/Classes/InputTableViewController.m index 6d9388a83..d77439aaa 100644 --- a/iphone/FixMyStreet/Classes/InputTableViewController.m +++ b/iphone/FixMyStreet/Classes/InputTableViewController.m @@ -17,7 +17,7 @@ //@synthesize image; //@synthesize imagCell; -//@synthesize reportSummary; +//@synthesize reportSubject; - (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle { if (self = [super initWithNibName:nibName bundle:nibBundle]) { @@ -174,7 +174,7 @@ cell.textColor = [UIColor grayColor]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } - actionSummaryCell = cell; + actionSubjectCell = cell; } else if (indexPath.section == 3) { if (delegate.name && delegate.name.length && delegate.email && delegate.email.length) { cell.accessoryType = UITableViewCellAccessoryCheckmark; @@ -193,11 +193,16 @@ if (indexPath.section == 0) { [self addPhoto:nil]; } else if (indexPath.section == 2) { - [self startLocation]; + if ([self startLocation]) { + UIActivityIndicatorView* activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; + [activityView startAnimating]; + actionFetchLocationCell.accessoryView = activityView; + [activityView release]; + } } else if (indexPath.section == 1) { FixMyStreetAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; EditSubjectViewController* editSubjectViewController = [[EditSubjectViewController alloc] initWithNibName:@"EditSubjectView" bundle:nil]; - [editSubjectViewController setAll:delegate.subject viewTitle:@"Edit summary" placeholder:@"Summary" keyboardType:UIKeyboardTypeDefault capitalisation:UITextAutocapitalizationTypeSentences]; + [editSubjectViewController setAll:delegate.subject viewTitle:@"Edit subject" placeholder:@"Subject" keyboardType:UIKeyboardTypeDefault capitalisation:UITextAutocapitalizationTypeSentences]; [self.navigationController pushViewController:editSubjectViewController animated:YES]; [editSubjectViewController release]; } else if (indexPath.section == 3) { @@ -247,7 +252,7 @@ [imageView release]; [actionTakePhotoCell release]; [actionFetchLocationCell release]; - [actionSummaryCell release]; + [actionSubjectCell release]; [actionsToDoView release]; [settingsButton release]; [backButton release]; @@ -277,18 +282,16 @@ // MyCLControllerDelegate and related --(void)startLocation { +-(BOOL)startLocation { NetworkStatus internetConnectionStatus = [[Reachability sharedReachability] internetConnectionStatus]; if (internetConnectionStatus == NotReachable) { UIAlertView *v = [[UIAlertView alloc] initWithTitle:@"Location required" message:@"FixMyStreet needs some sort of connection in order to find your location." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [v show]; - [v release]; + [v release]; + return FALSE; } else { [[MyCLController sharedInstance] startUpdatingLocation]; - UIActivityIndicatorView* activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - [activityView startAnimating]; - actionFetchLocationCell.accessoryView = activityView; - [activityView release]; + return TRUE; } } |