Commit 4bc26f31749c6d6f62001a9bed30193f7bae4e50
1 parent
8077a676
添加toast
Showing
2 changed files
with
41 additions
and
10 deletions
app/src/main/java/com/cnlive/im/ui/ChatRoomActivity.java
| @@ -87,17 +87,21 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -87,17 +87,21 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 87 | @Override | 87 | @Override |
| 88 | public void onTokenIncorrect() { | 88 | public void onTokenIncorrect() { |
| 89 | Log.e(TAG, "ConnectListener TokenIncorrect"); | 89 | Log.e(TAG, "ConnectListener TokenIncorrect"); |
| 90 | + Toast.makeText(ChatRoomActivity.this, "TokenIncorrect", Toast.LENGTH_SHORT).show(); | ||
| 91 | + | ||
| 90 | } | 92 | } |
| 91 | 93 | ||
| 92 | @Override | 94 | @Override |
| 93 | public void onSuccess(String s) { | 95 | public void onSuccess(String s) { |
| 94 | Log.e(TAG, "ConnectListener 连接监听" + s); | 96 | Log.e(TAG, "ConnectListener 连接监听" + s); |
| 95 | - | 97 | + Toast.makeText(ChatRoomActivity.this, "连接成功", Toast.LENGTH_SHORT).show(); |
| 96 | } | 98 | } |
| 97 | 99 | ||
| 98 | @Override | 100 | @Override |
| 99 | public void onError(int i, String s) { | 101 | public void onError(int i, String s) { |
| 100 | Log.e(TAG, "ConnectListener errorCode : " + i + " : errorMessage : " + s); | 102 | Log.e(TAG, "ConnectListener errorCode : " + i + " : errorMessage : " + s); |
| 103 | + Toast.makeText(ChatRoomActivity.this, s, Toast.LENGTH_SHORT).show(); | ||
| 104 | + | ||
| 101 | } | 105 | } |
| 102 | }; | 106 | }; |
| 103 | 107 | ||
| @@ -116,9 +120,12 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -116,9 +120,12 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 116 | 120 | ||
| 117 | @Override | 121 | @Override |
| 118 | public void onSuccess(final CNMessage cnMessage) { | 122 | public void onSuccess(final CNMessage cnMessage) { |
| 123 | + | ||
| 119 | mHandler.post(new Runnable() { | 124 | mHandler.post(new Runnable() { |
| 120 | @Override | 125 | @Override |
| 121 | public void run() { | 126 | public void run() { |
| 127 | + Toast.makeText(ChatRoomActivity.this, "发送成功", Toast.LENGTH_SHORT).show(); | ||
| 128 | + | ||
| 122 | if (("60_" + roomIdOne).equals(cnMessage.getTargetId())) { | 129 | if (("60_" + roomIdOne).equals(cnMessage.getTargetId())) { |
| 123 | groupChatOneListMy.add(cnMessage); | 130 | groupChatOneListMy.add(cnMessage); |
| 124 | chatListAdapterOne.updateItems(groupChatOneListMy); | 131 | chatListAdapterOne.updateItems(groupChatOneListMy); |
| @@ -143,6 +150,14 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -143,6 +150,14 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 143 | @Override | 150 | @Override |
| 144 | public void onError(CNMessage cnMessage, int i, String s) { | 151 | public void onError(CNMessage cnMessage, int i, String s) { |
| 145 | Log.v(TAG, "SendMessageListener 失败 " + i + " s" + s); | 152 | Log.v(TAG, "SendMessageListener 失败 " + i + " s" + s); |
| 153 | + mHandler.post(new Runnable() { | ||
| 154 | + @Override | ||
| 155 | + public void run() { | ||
| 156 | + Toast.makeText(ChatRoomActivity.this, "发送失败", Toast.LENGTH_SHORT).show(); | ||
| 157 | + | ||
| 158 | + } | ||
| 159 | + }); | ||
| 160 | + | ||
| 146 | 161 | ||
| 147 | } | 162 | } |
| 148 | }; | 163 | }; |
| @@ -200,6 +215,7 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -200,6 +215,7 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 200 | public void onJoined(String s) { | 215 | public void onJoined(String s) { |
| 201 | Log.i(TAG, "chatRoomActionListener " + "onJoined" + s); | 216 | Log.i(TAG, "chatRoomActionListener " + "onJoined" + s); |
| 202 | 217 | ||
| 218 | + | ||
| 203 | } | 219 | } |
| 204 | 220 | ||
| 205 | @Override | 221 | @Override |
| @@ -234,6 +250,13 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | @@ -234,6 +250,13 @@ public class ChatRoomActivity extends AppCompatActivity implements View.OnClickL | ||
| 234 | @Override | 250 | @Override |
| 235 | public void onSuccess(int what, String extra) { | 251 | public void onSuccess(int what, String extra) { |
| 236 | Log.v(TAG, "加入聊天室" + what + extra); | 252 | Log.v(TAG, "加入聊天室" + what + extra); |
| 253 | + mHandler.post(new Runnable() { | ||
| 254 | + @Override | ||
| 255 | + public void run() { | ||
| 256 | + Toast.makeText(ChatRoomActivity.this, "加入聊天室成功", Toast.LENGTH_SHORT).show(); | ||
| 257 | + | ||
| 258 | + } | ||
| 259 | + }); | ||
| 237 | 260 | ||
| 238 | } | 261 | } |
| 239 | 262 |
app/src/main/java/com/cnlive/im/ui/PrivateChatActivity.java
| @@ -118,22 +118,25 @@ public class PrivateChatActivity extends AppCompatActivity implements View.OnCli | @@ -118,22 +118,25 @@ public class PrivateChatActivity extends AppCompatActivity implements View.OnCli | ||
| 118 | private IChat.OnConnectListener connectListener = new IChat.OnConnectListener() { | 118 | private IChat.OnConnectListener connectListener = new IChat.OnConnectListener() { |
| 119 | @Override | 119 | @Override |
| 120 | public void onTokenIncorrect() { | 120 | public void onTokenIncorrect() { |
| 121 | - Log.e(TAG, "私聊ConnectListener TokenIncorrect"); | 121 | + Log.e(TAG, "ConnectListener TokenIncorrect"); |
| 122 | + Toast.makeText(PrivateChatActivity.this, "TokenIncorrect", Toast.LENGTH_SHORT).show(); | ||
| 123 | + | ||
| 122 | } | 124 | } |
| 123 | 125 | ||
| 124 | @Override | 126 | @Override |
| 125 | public void onSuccess(String s) { | 127 | public void onSuccess(String s) { |
| 126 | - Log.e(TAG, "私聊ConnectListener 连接监听" + s); | ||
| 127 | - | 128 | + Log.e(TAG, "ConnectListener 连接监听" + s); |
| 129 | + Toast.makeText(PrivateChatActivity.this, "连接成功", Toast.LENGTH_SHORT).show(); | ||
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | @Override | 132 | @Override |
| 131 | public void onError(int i, String s) { | 133 | public void onError(int i, String s) { |
| 132 | - Log.e(TAG, "私聊ConnectListener errorCode : " + i + " : errorMessage : " + s); | 134 | + Log.e(TAG, "ConnectListener errorCode : " + i + " : errorMessage : " + s); |
| 135 | + Toast.makeText(PrivateChatActivity.this, s, Toast.LENGTH_SHORT).show(); | ||
| 136 | + | ||
| 133 | } | 137 | } |
| 134 | }; | 138 | }; |
| 135 | 139 | ||
| 136 | - | ||
| 137 | /** | 140 | /** |
| 138 | * 发送消息监听 | 141 | * 发送消息监听 |
| 139 | */ | 142 | */ |
| @@ -150,6 +153,8 @@ public class PrivateChatActivity extends AppCompatActivity implements View.OnCli | @@ -150,6 +153,8 @@ public class PrivateChatActivity extends AppCompatActivity implements View.OnCli | ||
| 150 | mHandler.post(new Runnable() { | 153 | mHandler.post(new Runnable() { |
| 151 | @Override | 154 | @Override |
| 152 | public void run() { | 155 | public void run() { |
| 156 | + Toast.makeText(PrivateChatActivity.this, "发送消息成功", Toast.LENGTH_SHORT).show(); | ||
| 157 | + | ||
| 153 | messageList.add(cnMessage); | 158 | messageList.add(cnMessage); |
| 154 | chatListAdapter.updateItems(messageList); | 159 | chatListAdapter.updateItems(messageList); |
| 155 | chatListAdapter.notifyDataSetChanged(); | 160 | chatListAdapter.notifyDataSetChanged(); |
| @@ -164,8 +169,15 @@ public class PrivateChatActivity extends AppCompatActivity implements View.OnCli | @@ -164,8 +169,15 @@ public class PrivateChatActivity extends AppCompatActivity implements View.OnCli | ||
| 164 | @Override | 169 | @Override |
| 165 | public void onError(CNMessage cnMessage, int i, String s) { | 170 | public void onError(CNMessage cnMessage, int i, String s) { |
| 166 | Log.v(TAG, "私聊SendMessageListener 失败 " + i + " s" + s); | 171 | Log.v(TAG, "私聊SendMessageListener 失败 " + i + " s" + s); |
| 172 | + mHandler.post(new Runnable() { | ||
| 173 | + @Override | ||
| 174 | + public void run() { | ||
| 175 | + Toast.makeText(PrivateChatActivity.this, "发送消息失败", Toast.LENGTH_SHORT).show(); | ||
| 167 | 176 | ||
| 168 | 177 | ||
| 178 | + } | ||
| 179 | + }); | ||
| 180 | + | ||
| 169 | } | 181 | } |
| 170 | }; | 182 | }; |
| 171 | 183 | ||
| @@ -196,10 +208,6 @@ public class PrivateChatActivity extends AppCompatActivity implements View.OnCli | @@ -196,10 +208,6 @@ public class PrivateChatActivity extends AppCompatActivity implements View.OnCli | ||
| 196 | }; | 208 | }; |
| 197 | 209 | ||
| 198 | 210 | ||
| 199 | - | ||
| 200 | - | ||
| 201 | - | ||
| 202 | - | ||
| 203 | @Override | 211 | @Override |
| 204 | protected void onPause() { | 212 | protected void onPause() { |
| 205 | super.onPause(); | 213 | super.onPause(); |