forked from mirrors/linphone-iphone
Handle Arabic buttons and transitions
This commit is contained in:
parent
fe46e8f45b
commit
4bb359cb7b
4 changed files with 43 additions and 4 deletions
|
|
@ -143,7 +143,7 @@ typedef struct _LinphoneManagerSounds {
|
|||
- (void)acceptCallForCallId:(NSString*)callid;
|
||||
- (void)cancelLocalNotifTimerForCallId:(NSString*)callid;
|
||||
|
||||
|
||||
+ (BOOL)langageDirectionIsRTL;
|
||||
+ (void)kickOffNetworkConnection;
|
||||
- (void)setupNetworkReachabilityCallback;
|
||||
|
||||
|
|
|
|||
|
|
@ -245,6 +245,15 @@ struct codec_name_pref_table codec_pref_table[]={
|
|||
}
|
||||
#endif
|
||||
|
||||
+ (BOOL)langageDirectionIsRTL {
|
||||
static NSLocaleLanguageDirection dir = NSLocaleLanguageDirectionLeftToRight;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
dir = [NSLocale characterDirectionForLanguage:[[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]];
|
||||
});
|
||||
return dir == NSLocaleLanguageDirectionRightToLeft;
|
||||
}
|
||||
|
||||
#pragma mark - Lifecycle Functions
|
||||
|
||||
- (id)init {
|
||||
|
|
|
|||
|
|
@ -102,6 +102,22 @@ static NSString * const kDisappearAnimation = @"disappear";
|
|||
object:nil];
|
||||
}
|
||||
|
||||
- (void)flipImageForButton:(UIButton*)button {
|
||||
UIControlState states[] = { UIControlStateNormal, UIControlStateDisabled, UIControlStateSelected, UIControlStateHighlighted, -1 };
|
||||
UIControlState *state = states;
|
||||
|
||||
while (*state != -1) {
|
||||
UIImage* bgImage = [button backgroundImageForState:*state];
|
||||
|
||||
UIImage* flippedImage = [UIImage imageWithCGImage:bgImage.CGImage
|
||||
scale:bgImage.scale
|
||||
orientation:UIImageOrientationUpMirrored];
|
||||
[button setBackgroundImage:flippedImage forState:*state];
|
||||
state++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(applicationWillEnterForeground:)
|
||||
|
|
@ -175,6 +191,14 @@ static NSString * const kDisappearAnimation = @"disappear";
|
|||
[LinphoneUtils buttonFixStatesForTabs:chatButton];
|
||||
[LinphoneUtils buttonFixStatesForTabs:chatButtonLandscape];
|
||||
}
|
||||
if ([LinphoneManager langageDirectionIsRTL]){
|
||||
[self flipImageForButton:historyButton];
|
||||
[self flipImageForButton:settingsButton];
|
||||
[self flipImageForButton:dialerButton];
|
||||
[self flipImageForButton:chatButton];
|
||||
[self flipImageForButton:contactsButton];
|
||||
}
|
||||
|
||||
|
||||
[super viewDidLoad]; // Have to be after due to TPMultiLayoutViewController
|
||||
}
|
||||
|
|
@ -201,6 +225,8 @@ static NSString * const kDisappearAnimation = @"disappear";
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma mark - Event Functions
|
||||
|
||||
- (void)applicationWillEnterForeground:(NSNotification*)notif {
|
||||
|
|
|
|||
|
|
@ -462,21 +462,25 @@ static RootViewManager* rootViewManagerInstance = nil;
|
|||
}
|
||||
|
||||
+ (CATransition*)getBackwardTransition {
|
||||
BOOL RTL = [LinphoneManager langageDirectionIsRTL];
|
||||
NSString* transition = RTL? kCATransitionFromRight : kCATransitionFromLeft;
|
||||
CATransition* trans = [CATransition animation];
|
||||
[trans setType:kCATransitionPush];
|
||||
[trans setDuration:0.35];
|
||||
[trans setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
|
||||
[trans setSubtype:kCATransitionFromLeft];
|
||||
[trans setSubtype:transition];
|
||||
|
||||
return trans;
|
||||
}
|
||||
|
||||
+ (CATransition*)getForwardTransition {
|
||||
BOOL RTL = [LinphoneManager langageDirectionIsRTL];
|
||||
NSString* transition = RTL? kCATransitionFromLeft : kCATransitionFromRight;
|
||||
CATransition* trans = [CATransition animation];
|
||||
[trans setType:kCATransitionPush];
|
||||
[trans setDuration:0.35];
|
||||
[trans setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
|
||||
[trans setSubtype:kCATransitionFromRight];
|
||||
[trans setSubtype:transition];
|
||||
|
||||
return trans;
|
||||
}
|
||||
|
|
@ -507,7 +511,7 @@ static RootViewManager* rootViewManagerInstance = nil;
|
|||
left = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(left) {
|
||||
return [PhoneMainView getBackwardTransition];
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue