forked from mirrors/linphone-iphone
Improve rotation
This commit is contained in:
parent
af863e6e8e
commit
33edcdf265
8 changed files with 198 additions and 31 deletions
|
|
@ -41,6 +41,7 @@
|
|||
<object class="NSPSMatrix" key="NSFrameMatrix"/>
|
||||
<string key="NSFrameSize">{320, 480}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MAA</bytes>
|
||||
|
|
@ -144,7 +145,97 @@
|
|||
<nil key="sourceID"/>
|
||||
<int key="maxID">16</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes"/>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">LinphoneAppDelegate</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">window</string>
|
||||
<string key="NS.object.0">UIWindow</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<string key="NS.key.0">window</string>
|
||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||
<string key="name">window</string>
|
||||
<string key="candidateClassName">UIWindow</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/LinphoneAppDelegate.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">PhoneMainView</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">mainViewController</string>
|
||||
<string key="NS.object.0">UICompositeViewController</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<string key="NS.key.0">mainViewController</string>
|
||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||
<string key="name">mainViewController</string>
|
||||
<string key="candidateClassName">UICompositeViewController</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/PhoneMainView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">TPMultiLayoutViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="landscapeView">UIView</string>
|
||||
<string key="portraitView">UIView</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="landscapeView">
|
||||
<string key="name">landscapeView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="portraitView">
|
||||
<string key="name">portraitView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/TPMultiLayoutViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UICompositeViewController</string>
|
||||
<string key="superclassName">TPMultiLayoutViewController</string>
|
||||
<dictionary class="NSMutableDictionary" key="outlets">
|
||||
<string key="contentView">UIView</string>
|
||||
<string key="stateBarView">UIView</string>
|
||||
<string key="tabBarView">UIView</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<object class="IBToOneOutletInfo" key="contentView">
|
||||
<string key="name">contentView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="stateBarView">
|
||||
<string key="name">stateBarView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo" key="tabBarView">
|
||||
<string key="name">tabBarView</string>
|
||||
<string key="candidateClassName">UIView</string>
|
||||
</object>
|
||||
</dictionary>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/UICompositeViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ int __aeabi_idiv(int a, int b) {
|
|||
}
|
||||
|
||||
- (void)setupUI {
|
||||
|
||||
if ([[LinphoneManager instance].settingsStore boolForKey:@"enable_first_login_view_preference"] == true) {
|
||||
// Change to fist login view
|
||||
[[PhoneMainView instance] changeCurrentView: [FirstLoginViewController compositeViewDescription]];
|
||||
|
|
@ -173,7 +174,6 @@ int __aeabi_idiv(int a, int b) {
|
|||
[[PhoneMainView instance] changeCurrentView: [WizardViewController compositeViewDescription]];
|
||||
}
|
||||
}
|
||||
|
||||
[UIDevice currentDevice].batteryMonitoringEnabled = YES;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
}
|
||||
[self setString:val forKey:@"media_encryption_preference"];
|
||||
}
|
||||
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","landscape_preference", 1) forKey:@"landscape_preference"];
|
||||
[self setString: lp_config_get_string(linphone_core_get_config(lc),"app","rotation_preference", "auto") forKey:@"rotation_preference"];
|
||||
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","enable_first_login_view_preference", 0) forKey:@"enable_first_login_view_preference"];
|
||||
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","debugenable_preference", 0) forKey:@"debugenable_preference"];
|
||||
[self setBool: lp_config_get_int(linphone_core_get_config(lc),"app","check_config_disable_preference", 0) forKey:@"check_config_disable_preference"];
|
||||
|
|
@ -452,8 +452,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
BOOL firstloginview = [self boolForKey:@"enable_first_login_view_preference"];
|
||||
lp_config_set_int(linphone_core_get_config(lc),"app","enable_first_login_view_preference", firstloginview);
|
||||
|
||||
BOOL landscape = [self boolForKey:@"landscape_preference"];
|
||||
lp_config_set_int(linphone_core_get_config(lc),"app","landscape_preference", landscape);
|
||||
NSString *landscape = [self stringForKey:@"rotation_preference"];
|
||||
lp_config_set_string(linphone_core_get_config(lc),"app","rotation_preference", [landscape UTF8String]);
|
||||
|
||||
BOOL debugmode = [self boolForKey:@"debugenable_preference"];
|
||||
lp_config_set_int(linphone_core_get_config(lc),"app","debugenable_preference", debugmode);
|
||||
|
|
|
|||
|
|
@ -148,12 +148,13 @@
|
|||
[contentViewController viewWillAppear:animated];
|
||||
[tabBarViewController viewWillAppear:animated];
|
||||
[stateBarViewController viewWillAppear:animated];
|
||||
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(orientationChanged:)
|
||||
name:UIDeviceOrientationDidChangeNotification
|
||||
name:UIDeviceOrientationDidChangeNotification
|
||||
object:nil];
|
||||
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
|
||||
//currentOrientation = [UIDevice currentDevice].orientation;
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
|
|
@ -168,8 +169,8 @@
|
|||
[contentViewController viewWillDisappear:animated];
|
||||
[tabBarViewController viewWillDisappear:animated];
|
||||
[stateBarViewController viewWillDisappear:animated];
|
||||
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
|
||||
|
||||
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:UIDeviceOrientationDidChangeNotification
|
||||
object:nil];
|
||||
|
|
@ -211,15 +212,19 @@
|
|||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
if(currentViewDescription != nil && [[LinphoneManager instance].settingsStore boolForKey:@"landscape_preference"]) {
|
||||
if (UIInterfaceOrientationIsPortrait(interfaceOrientation) && [currentViewDescription portraitMode]) {
|
||||
if(currentViewDescription != nil) {
|
||||
NSString* rotationPreference = [[LinphoneManager instance].settingsStore objectForKey:@"rotation_preference"];
|
||||
if (UIInterfaceOrientationIsPortrait(interfaceOrientation) && [currentViewDescription portraitMode] &&
|
||||
([rotationPreference isEqualToString:@"auto"] || [rotationPreference isEqualToString:@"portrait"])) {
|
||||
return YES;
|
||||
}
|
||||
if (UIInterfaceOrientationIsLandscape(interfaceOrientation) && [currentViewDescription landscapeMode]) {
|
||||
if (UIInterfaceOrientationIsLandscape(interfaceOrientation) && [currentViewDescription landscapeMode] &&
|
||||
([rotationPreference isEqualToString:@"auto"] || [rotationPreference isEqualToString:@"landscape"])) {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return NO;
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -263,17 +268,63 @@
|
|||
}
|
||||
|
||||
- (UIInterfaceOrientation)getCorrectInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
if(currentViewDescription != nil && [[LinphoneManager instance].settingsStore boolForKey:@"landscape_preference"]) {
|
||||
if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
|
||||
if ([currentViewDescription portraitMode]) {
|
||||
return interfaceOrientation;
|
||||
if(currentViewDescription != nil) {
|
||||
NSString* rotationPreference = [[LinphoneManager instance].settingsStore objectForKey:@"rotation_preference"];
|
||||
if([rotationPreference isEqualToString:@"auto"]) {
|
||||
if(currentOrientation == UIDeviceOrientationUnknown) {
|
||||
return [UIApplication sharedApplication].statusBarOrientation;
|
||||
}
|
||||
if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
|
||||
if ([currentViewDescription portraitMode]) {
|
||||
return interfaceOrientation;
|
||||
} else {
|
||||
return UIInterfaceOrientationLandscapeLeft;
|
||||
}
|
||||
}
|
||||
if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
|
||||
if ([currentViewDescription landscapeMode]) {
|
||||
return interfaceOrientation;
|
||||
} else {
|
||||
return UIInterfaceOrientationPortrait;
|
||||
}
|
||||
}
|
||||
} else if([rotationPreference isEqualToString:@"portrait"]) {
|
||||
if ([currentViewDescription landscapeMode]) {
|
||||
if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
|
||||
if(currentOrientation == UIDeviceOrientationUnknown) {
|
||||
return [UIApplication sharedApplication].statusBarOrientation;
|
||||
}
|
||||
return interfaceOrientation;
|
||||
} else {
|
||||
if(UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation)) {
|
||||
if(currentOrientation == UIDeviceOrientationUnknown) {
|
||||
return [UIApplication sharedApplication].statusBarOrientation;
|
||||
}
|
||||
return [UIApplication sharedApplication].statusBarOrientation;
|
||||
} else {
|
||||
return UIInterfaceOrientationPortrait;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return UIInterfaceOrientationLandscapeLeft;
|
||||
}
|
||||
}
|
||||
if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
|
||||
} else if([rotationPreference isEqualToString:@"landscape"]) {
|
||||
if ([currentViewDescription landscapeMode]) {
|
||||
return interfaceOrientation;
|
||||
if (UIInterfaceOrientationIsLandscape(interfaceOrientation)) {
|
||||
if(currentOrientation == UIDeviceOrientationUnknown) {
|
||||
return [UIApplication sharedApplication].statusBarOrientation;
|
||||
}
|
||||
return interfaceOrientation;
|
||||
} else {
|
||||
if(UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
|
||||
if(currentOrientation == UIDeviceOrientationUnknown) {
|
||||
return [UIApplication sharedApplication].statusBarOrientation;
|
||||
}
|
||||
return [UIApplication sharedApplication].statusBarOrientation;
|
||||
} else {
|
||||
return UIInterfaceOrientationLandscapeLeft;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return UIInterfaceOrientationPortrait;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,11 +85,6 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
[super viewDidLoad];
|
||||
|
||||
[self.view addSubview: mainViewController.view];
|
||||
|
||||
if ([[UIDevice currentDevice].systemVersion doubleValue] >= 5.0) {
|
||||
UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];
|
||||
[self willRotateToInterfaceOrientation:interfaceOrientation duration:0.2f];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
|
@ -162,11 +157,14 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
return [mainViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
|
||||
if(mainViewController != nil) {
|
||||
return [mainViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
|
||||
} else {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
|
||||
|
||||
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
|
||||
[mainViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
|
||||
}
|
||||
|
|
@ -178,6 +176,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
}
|
||||
|
||||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
|
||||
NSLog(@"%d", fromInterfaceOrientation);
|
||||
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
|
||||
[mainViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@
|
|||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">216</int>
|
||||
<int key="maxID">217</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
|
|
|||
|
|
@ -16,13 +16,25 @@
|
|||
</dict>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
<string>auto</string>
|
||||
<key>Key</key>
|
||||
<string>landscape_preference</string>
|
||||
<string>rotation_preference</string>
|
||||
<key>Title</key>
|
||||
<string>Landscape</string>
|
||||
<string>Rotation</string>
|
||||
<key>Titles</key>
|
||||
<array>
|
||||
<string>Automatic</string>
|
||||
<string>Portrait</string>
|
||||
<string>Landscape</string>
|
||||
</array>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
<string>PSMultiValueSpecifier</string>
|
||||
<key>Values</key>
|
||||
<array>
|
||||
<string>auto</string>
|
||||
<string>portrait</string>
|
||||
<string>landscape</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
|
|
|
|||
|
|
@ -47,5 +47,19 @@
|
|||
</array>
|
||||
<key>UIRequiresPersistentWiFi</key>
|
||||
<true/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue