From 78c709fb59e88174eb8432ed37bd32cb0dcc54e9 Mon Sep 17 00:00:00 2001 From: zhijie Date: Tue, 30 Jul 2013 11:35:56 +0800 Subject: [PATCH] UE redesign for accout view && new project view --- RedmineMobile/RedmineMobile/OZLAppDelegate.m | 25 +--------- .../OZLAccountViewController.m | 50 +++++-------------- .../OZLAccountViewController.xib | 10 ++-- .../OZLIssueLogtimeViewController.h | 22 +++++++- .../OZLIssueLogtimeViewController.m | 22 +++++++- .../OZLProjectInfoViewController.m | 15 ++++-- .../OZLProjectListViewController.m | 14 ++++-- 7 files changed, 86 insertions(+), 72 deletions(-) diff --git a/RedmineMobile/RedmineMobile/OZLAppDelegate.m b/RedmineMobile/RedmineMobile/OZLAppDelegate.m index 6b3ffd0..ff16bd9 100644 --- a/RedmineMobile/RedmineMobile/OZLAppDelegate.m +++ b/RedmineMobile/RedmineMobile/OZLAppDelegate.m @@ -38,28 +38,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = PP_AUTORELEASE([[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]); -/* - id main = nil; - int lastProjectID = [[OZLSingleton sharedInstance] lastProjectID]; - if (lastProjectID < 0) { - main = [[OZLAccountViewController alloc] initWithNibName:@"OZLAccountViewController" bundle:nil]; - }else { - main = [[OZLProjectViewController alloc] initWithNibName:@"OZLProjectViewController" bundle:nil]; - OZLModelProject* data = [[OZLModelProject alloc] init]; - data.index = lastProjectID; - [main setProjectData:data]; - } - - UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:main]; - _revealSideViewController = [[PPRevealSideViewController alloc] initWithRootViewController:nav]; - - _revealSideViewController.delegate = self; - - self.window.rootViewController = _revealSideViewController; - - PP_RELEASE(main); - PP_RELEASE(nav); -*/ + OZLProjectListViewController* projectList = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil]; _navigationController = [[UINavigationController alloc] initWithRootViewController:projectList]; @@ -76,7 +55,7 @@ self.window.rootViewController = _navigationController; - self.window.backgroundColor = [UIColor whiteColor]; + self.window.backgroundColor = [UIColor blackColor]; [self.window makeKeyAndVisible]; return YES; } diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLAccountViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLAccountViewController.m index 75386b8..4027900 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLAccountViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLAccountViewController.m @@ -27,7 +27,6 @@ // THE SOFTWARE. #import "OZLAccountViewController.h" -#import "PPRevealSideViewController.h" #import "OZLProjectListViewController.h" #import "OZLSingleton.h" #import "OZLConstants.h" @@ -53,10 +52,12 @@ - (void)viewDidLoad { [super viewDidLoad]; -// [self changeSideViewOffset:40]; -// UIBarButtonItem* projectListBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(showProjectList)]; -// [self.navigationItem setLeftBarButtonItem:projectListBtn]; + UIBarButtonItem* doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(onOk:)]; + [self.navigationItem setRightBarButtonItem:doneBtn]; + + UIBarButtonItem* cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(showProjectList)]; + [self.navigationItem setLeftBarButtonItem:cancelBtn]; _redmineHomeURL.text = [[OZLSingleton sharedInstance] redmineHomeURL]; _redmineUserKey.text = [[OZLSingleton sharedInstance] redmineUserKey]; @@ -72,39 +73,13 @@ [self.view endEditing:YES]; } -- (void) preloadLeft { - OZLProjectListViewController *c = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil]; - [self.revealSideViewController preloadViewController:c - forSide:PPRevealSideDirectionLeft - withOffset:_sideviewOffset]; - PP_RELEASE(c); -} -- (void) viewDidAppear:(BOOL)animated { - [super viewDidAppear:animated]; - [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(preloadLeft) object:nil]; - [self performSelector:@selector(preloadLeft) withObject:nil afterDelay:0.3]; -} - - (void) showProjectList { - [self.navigationController popViewControllerAnimated:YES]; - -// OZLProjectListViewController *c = [[OZLProjectListViewController alloc] initWithNibName:@"OZLProjectListViewController" bundle:nil]; -// [c setNeedRefresh:YES]; -// UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController:c]; -// [self.revealSideViewController pushViewController:navigationController onDirection:PPRevealSideDirectionLeft withOffset:_sideviewOffset animated:YES]; -// PP_RELEASE(c); -} - -- (IBAction)changeSideViewOffset:(int)offset { - _sideviewOffset = offset; - [self.revealSideViewController changeOffset:_sideviewOffset - forDirection:PPRevealSideDirectionRight]; - [self.revealSideViewController changeOffset:_sideviewOffset - forDirection:PPRevealSideDirectionLeft]; - [self.revealSideViewController changeOffset:_sideviewOffset - forDirection:PPRevealSideDirectionTop]; - [self.revealSideViewController changeOffset:_sideviewOffset - forDirection:PPRevealSideDirectionBottom]; + [UIView animateWithDuration:0.75 + animations:^{ + [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; + [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; + }]; + [self.navigationController popViewControllerAnimated:NO]; } - (void)didReceiveMemoryWarning @@ -120,6 +95,7 @@ [self setPassword:nil]; [super viewDidUnload]; } + - (IBAction)onOk:(id)sender { [[OZLSingleton sharedInstance] setRedmineUserKey:_redmineUserKey.text]; [[OZLSingleton sharedInstance] setRedmineHomeURL:_redmineHomeURL.text]; @@ -129,7 +105,7 @@ NSNotificationCenter* center = [NSNotificationCenter defaultCenter]; [center postNotificationName:NOTIFICATION_REDMINE_ACCOUNT_CHANGED object:nil]; - + [self showProjectList]; } @end diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLAccountViewController.xib b/RedmineMobile/RedmineMobile/ViewControllers/OZLAccountViewController.xib index 88390e5..09fad1f 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLAccountViewController.xib +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLAccountViewController.xib @@ -48,7 +48,7 @@ {{20, 49}, {280, 30}} - + _NS:9 NO YES @@ -116,7 +116,7 @@ {{20, 454}, {280, 30}} - + _NS:9 NO YES @@ -160,10 +160,11 @@ - 292 + -2147483356 {{20, 241}, {280, 44}} + _NS:9 NO IBCocoaTouchFramework @@ -294,6 +295,7 @@ {320, 504} + _NS:9 YES YES @@ -303,7 +305,7 @@ {{0, 64}, {320, 504}} - + 3 MQA diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.h b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.h index c5fdb97..576348c 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.h +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.h @@ -3,8 +3,28 @@ // RedmineMobile // // Created by lizhijie on 7/23/13. -// Copyright (c) 2013 Lee Zhijie. All rights reserved. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) // +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import #import "OZLModelIssue.h" diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.m index ceeaab3..1c1a49e 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLIssueLogtimeViewController.m @@ -3,8 +3,28 @@ // RedmineMobile // // Created by lizhijie on 7/23/13. -// Copyright (c) 2013 Lee Zhijie. All rights reserved. + +// This code is distributed under the terms and conditions of the MIT license. + +// Copyright (c) 2013 Zhijie Lee(onezeros.lee@gmail.com) // +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. #import "OZLIssueLogtimeViewController.h" #import "MBProgressHUD.h" diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.m index c4b2a72..f8d0197 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectInfoViewController.m @@ -102,7 +102,11 @@ - (IBAction)onCancel:(id)sender { - [self.navigationController popViewControllerAnimated:YES]; + if (_viewMode == OZLProjectInfoViewModeCreate) { + [self.navigationController dismissModalViewControllerAnimated:YES]; + }else { + [self.navigationController popViewControllerAnimated:YES]; + } } - (IBAction)onSave:(id)sender { @@ -141,10 +145,15 @@ [OZLNetwork createProject:projectData withParams:nil andBlock:^(BOOL success, NSError *error) { if (error) { NSLog(@"create project error: %@",error.description); + _HUD.mode = MBProgressHUDModeText; + _HUD.labelText = @"Connection Failed"; + _HUD.detailsLabelText = @" Please check network connection or your account setting."; + [_HUD hide:YES afterDelay:3]; + }else { - + [_HUD hide:YES]; + [self onCancel:nil]; } - [_HUD hide:YES]; }]; } diff --git a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectListViewController.m b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectListViewController.m index 9f47e7a..05d227f 100644 --- a/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectListViewController.m +++ b/RedmineMobile/RedmineMobile/ViewControllers/OZLProjectListViewController.m @@ -125,8 +125,13 @@ - (IBAction)showAccountView:(id)sender { OZLAccountViewController *c = [[OZLAccountViewController alloc] initWithNibName:@"OZLAccountViewController" bundle:nil]; - [self.navigationController pushViewController:c animated:YES]; - + [UIView animateWithDuration:0.75 + animations:^{ + [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; + [self.navigationController pushViewController:c animated:NO]; + [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO]; + }]; + // UINavigationController *n = [[UINavigationController alloc] initWithRootViewController:c]; // [self.revealSideViewController popViewControllerWithNewCenterController:n // animated:YES]; @@ -167,7 +172,10 @@ OZLProjectInfoViewController* creator = [tableViewStoryboard instantiateViewControllerWithIdentifier:@"OZLProjectInfoViewController"]; [creator setProjectList:_projectList]; [creator setViewMode:OZLProjectInfoViewModeCreate]; - [self.navigationController pushViewController:creator animated:YES]; + + + UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:creator]; + [self.navigationController presentModalViewController:nav animated:YES]; } - (void)viewDidUnload {