scan archive UI improvements, phase 1
[zxing.git] / iphone / Classes / DecoderViewController.m
index 02a087c..6156e5d 100644 (file)
@@ -4,7 +4,7 @@
 //
 //  Created by Christian Brunschen on 22/05/2008.
 /*
- * Copyright 2008 Google Inc.
+ * Copyright 2008 ZXing authors
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@
   
   [self.resultView addSubview:self.messageView];
   [self updateToolbar];
-  [self showMessage:@"Please take or choose a picture containing a barcode"];
+  [self showMessage:NSLocalizedString(@"Please take or choose a picture containing a barcode", @"")];
 }
 
 - (void) updateToolbar {
 
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        // Return YES for supported orientations
-       return YES;
+       return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
 }
 
 
 
 - (void)decoder:(Decoder *)decoder willDecodeImage:(UIImage *)image {
   [self.imageView setImage:image];
-  [self showMessage:[NSString stringWithFormat:@"Decoding image (%.0fx%.0f) ...", image.size.width, image.size.height]];
+  [self showMessage:[NSString stringWithFormat:NSLocalizedString(@"Decoding image (%.0fx%.0f) ...", @"shown while image is decoding"), image.size.width, image.size.height]];
 }
 
 - (void)decoder:(Decoder *)decoder 
       [actionSheet addButtonWithTitle:[action title]];
     }
     
-    int cancelIndex = [actionSheet addButtonWithTitle:@"Cancel"];
+    int cancelIndex = [actionSheet addButtonWithTitle:NSLocalizedString(@"Cancel", @"")];
     actionSheet.cancelButtonIndex = cancelIndex;
     
     actionSheet.delegate = self;
 }
 
 - (void)showScan:(Scan *)scan {
-  [[self navigationController] popToViewController:self animated:YES];
+  [self.imageView setImage:nil];
   [self presentResultForString:scan.text];
+  [[self navigationController] popToViewController:self animated:YES];
 }
 
 @end