Files
yusheng-android/moduleUtil/src/main/java/com/qxcm/moduleutil/utils/ChatLauncher.java
2025-07-12 19:08:21 +08:00

39 lines
1.1 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
}