单军华
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
/************************************************************
 *  * 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 "EaseFaceView.h"
#import "EaseTextView.h"
#import "EaseRecordView.h"
#import "EaseChatBarMoreView.h"
#import "EaseChatToolbarItem.h"
 
#define kTouchToRecord NSEaseLocalizedString(@"message.toolBar.record.touch", @"hold down to talk")
#define kTouchToFinish NSEaseLocalizedString(@"message.toolBar.record.send", @"loosen to send")
 
 
 
@protocol EMChatToolbarDelegate;
@interface EaseChatToolbar : UIView
 
@property (weak, nonatomic) id<EMChatToolbarDelegate> delegate;
 
@property (nonatomic) UIImage *backgroundImage;
 
@property (nonatomic, readonly) EMChatToolbarType chatBarType;
 
@property (nonatomic, readonly) CGFloat inputViewMaxHeight;
 
@property (nonatomic, readonly) CGFloat inputViewMinHeight;
 
@property (nonatomic, readonly) CGFloat horizontalPadding;
 
@property (nonatomic, readonly) CGFloat verticalPadding;
 
@property (strong, nonatomic) NSArray *inputViewLeftItems;
 
@property (strong, nonatomic) NSArray *inputViewRightItems;
 
@property (strong, nonatomic) EaseTextView *inputTextView;
 
@property (strong, nonatomic) UIView *moreView;
 
@property (strong, nonatomic) UIView *faceView;
 
@property (strong, nonatomic) UIView *recordView;
 
- (instancetype)initWithFrame:(CGRect)frame
                         type:(EMChatToolbarType)type;
 
/**
 *  Initializa chat bar
 * @param horizontalPadding  default 8
 * @param verticalPadding    default 5
 * @param inputViewMinHeight default 36
 * @param inputViewMaxHeight default 150
 * @param type               default EMChatToolbarTypeGroup
 */
- (instancetype)initWithFrame:(CGRect)frame
            horizontalPadding:(CGFloat)horizontalPadding
              verticalPadding:(CGFloat)verticalPadding
           inputViewMinHeight:(CGFloat)inputViewMinHeight
           inputViewMaxHeight:(CGFloat)inputViewMaxHeight
                         type:(EMChatToolbarType)type;
 
/*!
 @method
 @brief 获取chatToolBar默认的高度
 @discussion
 @result  返回chatToolBar默认的高度
 */
+ (CGFloat)defaultHeight;
 
 
- (void)cancelTouchRecord;
 
/*!
 @method
 @brief 切换底部的菜单视图
 @discussion
 @param bottomView 待切换的菜单
 @result
 */
- (void)willShowBottomView:(UIView *)bottomView;
 
@end
 
@protocol EMChatToolbarDelegate <NSObject>
 
@optional
 
/*
 *  文字输入框开始编辑
 *
 *  @param inputTextView 输入框对象
 */
- (void)inputTextViewDidBeginEditing:(EaseTextView *)inputTextView;
 
/*
 *  文字输入框将要开始编辑
 *
 *  @param inputTextView 输入框对象
 */
- (void)inputTextViewWillBeginEditing:(EaseTextView *)inputTextView;
 
/*
 *  发送文字消息,可能包含系统自带表情
 *
 *  @param text 文字消息
 */
- (void)didSendText:(NSString *)text;
 
/*
 *  发送文字消息,可能包含系统自带表情
 *
 *  @param text 文字消息
 *  @param ext 扩展消息
 */
- (void)didSendText:(NSString *)text withExt:(NSDictionary*)ext;
 
/*
 *  在光标location位置处是否插入字符@
 *
 *  @param location 光标位置
 */
- (BOOL)didInputAtInLocation:(NSUInteger)location;
 
/*
 *  在光标location位置处是否删除字符@
 *
 *  @param location 光标位置
 */
- (BOOL)didDeleteCharacterFromLocation:(NSUInteger)location;
 
/*
 *  发送第三方表情,不会添加到文字输入框中
 *
 *  @param faceLocalPath 选中的表情的本地路径
 */
- (void)didSendFace:(NSString *)faceLocalPath;
 
/*
 *  按下录音按钮开始录音
 */
- (void)didStartRecordingVoiceAction:(UIView *)recordView;
 
/*
 *  手指向上滑动取消录音
 */
- (void)didCancelRecordingVoiceAction:(UIView *)recordView;
 
/*
 *  松开手指完成录音
 */
- (void)didFinishRecoingVoiceAction:(UIView *)recordView;
 
/*
 *  当手指离开按钮的范围内时,主要为了通知外部的HUD
 */
- (void)didDragOutsideAction:(UIView *)recordView;
 
/*
 *  当手指再次进入按钮的范围内时,主要也是为了通知外部的HUD
 */
- (void)didDragInsideAction:(UIView *)recordView;
 
@required
 
/*
 *  高度变到toHeight
 */
- (void)chatToolbarDidChangeFrameToHeight:(CGFloat)toHeight;
 
@end