2025-07-04 16:38:21 +08:00
|
|
|
|
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);
|
2025-07-12 19:08:21 +08:00
|
|
|
|
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, "u"+chatId);
|
2025-07-04 16:38:21 +08:00
|
|
|
|
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
|
|
|
|
|
|
context.startActivity(intent);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|