call widget delegate after 1 sec delay. this gives ui time to show points and user time to view them.

git-svn-id: https://zxing.googlecode.com/svn/trunk@1360 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dkavanagh 2010-05-13 16:05:02 +00:00
parent 8673bff046
commit e99dd51de9

View file

@ -54,6 +54,12 @@ CGImageRef UIGetScreenImage();
return self;
}
- (void)dealloc {
AudioServicesDisposeSystemSoundID(beepSound);
[overlayView dealloc];
[super dealloc];
}
- (void)cancelled {
NSLog(@"cancelled called in ZXingWidgetController");
wasCancelled = true;
@ -79,6 +85,15 @@ CGImageRef UIGetScreenImage();
return false;
}
- (void)viewDidLoad {
[super viewDidLoad];
NSBundle *mainBundle = [NSBundle mainBundle];
OSStatus error = AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"caf"] isDirectory:NO], &beepSound);
if (error != kAudioServicesNoError) {
NSLog(@"Problem loading nearSound.caf");
}
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[overlayView setPoints:nil];
@ -119,7 +134,6 @@ CGImageRef UIGetScreenImage();
NSLog(@"in presentResultForString()");
self.result = [ResultParser parsedResultForString:resultString];
AudioServicesPlaySystemSound(beepSound);
// self.actions = self.result.actions;
#ifdef DEBUG
NSLog(@"result string = %@", resultString);
NSLog(@"result has %d actions", actions ? 0 : actions.count);
@ -140,7 +154,7 @@ CGImageRef UIGetScreenImage();
NSLog(@"decoded image!!");
[self presentResultPoints:[twoDResult points] forImage:image usingSubset:subset];
// now, in a selector, call the delegate to give this overlay time to show the points
[self performSelectorOnMainThread:@selector(alertDelegate:) withObject:[[twoDResult text] copy] waitUntilDone:false];
[self performSelector:@selector(alertDelegate:) withObject:[[twoDResult text] copy] afterDelay:1.0];
decoder.delegate = nil;
[decoder release];
}