39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
package com.qxcm.moduleutil.utils;
|
||
|
||
import android.content.Context;
|
||
import android.content.Intent;
|
||
|
||
import com.tencent.imsdk.v2.V2TIMConversation;
|
||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
|
||
|
||
public class ChatLauncher {
|
||
private static volatile ChatLauncher instance;
|
||
|
||
private ChatLauncher() {}
|
||
|
||
public static ChatLauncher getInstance() {
|
||
if (instance == null) {
|
||
synchronized (ChatLauncher.class) {
|
||
if (instance == null) {
|
||
instance = new ChatLauncher();
|
||
}
|
||
}
|
||
}
|
||
return instance;
|
||
}
|
||
|
||
/**
|
||
* 启动 C2C 聊天界面
|
||
* @param context 上下文
|
||
* @param chatId 聊天对象 ID(用户 ID)
|
||
*/
|
||
public void launchC2CChat(Context context, String chatId) {
|
||
Intent intent = new Intent(context, TUIC2CChatActivity.class);
|
||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, "u"+chatId);
|
||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
|
||
context.startActivity(intent);
|
||
}
|
||
}
|
||
|