Skip to content

Commit

Permalink
Final version number 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shannoga committed Feb 2, 2013
1 parent 5bdd097 commit e32492c
Show file tree
Hide file tree
Showing 152 changed files with 3,653 additions and 1,808 deletions.
3 changes: 1 addition & 2 deletions Files/AlbumViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ - (void)didReceiveMemoryWarning

- (IBAction)refresh:(id)sender
{
NSLog(@"Showing Refresh HUD");
refreshHUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:refreshHUD];

Expand Down Expand Up @@ -162,7 +161,7 @@ - (IBAction)cameraButtonTapped:(id)sender
else{
// Device has no camera

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your device has no camera" delegate:self cancelButtonTitle:@"O.K" otherButtonTitles:nil, nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your device has no camera" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil];
[alert show];
}
}
Expand Down
3 changes: 1 addition & 2 deletions Files/Animal.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#import "Animal.h"
#import "Exhibit.h"
#import "JerusalemBiblicalZooAppDelegate.h"

@implementation Animal

Expand Down Expand Up @@ -56,7 +55,7 @@ +(BOOL)updateFromParseAnimalObject:(PFObject*)animal inContext:(NSManagedObjectC
if ([availableKeys containsObject:key]) {
[animalEntity setValue:animal[key] forKey:key];
}
if ([Helper isEnglish]) {
if (![Helper isRightToLeft]) {
animalEntity.nameEn = animal[@"name"];
}
animalEntity.createdAt = animal.createdAt;
Expand Down
9 changes: 4 additions & 5 deletions Files/AnimalAddPostView.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ -(void)notifEditingEnd{
-(void)sendPost{
if (![self verifyPost]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Post Attantion", nil)
message:NSLocalizedString(@"Post Missing Data Massege", nill) delegate:self cancelButtonTitle:NSLocalizedString(@"O.K", nil) otherButtonTitles:nil];
message:NSLocalizedString(@"Post Missing Data Massege", nill) delegate:self cancelButtonTitle:NSLocalizedString(@"Dismiss", nil) otherButtonTitles:nil];
[alert show];
return;
}
Expand All @@ -117,18 +117,17 @@ -(void)sendPost{
NSString * userNameAndCity = [NSString stringWithFormat:@"%@, %@",self.userName.text,self.cityField.text];
userPost[@"user"] = userNameAndCity;
userPost[@"animal_id"] = self.animal.objectId;
userPost[@"visible"] = @YES;
userPost[@"visible"] = @NO;

[userPost saveInBackground];
//[userPost saveEventually];
[userPost saveEventually];

[self.postView resignFirstResponder];
[self.cityField resignFirstResponder];
[self.userName resignFirstResponder];
[self notifEditingEnd];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Post Tanks", nil)
message:NSLocalizedString(@"Post Suscess Massege", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"O.K", nil) otherButtonTitles:nil];
message:NSLocalizedString(@"Post Suscess Massege", nil) delegate:self cancelButtonTitle:NSLocalizedString(@"Dismiss", nil) otherButtonTitles:nil];
[alert show];

}
Expand Down
47 changes: 32 additions & 15 deletions Files/AnimalAudioGuideView.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ @implementation AnimalAudioGuideView

-(void)initializePlayer{
NSString *fileName = [NSString stringWithFormat:@"%@_%@",animal.nameEn,[Helper isRightToLeft]?@"he":@"en"];
NSLog(@"file name = %@",fileName);
fileName = [[fileName stringByReplacingOccurrencesOfString:@" " withString:@"_"] lowercaseString];
NSString *path = [[NSBundle mainBundle] pathForResource:fileName ofType:@"m4a"];//[path stringByAppendingPathComponent:@"lion.m4a"];

if([[NSFileManager defaultManager] fileExistsAtPath:path]){
NSLog(@"path = %@",path);
NSURL *fileUrl = [NSURL fileURLWithPath:path];

NSError *error;
Expand All @@ -39,11 +37,8 @@ -(void)initializePlayer{
} else {

//Make sure the system follows our playback status
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[AVAudioSession sharedInstance] setActive: YES error: nil];
[[AVAudioSession sharedInstance] setDelegate:self];

//Load the audio into memory
[self.player prepareToPlay];
label.text = @"Ready";
}
}else{
Expand All @@ -62,47 +57,58 @@ - (id)initWithFrame:(CGRect)frame withAniaml:(Animal*)anAnimal

UIButton *btn = [[UIButton alloc] init];
[btn setFrame:CGRectMake(self.bounds.size.width/2-70, 30, 140, 140)];
btn.backgroundColor = UIColorFromRGB(0x5E939D);
btn.backgroundColor = UIColorFromRGB(0xC95000);
btn.layer.cornerRadius = btn.bounds.size.width/2;
btn.tag =kPlay;
[btn addTarget:self action:@selector(btnPressed:) forControlEvents:UIControlEventTouchUpInside];
self.playButton = btn;
[self addSubview:self.playButton];

UIImageView *playImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"play.png"]];
playImage.frame = CGRectMake(35, 30, 80, 80);
[self.playButton addSubview:playImage];

