From a616abd9b740e74eb7aea29cb692ca86ba1f7d7a Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期二, 27 八月 2024 15:24:54 +0800 Subject: [PATCH] 增加铃声功能 --- HDLLinPhoneSDK(OC)/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m | 66 +++++++++++++++++++++++++++++---- 1 files changed, 58 insertions(+), 8 deletions(-) diff --git "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m" "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m" index ef51c36..939ee47 100644 --- "a/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m" +++ "b/HDLLinPhoneSDK\357\274\210OC\357\274\211/HDLLinPhoneSDK/HDLLinphoneIntercomVC.m" @@ -27,6 +27,8 @@ @property (nonatomic, strong) UIButton *unlockImgBtn; //寮�閿� @property (nonatomic, strong) UIButton *hangUpImgBtn;//鎸傛柇鎸夐挳 @property (nonatomic, strong) UIButton *hangUpTextBtn; +@property (nonatomic, strong) UIButton *hangUpAllImgBtn;//鍏ㄩ儴鎸傛柇鎸夐挳 +@property (nonatomic, strong) UIButton *hangUpAllTextBtn; @property (nonatomic, strong) UIButton *answerImgBtn;//鎺ュ惉鎸夐挳 @property (nonatomic, strong) UIButton *answerTextBtn; @property (nonatomic, strong) UIButton *calltimeBtn; //閫氳瘽鏃堕棿鎸夐挳 @@ -51,7 +53,9 @@ NSString * answerStr; NSString * unlockSuccessfullyStr; NSString * callingStr; - NSString * hangUpStr; + NSString * hangUpStr;; + NSString * hangUpPhoneStr; + NSString * hangUpAllStr; NSString * endOfCallStr; @@ -123,6 +127,8 @@ refuseStr = @"鎷掔粷"; answerStr = @"鎺ュ惉"; hangUpStr = @"鎸傛柇"; + hangUpPhoneStr = @"鎸傛柇鎵嬫満"; + hangUpAllStr = @"鎸傛柇鍏ㄩ儴"; unlockSuccessfullyStr = @"寮�閿佹垚鍔�"; callingStr = @"鏉ョ數涓�..."; endOfCallStr = @"閫氳瘽缁撴潫"; @@ -136,6 +142,8 @@ refuseStr = @"Refuse"; answerStr = @"Answer"; hangUpStr = @"Hang up"; + hangUpPhoneStr = @"Hang up"; + hangUpAllStr = @"hang up all"; unlockSuccessfullyStr = @"Unlock successfully"; callingStr = @"Incoming call"; endOfCallStr = @"End of call"; @@ -195,6 +203,8 @@ [self.unlockView addSubview:self.unlockImgBtn]; [self.centerView addSubview:self.hangUpImgBtn]; [self.centerView addSubview:self.hangUpTextBtn]; + [self.centerView addSubview:self.hangUpAllImgBtn]; + [self.centerView addSubview:self.hangUpAllTextBtn]; [self.centerView addSubview:self.answerImgBtn]; [self.centerView addSubview:self.answerTextBtn]; [self.centerView addSubview:self.calltimeBtn]; @@ -330,10 +340,10 @@ if (_hangUpImgBtn == nil) { _hangUpImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, Height66, Height66)]; [_hangUpImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_hangup"] forState:UIControlStateNormal]; - // [_hangUpImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_hangup"] forState:UIControlStateSelected]; [_hangUpImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; [_hangUpImgBtn addTarget:self action:@selector(hangUpAction) forControlEvents:UIControlEventTouchUpInside]; - _hangUpImgBtn.center = CGPointMake(APP_SCREEN_WIDTH/4, GetRealHeight(452) + Height66/2); + + _hangUpImgBtn.center = CGPointMake(APP_SCREEN_WIDTH/2, GetRealHeight(452) + Height66/2); } return _hangUpImgBtn; } @@ -353,11 +363,34 @@ //2.椤甸潰鍏抽棴 [self backAction]; } + +//鍏ㄩ儴鎸傛柇 鍥炬爣鎸夐挳 +- (UIButton *)hangUpAllImgBtn{ + if (_hangUpAllImgBtn == nil) { + _hangUpAllImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, Height66, Height66)]; + [_hangUpAllImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_hangup_all"] forState:UIControlStateNormal]; + [_hangUpAllImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; + [_hangUpAllImgBtn addTarget:self action:@selector(hangUpAllAction) forControlEvents:UIControlEventTouchUpInside]; + + _hangUpAllImgBtn.center = CGPointMake(GetRealWidth(77.5), GetRealHeight(452) + Height66/2); + } + return _hangUpAllImgBtn; +} + +//鍏ㄩ儴鎸傛柇鎸夐挳浜嬩欢 +-(void)hangUpAllAction{ + //1.鍥炶皟浜嬩欢 + if(self.hdlLinphoneCallDelegate != NULL){ + [self.hdlLinphoneCallDelegate onRejectAllCallAction]; + } + //2.椤甸潰鍏抽棴 + [self backAction]; +} //鎷掓帴 鏂囨湰鎸夐挳 - (UIButton *)hangUpTextBtn{ if (_hangUpTextBtn == nil) { _hangUpTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, GetRealWidth(100), GetRealWidth(20))]; - [_hangUpTextBtn setTitle:@"鎷掔粷" forState:UIControlStateNormal]; + [_hangUpTextBtn setTitle:hangUpPhoneStr forState:UIControlStateNormal]; _hangUpTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; _hangUpTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:14.0]; [_hangUpTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; @@ -368,17 +401,31 @@ } return _hangUpTextBtn; } +//鍏ㄩ儴鎸傛柇 鏂囨湰鎸夐挳 +- (UIButton *)hangUpAllTextBtn{ + if (_hangUpAllTextBtn == nil) { + _hangUpAllTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, GetRealWidth(100), GetRealWidth(20))]; + [_hangUpAllTextBtn setTitle:hangUpAllStr forState:UIControlStateNormal]; + _hangUpAllTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; + _hangUpAllTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:14.0]; + [_hangUpAllTextBtn setTitleColor:TextColor forState:UIControlStateNormal]; + [_hangUpAllTextBtn setTitleColor:TextSelectColor forState:UIControlStateSelected]; + [_hangUpAllTextBtn addTarget:self action:@selector(screenshotAction) forControlEvents:UIControlEventTouchUpInside]; + _hangUpAllTextBtn.center = CGPointMake(_hangUpAllImgBtn.center.x, GetRealHeight(530)); + + } + return _hangUpAllTextBtn; +} //鎺ュ惉 鍥炬爣鎸夐挳 - (UIButton *)answerImgBtn{ if (_answerImgBtn == nil) { _answerImgBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, Height66, Height66)]; [_answerImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_answer"] forState:UIControlStateNormal]; - // [_answerImgBtn setImage:[UIImage imageNamed:@"ic_esvideo_on_answer"] forState:UIControlStateSelected]; [_answerImgBtn.imageView setContentMode:UIViewContentModeScaleAspectFit]; [_answerImgBtn addTarget:self action:@selector(answerIAction) forControlEvents:UIControlEventTouchUpInside]; - _answerImgBtn.center = CGPointMake((APP_SCREEN_WIDTH/4)*3, GetRealHeight(452) + Height66/2); + _answerImgBtn.center = CGPointMake(APP_SCREEN_WIDTH-GetRealWidth(77.5), GetRealHeight(452) + Height66/2); } return _answerImgBtn; } @@ -401,6 +448,8 @@ _answerImgBtn.hidden = YES; _answerTextBtn.hidden = YES; + _hangUpAllImgBtn.hidden = YES; + _hangUpAllTextBtn.hidden = YES; //鎸傛柇鎸夐挳绉诲姩涓棿 _hangUpImgBtn.center = CGPointMake(APP_CONTENT_WIDTH / 2, _hangUpImgBtn.center.y); @@ -437,7 +486,7 @@ - (UIButton *)answerTextBtn{ if (_answerTextBtn == nil) { _answerTextBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, GetRealWidth(100), GetRealWidth(20))]; - [_answerTextBtn setTitle:@"鎺ュ惉" forState:UIControlStateNormal]; + [_answerTextBtn setTitle:answerStr forState:UIControlStateNormal]; _answerTextBtn.titleLabel.font = [UIFont fontWithName:APP_UIFont size:14.0]; _answerTextBtn.titleLabel.textAlignment = NSTextAlignmentCenter; // _unlockTextBtn.titleLabel.textColor = TextColor; @@ -618,7 +667,8 @@ //鍒濆鍖栧弬鏁� -(void)initData{ // _titleUILabel.text = [[LCApiKit sharedInstance] currentDeviceName]; - [_hangUpTextBtn setTitle:refuseStr forState:UIControlStateNormal]; + [_hangUpTextBtn setTitle:hangUpPhoneStr forState:UIControlStateNormal]; + [_hangUpAllTextBtn setTitle:hangUpAllStr forState:UIControlStateNormal]; [_answerTextBtn setTitle:answerStr forState:UIControlStateNormal]; } -- Gitblit v1.8.0