单军华
2018-07-11 7b02207537d35bfa1714bf8beafc921f717d100a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/************************************************************
 *  * Hyphenate CONFIDENTIAL
 * __________________
 * Copyright (C) 2016 Hyphenate Inc. All rights reserved.
 *
 * NOTICE: All information contained herein is, and remains
 * the property of Hyphenate Inc.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Hyphenate Inc.
 */
 
#import <UIKit/UIKit.h>
 
#import "IModelChatCell.h"
#import "IMessageModel.h"
 
#import "EaseBubbleView.h"
 
/** @brief 缩略图宽度(当缩略图宽度为0或者宽度大于高度时) */
#define kEMMessageImageSizeWidth 120
/** @brief 缩略图高度(当缩略图高度为0或者宽度小于高度时) */
#define kEMMessageImageSizeHeight 120
/** @brief 位置消息cell的高度 */
#define kEMMessageLocationHeight 95
/** @brief 语音消息cell的高度 */
#define kEMMessageVoiceHeight 23
 
extern CGFloat const EaseMessageCellPadding;
 
typedef enum{
    EaseMessageCellEvenVideoBubbleTap,      /** @brief 视频消息cell点击 */
    EaseMessageCellEventLocationBubbleTap,  /** @brief 位置消息cell点击 */
    EaseMessageCellEventImageBubbleTap,     /** @brief 图片消息cell点击 */
    EaseMessageCellEventAudioBubbleTap,     /** @brief 语音消息cell点击 */
    EaseMessageCellEventFileBubbleTap,      /** @brief 文件消息cell点击 */
    EaseMessageCellEventCustomBubbleTap,    /** @brief 自定义gif图片消息cell点击 */
}EaseMessageCellTapEventType;
 
@protocol EaseMessageCellDelegate;
@interface EaseMessageCell : UITableViewCell<IModelChatCell>
{
    UIButton *_statusButton;
    UILabel *_hasRead;
    EaseBubbleView *_bubbleView;
    UIActivityIndicatorView *_activity;
 
    
    NSLayoutConstraint *_statusWidthConstraint;
}
 
@property (weak, nonatomic) id<EaseMessageCellDelegate> delegate;
 
@property (nonatomic, strong) UIActivityIndicatorView *activity;
 
@property (strong, nonatomic) UIImageView *avatarView;
 
@property (strong, nonatomic) UILabel *nameLabel;
 
@property (strong, nonatomic) UIButton *statusButton;
 
@property (strong, nonatomic) UILabel *hasRead;
 
/** @brief 气泡视图 */
@property (strong, nonatomic) EaseBubbleView *bubbleView;
 
@property (strong, nonatomic) id<IMessageModel> model;
 
/*
 *  状态按钮尺寸
 */
@property (nonatomic) CGFloat statusSize UI_APPEARANCE_SELECTOR; //default 20;
 
/*
 *  加载尺寸
 */
@property (nonatomic) CGFloat activitySize UI_APPEARANCE_SELECTOR; //default 20;
 
/*
 *  聊天气泡的最大宽度
 */
@property (nonatomic) CGFloat bubbleMaxWidth UI_APPEARANCE_SELECTOR; //default 200;
 
@property (nonatomic) UIEdgeInsets bubbleMargin UI_APPEARANCE_SELECTOR; //default UIEdgeInsetsMake(8, 0, 8, 0);
 
@property (nonatomic) UIEdgeInsets leftBubbleMargin UI_APPEARANCE_SELECTOR; //default UIEdgeInsetsMake(8, 15, 8, 10);
 
@property (nonatomic) UIEdgeInsets rightBubbleMargin UI_APPEARANCE_SELECTOR; //default UIEdgeInsetsMake(8, 10, 8, 15);
 
/*
 *  发送者气泡图片
 */
@property (strong, nonatomic) UIImage *sendBubbleBackgroundImage UI_APPEARANCE_SELECTOR;
 
/*
 *  接收者气泡图片
 */
@property (strong, nonatomic) UIImage *recvBubbleBackgroundImage UI_APPEARANCE_SELECTOR;
 
/*
 *  消息显示字体
 */
@property (nonatomic) UIFont *messageTextFont UI_APPEARANCE_SELECTOR; //default [UIFont systemFontOfSize:15];
 
/*
 *  消息显示颜色
 */
@property (nonatomic) UIColor *messageTextColor UI_APPEARANCE_SELECTOR; //default [UIColor blackColor];
 
/*
 *  位置消息显示字体
 */
@property (nonatomic) UIFont *messageLocationFont UI_APPEARANCE_SELECTOR; //default [UIFont systemFontOfSize:12];
 
/*
 *  位置消息显示颜色
 */
@property (nonatomic) UIColor *messageLocationColor UI_APPEARANCE_SELECTOR; //default [UIColor whiteColor];
 
/*
 *  发送者语音消息播放图片
 */
@property (nonatomic) NSArray *sendMessageVoiceAnimationImages UI_APPEARANCE_SELECTOR;
 
/*
 *  接收者语音消息播放图片
 */
@property (nonatomic) NSArray *recvMessageVoiceAnimationImages UI_APPEARANCE_SELECTOR;
 
/*
 *  语音消息显示颜色
 */
@property (nonatomic) UIColor *messageVoiceDurationColor UI_APPEARANCE_SELECTOR; //default [UIColor grayColor];
 
/*
 *  语音消息显示字体
 */
@property (nonatomic) UIFont *messageVoiceDurationFont UI_APPEARANCE_SELECTOR; //default [UIFont systemFontOfSize:12];
 
/*
 *  语音消息显示宽度
 */
@property (nonatomic) CGFloat voiceCellWidth UI_APPEARANCE_SELECTOR; //default 75;
 
/*
 *  文件消息名称显示字体
 */
@property (nonatomic) UIFont *messageFileNameFont UI_APPEARANCE_SELECTOR; //default [UIFont systemFontOfSize:13];
 
/*
 *  文件消息名称显示颜色
 */
@property (nonatomic) UIColor *messageFileNameColor UI_APPEARANCE_SELECTOR; //default [UIColor blackColor];
 
/*
 *  文件消息显示字体
 */
@property (nonatomic) UIFont *messageFileSizeFont UI_APPEARANCE_SELECTOR; //default [UIFont systemFontOfSize:11];
 
/*
 *  文件消息显示颜色
 */
@property (nonatomic) UIColor *messageFileSizeColor UI_APPEARANCE_SELECTOR; //default [UIColor grayColor];
 
/*
 *  @param  cell
 *  @param  
 *  @param  消息model
 */
- (instancetype)initWithStyle:(UITableViewCellStyle)style
              reuseIdentifier:(NSString *)reuseIdentifier
                        model:(id<IMessageModel>)model;
 
/*
 *  
 *
 *  @param  消息model
 *
 *  @result
 */
+ (NSString *)cellIdentifierWithModel:(id<IMessageModel>)model;
 
/*
 *
 *
 *  @param  消息model
 *
 *  @result cell高度
 */
+ (CGFloat)cellHeightWithModel:(id<IMessageModel>)model;
 
@end
 
@protocol EaseMessageCellDelegate <NSObject>
 
@optional
 
/*
 *  消息点击回调
 *
 *  @param  消息model
 */
- (void)messageCellSelected:(id<IMessageModel>)model;
 
/*
 *  状态按钮点击回调
 *
 *  @param  消息model
 *  @param  当前cell
 */
- (void)statusButtonSelcted:(id<IMessageModel>)model withMessageCell:(EaseMessageCell*)messageCell;
 
/*
 *  头像点击回调
 *
 *  @param  消息model
 */
- (void)avatarViewSelcted:(id<IMessageModel>)model;
 
@end