Commit 1eb0470e by ludi

完成新版本ui调整

parent 74f7e096
Showing with 255 additions and 244 deletions
...@@ -501,7 +501,7 @@ ...@@ -501,7 +501,7 @@
"$(PROJECT_DIR)/FuSiLive/Classes/FUSModules/FUSLiveModule/NewLive/Main/View/StreamView/Beauty/ByteDanceBeauty", "$(PROJECT_DIR)/FuSiLive/Classes/FUSModules/FUSLiveModule/NewLive/Main/View/StreamView/Beauty/ByteDanceBeauty",
); );
LOCALIZATION_PREFERS_STRING_CATALOGS = NO; LOCALIZATION_PREFERS_STRING_CATALOGS = NO;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.1;
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"$(inherited)", "$(inherited)",
"-isystem", "-isystem",
...@@ -769,7 +769,7 @@ ...@@ -769,7 +769,7 @@
"$(PROJECT_DIR)/FuSiLive/Classes/FUSModules/FUSLiveModule/NewLive/Main/View/StreamView/Beauty/ByteDanceBeauty", "$(PROJECT_DIR)/FuSiLive/Classes/FUSModules/FUSLiveModule/NewLive/Main/View/StreamView/Beauty/ByteDanceBeauty",
); );
LOCALIZATION_PREFERS_STRING_CATALOGS = NO; LOCALIZATION_PREFERS_STRING_CATALOGS = NO;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.1;
OTHER_CFLAGS = ( OTHER_CFLAGS = (
"$(inherited)", "$(inherited)",
"-isystem", "-isystem",
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
<key>FUSChatCenterBundle.xcscheme_^#shared#^_</key> <key>FUSChatCenterBundle.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>75</integer> <integer>76</integer>
</dict> </dict>
<key>FUSChatCenterModule.xcscheme_^#shared#^_</key> <key>FUSChatCenterModule.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>72</integer> <integer>71</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "live_chat_icon_gift_type2@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "live_chat_icon_gift_type2@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "live_head_follow_tick_btn@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "live_head_follow_tick_btn@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#import "FUSAgoraHelper.h" #import "FUSAgoraHelper.h"
#import "FUSLiveStreamView.h" #import "FUSLiveStreamView.h"
#import "FUSRoomQuickChatListModel.h" #import "FUSRoomQuickChatListModel.h"
#import "FUSBaoFangAnchorModel.h"
typedef enum : NSInteger { typedef enum : NSInteger {
defaultRoom = 0 defaultRoom = 0
......
...@@ -364,12 +364,14 @@ ...@@ -364,12 +364,14 @@
case FUSLiveBottomToolTypeGift: case FUSLiveBottomToolTypeGift:
{ {
if (isSelect){ if (isSelect){
image = [UIImage fus_liveGiftImage_normal]; // image = [UIImage fus_liveGiftImage_normal];
image = [FUSShowRoomCenterBunble imageNamed:@"live_chat_icon_gift_type2"];
[self.giftBtn setImage:image forState:UIControlStateHighlighted]; [self.giftBtn setImage:image forState:UIControlStateHighlighted];
} }
else else
{ {
image = [UIImage fus_liveGiftImage_normal]; // image = [UIImage fus_liveGiftImage_normal];
image = [FUSShowRoomCenterBunble imageNamed:@"live_chat_icon_gift_type2"];
[self.giftBtn setImage:image forState:UIControlStateNormal]; [self.giftBtn setImage:image forState:UIControlStateNormal];
btn = self.giftBtn; btn = self.giftBtn;
......
...@@ -605,7 +605,7 @@ UIGestureRecognizerDelegate ...@@ -605,7 +605,7 @@ UIGestureRecognizerDelegate
_headView.delegate = self; _headView.delegate = self;
[[self fus_viewWithLayer:FUSLiveFunctionLayerRoomInfos] addSubview:_headView]; [[self fus_viewWithLayer:FUSLiveFunctionLayerRoomInfos] addSubview:_headView];
self.popularView = [[FUSPopularProgressView alloc] initWithFrame:CGRectMake(12, self.headView.bottom, 48, 48)]; self.popularView = [[FUSPopularProgressView alloc] initWithFrame:CGRectMake(12, self.headView.bottom, 60, 60)];
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
self.popularView.tapPopularViewHandler = ^{ self.popularView.tapPopularViewHandler = ^{
[weakSelf fus_headViewClickHeatPower]; [weakSelf fus_headViewClickHeatPower];
......
...@@ -160,6 +160,9 @@ typedef NS_ENUM(NSInteger, FUSLiveHeadViewType) { ...@@ -160,6 +160,9 @@ typedef NS_ENUM(NSInteger, FUSLiveHeadViewType) {
*/ */
- (void)fus_setupLiked:(BOOL)liked; - (void)fus_setupLiked:(BOOL)liked;
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用,这个会弹出关注成功的toast,与fus_setupLiked的区别就是,fus_setupLiked仅仅作为更新其状态
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
/** /**
清除 HeadView 的数据 清除 HeadView 的数据
*/ */
...@@ -204,7 +207,5 @@ typedef NS_ENUM(NSInteger, FUSLiveHeadViewType) { ...@@ -204,7 +207,5 @@ typedef NS_ENUM(NSInteger, FUSLiveHeadViewType) {
- (void)fus_updateUserListModel:(id)userListModel; - (void)fus_updateUserListModel:(id)userListModel;
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
@end @end
...@@ -605,11 +605,7 @@ NSString * const kDidHotScoreChangeNotification = @"kDidHotScoreChangeNotificati ...@@ -605,11 +605,7 @@ NSString * const kDidHotScoreChangeNotification = @"kDidHotScoreChangeNotificati
*/ */
- (void)fus_setupLiked:(BOOL)liked - (void)fus_setupLiked:(BOOL)liked
{ {
if (!liked) { [_portraitView fus_setLike:liked];
[_portraitView fus_showLikeButtonWithAnimation:YES];
} else {
[_portraitView fus_dismissLikeButtonWithAnimation:YES];
}
} }
- (void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow{ - (void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow{
......
...@@ -52,19 +52,13 @@ ...@@ -52,19 +52,13 @@
@property (nonatomic, copy) void(^clickPortraitViewHandler)(void); @property (nonatomic, copy) void(^clickPortraitViewHandler)(void);
#pragma mark - Method #pragma mark - Method
/**
显示追踪按钮
@param animate 是否动画显示
*/
- (void)fus_showLikeButtonWithAnimation:(BOOL)animate;
/** /// 设置是否关注
隐藏追踪按钮 /// @param isLike 是否关注
-(void)fus_setLike:(BOOL)isLike;
@param animate 是否动画显示 /// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用,说白了,就是会显示动画,比如多一个toast提示
*/ -(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
- (void)fus_dismissLikeButtonWithAnimation:(BOOL)animate;
/** /**
根据 model 设置 PortraitView 根据 model 设置 PortraitView
...@@ -81,9 +75,6 @@ ...@@ -81,9 +75,6 @@
*/ */
- (void)fus_onClickLikeButton:(UIButton *)sender; - (void)fus_onClickLikeButton:(UIButton *)sender;
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow;
- (void)fus_anchorOffline:(BOOL)offline; - (void)fus_anchorOffline:(BOOL)offline;
......
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
#import "FUSLiveHelper.h" #import "FUSLiveHelper.h"
#import "CBAutoScrollLabel.h" #import "CBAutoScrollLabel.h"
#import "FUSRadarAnimImageViewView.h" #import "FUSRadarAnimImageViewView.h"
#import <SJAttributesFactory/SJAttributesFactory.h>
#define LIKE_BTN_MARGIN 9 #define LIKE_BTN_MARGIN 4
#define MAX_NICKNAME_WIDTH 90 #define MAX_NICKNAME_WIDTH 90
@interface FUSLivePortraitView () @interface FUSLivePortraitView ()
...@@ -42,10 +43,8 @@ ...@@ -42,10 +43,8 @@
//@property (nonatomic, strong) UILabel *nicknameLabel; //@property (nonatomic, strong) UILabel *nicknameLabel;
@property (nonatomic, strong) CBAutoScrollLabel *autoScrollNicknameLabel; @property (nonatomic, strong) CBAutoScrollLabel *autoScrollNicknameLabel;
/** /// 信息label
围观人数 Lable @property (nonatomic, strong) CBAutoScrollLabel *autoScrollMsgLabel;
*/
@property (nonatomic, strong) UIButton *audienceBtn;
/** /**
“围观”Label “围观”Label
...@@ -79,7 +78,7 @@ ...@@ -79,7 +78,7 @@
if (self) { if (self) {
// 初始化参数 // 初始化参数
minXDistance = 6; minXDistance = 0;
toleranceSpace = 4; toleranceSpace = 4;
bgXPosition = 0; bgXPosition = 0;
rightSpace = 8; rightSpace = 8;
...@@ -102,11 +101,13 @@ ...@@ -102,11 +101,13 @@
[self initBgView]; [self initBgView];
[self initFaceImageView]; [self initFaceImageView];
[self initNicknameLabel]; [self initNicknameLabel];
[self initAudienceLabel]; [self initAutoScrollMsgLabel];
[self initLikeBtn];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_focusStateDidChangedNotification:) name:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_focusStateDidChangedNotification:) name:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:nil];
[self addSubview:_grayView]; [self addSubview:_grayView];
[self updateFrameWithAnimate:NO];
} }
/** /**
...@@ -185,17 +186,37 @@ ...@@ -185,17 +186,37 @@
/** /**
搭建围观人数 Label 搭建围观人数 Label
*/ */
- (void)initAudienceLabel - (void)initAutoScrollMsgLabel
{ {
self.audienceBtn = [UIButton buttonWithType:UIButtonTypeCustom]; self.autoScrollMsgLabel = [[CBAutoScrollLabel alloc]initWithFrame:CGRectMake(_autoScrollNicknameLabel.x, CGRectGetMaxY(_autoScrollNicknameLabel.frame) + 0, 50, 13)];
_audienceBtn.frame = CGRectMake(_autoScrollNicknameLabel.x, CGRectGetMaxY(_autoScrollNicknameLabel.frame) + 0, 50, 13); _autoScrollMsgLabel.font = [UIFont fus_themeFont:11];
_audienceBtn.titleLabel.numberOfLines = 1; _autoScrollMsgLabel.textColor = [UIColor whiteColor];
_audienceBtn.titleLabel.font = [UIFont fus_themeFont:9]; _autoScrollMsgLabel.labelSpacing = 20;
_audienceBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 2, 0, 0); _autoScrollMsgLabel.pauseInterval = 5;
_audienceBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; _autoScrollMsgLabel.scrollSpeed = 15;
[_audienceBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; _autoScrollMsgLabel.fadeLength = 12;
[_audienceBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_head_audience_icon"] forState:UIControlStateNormal]; _autoScrollMsgLabel.scrollDirection = CBAutoScrollDirectionLeft;
[self addSubview:_audienceBtn]; [self addSubview:_autoScrollMsgLabel];
}
-(void)initLikeBtn{
// 已经添加,不需要在加载
if (!self.likeBtn.superview) {
self.likeBtn = [FUSStyleButton buttonWithType:UIButtonTypeCustom];
_likeBtn.titleLabel.font = [UIFont fus_themeFont:12];
[_likeBtn addTarget:self action:@selector(fus_onClickLikeButton:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_likeBtn];
}
[_likeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_head_follow_btn"] forState:UIControlStateNormal];
[_likeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_head_follow_tick_btn"] forState:UIControlStateSelected];
_likeBtn.hidden = NO;
CGRect frame = CGRectMake(CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_wordLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(_wordLabel.frame) + LIKE_BTN_MARGIN, 5, self.height - 10, self.height - 10);
_likeBtn.frame = frame;
_likeBtn.centerY = self.bgView.centerY;
} }
#pragma mark - Setter #pragma mark - Setter
...@@ -227,18 +248,19 @@ ...@@ -227,18 +248,19 @@
*/ */
- (void)setAudience:(NSString *)audience - (void)setAudience:(NSString *)audience
{ {
// ludy:新版本不显示这个了
// 赋值实例变量 // 赋值实例变量
_audience = audience; // _audience = audience;
//
// 赋值文字内容 // // 赋值文字内容
[_audienceBtn setTitle:audience forState:UIControlStateNormal]; // [_audienceBtn setTitle:audience forState:UIControlStateNormal];
//
// 更新 Frame // // 更新 Frame
[_audienceBtn sizeToFit]; // [_audienceBtn sizeToFit];
_audienceBtn.height = 13; // _audienceBtn.height = 13;
_audienceBtn.width += 5; // _audienceBtn.width += 5;
//
[self updateFrameWithAnimate:YES]; // [self updateFrameWithAnimate:YES];
} }
...@@ -252,103 +274,13 @@ ...@@ -252,103 +274,13 @@
if (roomId.integerValue != _currentModel.roomId.integerValue) { if (roomId.integerValue != _currentModel.roomId.integerValue) {
return; return;
} }
if (like) { [self fus_setLike:like];
[self fus_dismissLikeButtonWithAnimation:YES];
} else {
[self fus_showLikeButtonWithAnimation:YES];
}
} }
#pragma mark - Method #pragma mark - Method
/** - (void)fus_setLike:(BOOL)isLike{
显示追踪按钮
@param animate 是否动画显示
*/
- (void)fus_showLikeButtonWithAnimation:(BOOL)animate
{
// 已经添加,不需要在加载
if (!self.likeBtn.superview) {
self.likeBtn = [FUSStyleButton buttonWithType:UIButtonTypeCustom];
_likeBtn.titleLabel.font = [UIFont fus_themeFont:12];
[_likeBtn addTarget:self action:@selector(fus_onClickLikeButton:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_likeBtn];
}
[_likeBtn addTarget:self action:@selector(fus_onClickLikeButton:) forControlEvents:UIControlEventTouchUpInside];
[_likeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_head_follow_btn"] forState:UIControlStateNormal];
_likeBtn.hidden = NO; _likeBtn.hidden = NO;
_likeBtn.selected = isLike;
CGRect frame = CGRectMake(CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_wordLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(_wordLabel.frame) + LIKE_BTN_MARGIN, 5, self.height - 10, self.height - 10);
_likeBtn.frame = frame;
_likeBtn.centerY = self.bgView.centerY;
[self updateFrameWithAnimate:NO];
}
/**
隐藏追踪按钮
@param animate 是否动画显示
*/
- (void)fus_dismissLikeButtonWithAnimation:(BOOL)animate
{
if (!self.likeBtn.superview) {
self.likeBtn = [FUSStyleButton buttonWithType:UIButtonTypeCustom];
_likeBtn.titleLabel.font = [UIFont fus_themeFont:12];
[self addSubview:_likeBtn];
}
[_likeBtn removeTarget:self action:@selector(fus_onClickLikeButton:) forControlEvents:UIControlEventTouchUpInside];
_likeBtn.hidden = YES;
// // 没有追踪按钮
// if (!self.likeBtn || !self.likeBtn.superview) return;
//
// if (animate) {
//
//// CGFloat targetWidth = CGRectGetMaxX(_nicknameLabel.frame) > CGRectGetMaxX(_audienceLabel.frame) ? CGRectGetMaxX(_nicknameLabel.frame) + 8 : CGRectGetMaxX(_audienceLabel.frame) + rightSpace;
//
// // 获取最大 X 值
// CGFloat maxX = CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_wordLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) : CGRectGetMaxX(_wordLabel.frame);
//
// CGFloat targetWidth = (maxX + rightSpace + 5) > 80 ? (maxX + rightSpace + 5) : 80;//targetWidth > 80 ? targetWidth : 80;
//
// if (self.frameDidChange) {
// self.frameDidChange(self.x + targetWidth);
// }
//
// [UIView animateWithDuration:.35 animations:^{
//
// _likeBtn.width = 0;
// _likeBtn.x -= 0;
// self.width = targetWidth;
// self.bgView.width = self.width - bgXPosition;
// _bgImageView.frame = _bgView.frame;
//
// } completion:^(BOOL finished) {
//
// [_likeBtn removeFromSuperview];
// self.likeBtn = nil;
// [self updateFrameWithAnimate:YES];
//
// }];
//
// }else{
//
// [_likeBtn removeFromSuperview];
// self.likeBtn = nil;
//
CGRect frame = CGRectMake(CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_wordLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(_wordLabel.frame) + LIKE_BTN_MARGIN, 5, self.height - 10, self.height - 10);
_likeBtn.frame = frame;
_likeBtn.centerY = self.bgView.centerY;
[self updateFrameWithAnimate:NO];
//
// }
} }
/** /**
...@@ -370,45 +302,82 @@ ...@@ -370,45 +302,82 @@
// 设置头像 // 设置头像
[_faceImageView.imageView setLiveFaceWebImageWithSubURLString:model.face placeholder:nil]; [_faceImageView.imageView setLiveFaceWebImageWithSubURLString:model.face placeholder:nil];
// // 赋值文字内容
// _autoScrollNicknameLabel.text = model.nickName;
// // 更新 Frame
// [_autoScrollNicknameLabel sizeToFit];
// _autoScrollNicknameLabel.height = 13;
//
// // 如果超过最大长度,
// if (_autoScrollNicknameLabel.width > MAX_NICKNAME_WIDTH) {
// _autoScrollNicknameLabel.width = MAX_NICKNAME_WIDTH;
// }
// if (![NSDictionary isNull:model.popular[@"score"]]) {
// // 赋值文字内容
// [_audienceBtn setTitle:model.popular[@"score"] forState:UIControlStateNormal];
// } else {
//
// // 赋值文字内容
// [_audienceBtn setTitle:0 forState:UIControlStateNormal];
// }
NSString *ageStr = @"0";
NSString *addrStr = @"";
if ([model.roomId isEqualToString:[FUSCacheDataShare shareStore].userDetailInfo.roomId]) {
ageStr = [FUSCacheDataShare shareStore].userDetailInfo.age;
addrStr = [FUSCacheDataShare shareStore].userDetailInfo.addr;
}else {
for (FUSBaoFangAnchorModel *tempModel in [FUSLiveHelper shareInstance].rooms) {
if ([model.roomId isEqualToString:tempModel.roomId]) {
ageStr = tempModel.age;
addrStr = tempModel.addr;
break;
}
}
}
_autoScrollMsgLabel.attributedText = [NSAttributedString sj_UIKitText:^(id<SJUIKitTextMakerProtocol> _Nonnull make) {
make.appendImage(^(id<SJUTImageAttachment> _Nonnull make) {
make.image = [UIImage fus_boyIcon];
make.alignment = SJUTVerticalAlignmentCenter;
make.bounds = CGRectMake(0, 0, 10, 10);
});
make.append(@" ");
make.append(ageStr).textColor([UIColor colorWithHex:@"#76C4FF"]);
make.append(@" ");
make.append(addrStr).textColor([UIColor colorWithHex:@"#BBBAB8"]);
make.font([UIFont fus_themeFont:10]);
}];
// 更新 Frame
[_autoScrollMsgLabel sizeToFit];
_autoScrollMsgLabel.height = 13;
// 赋值文字内容 // 赋值文字内容
_autoScrollNicknameLabel.text = model.nickName; _autoScrollNicknameLabel.text = model.nickName;
// 更新 Frame // 更新 Frame
[_autoScrollNicknameLabel sizeToFit]; [_autoScrollNicknameLabel sizeToFit];
_autoScrollNicknameLabel.height = 13; _autoScrollNicknameLabel.height = 13;
NSLog(@"_autoScrollNicknameLabel.width :%f _autoScrollMsgLabel.width: %f",_autoScrollNicknameLabel.width, _autoScrollMsgLabel.width);
// 如果超过最大长度, // 如果超过最大长度,
if (_autoScrollNicknameLabel.width > MAX_NICKNAME_WIDTH) { if (MAX(_autoScrollNicknameLabel.width, _autoScrollMsgLabel.width) > MAX_NICKNAME_WIDTH) {
_autoScrollNicknameLabel.width = MAX_NICKNAME_WIDTH; _autoScrollNicknameLabel.width = MAX_NICKNAME_WIDTH;
_autoScrollMsgLabel.width = MAX_NICKNAME_WIDTH;
}else if (_autoScrollNicknameLabel.width < _autoScrollMsgLabel.width) {
_autoScrollNicknameLabel.width = _autoScrollMsgLabel.width;
} }
if (![NSDictionary isNull:model.popular[@"score"]]) {
// 赋值文字内容
[_audienceBtn setTitle:model.popular[@"score"] forState:UIControlStateNormal];
} else {
// 赋值文字内容
[_audienceBtn setTitle:0 forState:UIControlStateNormal];
}
// 更新 Frame
[_audienceBtn sizeToFit];
_audienceBtn.height = 13;
_audienceBtn.width += 5;
// 更新 View // 更新 View
[self updateFrameWithAnimate:animate]; [self updateFrameWithAnimate:animate];
// [self fus_showLikeButtonWithAnimation:animate];
if (![model.roomId isEqualToString:[[FUSCacheDataShare shareStore]userDetailInfo].uid] && // if (![model.roomId isEqualToString:[[FUSCacheDataShare shareStore]userDetailInfo].uid] &&
model.liked && // model.liked &&
![model.liked boolValue]) { // ![model.liked boolValue]) {
// 未追踪 // // 未追踪
[self fus_showLikeButtonWithAnimation:animate]; // [self fus_setLike:NO];
// 自动消失 // }
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(30.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self fus_setLike:[model.liked boolValue]];
// [self fus_dismissLikeButtonWithAnimation:YES];
// });
}
// // 设置富豪等级 头像边框 // // 设置富豪等级 头像边框
// if (model.level.integerValue == 0) { // if (model.level.integerValue == 0) {
...@@ -547,12 +516,17 @@ ...@@ -547,12 +516,17 @@
[_autoScrollNicknameLabel sizeToFit]; [_autoScrollNicknameLabel sizeToFit];
// 赋值实例变量 // 赋值实例变量
_audience = @""; // _audience = @"";
[_audienceBtn setTitle:_audience forState:UIControlStateNormal]; // [_audienceBtn setTitle:_audience forState:UIControlStateNormal];
[_audienceBtn sizeToFit]; // [_audienceBtn sizeToFit];
_audienceBtn.width += 5; // _audienceBtn.width += 5;
_autoScrollMsgLabel.attributedText = [NSAttributedString sj_UIKitText:^(id<SJUIKitTextMakerProtocol> _Nonnull make) {
make.append(@"");
}];
[_autoScrollMsgLabel sizeToFit];
// _autoScrollMsgLabel.width += 5;
[self fus_dismissLikeButtonWithAnimation:NO]; _likeBtn.hidden = YES;
_autoScrollNicknameLabel.textColor = [UIColor whiteColor]; _autoScrollNicknameLabel.textColor = [UIColor whiteColor];
_faceImageView.imageView.image = UIImage.fus_defaultIcon; _faceImageView.imageView.image = UIImage.fus_defaultIcon;
...@@ -636,7 +610,7 @@ ...@@ -636,7 +610,7 @@
- (void)updateFrameWithAnimate:(BOOL)animate - (void)updateFrameWithAnimate:(BOOL)animate
{ {
// 获取最大 X 值 // 获取最大 X 值
CGFloat maxX = CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_audienceBtn.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) : CGRectGetMaxX(_audienceBtn.frame); CGFloat maxX = CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_autoScrollMsgLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) : CGRectGetMaxX(_autoScrollMsgLabel.frame);
[self.layer removeAllAnimations]; [self.layer removeAllAnimations];
...@@ -652,7 +626,7 @@ ...@@ -652,7 +626,7 @@
if (animate) { if (animate) {
[UIView animateWithDuration:.35 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{ [UIView animateWithDuration:.35 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
self.likeBtn.x = CGRectGetMaxX(self.autoScrollNicknameLabel.frame) > CGRectGetMaxX(self.audienceBtn.frame) ? CGRectGetMaxX(self.autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(self.audienceBtn.frame) + LIKE_BTN_MARGIN; self.likeBtn.x = CGRectGetMaxX(self.autoScrollNicknameLabel.frame) > CGRectGetMaxX(self.autoScrollMsgLabel.frame) ? CGRectGetMaxX(self.autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(self.autoScrollMsgLabel.frame) + LIKE_BTN_MARGIN;
self.width = (maxX + self->rightSpace + 5) > 80 ? (maxX + self->rightSpace + 5) : 80; self.width = (maxX + self->rightSpace + 5) > 80 ? (maxX + self->rightSpace + 5) : 80;
self.bgView.width = self.width - self->bgXPosition; self.bgView.width = self.width - self->bgXPosition;
// self.bgImageView.frame = self.bgView.frame; // self.bgImageView.frame = self.bgView.frame;
...@@ -661,7 +635,7 @@ ...@@ -661,7 +635,7 @@
}]; }];
}else{ }else{
_likeBtn.x = CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_audienceBtn.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(_audienceBtn.frame) + LIKE_BTN_MARGIN; _likeBtn.x = CGRectGetMaxX(_autoScrollNicknameLabel.frame) > CGRectGetMaxX(_autoScrollMsgLabel.frame) ? CGRectGetMaxX(_autoScrollNicknameLabel.frame) + LIKE_BTN_MARGIN : CGRectGetMaxX(_autoScrollMsgLabel.frame) + LIKE_BTN_MARGIN;
self.width = (maxX + rightSpace + 5) > 80 ? (maxX + rightSpace + 5) : 80; self.width = (maxX + rightSpace + 5) > 80 ? (maxX + rightSpace + 5) : 80;
self.bgView.width = self.width - bgXPosition; self.bgView.width = self.width - bgXPosition;
// _bgImageView.frame = _bgView.frame; // _bgImageView.frame = _bgView.frame;
...@@ -727,101 +701,102 @@ ...@@ -727,101 +701,102 @@
[activityView startAnimating]; [activityView startAnimating];
[sender addSubview:activityView]; [sender addSubview:activityView];
MJWeakSelf
if (sender.isSelected) {
// 取消追踪
[FUSLiveHttpHelper fus_unlikeRoomWithRoomId:_currentModel.roomId success:^{
sender.enabled = YES;
[activityView stopAnimating];
[weakSelf fus_showClickLikeAnimateWithIsFollow:NO];
} failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg];
[activityView stopAnimating];
sender.enabled = YES;
}];
}else {
[FUSTalkingData fus_trackEvent:FUSLiveEventTrackParams.fus_EVENT_ROOM_FOLLOW label:@"" parameters:nil]; [FUSTalkingData fus_trackEvent:FUSLiveEventTrackParams.fus_EVENT_ROOM_FOLLOW label:@"" parameters:nil];
// 请求追踪 // 请求追踪
[FUSLiveHttpHelper fus_likeRoomWithRoomId:_currentModel.roomId success:^{ [FUSLiveHttpHelper fus_likeRoomWithRoomId:_currentModel.roomId success:^{
// 设置图片动画 // 设置图片动画
CGFloat framePerSecond = 12.0; // CGFloat framePerSecond = 12.0;
NSMutableArray *imageArr = [NSMutableArray array]; // NSMutableArray *imageArr = [NSMutableArray array];
for (int i = 0; i <= 5; i++) { // for (int i = 0; i <= 5; i++) {
UIImage *image = [FUSShowRoomCenterBunble imageNamed:[NSString stringWithFormat:@"live_head_follow_btn_anim_%d", i]]; // UIImage *image = [FUSShowRoomCenterBunble imageNamed:[NSString stringWithFormat:@"live_head_follow_btn_anim_%d", i]];
if (image) { // if (image) {
[imageArr addObject:image]; // [imageArr addObject:image];
} // }
} // }
//
CGFloat duration = imageArr.count / framePerSecond; // CGFloat duration = imageArr.count / framePerSecond;
self.likeBtn.imageView.animationImages = imageArr; // self.likeBtn.imageView.animationImages = imageArr;
self.likeBtn.imageView.animationDuration = duration; // self.likeBtn.imageView.animationDuration = duration;
self.likeBtn.imageView.animationRepeatCount = 1; // self.likeBtn.imageView.animationRepeatCount = 1;
[self.likeBtn.imageView startAnimating]; // [self.likeBtn.imageView startAnimating];
//
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.likeBtn.imageView stopAnimating]; // [self.likeBtn.imageView stopAnimating];
//
[activityView stopAnimating]; // [activityView stopAnimating];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"追踪成功"]]; // [FUSDialogView fus_showDialog:[NSString fus_localString:@"追踪成功"]];
[[FUSLiveHelper shareInstance]roomInfoModel].liked = @"1"; // [[FUSLiveHelper shareInstance]roomInfoModel].liked = @"1";
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:@{@"roomId":self.currentModel.roomId,@"like":@(YES)}]; // [[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:@{@"roomId":self.currentModel.roomId,@"like":@(YES)}];
[self fus_dismissLikeButtonWithAnimation:YES]; // [self fus_dismissLikeButtonWithAnimation:YES];
//
// sender.enabled = YES;
//
// if (self.clickLikeHandler) {
// self.clickLikeHandler();
// }
// });
sender.enabled = YES; sender.enabled = YES;
[activityView stopAnimating];
[weakSelf fus_showClickLikeAnimateWithIsFollow:YES];
if (self.clickLikeHandler) { if (self.clickLikeHandler) {
self.clickLikeHandler(); self.clickLikeHandler();
} }
});
} failure:^(NSString *msg, int code) { } failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg]; [FUSDialogView fus_showDialog:msg];
[activityView stopAnimating];
sender.enabled = YES; sender.enabled = YES;
if (code == -11022) { if (code == -11022) {
// 已经追踪了 // 已经追踪了
[self fus_dismissLikeButtonWithAnimation:YES]; [weakSelf fus_setLike:YES];
if (self.clickLikeHandler) { if (self.clickLikeHandler) {
self.clickLikeHandler(); self.clickLikeHandler();
} }
}else{ }else{
[activityView stopAnimating];
[sender setTitle:[NSString fus_localString:@"追踪"] forState:UIControlStateNormal]; [sender setTitle:[NSString fus_localString:@"追踪"] forState:UIControlStateNormal];
} }
}]; }];
}
} }
/// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用 /// 显示点击关注的动画,给外面某些比如一个接口就是送礼并且自动关注的动作调用
-(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow{ -(void)fus_showClickLikeAnimateWithIsFollow:(BOOL)isFollow{
if (isFollow) { self.likeBtn.hidden = NO;
self.likeBtn.selected = isFollow;
// 设置图片动画 if (isFollow == YES) {
CGFloat framePerSecond = 12.0; // [self.likeBtn setImage:[FUSShowRoomCenterBunble imageNamed:@"live_head_follow_tick_btn"] forState:UIControlStateNormal];
NSMutableArray *imageArr = [NSMutableArray array];
for (int i = 0; i <= 5; i++) {
UIImage *image = [FUSShowRoomCenterBunble imageNamed:[NSString stringWithFormat:@"live_head_follow_btn_anim_%d", i]];
if (image) {
[imageArr addObject:image];
}
}
CGFloat duration = imageArr.count / framePerSecond;
self.likeBtn.imageView.animationImages = imageArr;
self.likeBtn.imageView.animationDuration = duration;
self.likeBtn.imageView.animationRepeatCount = 1;
[self.likeBtn.imageView startAnimating];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.likeBtn.imageView stopAnimating];
[FUSDialogView fus_showDialog:[NSString fus_localString:@"追踪成功"]]; [FUSDialogView fus_showDialog:[NSString fus_localString:@"追踪成功"]];
[[FUSLiveHelper shareInstance]roomInfoModel].liked = @"1"; [[FUSLiveHelper shareInstance]roomInfoModel].liked = @"1";
[[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:@{@"roomId":self.currentModel.roomId,@"like":@(YES)}]; [[NSNotificationCenter defaultCenter] postNotificationName:FUSLiveNotificationKeys.fus_FocusBaoFang_Refresh object:@{@"roomId":self.currentModel.roomId,@"like":@(YES)}];
[self fus_dismissLikeButtonWithAnimation:YES];
self.likeBtn.enabled = YES;
});
}else {
// ludy:这个居然是取消,我也不知道前面的人怎么写的,很夸张
[self fus_showLikeButtonWithAnimation:YES];
} }
} }
......
...@@ -44,13 +44,14 @@ ...@@ -44,13 +44,14 @@
self.progressView.y = self.progressBGView.height; self.progressView.y = self.progressBGView.height;
[self.progressBGView addSubview:self.progressView]; [self.progressBGView addSubview:self.progressView];
CGFloat iconWidth = 20;
self.iconImageView = [[UIImageView alloc] initWithImage:[FUSShowRoomCenterBunble imageNamed:@"live_heat_progress_icon"]]; self.iconImageView = [[UIImageView alloc] initWithImage:[FUSShowRoomCenterBunble imageNamed:@"live_heat_progress_icon"]];
self.iconImageView.frame = CGRectMake((self.width - 15) / 2.0, 9, 15, 15); self.iconImageView.frame = CGRectMake((self.width - iconWidth) / 2.0, 12, iconWidth, iconWidth);
[self addSubview:self.iconImageView]; [self addSubview:self.iconImageView];
self.numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.iconImageView.bottom, self.width, 16)]; self.numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.iconImageView.bottom + 4, self.width, 16)];
self.numberLabel.textColor = [UIColor whiteColor]; self.numberLabel.textColor = [UIColor whiteColor];
self.numberLabel.font = [UIFont fus_themeBoldFont:9]; self.numberLabel.font = [UIFont fus_themeBoldFont:12];
self.numberLabel.textAlignment = NSTextAlignmentCenter; self.numberLabel.textAlignment = NSTextAlignmentCenter;
self.numberLabel.text = @"0"; self.numberLabel.text = @"0";
[self addSubview:self.numberLabel]; [self addSubview:self.numberLabel];
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
<key>FUSUserCenterModule.xcscheme_^#shared#^_</key> <key>FUSUserCenterModule.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>76</integer> <integer>72</integer>
</dict> </dict>
<key>FUSUserCenterModuleBundle.xcscheme_^#shared#^_</key> <key>FUSUserCenterModuleBundle.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>71</integer> <integer>75</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment