diff --git a/RedmineMobile/RedmineMobile.xcodeproj/project.pbxproj b/RedmineMobile/RedmineMobile.xcodeproj/project.pbxproj index 5c991c2..f47963c 100644 --- a/RedmineMobile/RedmineMobile.xcodeproj/project.pbxproj +++ b/RedmineMobile/RedmineMobile.xcodeproj/project.pbxproj @@ -10,7 +10,6 @@ 2B62D0DF1796498800AC3C19 /* OZLIssueCreateViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B62D0DE1796498800AC3C19 /* OZLIssueCreateViewController.storyboard */; }; 2B62D0E1179649A800AC3C19 /* OZLIssueDetailViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B62D0E0179649A800AC3C19 /* OZLIssueDetailViewController.storyboard */; }; 2B62D0E31796A15C00AC3C19 /* OZLProjectCreateViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B62D0E21796A15C00AC3C19 /* OZLProjectCreateViewController.storyboard */; }; - 2B62D0E51796A8C800AC3C19 /* OZLIssueFilterViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B62D0E41796A8C800AC3C19 /* OZLIssueFilterViewController.storyboard */; }; 2B62D0E81796A8D800AC3C19 /* OZLIssueFilterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B62D0E71796A8D800AC3C19 /* OZLIssueFilterViewController.m */; }; 2B6F382F1797A00A00D06F51 /* MLTableAlertBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 2B6F38251797A00A00D06F51 /* MLTableAlertBackground.png */; }; 2B6F38301797A00A00D06F51 /* MLTableAlertBackground@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2B6F38261797A00A00D06F51 /* MLTableAlertBackground@2x.png */; }; @@ -76,7 +75,6 @@ 2B62D0DE1796498800AC3C19 /* OZLIssueCreateViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = OZLIssueCreateViewController.storyboard; path = ViewControllers/OZLIssueCreateViewController.storyboard; sourceTree = ""; }; 2B62D0E0179649A800AC3C19 /* OZLIssueDetailViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = OZLIssueDetailViewController.storyboard; path = ViewControllers/OZLIssueDetailViewController.storyboard; sourceTree = ""; }; 2B62D0E21796A15C00AC3C19 /* OZLProjectCreateViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = OZLProjectCreateViewController.storyboard; path = ViewControllers/OZLProjectCreateViewController.storyboard; sourceTree = ""; }; - 2B62D0E41796A8C800AC3C19 /* OZLIssueFilterViewController.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = OZLIssueFilterViewController.storyboard; path = ViewControllers/OZLIssueFilterViewController.storyboard; sourceTree = ""; }; 2B62D0E61796A8D800AC3C19 /* OZLIssueFilterViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OZLIssueFilterViewController.h; path = ViewControllers/OZLIssueFilterViewController.h; sourceTree = ""; }; 2B62D0E71796A8D800AC3C19 /* OZLIssueFilterViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OZLIssueFilterViewController.m; path = ViewControllers/OZLIssueFilterViewController.m; sourceTree = ""; }; 2B6F38251797A00A00D06F51 /* MLTableAlertBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = MLTableAlertBackground.png; sourceTree = ""; }; @@ -273,7 +271,6 @@ 2B8A11E017963CE500906D34 /* OZLIssueDetailViewController.h */, 2B8A11E117963CE500906D34 /* OZLIssueDetailViewController.m */, 2B62D0E0179649A800AC3C19 /* OZLIssueDetailViewController.storyboard */, - 2B62D0E41796A8C800AC3C19 /* OZLIssueFilterViewController.storyboard */, 2B62D0E61796A8D800AC3C19 /* OZLIssueFilterViewController.h */, 2B62D0E71796A8D800AC3C19 /* OZLIssueFilterViewController.m */, ); @@ -519,7 +516,6 @@ 2B62D0DF1796498800AC3C19 /* OZLIssueCreateViewController.storyboard in Resources */, 2B62D0E1179649A800AC3C19 /* OZLIssueDetailViewController.storyboard in Resources */, 2B62D0E31796A15C00AC3C19 /* OZLProjectCreateViewController.storyboard in Resources */, - 2B62D0E51796A8C800AC3C19 /* OZLIssueFilterViewController.storyboard in Resources */, 2B6F382F1797A00A00D06F51 /* MLTableAlertBackground.png in Resources */, 2B6F38301797A00A00D06F51 /* MLTableAlertBackground@2x.png in Resources */, 2B6F38311797A00A00D06F51 /* MLTableAlertButton.png in Resources */, diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.m index d7fa966..38c3473 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueCreateViewController.m @@ -116,6 +116,7 @@ doneCount ++; if (doneCount == 4) { [_HUD hide:YES]; + doneCount = 0; } }]; @@ -128,6 +129,7 @@ doneCount ++; if (doneCount == 4) { [_HUD hide:YES]; + doneCount = 0; } }]; [OZLNetwork getPriorityListWithParams:nil andBlock:^(NSArray *result, NSError *error) { @@ -139,6 +141,7 @@ doneCount ++; if (doneCount == 4) { [_HUD hide:YES]; + doneCount = 0; } }]; [OZLNetwork getUserListWithParams:nil andBlock:^(NSArray *result, NSError *error) { @@ -150,6 +153,7 @@ doneCount ++; if (doneCount == 4) { [_HUD hide:YES]; + doneCount = 0; } }]; } @@ -341,12 +345,12 @@ } } + [self.tableView reloadData]; } #pragma mark - #pragma mark delegate of textfield inputview - #pragma mark data picker value changed -(void)datePickerValueChanged:(id)sender { diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.m index b9bf963..7d91789 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.m @@ -8,8 +8,12 @@ #import "OZLIssueFilterViewController.h" -@interface OZLIssueFilterViewController () +@interface OZLIssueFilterViewController () { + NSArray* _cellArray; + NSArray* _headerArray; + int _checkedCell[3]; +} @end @implementation OZLIssueFilterViewController @@ -27,11 +31,30 @@ { [super viewDidLoad]; - // Uncomment the following line to preserve selection between presentations. - // self.clearsSelectionOnViewWillAppear = NO; - - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem; + UIBarButtonItem* cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(onCancel:)]; + [self.navigationItem setLeftBarButtonItem:cancelBtn]; + UIBarButtonItem* saveBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(onSave:)]; + [self.navigationItem setRightBarButtonItem:saveBtn]; + + _cellArray = @[ + @[@"Assigned to me",@"Open",@"Reported by me"], + @[@"Id", @"Tracker", @"Status", @"Priority", @"Category", @"Asssigned to", @"Fixed Version", @"Start Date", @"Due Date", @"Estimated Date", @"Done", @"Updated on"], + @[@"Ascending", @"Descending"]]; + _headerArray = @[@"Filter by", @"Sort by", @""]; + + _checkedCell[0] = 0; + _checkedCell[1] = 0; + _checkedCell[2] = 0; +} + +-(void) onCancel:(id)sender +{ + [self.navigationController popViewControllerAnimated:YES]; +} + +-(void) onSave:(id) sender +{ + } - (void)didReceiveMemoryWarning @@ -44,78 +67,43 @@ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { -#warning Potentially incomplete method implementation. - // Return the number of sections. - return 0; + return _cellArray.count; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { -#warning Incomplete method implementation. - // Return the number of rows in the section. - return 0; + + return [[_cellArray objectAtIndex:section] count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"Cell"; - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; - - // Configure the cell... + static NSString *CellIdentifier = @"OZLIssueFilterViewControllerCell"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier ]; + if (!cell) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; + } + if (_checkedCell[indexPath.section] == indexPath.row ) { + cell.accessoryType = UITableViewCellAccessoryCheckmark; + }else { + cell.accessoryType = UITableViewCellAccessoryNone; + } + cell.textLabel.text = [[_cellArray objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]; + cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } -/* -// Override to support conditional editing of the table view. -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath +-(NSString*) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { - // Return NO if you do not want the specified item to be editable. - return YES; + return [_headerArray objectAtIndex:section]; } -*/ - -/* -// Override to support editing the table view. -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath -{ - if (editingStyle == UITableViewCellEditingStyleDelete) { - // Delete the row from the data source - [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; - } - else if (editingStyle == UITableViewCellEditingStyleInsert) { - // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view - } -} -*/ - -/* -// Override to support rearranging the table view. -- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath -{ -} -*/ - -/* -// Override to support conditional rearranging of the table view. -- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath -{ - // Return NO if you do not want the item to be re-orderable. - return YES; -} -*/ - #pragma mark - Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - // Navigation logic may go here. Create and push another view controller. - /* - <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; - // ... - // Pass the selected object to the new view controller. - [self.navigationController pushViewController:detailViewController animated:YES]; - */ + _checkedCell[indexPath.section] = indexPath.row; + [self.tableView reloadData]; } @end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.storyboard b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.storyboard deleted file mode 100644 index f7fc068..0000000 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueFilterViewController.storyboard +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.h b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.h index e4ef196..373e58f 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.h +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.h @@ -33,4 +33,6 @@ @property (weak, nonatomic) IBOutlet UITableView *issuesTableview; @property (nonatomic,strong) OZLModelProject* projectData; - (IBAction)onNewIssue:(id)sender; +- (IBAction)onSortSetting:(id)sender; + @end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.m index fce4a94..4dbeb42 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.m @@ -34,6 +34,7 @@ #import "OZLProjectDetailViewController.h" #import "OZLIssueDetailViewController.h" #import "OZLIssueCreateViewController.h" +#import "OZLIssueFilterViewController.h" #import "OZLSingleton.h" @@ -71,11 +72,14 @@ [self.view addSubview:_HUD]; _HUD.labelText = @"Loading..."; - [self reloadData]; - [[OZLSingleton sharedInstance] setLastProjectID:_projectData.index]; } +-(void) viewWillAppear:(BOOL)animated +{ + [self reloadData]; +} + -(void) reloadData { if (_projectData == nil) { @@ -108,8 +112,8 @@ - (void) viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(preloadLeft) object:nil]; - [self performSelector:@selector(preloadLeft) withObject:nil afterDelay:0.3]; +// [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(preloadLeft) object:nil]; +// [self performSelector:@selector(preloadLeft) withObject:nil afterDelay:0.3]; } @@ -256,4 +260,9 @@ //[self.navigationController presentModalViewController:creator animated:YES]; [self.navigationController pushViewController:creator animated:YES]; } + +- (IBAction)onSortSetting:(id)sender { + OZLIssueFilterViewController* filter = [[OZLIssueFilterViewController alloc] initWithStyle:UITableViewStyleGrouped]; + [self.navigationController pushViewController:filter animated:YES]; +} @end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.xib b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.xib index f54c05c..d31008a 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.xib +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectViewController.xib @@ -74,6 +74,12 @@ 4 + + IBCocoaTouchFramework + 1 + + 10 + @@ -153,6 +159,14 @@ 11 + + + onSortSetting: + + + + 14 + @@ -187,6 +201,7 @@ + @@ -200,6 +215,11 @@ + + 13 + + + @@ -208,6 +228,7 @@ UIResponder com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -216,7 +237,7 @@ - 12 + 14 0