mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
SideMenu: use UIScreenEdgePanGestureRecognizer when available (iOS7 and +): it's better to close side menu only when starting from edges
This commit is contained in:
parent
4ddbbeb22b
commit
17696a8298
4 changed files with 36 additions and 21 deletions
|
|
@ -12,11 +12,12 @@
|
|||
<outlet property="grayBackground" destination="ccB-VK-LF9" id="Rbz-Ix-k62"/>
|
||||
<outlet property="nameLabel" destination="XbU-2B-u1b" id="rKF-4e-1HA"/>
|
||||
<outlet property="sideMenuTableViewController" destination="Yyh-z6-IGO" id="6Xq-OQ-vYm"/>
|
||||
<outlet property="swipeGestureRecognizer" destination="JRs-i1-zCl" id="YA3-UP-6Dc"/>
|
||||
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<swipeGestureRecognizer direction="left" id="JRs-i1-zCl" userLabel="OnLateralSwipe">
|
||||
<swipeGestureRecognizer enabled="NO" direction="left" id="JRs-i1-zCl" userLabel="OnLateralSwipe">
|
||||
<connections>
|
||||
<action selector="onLateralSwipe:" destination="-1" id="5td-pZ-6Vc"/>
|
||||
<outlet property="delegate" destination="-1" id="yhK-9x-aT0"/>
|
||||
|
|
|
|||
|
|
@ -498,7 +498,8 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (IBAction)onEditionChangeClick:(id)sender {
|
||||
_backButton.hidden = _callButton.hidden = _backToCallButton.hidden = _tableController.isEditing;
|
||||
_backButton.hidden = _callButton.hidden = _tableController.isEditing;
|
||||
_backToCallButton.hidden |= _tableController.isEditing;
|
||||
}
|
||||
|
||||
- (IBAction)onCallClick:(id)sender {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
@interface SideMenuView : UIViewController <ImagePickerDelegate>
|
||||
|
||||
@property(strong, nonatomic) IBOutlet UISwipeGestureRecognizer *swipeGestureRecognizer;
|
||||
@property(weak, nonatomic) IBOutlet UIRoundedImageView *avatarImage;
|
||||
@property(weak, nonatomic) IBOutlet UILabel *nameLabel;
|
||||
@property(weak, nonatomic) IBOutlet UIButton *addressButton;
|
||||
|
|
|
|||
|
|
@ -12,25 +12,17 @@
|
|||
|
||||
@implementation SideMenuView
|
||||
|
||||
- (void)updateHeader {
|
||||
LinphoneProxyConfig *default_proxy = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
|
||||
|
||||
if (default_proxy != NULL) {
|
||||
const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(default_proxy);
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
|
||||
char *as_string = linphone_address_as_string_uri_only(addr);
|
||||
[_addressButton setTitle:[NSString stringWithUTF8String:as_string] forState:UIControlStateNormal];
|
||||
ms_free(as_string);
|
||||
[_addressButton setImage:[StatusBarView imageForState:linphone_proxy_config_get_state(default_proxy)]
|
||||
forState:UIControlStateNormal];
|
||||
} else {
|
||||
_nameLabel.text = @"No account";
|
||||
[_addressButton setTitle:NSLocalizedString(@"No address", nil) forState:UIControlStateNormal];
|
||||
[_addressButton setImage:nil forState:UIControlStateNormal];
|
||||
}
|
||||
_avatarImage.image = [LinphoneUtils selfAvatar];
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
|
||||
// it's better to detect only pan from screen edges
|
||||
UIScreenEdgePanGestureRecognizer *pan =
|
||||
[[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(onLateralSwipe:)];
|
||||
pan.edges = UIRectEdgeRight;
|
||||
[self.view addGestureRecognizer:pan];
|
||||
_swipeGestureRecognizer.enabled = NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
|
|
@ -53,7 +45,27 @@
|
|||
_grayBackground.hidden = YES;
|
||||
// should be better than that with alpha animation..
|
||||
}
|
||||
- (IBAction)onLateralSwipe:(id)sender {
|
||||
|
||||
- (void)updateHeader {
|
||||
LinphoneProxyConfig *default_proxy = linphone_core_get_default_proxy_config([LinphoneManager getLc]);
|
||||
|
||||
if (default_proxy != NULL) {
|
||||
const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(default_proxy);
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
|
||||
char *as_string = linphone_address_as_string_uri_only(addr);
|
||||
[_addressButton setTitle:[NSString stringWithUTF8String:as_string] forState:UIControlStateNormal];
|
||||
ms_free(as_string);
|
||||
[_addressButton setImage:[StatusBarView imageForState:linphone_proxy_config_get_state(default_proxy)]
|
||||
forState:UIControlStateNormal];
|
||||
} else {
|
||||
_nameLabel.text = @"No account";
|
||||
[_addressButton setTitle:NSLocalizedString(@"No address", nil) forState:UIControlStateNormal];
|
||||
[_addressButton setImage:nil forState:UIControlStateNormal];
|
||||
}
|
||||
_avatarImage.image = [LinphoneUtils selfAvatar];
|
||||
}
|
||||
|
||||
- (void)onLateralSwipe:(UIScreenEdgePanGestureRecognizer *)pan {
|
||||
[PhoneMainView.instance.mainViewController hideSideMenu:YES];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue