diff --git a/diffstrings.py b/diffstrings.py index af2ab364f9..9366699e51 100755 --- a/diffstrings.py +++ b/diffstrings.py @@ -66,20 +66,21 @@ def mergeProjects(projects, sourceLocaleName, focusedLocaleName=None, verbose=Fa sourceStrings = project.condenseStringSourceFiles() for localeName, localizedStrings in project.locales.iteritems(): - if localizedStrings.name in translations: - translation = translations[localizedStrings.name] - else: - translation = Translation(localizedStrings.name) - translation.open(".", "2") - translations[localizedStrings.name] = translation + if not focusedLocaleName or focusedLocaleName == localeName: + if localizedStrings.name in translations: + translation = translations[localizedStrings.name] + else: + translation = Translation(localizedStrings.name) + translation.open(".", "2") + translations[localizedStrings.name] = translation - if translation.strings: - if verbose: - localizedStrings.mergeReport(sourceStrings, translation) + if translation.strings: + if verbose: + localizedStrings.mergeReport(sourceStrings, translation) - localizedStrings.mergeTranslation(sourceStrings, translation) - if not dryRun: - localizedStrings.save() + localizedStrings.mergeTranslation(sourceStrings, translation) + if not dryRun: + localizedStrings.save() ################################################################################################### diff --git a/src/TTGlobal.m b/src/TTGlobal.m index e1c948f101..a5ebef6751 100644 --- a/src/TTGlobal.m +++ b/src/TTGlobal.m @@ -37,6 +37,11 @@ BOOL TTIsEmptyString(id object) { return [object isKindOfClass:[NSString class]] && ![(NSString*)object length]; } +BOOL TTIsKeyboardVisible() { + UIWindow* window = [UIApplication sharedApplication].keyWindow; + return !![window performSelector:@selector(firstResponder)]; +} + UIInterfaceOrientation TTDeviceOrientation() { UIInterfaceOrientation orient = [UIDevice currentDevice].orientation; if (!orient) { diff --git a/src/TTPhotoViewController.m b/src/TTPhotoViewController.m index 6fa9be2969..7dacfccc6e 100644 --- a/src/TTPhotoViewController.m +++ b/src/TTPhotoViewController.m @@ -2,6 +2,7 @@ #import "Three20/TTURLCache.h" #import "Three20/TTURLRequest.h" #import "Three20/TTPhotoView.h" +#import "Three20/TTActivityLabel.h" #import "Three20/TTNavigator.h" /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -10,6 +11,7 @@ static const NSTimeInterval kPhotoLoadLongDelay = 0.5; static const NSTimeInterval kPhotoLoadShortDelay = 0.25; static const NSTimeInterval kSlideshowInterval = 2; +static const NSInteger kActivityLabelTag = 96; /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -523,6 +525,7 @@ - (void)model:(id)model didInsertObject:(id)object atIndexPath:(NSIndex - (void)model:(id)model didDeleteObject:(id)object atIndexPath:(NSIndexPath*)indexPath { if (object == self.centerPhoto) { + [self showActivity:nil]; [self moveToNextValidPhoto]; [_scrollView reloadData]; [self refresh]; @@ -658,4 +661,23 @@ - (TTThumbsViewController*)createThumbsViewController { - (void)didMoveToPhoto:(id)photo fromPhoto:(id)fromPhoto { } +- (void)showActivity:(NSString*)title { + if (title) { + TTActivityLabel* label = [[TTActivityLabel alloc] initWithStyle:TTActivityLabelStyleBlackBezel]; + label.tag = kActivityLabelTag; + label.text = title; + label.frame = _scrollView.frame; + [_innerView addSubview:label]; + + _scrollView.scrollEnabled = NO; + } else { + UIView* label = [_innerView viewWithTag:kActivityLabelTag]; + if (label) { + [label removeFromSuperview]; + } + + _scrollView.scrollEnabled = YES; + } +} + @end diff --git a/src/TTURLCache.m b/src/TTURLCache.m index de3ba8fba5..87d8559285 100644 --- a/src/TTURLCache.m +++ b/src/TTURLCache.m @@ -293,10 +293,10 @@ - (void)moveDataForURL:(NSString*)oldURL toURL:(NSString*)newURL { [_imageSortedList addObject:newKey]; [_imageCache setObject:image forKey:newKey]; } - NSString* oldPath = [self cachePathForURL:oldKey]; + NSString* oldPath = [self cachePathForKey:oldKey]; NSFileManager* fm = [NSFileManager defaultManager]; if ([fm fileExistsAtPath:oldPath]) { - NSString* newPath = [self cachePathForURL:newKey]; + NSString* newPath = [self cachePathForKey:newKey]; [fm moveItemAtPath:oldPath toPath:newPath error:nil]; } } diff --git a/src/Three20.bundle/de.lproj/Localizable.strings b/src/Three20.bundle/de.lproj/Localizable.strings index a032740f2c..0f5ede0b97 100644 Binary files a/src/Three20.bundle/de.lproj/Localizable.strings and b/src/Three20.bundle/de.lproj/Localizable.strings differ diff --git a/src/Three20.bundle/it.lproj/Localizable.strings b/src/Three20.bundle/it.lproj/Localizable.strings index 46b134b197..f3aea26929 100644 Binary files a/src/Three20.bundle/it.lproj/Localizable.strings and b/src/Three20.bundle/it.lproj/Localizable.strings differ diff --git a/src/Three20.bundle/ja.lproj/Localizable.strings b/src/Three20.bundle/ja.lproj/Localizable.strings index 3c7d970d2b..48de826795 100644 Binary files a/src/Three20.bundle/ja.lproj/Localizable.strings and b/src/Three20.bundle/ja.lproj/Localizable.strings differ diff --git a/src/Three20/TTGlobal.h b/src/Three20/TTGlobal.h index fe75fc40e4..46a9485a74 100644 --- a/src/Three20/TTGlobal.h +++ b/src/Three20/TTGlobal.h @@ -164,6 +164,12 @@ BOOL TTIsEmptyArray(id object); * Tests if an object is a string which is empty. */ BOOL TTIsEmptyString(id object); + +/** + * Tests if the keyboard is visible. + */ +BOOL TTIsKeyboardVisible(); + /** * Gets the current device orientation. */ diff --git a/src/Three20/TTPhotoViewController.h b/src/Three20/TTPhotoViewController.h index 1042c42ba7..2f41860402 100644 --- a/src/Three20/TTPhotoViewController.h +++ b/src/Three20/TTPhotoViewController.h @@ -77,4 +77,9 @@ */ - (void)didMoveToPhoto:(id)photo fromPhoto:(id)fromPhoto; +/** + * Shows or hides an activity label on top of the photo. + */ +- (void)showActivity:(NSString*)title; + @end