• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*-------------------------------------------------------------------------
2 * drawElements Quality Program Tester Core
3 * ----------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 *//*!
20 * \file
21 * \brief iOS Application Delegate.
22 *//*--------------------------------------------------------------------*/
23
24#import "tcuIOSAppDelegate.h"
25#import "tcuEAGLView.h"
26#import "tcuIOSViewController.h"
27
28@implementation tcuIOSAppDelegate
29
30@synthesize window = _window;
31@synthesize viewController = _viewController;
32
33- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
34{
35	DE_UNREF(application && launchOptions);
36
37	// Construct window.
38	self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
39	if (!self.window)
40	{
41		[self release];
42		return NO;
43	}
44
45	self.window.backgroundColor = [UIColor whiteColor];
46
47	// Create view controller.
48	self.viewController = [tcuIOSViewController alloc];
49
50	[self.window setRootViewController:self.viewController];
51
52	[self.window makeKeyAndVisible];
53	[self.window layoutSubviews];
54
55	// Disable idle timer (keep screen on).
56	[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
57
58    return YES;
59}
60
61- (void)applicationWillResignActive:(UIApplication *)application
62{
63	DE_UNREF(application);
64	[self.viewController stopTestIteration];
65}
66
67- (void)applicationDidEnterBackground:(UIApplication *)application
68{
69	DE_UNREF(application);
70}
71
72- (void)applicationWillEnterForeground:(UIApplication *)application
73{
74	DE_UNREF(application);
75}
76
77- (void)applicationDidBecomeActive:(UIApplication *)application
78{
79	DE_UNREF(application);
80	[self.viewController startTestIteration];
81}
82
83- (void)applicationWillTerminate:(UIApplication *)application
84{
85	DE_UNREF(application);
86	[self.viewController stopTestIteration];
87}
88
89- (void)dealloc
90{
91	[_window release];
92	[_viewController release];
93    [super dealloc];
94}
95
96@end
97