btn = [[UIButton alloc] init];
[btn setFrame:CGRectMake(15, 70, 60, 60)];
btn.backgroundColor = UIColorFromRGB(0x3B2F24);
btn.layer.cornerRadius = btn.bounds.size.width/2;
btn.layer.cornerRadius = btn.bounds.size.width/2;
btn.tag =kStop;
[btn addTarget:self action:@selector(btnPressed:) forControlEvents:UIControlEventTouchUpInside];

[self addSubview:btn];

playImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"stop.png"]];
playImage.frame = CGRectMake(15, 15, 30, 30);
[btn addSubview:playImage];

btn = [[UIButton alloc] init];
[btn setFrame:CGRectMake(245, 70, 60, 60)];
btn.backgroundColor = UIColorFromRGB(0x3B2F24);
btn.layer.cornerRadius = btn.bounds.size.width/2;
btn.backgroundColor = UIColorFromRGB(0x3B2F24);
btn.layer.cornerRadius = btn.bounds.size.width/2;
btn.tag =kPause;
[btn addTarget:self action:@selector(btnPressed:) forControlEvents:UIControlEventTouchUpInside];

[self addSubview:btn];

playImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"pouse.png"]];
playImage.frame = CGRectMake(15, 15, 30, 30);
[btn addSubview:playImage];

self.progressSlider = [[UISlider alloc] initWithFrame:CGRectMake(40, 180, 240, 40)];
self.progressSlider.maximumValue =1;
self.progressSlider.minimumValue =0;
self.progressSlider.value = 0;
self.progressSlider.thumbTintColor = UIColorFromRGB(0x48382E);
self.progressSlider.minimumTrackTintColor = UIColorFromRGB(0x5E939D);
self.progressSlider.minimumTrackTintColor = UIColorFromRGB(0xC95000);
self.progressSlider.maximumTrackTintColor = UIColorFromRGB(0x3B2F24);
[self.progressSlider addTarget:self action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];
[self addSubview: self.progressSlider];

label = [[UILabel alloc] initWithFrame:CGRectMake(150, 0, 100, 50)];
label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 25)];
label.font = [UIFont fontWithName:@"Futura" size:14];
label.textAlignment = UITextAlignmentCenter;
label.textColor = UIColorFromRGB(0x3B2F24);
label.backgroundColor = [UIColor clearColor];
[self addSubview:label];
[self initializePlayer];


}
return self;
Expand All @@ -120,8 +126,17 @@ -(void)togglePlayPause{
}
}
-(void)play{
if (self.player==nil) {
[self initializePlayer];
}
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[AVAudioSession sharedInstance] setActive: YES error: nil];
[[AVAudioSession sharedInstance] setDelegate:self];
[self.player prepareToPlay];

[self.player play];
self.player.delegate = self;

