//
//  AppDelegate.m
//  ABC Bank
//
//  Created by oliviers on 9/19/13.
//  Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
//

#import "AppDelegate.h"

@implementation AppDelegate

@synthesize window, navController;

- (void)customizeAppearance
{
    // Create resizable images
    UIImage *gradientImage44 = [[UIImage imageNamed:@"navbar-green-portrait"]
                                resizableImageWithCapInsets:UIEdgeInsetsMake(0, 10, 0, 10)];
    UIImage *gradientImage32 = [[UIImage imageNamed:@"navbar-green-landscape"]
                                resizableImageWithCapInsets:UIEdgeInsetsMake(0, 10, 0, 10)];
    
    // Set the background image for *all* UINavigationBars
    [[UINavigationBar appearance] setBackgroundImage:gradientImage44
                                       forBarMetrics:UIBarMetricsDefault];
    [[UINavigationBar appearance] setBackgroundImage:gradientImage32
                                       forBarMetrics:UIBarMetricsLandscapePhone];
    
    // Customize the title text for *all* UINavigationBars
    [[UINavigationBar appearance] setTitleTextAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor whiteColor],
      NSForegroundColorAttributeName,
      [UIFont fontWithName:@"Helvetica" size:0.0],
      NSFontAttributeName,
      nil]];
    
    UIImage *backbutton30 = [[UIImage imageNamed:@"back-button-green-portrait"]
                             resizableImageWithCapInsets:UIEdgeInsetsMake(0, 18, 0, 5)];
    UIImage *backbutton24 = [[UIImage imageNamed:@"back-button-green-landscape"]
                             resizableImageWithCapInsets:UIEdgeInsetsMake(0, 18, 0, 5)];
    
    [[UIBarButtonItem appearance] setBackButtonBackgroundImage:backbutton30 forState:UIControlStateNormal
                                                    barMetrics:UIBarMetricsDefault];
    [[UIBarButtonItem appearance] setBackButtonBackgroundImage:backbutton24 forState:UIControlStateNormal
                                                    barMetrics:UIBarMetricsLandscapePhone];
    
    UIImage *barbutton30 = [[UIImage imageNamed:@"bar-button-green-portrait"]
                            resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
    UIImage *barbutton24 = [[UIImage imageNamed:@"bar-button-green-landscape"]
                            resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
    
    [[UIBarButtonItem appearance] setBackgroundImage:barbutton30 forState:UIControlStateNormal
                                          barMetrics:UIBarMetricsDefault];
    [[UIBarButtonItem appearance] setBackgroundImage:barbutton24 forState:UIControlStateNormal
                                          barMetrics:UIBarMetricsLandscapePhone];
    
    [[UIBarButtonItem appearance] setTitleTextAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor whiteColor],
      NSForegroundColorAttributeName,
      [UIFont fontWithName:@"Helvetica-Bold" size:0.0],
      NSFontAttributeName,
      nil]
                                                forState:UIControlStateNormal];
    

}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
   
    // The Jabber Guest SDK for iOS uses H.264 AVC video, which requires activation of a license agreement
    // by each user. The user will be prompted to activate the video license with an AlertView.
    //
    // If your company has it’s own license agreement for H.264 AVC video from MPEG LA, and you wish to
    // disable the display of the video license AlertView, you may call the disableActivation API (see below)
    //
    // If you disable the built-in activation capability of the Jabber SDK for iOS, you do so at your own risk
    // and are responsible for any royalties or other fees associated with your use of the H.264 AVC video codec.
    //
    // [[CJGuestVideoLicense sharedInstance] disableActivation];

    [self customizeAppearance];
    
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
