diff --git a/Classes/ChatRoomViewController.m b/Classes/ChatRoomViewController.m index 5531f3bef..7b00889bc 100644 --- a/Classes/ChatRoomViewController.m +++ b/Classes/ChatRoomViewController.m @@ -57,9 +57,9 @@ self->imageSharing = NULL; self->listTapGestureRecognizer = [[UITapGestureRecognizer alloc] init]; self->imageQualities = [[OrderedDictionary alloc] initWithObjectsAndKeys: - [NSNumber numberWithFloat:0.9], NSLocalizedString(@"Minimum", nil), + [NSNumber numberWithFloat:0.9], NSLocalizedString(@"Maximum", nil), [NSNumber numberWithFloat:0.5], NSLocalizedString(@"Average", nil), - [NSNumber numberWithFloat:0.0], NSLocalizedString(@"Maximum", nil), nil]; + [NSNumber numberWithFloat:0.0], NSLocalizedString(@"Minimum", nil), nil]; } return self; } @@ -364,7 +364,7 @@ static void message_status(LinphoneChatMessage* msg,LinphoneChatMessageState sta - (void)chooseImageQuality:(UIImage*)image url:(NSURL*)url { [waitView setHidden:FALSE]; - DTActionSheet *sheet = [[DTActionSheet alloc] initWithTitle:NSLocalizedString(@"Choose the compression", nil)]; + DTActionSheet *sheet = [[DTActionSheet alloc] initWithTitle:NSLocalizedString(@"Choose the image size", nil)]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ //UIImage *image = [original_image normalizedImage]; for(NSString *key in [imageQualities allKeys]) { diff --git a/Classes/ImageViewController.h b/Classes/ImageViewController.h index 7befe1552..2b349bf55 100644 --- a/Classes/ImageViewController.h +++ b/Classes/ImageViewController.h @@ -21,10 +21,11 @@ #import "UICompositeViewController.h" -@interface ImageViewController : UIViewController { +@interface ImageViewController : UIViewController { } +@property (nonatomic, retain) IBOutlet UIScrollView *scrollView; @property (nonatomic, retain) IBOutlet UIImageView *imageView; @property (nonatomic, retain) UIImage *image; @property (nonatomic, retain) IBOutlet UIButton *backButton; diff --git a/Classes/ImageViewController.m b/Classes/ImageViewController.m index 225ca9a4f..e4f4af103 100644 --- a/Classes/ImageViewController.m +++ b/Classes/ImageViewController.m @@ -26,11 +26,28 @@ @implementation ImageViewController +@synthesize scrollView; @synthesize imageView; @synthesize backButton; @synthesize image; +#pragma mark - Lifecycle Functions + +- (id)init { + return [super initWithNibName:@"ImageViewController" bundle:[NSBundle mainBundle]]; +} + +- (void)dealloc { + [scrollView release]; + [imageView release]; + [backButton release]; + [image release]; + + [super dealloc]; +} + + #pragma mark - UICompositeViewDelegate Functions static UICompositeViewDescription *compositeDescription = nil; @@ -51,10 +68,23 @@ static UICompositeViewDescription *compositeDescription = nil; } +#pragma mark - ViewController Functions + +- (void)viewDidLoad { + [super viewDidLoad]; + + [scrollView setDelegate:self]; +} + + #pragma mark - Property Functions - (void)setImage:(UIImage *)aimage { imageView.image = aimage; + imageView.frame = CGRectMake(0, 0, aimage.size.width, aimage.size.height); + scrollView.contentSize = aimage.size; + [scrollView zoomToRect:imageView.bounds animated:FALSE]; + scrollView.minimumZoomScale = scrollView.zoomScale; } - (UIImage *)image { @@ -70,4 +100,11 @@ static UICompositeViewDescription *compositeDescription = nil; } } + +#pragma mark - UIScrollViewDelegate Functions + +- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { + return self.imageView; +} + @end diff --git a/Classes/LinphoneUI/UIChatRoomCell.m b/Classes/LinphoneUI/UIChatRoomCell.m index 341a8f0d0..791a4c2c6 100644 --- a/Classes/LinphoneUI/UIChatRoomCell.m +++ b/Classes/LinphoneUI/UIChatRoomCell.m @@ -277,9 +277,11 @@ static UIFont *CELL_FONT = nil; } - (IBAction)onImageClick:(id)event { - ImageViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ImageViewController compositeViewDescription] push:TRUE], ImageViewController); - if(controller != nil) { - [controller setImage:messageImageView.image]; + if(![messageImageView isLoading]) { + ImageViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[ImageViewController compositeViewDescription] push:TRUE], ImageViewController); + if(controller != nil) { + [controller setImage:messageImageView.image]; + } } } diff --git a/Classes/LinphoneUI/UILoadingImageView.h b/Classes/LinphoneUI/UILoadingImageView.h index 621be1c63..a27c7462d 100644 --- a/Classes/LinphoneUI/UILoadingImageView.h +++ b/Classes/LinphoneUI/UILoadingImageView.h @@ -23,6 +23,7 @@ - (void)startLoading; +- (BOOL)isLoading; - (void)stopLoading; @property (nonatomic, readonly) IBOutlet UIActivityIndicatorView *waitIndicatorView; diff --git a/Classes/LinphoneUI/UILoadingImageView.m b/Classes/LinphoneUI/UILoadingImageView.m index 3fd253dd0..ceaaa06e5 100644 --- a/Classes/LinphoneUI/UILoadingImageView.m +++ b/Classes/LinphoneUI/UILoadingImageView.m @@ -93,5 +93,8 @@ [waitIndicatorView stopAnimating]; } +- (BOOL)isLoading { + return [waitIndicatorView isAnimating]; +} @end diff --git a/Classes/en.lproj/ImageViewController.xib b/Classes/en.lproj/ImageViewController.xib index 2deb24b23..cbe23f899 100644 --- a/Classes/en.lproj/ImageViewController.xib +++ b/Classes/en.lproj/ImageViewController.xib @@ -14,6 +14,7 @@ IBProxyObject IBUIButton IBUIImageView + IBUIScrollView IBUIView @@ -36,20 +37,6 @@ 274 - - - 274 - {{0, 44}, {320, 416}} - - _NS:9 - - 3 - MCAwAA - - 1 - NO - IBCocoaTouchFramework - 290 @@ -59,6 +46,7 @@ 290 {320, 44} + _NS:9 NO @@ -73,7 +61,8 @@ 292 {160, 44} - + + _NS:9 NO @@ -122,14 +111,51 @@ {320, 44} + _NS:9 - + + 3 + MCAwAA + IBCocoaTouchFramework + + + 274 + + + + 274 + {320, 416} + + + _NS:9 + + 4 + NO + IBCocoaTouchFramework + + + {{0, 44}, {320, 416}} + + + + _NS:9 + + 3 + MAA + + YES + YES + IBCocoaTouchFramework + 0.0 + 10 + {{0, 20}, {320, 460}} + @@ -146,6 +172,14 @@ 3 + + + backButton + + + + 8 + imageView @@ -156,11 +190,11 @@ - backButton + scrollView - + - 8 + 13 @@ -184,8 +218,8 @@ 1 - + @@ -200,12 +234,6 @@ - - 4 - - - imageView - 11 @@ -228,6 +256,21 @@ background + + 12 + + + + + + scrollView + + + 4 + + + imageView + @@ -237,6 +280,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -247,9 +291,50 @@ - 11 + 13 + + + + + ImageViewController + UIViewController + + onBackClick: + id + + + onBackClick: + + onBackClick: + id + + + + UIButton + UIImageView + UIScrollView + + + + backButton + UIButton + + + imageView + UIImageView + + + scrollView + UIScrollView + + + + IBProjectSource + ./Classes/ImageViewController.h + + + - 0 IBCocoaTouchFramework YES diff --git a/Classes/fr.lproj/ImageViewController.xib b/Classes/fr.lproj/ImageViewController.xib index 33dc45d1c..b3439c30a 100644 --- a/Classes/fr.lproj/ImageViewController.xib +++ b/Classes/fr.lproj/ImageViewController.xib @@ -1,20 +1,21 @@ - 1280 + 1536 11E53 - 1938 + 2840 1138.47 569.00 com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 933 + 1926 + IBProxyObject IBUIButton IBUIImageView + IBUIScrollView IBUIView - IBProxyObject com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -33,23 +34,9 @@ IBCocoaTouchFramework - + 274 - - - 274 - {{0, 44}, {320, 416}} - - _NS:9 - - 3 - MCAwAA - - 1 - NO - IBCocoaTouchFramework - 290 @@ -73,7 +60,7 @@ 292 {160, 44} - + _NS:9 NO @@ -124,11 +111,45 @@ _NS:9 - + + 3 + MCAwAA + IBCocoaTouchFramework + + + 274 + + + + 274 + {320, 416} + + _NS:9 + + 4 + NO + IBCocoaTouchFramework + + + {{0, 44}, {320, 416}} + + + _NS:9 + + 3 + MAA + + YES + YES + IBCocoaTouchFramework + 0.0 + 10 + {{0, 20}, {320, 460}} + @@ -145,6 +166,14 @@ 3 + + + backButton + + + + 8 + imageView @@ -155,11 +184,11 @@ - backButton + scrollView - + - 8 + 13 @@ -183,8 +212,8 @@ 1 - + @@ -199,12 +228,6 @@ - - 4 - - - imageView - 11 @@ -227,6 +250,21 @@ background + + 12 + + + + + + scrollView + + + 4 + + + imageView + @@ -236,6 +274,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -246,7 +285,7 @@ - 11 + 13 0 @@ -258,6 +297,6 @@ {320, 88} {5, 88} - 933 + 1926 diff --git a/linphone.ldb/Contents.plist b/linphone.ldb/Contents.plist index 4c2ec79ab..c6ef74949 100644 --- a/linphone.ldb/Contents.plist +++ b/linphone.ldb/Contents.plist @@ -5062,17 +5062,17 @@ backup - 9 + 10 class BLWrapperHandle name - Classes/ImageViewController/9/ImageViewController.xib + Classes/ImageViewController/10/ImageViewController.xib change date - 2012-09-25T09:16:20Z + 2012-09-25T15:43:59Z changed values class @@ -5082,7 +5082,7 @@ flags 0 hash - e7fb7fceec086e05fc06199fa2fc727e + a6f92c4f1f39135867bae2c55aab1d43 name ImageViewController.xib @@ -5146,9 +5146,9 @@ versions en - 9 + 10 fr - 9 + 10 diff --git a/linphone.ldb/Resources/Classes/ImageViewController/9/ImageViewController.xib b/linphone.ldb/Resources/Classes/ImageViewController/10/ImageViewController.xib similarity index 74% rename from linphone.ldb/Resources/Classes/ImageViewController/9/ImageViewController.xib rename to linphone.ldb/Resources/Classes/ImageViewController/10/ImageViewController.xib index 2deb24b23..cbe23f899 100644 --- a/linphone.ldb/Resources/Classes/ImageViewController/9/ImageViewController.xib +++ b/linphone.ldb/Resources/Classes/ImageViewController/10/ImageViewController.xib @@ -14,6 +14,7 @@ IBProxyObject IBUIButton IBUIImageView + IBUIScrollView IBUIView @@ -36,20 +37,6 @@ 274 - - - 274 - {{0, 44}, {320, 416}} - - _NS:9 - - 3 - MCAwAA - - 1 - NO - IBCocoaTouchFramework - 290 @@ -59,6 +46,7 @@ 290 {320, 44} + _NS:9 NO @@ -73,7 +61,8 @@ 292 {160, 44} - + + _NS:9 NO @@ -122,14 +111,51 @@ {320, 44} + _NS:9 - + + 3 + MCAwAA + IBCocoaTouchFramework + + + 274 + + + + 274 + {320, 416} + + + _NS:9 + + 4 + NO + IBCocoaTouchFramework + + + {{0, 44}, {320, 416}} + + + + _NS:9 + + 3 + MAA + + YES + YES + IBCocoaTouchFramework + 0.0 + 10 + {{0, 20}, {320, 460}} + @@ -146,6 +172,14 @@ 3 + + + backButton + + + + 8 + imageView @@ -156,11 +190,11 @@ - backButton + scrollView - + - 8 + 13 @@ -184,8 +218,8 @@ 1 - + @@ -200,12 +234,6 @@ - - 4 - - - imageView - 11 @@ -228,6 +256,21 @@ background + + 12 + + + + + + scrollView + + + 4 + + + imageView + @@ -237,6 +280,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin @@ -247,9 +291,50 @@ - 11 + 13 + + + + + ImageViewController + UIViewController + + onBackClick: + id + + + onBackClick: + + onBackClick: + id + + + + UIButton + UIImageView + UIScrollView + + + + backButton + UIButton + + + imageView + UIImageView + + + scrollView + UIScrollView + + + + IBProjectSource + ./Classes/ImageViewController.h + + + - 0 IBCocoaTouchFramework YES