label.text = @"Playing";
[self.playButton.layer addAnimation:[Animations pulseAnimation:1.05] forKey:@"pulse"];
sliderTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateSlider) userInfo:nil repeats:YES];
Expand All @@ -147,6 +162,8 @@ -(void)pause{
label.text = @"Paused";
}
-(void)stop{
[[AVAudioSession sharedInstance] setActive: NO error: nil];
[[AVAudioSession sharedInstance] setDelegate:nil];
[self.player stop];
[self.player setCurrentTime:0];
[self.playButton.layer removeAllAnimations];
Expand Down
2 changes: 1 addition & 1 deletion Files/AnimalDataScrollView.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@property (nonatomic, weak) Animal *animal;
@property (nonatomic, strong) AnimalAudioGuideView *audioGuide;
@property (nonatomic, retain) AnimalPostView *postView;
- (id)initWithFrame:(CGRect)frame withAnimal:(Animal*)anAnimal;
- (id)initWithFrame:(CGRect)frame withAnimal:(Animal*)anAnimal withParentController:(AnimalViewController *)animalController;
-(void)play;
-(void)pause;
-(void)stop;
Expand Down
18 changes: 13 additions & 5 deletions Files/AnimalDataScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,20 @@
#import "AnimalViewController.h"
#import "AnimalQuestionsTableView.h"
#import "Exhibit.h"
#import "AnimalSpecificQuestionsTableView.h"

@implementation AnimalDataScrollView
@synthesize animal;
@synthesize audioGuide;
@synthesize parentController;
@synthesize postView;

- (id)initWithFrame:(CGRect)frame withAnimal:(Animal*)anAnimal
- (id)initWithFrame:(CGRect)frame withAnimal:(Animal*)anAnimal withParentController:(AnimalViewController *)animalController
{
self = [super initWithFrame:frame];
if (self) {

self.parentController = animalController;


self.contentSize =CGSizeMake(320*6, IS_IPHONE_5? 240 : 226);
Expand Down Expand Up @@ -53,14 +56,19 @@ - (id)initWithFrame:(CGRect)frame withAnimal:(Animal*)anAnimal
[self addSubview:descriptionView];




//future feature
/*****************************************/
/*Zoo Description view*/
/*AnimalSpecificQuestionsTableView view*/
/*****************************************/

AnimalDescriptionWebView *zooDescriptionView = [[AnimalDescriptionWebView alloc] initWithFrame:CGRectMake(640, 0, 320, self.contentSize.height) withAnimal:anAnimal];
[self addSubview:zooDescriptionView];

// AnimalDescriptionWebView *zooDescriptionView = [[AnimalDescriptionWebView alloc] initWithFrame:CGRectMake(640, 0, 320, self.contentSize.height) withAnimal:anAnimal];
// [self addSubview:zooDescriptionView];
AnimalSpecificQuestionsTableView *animalQuestionsView = [[AnimalSpecificQuestionsTableView alloc] initWithFrame:CGRectMake(640, 0, 320, self.contentSize.height) withAnimal:anAnimal withParentController:self.parentController];

[self addSubview:animalQuestionsView];


/*****************************************/
/* map view*/
Expand Down
24 changes: 21 additions & 3 deletions Files/AnimalDataTableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,35 @@ - (void)drawRect:(CGRect)rect
#pragma mark - Table view data source

-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

NSString *key = tableViewdata[indexPath.row][0];
if (indexPath.row==1 && [animal.verse length]>0) {

NSString *str = animal.verse;
CGSize size = [str sizeWithFont:[UIFont fontWithName:@"Futura" size:18] constrainedToSize:CGSizeMake(300, 999) lineBreakMode:UILineBreakModeWordWrap];
NSLog(@"%f",size.height);
return size.height + 60;
return size.height + 40;

// return 120;
}else if ([animal.diet length]>0 && [key isEqualToString:NSLocalizedString(@"Diet",nil)]){

NSString *str = animal.diet;
CGSize size = [str sizeWithFont:[UIFont fontWithName:@"Futura" size:18] constrainedToSize:CGSizeMake(300, 999) lineBreakMode:UILineBreakModeWordWrap];
NSLog(@"%f",size.height);
return size.height + 40;
}else if ([animal.socialStructure length]>0 && [key isEqualToString:NSLocalizedString(@"Social Structure",nil)]){

NSString *str = animal.socialStructure;
CGSize size = [str sizeWithFont:[UIFont fontWithName:@"Futura" size:18] constrainedToSize:CGSizeMake(300, 999) lineBreakMode:UILineBreakModeWordWrap];
NSLog(@"%f",size.height);
return size.height + 40;
}else if ([animal.habitat length]>0 && [key isEqualToString:NSLocalizedString(@"Habitat",nil)]){

NSString *str = animal.habitat;
CGSize size = [str sizeWithFont:[UIFont fontWithName:@"Futura" size:18] constrainedToSize:CGSizeMake(300, 999) lineBreakMode:UILineBreakModeWordWrap];
NSLog(@"%f",size.height);
return size.height + 40;
}
return 60;
return 70;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
Expand Down
1 change: 0 additions & 1 deletion Files/AnimalDataTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ - (void)drawRect:(CGRect)rect

- (void)layoutSubviews {
[super layoutSubviews];

if ([[Helper currentLang] isEqualToString:@"en"]) {
self.labelView.frame = CGRectMake(10,6,CGRectGetWidth(self.frame)-10,CGRectGetHeight(self.frame)/4);
self.detailLableView.frame = CGRectMake(10,CGRectGetMaxY(self.labelView.frame),CGRectGetWidth(self.frame)-10,CGRectGetHeight(self.labelView.frame)*3);;
Expand Down
14 changes: 6 additions & 8 deletions Files/AnimalPostView.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
//

#import "AnimalPostView.h"
#import "Animal.h"
#import "AnimalUserPostsViewer.h"
#import <QuartzCore/QuartzCore.h>
#import "AnimalAddPostView.h"


@implementation AnimalPostView
@synthesize viewPosts;
Expand All @@ -37,7 +35,7 @@ - (id)initWithFrame:(CGRect)frame withAnimal:(Animal*)anAnimal


buttonsBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
buttonsBackgroundView.backgroundColor = UIColorFromRGB(0x3B2F24);
buttonsBackgroundView.backgroundColor = UIColorFromRGB(0xC95000);
[self addSubview:buttonsBackgroundView];


Expand Down Expand Up @@ -87,7 +85,7 @@ - (id)initWithFrame:(CGRect)frame withAnimal:(Animal*)anAnimal
postExplainLabel.backgroundColor = [UIColor clearColor];
postExplainLabel.textColor = UIColorFromRGB(0x281502);
postExplainLabel.editable = NO;
if(![Helper isRightToLeft]) {
if([Helper isRightToLeft]) {
postExplainLabel.font = [UIFont fontWithName:@"ArialHebrew" size:14];
}else{
postExplainLabel.font = [UIFont fontWithName:@"Futura" size:14];
Expand Down Expand Up @@ -158,7 +156,7 @@ -(void)getPosts:(BOOL)fromButton{
initWithTitle:NSLocalizedString(@"No Posts For Animal",nil)
message:NSLocalizedString(@"Be the first to add an interesting fact, joke, song. any thing that might interest other visitors.",nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"okay",nil)
cancelButtonTitle:NSLocalizedString(@"Dismiss",nil)
otherButtonTitles:nil];
[alert show];
}
Expand All @@ -177,9 +175,9 @@ -(void)getPosts:(BOOL)fromButton{

UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"No Internet Connection",nil)
message:NSLocalizedString(@"If you don't have intenrt services you can find an Internet acsses in the enternce to the zoo",nil)
message:NSLocalizedString(@"No Internet alert body",nil)
delegate:nil
cancelButtonTitle:NSLocalizedString(@"okay",nil)
cancelButtonTitle:NSLocalizedString(@"Dismiss",nil)
otherButtonTitles:nil];
[alert show];
}
Expand Down
21 changes: 13 additions & 8 deletions Files/AnimalQuestionAnswerViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,26 @@ - (void)viewDidLoad
{
[super viewDidLoad];
NSString *directionalString;
NSString *quest = self.questionObject[@"question"];
if(quest != nil){
NSString *key = [Helper isRightToLeft]? @"question":@"question_en";
NSString *quest = self.questionObject[key];
if(quest != nil && [Helper isRightToLeft]){
directionalString = [@"\u200F" stringByAppendingString:quest];
}else{
}else if([Helper isRightToLeft]){
directionalString=@"";
}else{
directionalString=quest;
}

[self.questionLabel setText:directionalString];


NSString *answer = self.questionObject[@"answer"];
if(answer != nil){
key = [Helper isRightToLeft]? @"answer":@"answer_en";
NSString *answer = self.questionObject[key];
if(answer != nil && [Helper isRightToLeft]){
directionalString = [@"\u200F" stringByAppendingString:answer];
}else{
}else if([Helper isRightToLeft]){
directionalString=@"";
}else{
directionalString=quest;
}
self.answerTextView.text = directionalString;
// Do any additional setup after loading the view from its nib.
Expand Down
Loading

0 comments on commit e32492c

Please sign in to comment.