//
//  AboutUsViewController.m
//  VideoVision
//
//  Created by Nguyen Viet Minh on 5/5/13.
//  Copyright (c) 2013 Hieu Nguyen. All rights reserved.
//

#import "AboutUsViewController.h"
#import <QuartzCore/QuartzCore.h>

@interface AboutUsViewController ()

@end

@implementation AboutUsViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        
        NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
        
        // getting an NSString
        NSString *myString = [prefs stringForKey:@"language"];
        
        if([myString isEqualToString:@"عربي"])
        {
            UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"فعلت" style:UIBarButtonItemStylePlain
                                                                             target:self action:@selector(dismissView:)];
            self.navigationItem.rightBarButtonItem = anotherButton;
        }
        else
        {
            UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain
                                                                             target:self action:@selector(dismissView:)];
            self.navigationItem.rightBarButtonItem = anotherButton;
        }

    }
    return self;
}
-(IBAction)dismissView:(id)sender
{
    CATransition* transition = [CATransition animation];
    transition.duration = 0.5;
    transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
    transition.type = kCATransitionFade;
    [self.navigationController.view.layer addAnimation:transition forKey:nil];
    [[self navigationController] popViewControllerAnimated:NO];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self.navigationController.navigationBar setHidden:NO];
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    
    // getting an NSString
    NSString *myString = [prefs stringForKey:@"language"];
    
        if([myString isEqualToString:@"عربي"])
        {
            txtArabic.alpha=1;
            txtEnglish.alpha=0;
         }
        else
        {
//            txtArabic.hidden=YES;
//            txtEnglish.hidden=NO;
            txtArabic.alpha=0;
            txtEnglish.alpha=1;

  
        }

    

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void) viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBarHidden = YES;
    
    [[self navigationController] setNavigationBarHidden:NO animated:NO];
    [self.navigationItem setHidesBackButton:YES animated:NO];
    
    self.navigationController.navigationBar.backgroundColor = [UIColor blackColor];
    AppDelegate *delegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
    
    [self setTitle:delegate.stringTitle];
    
}

@end
