初始代码
@@ -0,0 +1,58 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
namespace "com.tencent.qcloud.tuikit.tuicustomerserviceplugin"
|
||||
defaultConfig {
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
renderscriptSupportModeEnabled false
|
||||
renderscriptTargetApi 30
|
||||
}
|
||||
buildFeatures {
|
||||
buildConfig = false
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
res.srcDirs += "src/main/res-minimalistui"
|
||||
res.srcDirs += "src/main/res-light"
|
||||
res.srcDirs += "src/main/res-lively"
|
||||
res.srcDirs += "src/main/res-serious"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'com.google.code.gson:gson:2.9.1'
|
||||
annotationProcessor 'com.google.auto.service:auto-service:1.1.1'
|
||||
implementation 'io.noties.markwon:core:4.6.2'
|
||||
implementation 'io.noties.markwon:html:4.6.2'
|
||||
implementation 'io.noties.markwon:image:4.6.2'
|
||||
implementation 'io.noties.markwon:image-glide:4.6.2'
|
||||
implementation 'io.noties.markwon:inline-parser:4.6.2'
|
||||
implementation 'io.noties.markwon:linkify:4.6.2'
|
||||
implementation 'io.noties.markwon:ext-tables:4.6.2'
|
||||
|
||||
api project(':timcommon')
|
||||
api project(':tuichat')
|
||||
api project(':tuicontact')
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name="com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.page.CustomerServiceMemberListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name="com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.page.CustomerServiceProfileActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin;
|
||||
|
||||
public class TUICustomerServiceConstants {
|
||||
public static final long CUSTOMER_SERVICE_PLUGIN_ABILITY = 1L << 40;
|
||||
public static final String DEFAULT_CUSTOMER_SERVICE_ACCOUNT = "@customer_service_account";
|
||||
public static final String CUSTOMER_SERVICE_CONTENT = "content";
|
||||
public static final String CUSTOMER_SERVICE_HEADER = "header";
|
||||
public static final String CUSTOMER_SERVICE_ITEMS = "items";
|
||||
public static final String CUSTOMER_SERVICE_MENU_CONTENT = "menuContent";
|
||||
public static final String CUSTOMER_SERVICE_MENU_CONTENT_HEAD = "head";
|
||||
public static final String CUSTOMER_SERVICE_MENU = "menu";
|
||||
public static final String CUSTOMER_SERVICE_ITEM_ID = "id";
|
||||
public static final String CUSTOMER_SERVICE_ITEM_CONTENT = "content";
|
||||
public static final String CUSTOMER_SERVICE_ITEM_DESCRIPTION = "desc";
|
||||
public static final String CUSTOMER_SERVICE_ITEM_SELECTED = "selected";
|
||||
public static final String CUSTOMER_SERVICE_ITEM_MENU_SELECTED = "menuSelected";
|
||||
public static final String CUSTOMER_SERVICE_TAIL = "tail";
|
||||
public static final String CUSTOMER_SERVICE_SESSION_ID = "sessionId";
|
||||
public static final String CUSTOMER_SERVICE_EXPIRED_TIME = "expireTime";
|
||||
public static final String CUSTOMER_SERVICE_TYPE = "type";
|
||||
public static final String CUSTOMER_SERVICE_CARD_PIC = "pic";
|
||||
public static final String CUSTOMER_SERVICE_CARD_URL = "url";
|
||||
public static final String BOT_SUBTYPE_WELCOME_MSG = "welcome_msg";
|
||||
public static final String BOT_SUBTYPE_CLARIFY_MSG = "clarify_msg";
|
||||
public static final String BOT_SUBTYPE = "subtype";
|
||||
public static final String BOT_TITLE = "title";
|
||||
public static final String BOT_CHUNKS = "chunks";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,423 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import com.google.auto.service.AutoService;
|
||||
import com.tencent.qcloud.tuicore.ServiceInitializer;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuicore.TUICore;
|
||||
import com.tencent.qcloud.tuicore.TUIThemeManager;
|
||||
import com.tencent.qcloud.tuicore.annotations.TUIInitializerDependency;
|
||||
import com.tencent.qcloud.tuicore.annotations.TUIInitializerID;
|
||||
import com.tencent.qcloud.tuicore.interfaces.ITUIExtension;
|
||||
import com.tencent.qcloud.tuicore.interfaces.ITUINotification;
|
||||
import com.tencent.qcloud.tuicore.interfaces.TUIExtensionEventListener;
|
||||
import com.tencent.qcloud.tuicore.interfaces.TUIExtensionInfo;
|
||||
import com.tencent.qcloud.tuicore.interfaces.TUIInitializer;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.interfaces.IUIKitCallback;
|
||||
import com.tencent.qcloud.tuikit.tuichat.TUIChatConstants;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchMessageReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BranchMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BranchMessageReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CardMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CardMessageReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CollectionMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CollectionMessageReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CustomerServiceTypingMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.EvaluationMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.EvaluationMessageReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.InvisibleMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.RichTextMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.RichTextMessageReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.StreamTextMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.StreamTextMessageReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.page.CustomerServiceMemberListActivity;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.page.CustomerServiceProfileActivity;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.BotBranchHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.BotBranchReplyView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.BranchHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.BranchReplyView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.CardHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.CardReplyView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.CollectionHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.CollectionReplyView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.EvaluationHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.EvaluationReplyView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.InputViewFloatLayerProxy;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.InvisibleHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.RichTextHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.RichTextReplyQuoteView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.StreamTextHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.StreamTextReplyQuoteView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.config.TUICustomerServiceConfig;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.TUICustomerServiceUtils;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@AutoService(TUIInitializer.class)
|
||||
@TUIInitializerDependency({"TUIChatClassic", "TUIContact"})
|
||||
@TUIInitializerID("TUICustomerServicePlugin")
|
||||
public class TUICustomerServicePluginService implements TUIInitializer, ITUINotification, ITUIExtension {
|
||||
public static final String TAG = TUICustomerServicePluginService.class.getSimpleName();
|
||||
private static TUICustomerServicePluginService instance;
|
||||
|
||||
public static TUICustomerServicePluginService getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private Context appContext;
|
||||
private boolean canTriggerEvaluation = false;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
appContext = context;
|
||||
instance = this;
|
||||
initTheme();
|
||||
initExtension();
|
||||
initMessage();
|
||||
}
|
||||
|
||||
private void initMessage() {
|
||||
Map<String, Object> branchParam = new HashMap<>();
|
||||
branchParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY + TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_BRANCH);
|
||||
branchParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, BranchMessageBean.class);
|
||||
branchParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, BranchHolder.class);
|
||||
branchParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_BEAN_CLASS, BranchMessageReplyQuoteBean.class);
|
||||
branchParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_VIEW_CLASS, BranchReplyView.class);
|
||||
TUICore.callService(
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME, TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, branchParam);
|
||||
|
||||
Map<String, Object> collectionParam = new HashMap<>();
|
||||
collectionParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY
|
||||
+ TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_COLLECTION);
|
||||
collectionParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, CollectionMessageBean.class);
|
||||
collectionParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, CollectionHolder.class);
|
||||
collectionParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_BEAN_CLASS, CollectionMessageReplyQuoteBean.class);
|
||||
collectionParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_VIEW_CLASS, CollectionReplyView.class);
|
||||
TUICore.callService(TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME,
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, collectionParam);
|
||||
|
||||
Map<String, Object> cardParam = new HashMap<>();
|
||||
cardParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY + TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_CARD);
|
||||
cardParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, CardMessageBean.class);
|
||||
cardParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, CardHolder.class);
|
||||
cardParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_BEAN_CLASS, CardMessageReplyQuoteBean.class);
|
||||
cardParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_VIEW_CLASS, CardReplyView.class);
|
||||
TUICore.callService(
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME, TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, cardParam);
|
||||
|
||||
Map<String, Object> evaluationParam = new HashMap<>();
|
||||
evaluationParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY
|
||||
+ TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_EVALUATION);
|
||||
evaluationParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, EvaluationMessageBean.class);
|
||||
evaluationParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, EvaluationHolder.class);
|
||||
evaluationParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_BEAN_CLASS, EvaluationMessageReplyQuoteBean.class);
|
||||
evaluationParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_VIEW_CLASS, EvaluationReplyView.class);
|
||||
evaluationParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.IS_NEED_EMPTY_VIEW_GROUP, true);
|
||||
TUICore.callService(TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME,
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, evaluationParam);
|
||||
|
||||
Map<String, Object> botBranchParam = new HashMap<>();
|
||||
botBranchParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY + TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_BOT_RESPONSE);
|
||||
botBranchParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, BotBranchMessageBean.class);
|
||||
botBranchParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, BotBranchHolder.class);
|
||||
botBranchParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_BEAN_CLASS, BotBranchMessageReplyQuoteBean.class);
|
||||
botBranchParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_VIEW_CLASS, BotBranchReplyView.class);
|
||||
TUICore.callService(
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME, TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, botBranchParam);
|
||||
|
||||
Map<String, Object> richTextParam = new HashMap<>();
|
||||
richTextParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY + TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_BOT_RICH_TEXT);
|
||||
richTextParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, RichTextMessageBean.class);
|
||||
richTextParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, RichTextHolder.class);
|
||||
richTextParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_BEAN_CLASS, RichTextMessageReplyQuoteBean.class);
|
||||
richTextParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_VIEW_CLASS, RichTextReplyQuoteView.class);
|
||||
TUICore.callService(TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME,
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, richTextParam);
|
||||
|
||||
Map<String, Object> streamTextParam = new HashMap<>();
|
||||
streamTextParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY + TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_BOT_STREAM_TEXT);
|
||||
streamTextParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, StreamTextMessageBean.class);
|
||||
streamTextParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, StreamTextHolder.class);
|
||||
streamTextParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_BEAN_CLASS, StreamTextMessageReplyQuoteBean.class);
|
||||
streamTextParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_REPLY_VIEW_CLASS, StreamTextReplyQuoteView.class);
|
||||
TUICore.callService(TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME,
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, streamTextParam);
|
||||
|
||||
Map<String, Object> invisibleEndParam = new HashMap<>();
|
||||
invisibleEndParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY + TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_END);
|
||||
invisibleEndParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, InvisibleMessageBean.class);
|
||||
invisibleEndParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, InvisibleHolder.class);
|
||||
TUICore.callService(TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME,
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, invisibleEndParam);
|
||||
|
||||
Map<String, Object> invisibleTimeoutParam = new HashMap<>();
|
||||
invisibleTimeoutParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY
|
||||
+ TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_TIMEOUT);
|
||||
invisibleTimeoutParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, InvisibleMessageBean.class);
|
||||
invisibleTimeoutParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, InvisibleHolder.class);
|
||||
TUICore.callService(TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME,
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, invisibleTimeoutParam);
|
||||
|
||||
Map<String, Object> invisibleEvaluationSettingParam = new HashMap<>();
|
||||
invisibleEvaluationSettingParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY
|
||||
+ TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_EVALUATION_SETTING);
|
||||
invisibleEvaluationSettingParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, InvisibleMessageBean.class);
|
||||
invisibleEvaluationSettingParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, InvisibleHolder.class);
|
||||
TUICore.callService(TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME,
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, invisibleEvaluationSettingParam);
|
||||
|
||||
Map<String, Object> invisibleEvaluationSelectedParam = new HashMap<>();
|
||||
invisibleEvaluationSelectedParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY
|
||||
+ TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_EVALUATION_SELECTED);
|
||||
invisibleEvaluationSelectedParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, InvisibleMessageBean.class);
|
||||
invisibleEvaluationSelectedParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, InvisibleHolder.class);
|
||||
TUICore.callService(TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME,
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, invisibleEvaluationSelectedParam);
|
||||
|
||||
Map<String, Object> invisibleTriggerEvaluationParam = new HashMap<>();
|
||||
invisibleTriggerEvaluationParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY
|
||||
+ TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_TRIGGER_EVALUATION);
|
||||
invisibleTriggerEvaluationParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, InvisibleMessageBean.class);
|
||||
invisibleTriggerEvaluationParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, InvisibleHolder.class);
|
||||
TUICore.callService(TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME,
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, invisibleTriggerEvaluationParam);
|
||||
|
||||
Map<String, Object> invisibleGetEvaluationSettingParam = new HashMap<>();
|
||||
invisibleGetEvaluationSettingParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY
|
||||
+ TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_SAY_HELLO);
|
||||
invisibleGetEvaluationSettingParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, InvisibleMessageBean.class);
|
||||
invisibleGetEvaluationSettingParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_VIEW_HOLDER_CLASS, InvisibleHolder.class);
|
||||
TUICore.callService(TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME,
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, invisibleGetEvaluationSettingParam);
|
||||
|
||||
Map<String, Object> typingParam = new HashMap<>();
|
||||
typingParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BUSINESS_ID,
|
||||
TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY + TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_TYPING);
|
||||
typingParam.put(TUIConstants.TUIChat.Method.RegisterCustomMessage.MESSAGE_BEAN_CLASS, CustomerServiceTypingMessageBean.class);
|
||||
TUICore.callService(
|
||||
TUIConstants.TUIChat.Method.RegisterCustomMessage.CLASSIC_SERVICE_NAME, TUIConstants.TUIChat.Method.RegisterCustomMessage.METHOD_NAME, typingParam);
|
||||
}
|
||||
|
||||
private void initExtension() {
|
||||
TUICore.registerExtension(TUIConstants.TUIChat.Extension.InputMore.CLASSIC_EXTENSION_ID, this);
|
||||
TUICore.registerExtension(TUIConstants.TUIChat.Extension.InputViewFloatLayer.CLASSIC_EXTENSION_ID, this);
|
||||
TUICore.registerExtension(TUIConstants.TUIContact.Extension.ContactItem.CLASSIC_EXTENSION_ID, this);
|
||||
TUICore.registerExtension(TUIConstants.TUIChat.Extension.ChatNavigationMoreItem.CLASSIC_EXTENSION_ID, this);
|
||||
TUICore.registerExtension(TUIConstants.TUIChat.Extension.ChatUserIconClickedProcessor.CLASSIC_EXTENSION_ID, this);
|
||||
TUICore.registerExtension(TUIConstants.TUIChat.Extension.ChatView.GET_CONFIG_PARAMS, this);
|
||||
}
|
||||
|
||||
private void initTheme() {
|
||||
TUIThemeManager.addLightTheme(R.style.TUICustomerServiceLightTheme);
|
||||
TUIThemeManager.addLivelyTheme(R.style.TUICustomerServiceLivelyTheme);
|
||||
TUIThemeManager.addSeriousTheme(R.style.TUICustomerServiceSeriousTheme);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TUIExtensionInfo> onGetExtension(String extensionID, Map<String, Object> param) {
|
||||
if (TextUtils.equals(extensionID, TUIConstants.TUIChat.Extension.InputMore.CLASSIC_EXTENSION_ID)) {
|
||||
if (!canTriggerEvaluation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (param != null && !param.isEmpty()) {
|
||||
String userID = getOrDefault(param, TUIConstants.TUIChat.Extension.InputMore.USER_ID, null);
|
||||
if (!TextUtils.isEmpty(userID)) {
|
||||
TUIExtensionInfo extensionInfo = new TUIExtensionInfo();
|
||||
extensionInfo.setWeight(200);
|
||||
extensionInfo.setText(appContext.getString(R.string.extension_satisfaction_evaluation));
|
||||
extensionInfo.setIcon(R.drawable.tui_evaluation_ic);
|
||||
extensionInfo.setExtensionListener(new TUIExtensionEventListener() {
|
||||
@Override
|
||||
public void onClicked(Map<String, Object> param) {
|
||||
TUICustomerServicePresenter presenter = new TUICustomerServicePresenter();
|
||||
presenter.triggerEvaluation(userID);
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(extensionInfo);
|
||||
}
|
||||
}
|
||||
} else if (TextUtils.equals(extensionID, TUIConstants.TUIContact.Extension.ContactItem.CLASSIC_EXTENSION_ID)) {
|
||||
TUIExtensionInfo extensionInfo = new TUIExtensionInfo();
|
||||
extensionInfo.setWeight(200);
|
||||
extensionInfo.setText(appContext.getString(R.string.customer_service));
|
||||
extensionInfo.setIcon(TUIThemeManager.getAttrResId(appContext, R.attr.customer_service_icon));
|
||||
extensionInfo.setExtensionListener(new TUIExtensionEventListener() {
|
||||
@Override
|
||||
public void onClicked(Map<String, Object> param) {
|
||||
TUICustomerServiceUtils.checkCustomerServiceAbility(
|
||||
TUICustomerServiceConstants.CUSTOMER_SERVICE_PLUGIN_ABILITY, new IUIKitCallback<Boolean>() {
|
||||
@Override
|
||||
public void onSuccess(Boolean isSupportPlugin) {
|
||||
if (isSupportPlugin) {
|
||||
Intent intent = new Intent(TUICustomerServicePluginService.getAppContext(), CustomerServiceMemberListActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
TUICustomerServicePluginService.getAppContext().startActivity(intent);
|
||||
} else {
|
||||
Context context = getOrDefault(param, TUIConstants.TUIContact.CONTEXT, null);
|
||||
if (context != null) {
|
||||
TUICustomerServiceUtils.showNotSupportDialog(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(extensionInfo);
|
||||
} else if (TextUtils.equals(extensionID, TUIConstants.TUIChat.Extension.ChatNavigationMoreItem.CLASSIC_EXTENSION_ID)) {
|
||||
Object userID = param.get(TUIConstants.TUIChat.Extension.ChatNavigationMoreItem.USER_ID);
|
||||
if (userID instanceof String && TUICustomerServiceConfig.getInstance().getCustomerServiceAccounts().contains(userID)) {
|
||||
TUIExtensionInfo extensionInfo = new TUIExtensionInfo();
|
||||
extensionInfo.setIcon(
|
||||
TUIThemeManager.getAttrResId(getAppContext(), com.tencent.qcloud.tuikit.tuicontact.R.attr.contact_chat_extension_title_bar_more_menu));
|
||||
extensionInfo.setWeight(200);
|
||||
extensionInfo.setExtensionListener(new TUIExtensionEventListener() {
|
||||
@Override
|
||||
public void onClicked(Map<String, Object> param) {
|
||||
Intent intent = new Intent(getAppContext(), CustomerServiceProfileActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, (String) userID);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
getAppContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(extensionInfo);
|
||||
}
|
||||
} else if (TextUtils.equals(extensionID, TUIConstants.TUIChat.Extension.ChatUserIconClickedProcessor.CLASSIC_EXTENSION_ID)) {
|
||||
Object userIDObj = param.get(TUIConstants.TUIChat.Extension.ChatUserIconClickedProcessor.USER_ID);
|
||||
if (userIDObj instanceof String) {
|
||||
String userID = (String) userIDObj;
|
||||
if (TUICustomerServiceConfig.getInstance().getCustomerServiceAccounts().contains(userID)) {
|
||||
TUIExtensionInfo extensionInfo = new TUIExtensionInfo();
|
||||
extensionInfo.setIcon(
|
||||
TUIThemeManager.getAttrResId(getAppContext(), com.tencent.qcloud.tuikit.tuicontact.R.attr.contact_chat_extension_title_bar_more_menu));
|
||||
extensionInfo.setWeight(100);
|
||||
extensionInfo.setExtensionListener(new TUIExtensionEventListener() {
|
||||
@Override
|
||||
public void onClicked(Map<String, Object> param) {
|
||||
Intent intent = new Intent(getAppContext(), CustomerServiceProfileActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, userID);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
getAppContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(extensionInfo);
|
||||
}
|
||||
}
|
||||
} else if (TextUtils.equals(extensionID, TUIConstants.TUIChat.Extension.ChatView.GET_CONFIG_PARAMS)) {
|
||||
Object userIDObj = param.get(TUIConstants.TUIChat.CHAT_ID);
|
||||
if (userIDObj instanceof String) {
|
||||
String userID = (String) userIDObj;
|
||||
if (TUICustomerServiceConfig.getInstance().getCustomerServiceAccounts().contains(userID)) {
|
||||
TUIExtensionInfo extensionInfo = new TUIExtensionInfo();
|
||||
Map<String, Object> extensionMap = new HashMap<>();
|
||||
extensionMap.put(TUIConstants.TUIChat.Extension.ChatView.MESSAGE_NEED_READ_RECEIPT, true);
|
||||
extensionMap.put(TUIConstants.TUIChat.Extension.ChatView.ENABLE_VIDEO_CALL, false);
|
||||
extensionMap.put(TUIConstants.TUIChat.Extension.ChatView.ENABLE_AUDIO_CALL, false);
|
||||
extensionMap.put(TUIConstants.TUIChat.Extension.ChatView.ENABLE_CUSTOM_HELLO_MESSAGE, false);
|
||||
extensionInfo.setData(extensionMap);
|
||||
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TUICustomerServicePresenter presenter = new TUICustomerServicePresenter();
|
||||
presenter.sendHelloMessage(userID);
|
||||
}
|
||||
}, 200);
|
||||
|
||||
return Collections.singletonList(extensionInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onRaiseExtension(String extensionID, View parentView, Map<String, Object> param) {
|
||||
if (TextUtils.equals(extensionID, TUIConstants.TUIChat.Extension.InputViewFloatLayer.CLASSIC_EXTENSION_ID)) {
|
||||
if (parentView == null || param == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ViewGroup viewGroup = null;
|
||||
if (parentView instanceof ViewGroup) {
|
||||
viewGroup = (ViewGroup) parentView;
|
||||
}
|
||||
if (viewGroup == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object objChatInfo = param.get(TUIChatConstants.CHAT_INFO);
|
||||
if (!(objChatInfo instanceof ChatInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ChatInfo chatInfo = (ChatInfo) objChatInfo;
|
||||
if (chatInfo.getType() != ChatInfo.TYPE_C2C) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!TUICustomerServiceConfig.getInstance().getCustomerServiceAccounts().contains(chatInfo.getId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TUICustomerServiceConfig.getInstance().isOnlineShopping(chatInfo.getId())) {
|
||||
InputViewFloatLayerProxy inputViewFloatLayerProxy = new InputViewFloatLayerProxy(chatInfo);
|
||||
inputViewFloatLayerProxy.showFloatLayerContent(viewGroup);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotifyEvent(String key, String subKey, Map<String, Object> param) {}
|
||||
|
||||
private <T> T getOrDefault(Map map, Object key, T defaultValue) {
|
||||
if (map == null || map.isEmpty()) {
|
||||
return defaultValue;
|
||||
}
|
||||
Object object = map.get(key);
|
||||
try {
|
||||
if (object != null) {
|
||||
return (T) object;
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setCanTriggerEvaluation(boolean canTriggerEvaluation) {
|
||||
this.canTriggerEvaluation = canTriggerEvaluation;
|
||||
}
|
||||
|
||||
public static Context getAppContext() {
|
||||
return ServiceInitializer.getAppContext();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class BotBranchBean implements Serializable {
|
||||
private String subType;
|
||||
private String title;
|
||||
private String content;
|
||||
private List<Item> itemList;
|
||||
|
||||
public String getSubType() {
|
||||
return subType;
|
||||
}
|
||||
|
||||
public void setSubType(String subType) {
|
||||
this.subType = subType;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public List<Item> getItemList() {
|
||||
return itemList;
|
||||
}
|
||||
|
||||
public void setItemList(List<Item> itemList) {
|
||||
this.itemList = itemList;
|
||||
}
|
||||
|
||||
public static class Item implements Serializable {
|
||||
private String content;
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServicePluginService;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.TUICustomerServiceMessageParser;
|
||||
|
||||
public class BotBranchMessageBean extends TUIMessageBean {
|
||||
private BotBranchBean botBranchBean;
|
||||
|
||||
public BotBranchBean getBotBranchBean() {
|
||||
return botBranchBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onGetDisplayString() {
|
||||
return getExtra();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessMessage(V2TIMMessage v2TIMMessage) {
|
||||
botBranchBean = TUICustomerServiceMessageParser.getBotBranchInfo(v2TIMMessage);
|
||||
if (botBranchBean != null) {
|
||||
setExtra(botBranchBean.getTitle());
|
||||
} else {
|
||||
String text = TUICustomerServicePluginService.getAppContext().getString(com.tencent.qcloud.tuikit.timcommon.R.string.timcommon_no_support_msg);
|
||||
setExtra(text);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TUIReplyQuoteBean<?>> getReplyQuoteBeanClass() {
|
||||
return BotBranchMessageReplyQuoteBean.class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
|
||||
public class BotBranchMessageReplyQuoteBean extends TUIReplyQuoteBean<BotBranchMessageBean> {
|
||||
private String text;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessReplyQuoteBean(BotBranchMessageBean messageBean) {
|
||||
text = messageBean.getExtra();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class BranchBean implements Serializable {
|
||||
private String head;
|
||||
private List<Item> itemList;
|
||||
private Item selectedItem;
|
||||
private String tail;
|
||||
|
||||
public String getHead() {
|
||||
return head;
|
||||
}
|
||||
|
||||
public void setHead(String head) {
|
||||
this.head = head;
|
||||
}
|
||||
|
||||
public List<Item> getItemList() {
|
||||
return itemList;
|
||||
}
|
||||
|
||||
public void setItemList(List<Item> itemList) {
|
||||
this.itemList = itemList;
|
||||
}
|
||||
|
||||
public Item getSelectedItem() {
|
||||
return selectedItem;
|
||||
}
|
||||
|
||||
public void setSelectedItem(Item selectedItem) {
|
||||
this.selectedItem = selectedItem;
|
||||
}
|
||||
|
||||
public String getTail() {
|
||||
return tail;
|
||||
}
|
||||
|
||||
public void setTail(String tail) {
|
||||
this.tail = tail;
|
||||
}
|
||||
|
||||
public static class Item implements Serializable {
|
||||
private String content;
|
||||
private String description;
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServicePluginService;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.TUICustomerServiceMessageParser;
|
||||
|
||||
public class BranchMessageBean extends TUIMessageBean {
|
||||
private BranchBean branchBean;
|
||||
|
||||
public BranchBean getBranchBean() {
|
||||
return branchBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onGetDisplayString() {
|
||||
return getExtra();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessMessage(V2TIMMessage v2TIMMessage) {
|
||||
branchBean = TUICustomerServiceMessageParser.getBranchInfo(v2TIMMessage);
|
||||
if (branchBean != null) {
|
||||
setExtra(branchBean.getHead());
|
||||
} else {
|
||||
String text = TUICustomerServicePluginService.getAppContext().getString(com.tencent.qcloud.tuikit.timcommon.R.string.timcommon_no_support_msg);
|
||||
setExtra(text);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TUIReplyQuoteBean<?>> getReplyQuoteBeanClass() {
|
||||
return BranchMessageReplyQuoteBean.class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
|
||||
public class BranchMessageReplyQuoteBean extends TUIReplyQuoteBean<BranchMessageBean> {
|
||||
private String text;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessReplyQuoteBean(BranchMessageBean messageBean) {
|
||||
text = messageBean.getExtra();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class CardBean implements Serializable {
|
||||
private String header;
|
||||
private String desc;
|
||||
private String pic;
|
||||
private String url;
|
||||
|
||||
public String getHeader() {
|
||||
return header;
|
||||
}
|
||||
|
||||
public void setHeader(String header) {
|
||||
this.header = header;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public String getPic() {
|
||||
return pic;
|
||||
}
|
||||
|
||||
public void setPic(String pic) {
|
||||
this.pic = pic;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServicePluginService;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.TUICustomerServiceMessageParser;
|
||||
|
||||
public class CardMessageBean extends TUIMessageBean {
|
||||
private CardBean cardBean;
|
||||
|
||||
public CardBean getCardBean() {
|
||||
return cardBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onGetDisplayString() {
|
||||
return getExtra();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessMessage(V2TIMMessage v2TIMMessage) {
|
||||
cardBean = TUICustomerServiceMessageParser.getCardInfo(v2TIMMessage);
|
||||
if (cardBean != null) {
|
||||
setExtra(cardBean.getHeader());
|
||||
} else {
|
||||
String text = TUICustomerServicePluginService.getAppContext().getString(com.tencent.qcloud.tuikit.timcommon.R.string.timcommon_no_support_msg);
|
||||
setExtra(text);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TUIReplyQuoteBean<?>> getReplyQuoteBeanClass() {
|
||||
return CardMessageReplyQuoteBean.class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
|
||||
public class CardMessageReplyQuoteBean extends TUIReplyQuoteBean<CardMessageBean> {
|
||||
private String text;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessReplyQuoteBean(CardMessageBean messageBean) {
|
||||
text = messageBean.getExtra();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class CollectionBean implements Serializable {
|
||||
public static final int COLLECTION_TYPE_SUGGEST = 0;
|
||||
public static final int COLLECTION_TYPE_FORM = 1;
|
||||
private String head;
|
||||
private List<FormItem> itemList;
|
||||
private FormItem selectedItem;
|
||||
private int type;
|
||||
|
||||
public String getHead() {
|
||||
return head;
|
||||
}
|
||||
|
||||
public void setHead(String head) {
|
||||
this.head = head;
|
||||
}
|
||||
|
||||
public List<FormItem> getItemList() {
|
||||
return itemList;
|
||||
}
|
||||
|
||||
public void setItemList(List<FormItem> itemList) {
|
||||
this.itemList = itemList;
|
||||
}
|
||||
|
||||
public FormItem getSelectedItem() {
|
||||
return selectedItem;
|
||||
}
|
||||
|
||||
public void setSelectedItem(FormItem selectedItem) {
|
||||
this.selectedItem = selectedItem;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public static class FormItem implements Serializable {
|
||||
private String content;
|
||||
private String description;
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServicePluginService;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.TUICustomerServiceMessageParser;
|
||||
|
||||
public class CollectionMessageBean extends TUIMessageBean {
|
||||
private CollectionBean collectionBean;
|
||||
|
||||
public CollectionBean getCollectionBean() {
|
||||
return collectionBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onGetDisplayString() {
|
||||
return getExtra();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessMessage(V2TIMMessage v2TIMMessage) {
|
||||
collectionBean = TUICustomerServiceMessageParser.getCollectionInfo(v2TIMMessage);
|
||||
if (collectionBean != null) {
|
||||
setExtra(collectionBean.getHead());
|
||||
} else {
|
||||
String text = TUICustomerServicePluginService.getAppContext().getString(com.tencent.qcloud.tuikit.timcommon.R.string.timcommon_no_support_msg);
|
||||
setExtra(text);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TUIReplyQuoteBean<?>> getReplyQuoteBeanClass() {
|
||||
return CollectionMessageReplyQuoteBean.class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
|
||||
public class CollectionMessageReplyQuoteBean extends TUIReplyQuoteBean<CollectionMessageBean> {
|
||||
private String text;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessReplyQuoteBean(CollectionMessageBean messageBean) {
|
||||
text = messageBean.getExtra();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.MessageTyping;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.message.MessageTypingBean;
|
||||
|
||||
public class CustomerServiceTypingMessageBean extends MessageTypingBean {
|
||||
@Override
|
||||
public void onProcessMessage(V2TIMMessage v2TIMMessage) {
|
||||
messageTyping = new MessageTyping();
|
||||
messageTyping.setTypingStatus(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class EvaluationBean implements Serializable {
|
||||
public static final int EVALUATION_TYPE_STAR = 1;
|
||||
public static final int EVALUATION_TYPE_NUMBER = 2;
|
||||
private String head;
|
||||
private List<Menu> menuList;
|
||||
private Menu selectedMenu;
|
||||
private String tail;
|
||||
private int type;
|
||||
private String sessionID;
|
||||
private int expireTime;
|
||||
public String getHead() {
|
||||
return head;
|
||||
}
|
||||
|
||||
public void setHead(String head) {
|
||||
this.head = head;
|
||||
}
|
||||
|
||||
public List<Menu> getMenuList() {
|
||||
return menuList;
|
||||
}
|
||||
|
||||
public void setMenuList(List<Menu> menuList) {
|
||||
this.menuList = menuList;
|
||||
}
|
||||
|
||||
public Menu getSelectedMenu() {
|
||||
return selectedMenu;
|
||||
}
|
||||
|
||||
public void setSelectedMenu(Menu selectedMenu) {
|
||||
this.selectedMenu = selectedMenu;
|
||||
}
|
||||
|
||||
public String getTail() {
|
||||
return tail;
|
||||
}
|
||||
|
||||
public void setTail(String tail) {
|
||||
this.tail = tail;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getSessionID() {
|
||||
return sessionID;
|
||||
}
|
||||
|
||||
public void setSessionID(String sessionID) {
|
||||
this.sessionID = sessionID;
|
||||
}
|
||||
|
||||
public int getExpireTime() {
|
||||
return expireTime;
|
||||
}
|
||||
|
||||
public void setExpireTime(int expireTime) {
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
|
||||
public static class Menu implements Serializable {
|
||||
private String id;
|
||||
private String content;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServicePluginService;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.TUICustomerServiceMessageParser;
|
||||
|
||||
public class EvaluationMessageBean extends TUIMessageBean {
|
||||
private EvaluationBean evaluationBean;
|
||||
|
||||
public EvaluationBean getEvaluationBean() {
|
||||
return evaluationBean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onGetDisplayString() {
|
||||
return getExtra();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessMessage(V2TIMMessage v2TIMMessage) {
|
||||
evaluationBean = TUICustomerServiceMessageParser.getEvaluationInfo(v2TIMMessage);
|
||||
if (evaluationBean != null) {
|
||||
setExtra(evaluationBean.getHead());
|
||||
} else {
|
||||
String text = TUICustomerServicePluginService.getAppContext().getString(com.tencent.qcloud.tuikit.timcommon.R.string.timcommon_no_support_msg);
|
||||
setExtra(text);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TUIReplyQuoteBean<?>> getReplyQuoteBeanClass() {
|
||||
return EvaluationMessageReplyQuoteBean.class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
|
||||
public class EvaluationMessageReplyQuoteBean extends TUIReplyQuoteBean<EvaluationMessageBean> {
|
||||
private String text;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessReplyQuoteBean(EvaluationMessageBean messageBean) {
|
||||
text = messageBean.getExtra();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuichat.TUIChatService;
|
||||
import com.tencent.qcloud.tuikit.tuichat.util.TUIChatLog;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServiceConstants;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServicePluginService;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class InvisibleMessageBean extends TUIMessageBean {
|
||||
public static class InvisibleBean implements Serializable {
|
||||
public String src = "";
|
||||
|
||||
// Satisfaction Setting
|
||||
// Indicates that users can actively initiate evaluations.
|
||||
public final int RULE_USER_TRIGGER_EVALUATION = 1 << 2;
|
||||
public static final String MENU_SEND_RULE_FLAG = "menuSendRuleFlag";
|
||||
public int menuSendRuleFlag;
|
||||
}
|
||||
|
||||
private InvisibleBean invisibleBean;
|
||||
|
||||
@Override
|
||||
public String onGetDisplayString() {
|
||||
return getExtra();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessMessage(V2TIMMessage v2TIMMessage) {
|
||||
String data = new String(v2TIMMessage.getCustomElem().getData());
|
||||
if (!TextUtils.isEmpty(data)) {
|
||||
invisibleBean = new InvisibleBean();
|
||||
try {
|
||||
JSONObject invisibleJson = new JSONObject(data);
|
||||
invisibleBean.src = invisibleJson.optString(TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_BUSINESS_ID_SRC_KEY);
|
||||
JSONObject contentJson = invisibleJson.optJSONObject(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_CONTENT);
|
||||
if (contentJson != null) {
|
||||
invisibleBean.menuSendRuleFlag = contentJson.optInt(InvisibleBean.MENU_SEND_RULE_FLAG);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
TUIChatLog.e("InvisibleMessageBean", "exception e = " + e);
|
||||
}
|
||||
}
|
||||
|
||||
if (invisibleBean != null) {
|
||||
if (invisibleBean.src.equals(TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_EVALUATION_SELECTED)) {
|
||||
setExtra(TUIChatService.getAppContext().getString(R.string.satisfaction_evaluation));
|
||||
} else if (invisibleBean.src.equals(TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_END)) {
|
||||
setExtra(TUIChatService.getAppContext().getString(R.string.session_end));
|
||||
} else if (invisibleBean.src.equals(TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_TIMEOUT)) {
|
||||
setExtra(TUIChatService.getAppContext().getString(R.string.session_timeout));
|
||||
} else if (invisibleBean.src.equals(TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_EVALUATION_SETTING)) {
|
||||
int triggerResult = invisibleBean.menuSendRuleFlag & invisibleBean.RULE_USER_TRIGGER_EVALUATION;
|
||||
TUICustomerServicePluginService.getInstance().setCanTriggerEvaluation(triggerResult > 0 ? true : false);
|
||||
} else if (invisibleBean.src.equals(TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_TRIGGER_EVALUATION)) {
|
||||
} else if (invisibleBean.src.equals(TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_SAY_HELLO)) {
|
||||
} else {
|
||||
String text = TUICustomerServicePluginService.getAppContext().getString(com.tencent.qcloud.tuikit.timcommon.R.string.timcommon_no_support_msg);
|
||||
setExtra(text);
|
||||
}
|
||||
} else {
|
||||
String text = TUICustomerServicePluginService.getAppContext().getString(com.tencent.qcloud.tuikit.timcommon.R.string.timcommon_no_support_msg);
|
||||
setExtra(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.message.TextMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.TUICustomerServiceMessageParser;
|
||||
|
||||
public class RichTextMessageBean extends TextMessageBean {
|
||||
private String content;
|
||||
|
||||
@Override
|
||||
public String onGetDisplayString() {
|
||||
return "Rich Text";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessMessage(V2TIMMessage v2TIMMessage) {
|
||||
content = TUICustomerServiceMessageParser.getRichText(v2TIMMessage);
|
||||
setExtra(content);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
|
||||
public class RichTextMessageReplyQuoteBean extends TUIReplyQuoteBean<RichTextMessageBean> {
|
||||
private String text;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessReplyQuoteBean(RichTextMessageBean messageBean) {
|
||||
text = messageBean.getExtra();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuicore.TUICore;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuichat.TUIChatConstants;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.message.TextMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuichat.interfaces.IMessageRecyclerView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.TUICustomerServiceMessageParser;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class StreamTextMessageBean extends TextMessageBean {
|
||||
private int displayedContentLength = 0;
|
||||
private String content;
|
||||
|
||||
@Override
|
||||
public String onGetDisplayString() {
|
||||
return getExtra();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean customReloadWithNewMsg(V2TIMMessage v2TIMMessage) {
|
||||
String newContent = TUICustomerServiceMessageParser.getStreamText(v2TIMMessage);
|
||||
if (newContent.length() <= displayedContentLength) {
|
||||
return true;
|
||||
}
|
||||
|
||||
setV2TIMMessage(v2TIMMessage);
|
||||
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put(TUIChatConstants.MESSAGE_BEAN, this);
|
||||
param.put(TUIChatConstants.DATA_CHANGE_TYPE, IMessageRecyclerView.DATA_CHANGE_TYPE_UPDATE);
|
||||
TUICore.notifyEvent(TUIConstants.TUIChat.EVENT_KEY_MESSAGE_EVENT, TUIConstants.TUIChat.EVENT_SUB_KEY_MESSAGE_INFO_CHANGED, param);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessMessage(V2TIMMessage v2TIMMessage) {
|
||||
content = TUICustomerServiceMessageParser.getStreamText(v2TIMMessage);
|
||||
if (getMessageSource() != TUIMessageBean.MSG_SOURCE_ONLINE_PUSH) {
|
||||
setExtra(content);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDisplayedContentLength(int displayedContentLength) {
|
||||
this.displayedContentLength = displayedContentLength;
|
||||
}
|
||||
|
||||
public int getDisplayedContentLength() {
|
||||
return displayedContentLength;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean;
|
||||
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIReplyQuoteBean;
|
||||
|
||||
public class StreamTextMessageReplyQuoteBean extends TUIReplyQuoteBean<StreamTextMessageBean> {
|
||||
private String text;
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProcessReplyQuoteBean(StreamTextMessageBean messageBean) {
|
||||
text = messageBean.getExtra();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.page;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.TitleBarLayout;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.activities.BaseLightActivity;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.interfaces.ITitleBarLayout;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.MemberListAdapter;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
import java.util.List;
|
||||
|
||||
public class CustomerServiceMemberListActivity extends BaseLightActivity {
|
||||
private TitleBarLayout mTitleBar;
|
||||
private ListView memberListView;
|
||||
private TextView notFoundTip;
|
||||
private TUICustomerServicePresenter presenter;
|
||||
private MemberListAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.customer_service_member_list_activity);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
mTitleBar = findViewById(R.id.customer_service_member_titlebar);
|
||||
mTitleBar.setTitle(getResources().getString(R.string.customer_service), ITitleBarLayout.Position.MIDDLE);
|
||||
mTitleBar.setOnLeftClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
memberListView = findViewById(R.id.customer_service_member_list);
|
||||
notFoundTip = findViewById(R.id.customer_service_member_not_found_tip);
|
||||
presenter = new TUICustomerServicePresenter();
|
||||
presenter.getCustomerServiceUserInfo(new V2TIMValueCallback<List<V2TIMUserFullInfo>>() {
|
||||
@Override
|
||||
public void onSuccess(List<V2TIMUserFullInfo> v2TIMUserFullInfos) {
|
||||
if (v2TIMUserFullInfos == null || v2TIMUserFullInfos.isEmpty()) {
|
||||
notFoundTip.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
notFoundTip.setVisibility(View.GONE);
|
||||
mAdapter = new MemberListAdapter(CustomerServiceMemberListActivity.this, R.layout.customer_service_member_item, v2TIMUserFullInfos);
|
||||
memberListView.setAdapter(mAdapter);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
notFoundTip.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.page;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.activities.BaseLightActivity;
|
||||
import com.tencent.qcloud.tuikit.tuicontact.TUIContactConstants;
|
||||
import com.tencent.qcloud.tuikit.tuicontact.presenter.FriendProfilePresenter;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.CustomerServiceProfileLayout;
|
||||
|
||||
public class CustomerServiceProfileActivity extends BaseLightActivity {
|
||||
private FriendProfilePresenter presenter;
|
||||
private CustomerServiceProfileLayout layout;
|
||||
private String mChatId;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.customer_service_profile_activity);
|
||||
layout = findViewById(R.id.friend_profile);
|
||||
|
||||
presenter = new FriendProfilePresenter();
|
||||
layout.setPresenter(presenter);
|
||||
presenter.setFriendProfileLayout(layout);
|
||||
Intent intent = getIntent();
|
||||
mChatId = intent.getStringExtra(TUIConstants.TUIChat.CHAT_ID);
|
||||
|
||||
if (!TextUtils.isEmpty(mChatId)) {
|
||||
layout.initData(mChatId);
|
||||
} else {
|
||||
layout.initData(intent.getSerializableExtra(TUIConstants.TUIContact.CONTENT));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.MessageContentHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServiceConstants;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
|
||||
public class BotBranchHolder extends MessageContentHolder {
|
||||
private LinearLayout llWelcomeContent;
|
||||
private LinearLayout llRefresh;
|
||||
private TextView tvWelcomeContent;
|
||||
private TextView tvClarifyMessage;
|
||||
private ImageView ivRefresh;
|
||||
private BotBranchListLayout listLayout;
|
||||
|
||||
public BotBranchHolder(View itemView) {
|
||||
super(itemView);
|
||||
llWelcomeContent = itemView.findViewById(R.id.ll_title_welcome_content);
|
||||
tvWelcomeContent = itemView.findViewById(R.id.tv_welcome_content);
|
||||
llRefresh = itemView.findViewById(R.id.ll_refresh);
|
||||
tvClarifyMessage = itemView.findViewById(R.id.tv_title_clarify_message);
|
||||
listLayout = itemView.findViewById(R.id.branch_question_item_list);
|
||||
ivRefresh = itemView.findViewById(R.id.iv_refresh);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
llWelcomeContent.getBackground().setAutoMirrored(true);
|
||||
ivRefresh.getBackground().setAutoMirrored(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVariableLayout() {
|
||||
return R.layout.bot_message_adapter_branch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutVariableViews(TUIMessageBean msg, int position) {
|
||||
int paddingHorizontal = 0;
|
||||
int paddingVertical = 0;
|
||||
msgArea.setPaddingRelative(paddingHorizontal, paddingVertical, paddingHorizontal, paddingVertical);
|
||||
|
||||
BotBranchMessageBean botBranchMessageBean = (BotBranchMessageBean) msg;
|
||||
TUICustomerServicePresenter presenter = new TUICustomerServicePresenter();
|
||||
presenter.setMessage(botBranchMessageBean);
|
||||
BotBranchBean branchBean = botBranchMessageBean.getBotBranchBean();
|
||||
if (branchBean != null) {
|
||||
if (TextUtils.equals(branchBean.getSubType(), TUICustomerServiceConstants.BOT_SUBTYPE_WELCOME_MSG)) {
|
||||
tvClarifyMessage.setVisibility(View.GONE);
|
||||
tvWelcomeContent.setText(branchBean.getTitle());
|
||||
llWelcomeContent.setVisibility(View.VISIBLE);
|
||||
llRefresh.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
listLayout.refreshData();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
llWelcomeContent.setVisibility(View.GONE);
|
||||
tvClarifyMessage.setText(branchBean.getTitle());
|
||||
tvClarifyMessage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
listLayout.setPresenter(presenter);
|
||||
listLayout.setBotBranchItemList(branchBean.getItemList());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServiceConstants;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchMessageBean;
|
||||
|
||||
public class BotBranchItemHolder extends RecyclerView.ViewHolder {
|
||||
private View rootView;
|
||||
private View vBranchLine;
|
||||
private TextView tvNumber;
|
||||
private TextView tvContent;
|
||||
private ImageView ivArrow;
|
||||
private BotBranchListAdapter adapter;
|
||||
public BotBranchItemHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
rootView = itemView;
|
||||
vBranchLine = itemView.findViewById(R.id.v_branch_line);
|
||||
tvNumber = itemView.findViewById(R.id.branch_item_number);
|
||||
tvContent = itemView.findViewById(R.id.branch_item_content);
|
||||
ivArrow = itemView.findViewById(R.id.branch_item_arrow);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
ivArrow.getBackground().setAutoMirrored(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void layoutViews(BotBranchBean.Item item, int position) {
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (position == 0) {
|
||||
vBranchLine.setVisibility(View.GONE);
|
||||
} else {
|
||||
vBranchLine.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
BotBranchMessageBean botBranchMessageBean = (BotBranchMessageBean) adapter.getPresenter().getMessageBean();
|
||||
if (botBranchMessageBean != null) {
|
||||
if (TextUtils.equals(botBranchMessageBean.getBotBranchBean().getSubType(), TUICustomerServiceConstants.BOT_SUBTYPE_WELCOME_MSG)) {
|
||||
tvNumber.setText(String.valueOf((position + 1)));
|
||||
tvNumber.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
tvNumber.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
tvContent.setText(item.getContent());
|
||||
rootView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (adapter != null && adapter.getPresenter() != null) {
|
||||
adapter.getPresenter().OnItemContentSelected(item.getContent());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setAdapter(BotBranchListAdapter adapter) {
|
||||
this.adapter = adapter;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServiceConstants;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BotBranchListAdapter extends RecyclerView.Adapter {
|
||||
private final int ITEM_SHOW_COUNT = 4;
|
||||
private int lastItemPosition = 0;
|
||||
private TUICustomerServicePresenter presenter;
|
||||
private List<BotBranchBean.Item> botBranchItemTotalList = new ArrayList<>();
|
||||
private List<BotBranchBean.Item> botBranchItemList = new ArrayList<>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||
View rootView = inflater.inflate(R.layout.bot_branch_item_layout, parent, false);
|
||||
BotBranchItemHolder holder = new BotBranchItemHolder(rootView);
|
||||
holder.setAdapter(this);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
BotBranchBean.Item branchItem = botBranchItemList.get(position);
|
||||
BotBranchItemHolder branchItemHolder = (BotBranchItemHolder) holder;
|
||||
branchItemHolder.layoutViews(branchItem, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return botBranchItemList.size();
|
||||
}
|
||||
|
||||
public void setPresenter(TUICustomerServicePresenter presenter) {
|
||||
this.presenter = presenter;
|
||||
}
|
||||
|
||||
public TUICustomerServicePresenter getPresenter() {
|
||||
return this.presenter;
|
||||
}
|
||||
|
||||
public void setBotBranchItemList(List<BotBranchBean.Item> itemList) {
|
||||
BotBranchMessageBean botBranchMessageBean = (BotBranchMessageBean) presenter.getMessageBean();
|
||||
|
||||
if (TextUtils.equals(botBranchMessageBean.getBotBranchBean().getSubType(), TUICustomerServiceConstants.BOT_SUBTYPE_CLARIFY_MSG)) {
|
||||
botBranchItemList = itemList;
|
||||
} else {
|
||||
botBranchItemTotalList.clear();
|
||||
botBranchItemList.clear();
|
||||
|
||||
botBranchItemTotalList.addAll(itemList);
|
||||
if (botBranchItemTotalList.size() <= 4) {
|
||||
botBranchItemList.addAll(botBranchItemTotalList);
|
||||
} else {
|
||||
for (int i = 0; i < botBranchItemTotalList.size(); i++) {
|
||||
botBranchItemList.add(botBranchItemTotalList.get(i));
|
||||
if (botBranchItemList.size() == ITEM_SHOW_COUNT) {
|
||||
lastItemPosition = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void refreshData() {
|
||||
if (botBranchItemTotalList.size() <= 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
botBranchItemList.clear();
|
||||
int remainCount = botBranchItemTotalList.size() - lastItemPosition - 1;
|
||||
if (remainCount == 0) {
|
||||
for (int i = 0; i < botBranchItemTotalList.size(); i++) {
|
||||
botBranchItemList.add(botBranchItemTotalList.get(i));
|
||||
if (botBranchItemList.size() == ITEM_SHOW_COUNT) {
|
||||
lastItemPosition = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (remainCount <= 4) {
|
||||
botBranchItemList.addAll(botBranchItemTotalList.subList(lastItemPosition + 1, botBranchItemTotalList.size()));
|
||||
lastItemPosition = botBranchItemTotalList.size() - 1;
|
||||
} else {
|
||||
for (int i = lastItemPosition + 1; i < botBranchItemTotalList.size(); i++) {
|
||||
botBranchItemList.add(botBranchItemTotalList.get(i));
|
||||
if (botBranchItemList.size() == ITEM_SHOW_COUNT) {
|
||||
lastItemPosition = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.CustomLinearLayoutManager;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BotBranchListLayout extends RecyclerView {
|
||||
private BotBranchListAdapter adapter;
|
||||
|
||||
public BotBranchListLayout(@NonNull Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public BotBranchListLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public BotBranchListLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setItemViewCacheSize(0);
|
||||
setHasFixedSize(true);
|
||||
CustomLinearLayoutManager linearLayoutManager = new CustomLinearLayoutManager(getContext());
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
setLayoutManager(linearLayoutManager);
|
||||
SimpleItemAnimator animator = (SimpleItemAnimator) getItemAnimator();
|
||||
if (animator != null) {
|
||||
animator.setSupportsChangeAnimations(false);
|
||||
}
|
||||
|
||||
adapter = new BotBranchListAdapter();
|
||||
super.setAdapter(adapter);
|
||||
}
|
||||
|
||||
public void setPresenter(TUICustomerServicePresenter presenter) {
|
||||
if (presenter != null) {
|
||||
adapter.setPresenter(presenter);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBotBranchItemList(List<BotBranchBean.Item> itemList) {
|
||||
adapter.setBotBranchItemList(itemList);
|
||||
}
|
||||
|
||||
public void refreshData() {
|
||||
adapter.refreshData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.TUIReplyQuoteView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.face.FaceManager;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchMessageReplyQuoteBean;
|
||||
|
||||
public class BotBranchReplyView extends TUIReplyQuoteView<BotBranchMessageReplyQuoteBean> {
|
||||
private TextView textView;
|
||||
|
||||
public BotBranchReplyView(Context context) {
|
||||
super(context);
|
||||
textView = findViewById(R.id.text_quote_tv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResourceId() {
|
||||
return R.layout.bot_branch_reply_quote_text_layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawReplyQuote(BotBranchMessageReplyQuoteBean quoteBean) {
|
||||
String text = quoteBean.getText();
|
||||
FaceManager.handlerEmojiText(textView, text, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.MessageContentHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BranchBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BranchMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
|
||||
public class BranchHolder extends MessageContentHolder {
|
||||
private TextView tvTitle;
|
||||
private BranchListLayout listLayout;
|
||||
|
||||
public BranchHolder(View itemView) {
|
||||
super(itemView);
|
||||
tvTitle = itemView.findViewById(R.id.tv_branch_title);
|
||||
listLayout = itemView.findViewById(R.id.branch_item_list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVariableLayout() {
|
||||
return R.layout.message_adapter_branch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutVariableViews(TUIMessageBean msg, int position) {
|
||||
BranchMessageBean branchMessageBean = (BranchMessageBean) msg;
|
||||
TUICustomerServicePresenter presenter = new TUICustomerServicePresenter();
|
||||
presenter.setMessage(branchMessageBean);
|
||||
BranchBean branchBean = branchMessageBean.getBranchBean();
|
||||
if (branchBean != null) {
|
||||
if (TextUtils.isEmpty(branchBean.getHead())) {
|
||||
tvTitle.setText("");
|
||||
tvTitle.setVisibility(View.GONE);
|
||||
} else {
|
||||
tvTitle.setVisibility(View.VISIBLE);
|
||||
tvTitle.setText(branchBean.getHead());
|
||||
}
|
||||
listLayout.setPresenter(presenter);
|
||||
listLayout.setBranchItemList(branchBean.getItemList());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BranchBean;
|
||||
|
||||
public class BranchItemHolder extends RecyclerView.ViewHolder {
|
||||
private View rootView;
|
||||
private TextView tvContent;
|
||||
private BranchListAdapter adapter;
|
||||
public BranchItemHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
rootView = itemView;
|
||||
tvContent = itemView.findViewById(R.id.branch_item_content);
|
||||
}
|
||||
|
||||
public void layoutViews(BranchBean.Item item, int position) {
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
tvContent.setText(item.getContent());
|
||||
rootView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (adapter != null && adapter.getPresenter() != null && adapter.getPresenter().allowSelection()) {
|
||||
adapter.getPresenter().OnItemContentSelected(item.getContent());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setAdapter(BranchListAdapter adapter) {
|
||||
this.adapter = adapter;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BranchBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BranchListAdapter extends RecyclerView.Adapter {
|
||||
private TUICustomerServicePresenter presenter;
|
||||
private List<BranchBean.Item> branchItemList = new ArrayList<>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||
View rootView = inflater.inflate(R.layout.branch_item_layout, parent, false);
|
||||
BranchItemHolder holder = new BranchItemHolder(rootView);
|
||||
holder.setAdapter(this);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
BranchBean.Item branchItem = branchItemList.get(position);
|
||||
BranchItemHolder branchItemHolder = (BranchItemHolder) holder;
|
||||
branchItemHolder.layoutViews(branchItem, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return branchItemList.size();
|
||||
}
|
||||
|
||||
public void setPresenter(TUICustomerServicePresenter presenter) {
|
||||
this.presenter = presenter;
|
||||
}
|
||||
|
||||
public TUICustomerServicePresenter getPresenter() {
|
||||
return this.presenter;
|
||||
}
|
||||
|
||||
public void setBranchItemList(List<BranchBean.Item> itemList) {
|
||||
this.branchItemList = itemList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.CustomLinearLayoutManager;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BranchBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
import java.util.List;
|
||||
|
||||
public class BranchListLayout extends RecyclerView {
|
||||
private BranchListAdapter adapter;
|
||||
|
||||
public BranchListLayout(@NonNull Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public BranchListLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public BranchListLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setItemViewCacheSize(0);
|
||||
setHasFixedSize(true);
|
||||
CustomLinearLayoutManager linearLayoutManager = new CustomLinearLayoutManager(getContext());
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
setLayoutManager(linearLayoutManager);
|
||||
SimpleItemAnimator animator = (SimpleItemAnimator) getItemAnimator();
|
||||
if (animator != null) {
|
||||
animator.setSupportsChangeAnimations(false);
|
||||
}
|
||||
|
||||
adapter = new BranchListAdapter();
|
||||
super.setAdapter(adapter);
|
||||
}
|
||||
|
||||
public void setPresenter(TUICustomerServicePresenter presenter) {
|
||||
if (presenter != null) {
|
||||
adapter.setPresenter(presenter);
|
||||
}
|
||||
}
|
||||
|
||||
public void setBranchItemList(List<BranchBean.Item> itemList) {
|
||||
adapter.setBranchItemList(itemList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.TUIReplyQuoteView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.face.FaceManager;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BranchMessageReplyQuoteBean;
|
||||
|
||||
public class BranchReplyView extends TUIReplyQuoteView<BranchMessageReplyQuoteBean> {
|
||||
private TextView textView;
|
||||
|
||||
public BranchReplyView(Context context) {
|
||||
super(context);
|
||||
textView = findViewById(R.id.text_quote_tv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResourceId() {
|
||||
return R.layout.branch_reply_quote_text_layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawReplyQuote(BranchMessageReplyQuoteBean quoteBean) {
|
||||
String text = quoteBean.getText();
|
||||
FaceManager.handlerEmojiText(textView, text, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.MessageContentHolder;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.impl.GlideEngine;
|
||||
import com.tencent.qcloud.tuikit.tuichat.TUIChatService;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CardBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CardMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
|
||||
public class CardHolder extends MessageContentHolder {
|
||||
private ImageView ivPic;
|
||||
private TextView tvHeader;
|
||||
private TextView tvDesc;
|
||||
public CardHolder(View itemView) {
|
||||
super(itemView);
|
||||
ivPic = itemView.findViewById(R.id.iv_card_pic);
|
||||
tvHeader = itemView.findViewById(R.id.tv_card_header);
|
||||
tvDesc = itemView.findViewById(R.id.tv_card_desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVariableLayout() {
|
||||
return R.layout.message_adapter_card;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutVariableViews(TUIMessageBean msg, int position) {
|
||||
CardMessageBean cardMessageBean = (CardMessageBean) msg;
|
||||
TUICustomerServicePresenter presenter = new TUICustomerServicePresenter();
|
||||
presenter.setMessage(cardMessageBean);
|
||||
CardBean cardBean = cardMessageBean.getCardBean();
|
||||
if (cardBean == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
tvHeader.setText(cardBean.getHeader());
|
||||
tvDesc.setText(cardBean.getDesc());
|
||||
GlideEngine.loadImageSetDefault(ivPic, cardBean.getPic(), R.drawable.product_picture_fail);
|
||||
msgContentFrame.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!TextUtils.isEmpty(cardBean.getUrl())) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("android.intent.action.VIEW");
|
||||
Uri contentUrl = Uri.parse(cardBean.getUrl());
|
||||
intent.setData(contentUrl);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
TUIChatService.getAppContext().startActivity(intent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.TUIReplyQuoteView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.face.FaceManager;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CardMessageReplyQuoteBean;
|
||||
|
||||
public class CardReplyView extends TUIReplyQuoteView<CardMessageReplyQuoteBean> {
|
||||
private TextView textView;
|
||||
|
||||
public CardReplyView(Context context) {
|
||||
super(context);
|
||||
textView = findViewById(R.id.text_quote_tv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResourceId() {
|
||||
return R.layout.card_reply_quote_text_layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawReplyQuote(CardMessageReplyQuoteBean quoteBean) {
|
||||
String text = quoteBean.getText();
|
||||
FaceManager.handlerEmojiText(textView, text, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CollectionBean;
|
||||
|
||||
public class CollectionFormItemHolder extends RecyclerView.ViewHolder {
|
||||
private View rootView;
|
||||
private TextView tvContent;
|
||||
private CollectionListAdapter adapter;
|
||||
public CollectionFormItemHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
rootView = itemView;
|
||||
tvContent = itemView.findViewById(R.id.collection_form_item_content);
|
||||
}
|
||||
|
||||
public void layoutViews(CollectionBean.FormItem item, int position) {
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
tvContent.setText(item.getContent());
|
||||
rootView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (adapter != null && adapter.getPresenter() != null && adapter.getPresenter().allowSelection()) {
|
||||
adapter.getPresenter().OnItemContentSelected(item.getContent());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setAdapter(CollectionListAdapter adapter) {
|
||||
this.adapter = adapter;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.MessageContentHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CollectionBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CollectionMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
|
||||
public class CollectionHolder extends MessageContentHolder {
|
||||
private ViewGroup vgCollectionForm;
|
||||
private ViewGroup vgCollectionSuggest;
|
||||
private TextView tvTitle;
|
||||
private CollectionListLayout listLayout;
|
||||
private EditText etSuggest;
|
||||
private TextView tvSendSuggest;
|
||||
|
||||
public CollectionHolder(View itemView) {
|
||||
super(itemView);
|
||||
vgCollectionForm = itemView.findViewById(R.id.ll_collection_form);
|
||||
vgCollectionSuggest = itemView.findViewById(R.id.rl_collection_suggest);
|
||||
tvTitle = itemView.findViewById(R.id.tv_collection_title);
|
||||
listLayout = itemView.findViewById(R.id.collection_item_list);
|
||||
etSuggest = itemView.findViewById(R.id.et_suggest);
|
||||
tvSendSuggest = itemView.findViewById(R.id.tv_send_suggest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVariableLayout() {
|
||||
return R.layout.message_adapter_collection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutVariableViews(TUIMessageBean msg, int position) {
|
||||
CollectionMessageBean collectionMessageBean = (CollectionMessageBean) msg;
|
||||
TUICustomerServicePresenter presenter = new TUICustomerServicePresenter();
|
||||
presenter.setMessage(collectionMessageBean);
|
||||
CollectionBean collectionBean = collectionMessageBean.getCollectionBean();
|
||||
if (collectionBean == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
CollectionBean.FormItem selectedItem = collectionBean.getSelectedItem();
|
||||
if (collectionBean.getType() == CollectionBean.COLLECTION_TYPE_FORM) {
|
||||
vgCollectionForm.setVisibility(View.VISIBLE);
|
||||
vgCollectionSuggest.setVisibility(View.GONE);
|
||||
if (TextUtils.isEmpty(collectionBean.getHead())) {
|
||||
tvTitle.setText("");
|
||||
tvTitle.setVisibility(View.GONE);
|
||||
} else {
|
||||
tvTitle.setVisibility(View.VISIBLE);
|
||||
tvTitle.setText(collectionBean.getHead());
|
||||
}
|
||||
listLayout.setPresenter(presenter);
|
||||
listLayout.setCollectionItemList(collectionBean.getItemList());
|
||||
} else if (collectionBean.getType() == CollectionBean.COLLECTION_TYPE_SUGGEST) {
|
||||
vgCollectionForm.setVisibility(View.GONE);
|
||||
vgCollectionSuggest.setVisibility(View.VISIBLE);
|
||||
if (selectedItem != null) {
|
||||
tvSendSuggest.setOnClickListener(null);
|
||||
etSuggest.setText(selectedItem.getContent());
|
||||
etSuggest.setEnabled(false);
|
||||
} else {
|
||||
etSuggest.setEnabled(true);
|
||||
tvSendSuggest.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String suggestContent = etSuggest.getText().toString();
|
||||
if (!TextUtils.isEmpty(suggestContent)) {
|
||||
presenter.sendTextMessage(msg.getUserId(), suggestContent);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CollectionBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CollectionListAdapter extends RecyclerView.Adapter {
|
||||
private TUICustomerServicePresenter presenter;
|
||||
private List<CollectionBean.FormItem> collectionFormItemList = new ArrayList<>();
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||
View rootView = inflater.inflate(R.layout.collection_form_item_layout, parent, false);
|
||||
CollectionFormItemHolder holder = new CollectionFormItemHolder(rootView);
|
||||
holder.setAdapter(this);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
CollectionBean.FormItem collectionFormItem = collectionFormItemList.get(position);
|
||||
CollectionFormItemHolder collectionItemHolder = (CollectionFormItemHolder) holder;
|
||||
collectionItemHolder.layoutViews(collectionFormItem, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return collectionFormItemList.size();
|
||||
}
|
||||
|
||||
public void setPresenter(TUICustomerServicePresenter presenter) {
|
||||
this.presenter = presenter;
|
||||
}
|
||||
|
||||
public TUICustomerServicePresenter getPresenter() {
|
||||
return this.presenter;
|
||||
}
|
||||
|
||||
public void setCollectionItemList(List<CollectionBean.FormItem> itemList) {
|
||||
this.collectionFormItemList = itemList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.CustomLinearLayoutManager;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CollectionBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
import java.util.List;
|
||||
|
||||
public class CollectionListLayout extends RecyclerView {
|
||||
private CollectionListAdapter adapter;
|
||||
|
||||
public CollectionListLayout(@NonNull Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public CollectionListLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public CollectionListLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setItemViewCacheSize(0);
|
||||
setHasFixedSize(true);
|
||||
CustomLinearLayoutManager linearLayoutManager = new CustomLinearLayoutManager(getContext());
|
||||
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
setLayoutManager(linearLayoutManager);
|
||||
SimpleItemAnimator animator = (SimpleItemAnimator) getItemAnimator();
|
||||
if (animator != null) {
|
||||
animator.setSupportsChangeAnimations(false);
|
||||
}
|
||||
|
||||
adapter = new CollectionListAdapter();
|
||||
super.setAdapter(adapter);
|
||||
}
|
||||
|
||||
public void setPresenter(TUICustomerServicePresenter presenter) {
|
||||
if (presenter != null) {
|
||||
adapter.setPresenter(presenter);
|
||||
}
|
||||
}
|
||||
|
||||
public void setCollectionItemList(List<CollectionBean.FormItem> itemList) {
|
||||
adapter.setCollectionItemList(itemList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.TUIReplyQuoteView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.face.FaceManager;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CollectionMessageReplyQuoteBean;
|
||||
|
||||
public class CollectionReplyView extends TUIReplyQuoteView<CollectionMessageReplyQuoteBean> {
|
||||
private TextView textView;
|
||||
|
||||
public CollectionReplyView(Context context) {
|
||||
super(context);
|
||||
textView = findViewById(R.id.text_quote_tv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResourceId() {
|
||||
return R.layout.collection_reply_quote_text_layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawReplyQuote(CollectionMessageReplyQuoteBean quoteBean) {
|
||||
String text = quoteBean.getText();
|
||||
FaceManager.handlerEmojiText(textView, text, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuicore.TUICore;
|
||||
import com.tencent.qcloud.tuicore.TUILogin;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.LineControllerView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.TitleBarLayout;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.dialog.TUIKitDialog;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.impl.GlideEngine;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.interfaces.ITitleBarLayout;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.interfaces.IUIKitCallback;
|
||||
import com.tencent.qcloud.tuikit.tuicontact.bean.ContactItemBean;
|
||||
import com.tencent.qcloud.tuikit.tuicontact.interfaces.IFriendProfileLayout;
|
||||
import com.tencent.qcloud.tuikit.tuicontact.presenter.FriendProfilePresenter;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CustomerServiceProfileLayout extends LinearLayout implements View.OnClickListener, IFriendProfileLayout {
|
||||
private static final String TAG = CustomerServiceProfileLayout.class.getSimpleName();
|
||||
|
||||
private static final int CHANGE_REMARK_CODE = 200;
|
||||
|
||||
private TitleBarLayout mTitleBar;
|
||||
private ImageView mHeadImageView;
|
||||
private TextView mNickNameView;
|
||||
private TextView mIDView;
|
||||
private TextView mSignatureView;
|
||||
private TextView mSignatureTagView;
|
||||
private LineControllerView mMessageOptionView;
|
||||
private Button clearMessageBtn;
|
||||
private ContactItemBean mContactInfo;
|
||||
private String mId;
|
||||
private String mNickname;
|
||||
|
||||
private FriendProfilePresenter presenter;
|
||||
|
||||
public CustomerServiceProfileLayout(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
}
|
||||
|
||||
public CustomerServiceProfileLayout(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
}
|
||||
|
||||
public CustomerServiceProfileLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
public void setPresenter(FriendProfilePresenter presenter) {
|
||||
this.presenter = presenter;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
inflate(getContext(), R.layout.customer_service_profile_layout, this);
|
||||
|
||||
mHeadImageView = findViewById(R.id.customer_service_icon);
|
||||
mNickNameView = findViewById(R.id.customer_service_nick_name);
|
||||
mIDView = findViewById(R.id.customer_service_account);
|
||||
mSignatureTagView = findViewById(R.id.customer_service_signature_tag);
|
||||
mSignatureView = findViewById(R.id.customer_service_signature);
|
||||
mMessageOptionView = findViewById(R.id.customer_service_msg_rev_opt);
|
||||
mMessageOptionView.setOnClickListener(this);
|
||||
clearMessageBtn = findViewById(R.id.btn_customer_service_clear_chat_history);
|
||||
clearMessageBtn.setOnClickListener(this);
|
||||
|
||||
mTitleBar = findViewById(R.id.customer_service_titlebar);
|
||||
mTitleBar.setTitle(getResources().getString(com.tencent.qcloud.tuikit.tuicontact.R.string.profile_detail), ITitleBarLayout.Position.MIDDLE);
|
||||
mTitleBar.getRightGroup().setVisibility(View.GONE);
|
||||
mTitleBar.setOnLeftClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
((Activity) getContext()).finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void initData(Object data) {
|
||||
if (data instanceof String) {
|
||||
mId = (String) data;
|
||||
loadUserProfile(mId);
|
||||
} else if (data instanceof ContactItemBean) {
|
||||
setViewContentFromItemBean((ContactItemBean) data);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(mNickname)) {
|
||||
mNickNameView.setText(mNickname);
|
||||
} else {
|
||||
mNickNameView.setText(mId);
|
||||
}
|
||||
mIDView.setText(mId);
|
||||
}
|
||||
|
||||
private void setViewContentFromItemBean(ContactItemBean data) {
|
||||
mContactInfo = data;
|
||||
mId = mContactInfo.getId();
|
||||
mNickname = mContactInfo.getNickName();
|
||||
mSignatureView.setText(mContactInfo.getSignature());
|
||||
if (TextUtils.isEmpty(mContactInfo.getSignature())) {
|
||||
mSignatureTagView.setText(getResources().getString(com.tencent.qcloud.tuikit.tuicontact.R.string.contact_no_status));
|
||||
} else {
|
||||
mSignatureTagView.setText(getResources().getString(com.tencent.qcloud.tuikit.tuicontact.R.string.contact_signature_tag));
|
||||
}
|
||||
int radius = getResources().getDimensionPixelSize(com.tencent.qcloud.tuikit.tuicontact.R.dimen.contact_profile_face_radius);
|
||||
GlideEngine.loadUserIcon(mHeadImageView, mContactInfo.getAvatarUrl(), radius);
|
||||
|
||||
clearMessageBtn.setVisibility(VISIBLE);
|
||||
|
||||
if (!TextUtils.equals(mContactInfo.getId(), TUILogin.getLoginUser())) {
|
||||
updateMessageOptionView();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMessageOptionView() {
|
||||
mMessageOptionView.setVisibility(VISIBLE);
|
||||
// get
|
||||
final ArrayList<String> userIdList = new ArrayList<>();
|
||||
userIdList.add(mId);
|
||||
|
||||
presenter.getC2CReceiveMessageOpt(userIdList, new IUIKitCallback<Boolean>() {
|
||||
@Override
|
||||
public void onSuccess(Boolean data) {
|
||||
mMessageOptionView.setChecked(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String module, int errCode, String errMsg) {
|
||||
mMessageOptionView.setChecked(false);
|
||||
}
|
||||
});
|
||||
|
||||
// set
|
||||
mMessageOptionView.setCheckListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
presenter.setC2CReceiveMessageOpt(userIdList, isChecked);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataSourceChanged(ContactItemBean bean) {
|
||||
setViewContentFromItemBean(bean);
|
||||
if (bean.isFriend()) {
|
||||
updateMessageOptionView();
|
||||
clearMessageBtn.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(mNickname)) {
|
||||
mNickNameView.setText(mNickname);
|
||||
} else {
|
||||
mNickNameView.setText(mId);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(bean.getAvatarUrl())) {
|
||||
int radius = getResources().getDimensionPixelSize(com.tencent.qcloud.tuikit.tuicontact.R.dimen.contact_profile_face_radius);
|
||||
GlideEngine.loadUserIcon(mHeadImageView, bean.getAvatarUrl(), radius);
|
||||
}
|
||||
mIDView.setText(mId);
|
||||
}
|
||||
|
||||
private void loadUserProfile(String id) {
|
||||
final ContactItemBean bean = new ContactItemBean();
|
||||
presenter.getUsersInfo(id, bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v == clearMessageBtn) {
|
||||
new TUIKitDialog(getContext())
|
||||
.builder()
|
||||
.setCancelable(true)
|
||||
.setCancelOutside(true)
|
||||
.setTitle(getContext().getString(com.tencent.qcloud.tuikit.tuichat.R.string.clear_msg_tip))
|
||||
.setDialogWidth(0.75f)
|
||||
.setPositiveButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.sure),
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Map<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put(TUIConstants.TUIContact.FRIEND_ID, mId);
|
||||
TUICore.notifyEvent(TUIConstants.TUIContact.EVENT_USER, TUIConstants.TUIContact.EVENT_SUB_KEY_CLEAR_C2C_MESSAGE, hashMap);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.cancel),
|
||||
new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.qcloud.tuicore.TUIThemeManager;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.MessageBaseHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.EvaluationBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.EvaluationMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class EvaluationHolder extends MessageBaseHolder {
|
||||
private final String TAG = EvaluationHolder.class.getSimpleName();
|
||||
private static final int UNSELECT = -1;
|
||||
private View rootView;
|
||||
private ViewGroup llStar, llNumber;
|
||||
private ImageView ivStar1, ivStar2, ivStar3, ivStar4, ivStar5;
|
||||
private TextView tvNumber1, tvNumber2, tvNumber3, tvNumber4, tvNumber5;
|
||||
private View vNumberFloatLayer1, vNumberFloatLayer2, vNumberFloatLayer3, vNumberFloatLayer4, vNumberFloatLayer5;
|
||||
private View vStarFloatLayer1, vStarFloatLayer2, vStarFloatLayer3, vStarFloatLayer4, vStarFloatLayer5;
|
||||
private List<ImageView> ivStarList = new ArrayList<>();
|
||||
private List<TextView> tvNumberList = new ArrayList<>();
|
||||
private List<View> numberFloatLayerList = new ArrayList<>();
|
||||
private List<View> starFloatLayerList = new ArrayList<>();
|
||||
private TextView tvInviteToEvaluation;
|
||||
private TextView tvEvaluationTail;
|
||||
private TextView tvSubmitEvaluation;
|
||||
private View vSubmitEvaluationFloatLayer;
|
||||
private int selectedIndex = -1;
|
||||
|
||||
public EvaluationHolder(View itemView) {
|
||||
super(itemView);
|
||||
rootView = itemView;
|
||||
tvInviteToEvaluation = itemView.findViewById(R.id.tv_invite_to_evaluation);
|
||||
tvEvaluationTail = itemView.findViewById(R.id.tv_evaluation_tail);
|
||||
tvSubmitEvaluation = itemView.findViewById(R.id.tv_submit_evaluation);
|
||||
vSubmitEvaluationFloatLayer = itemView.findViewById(R.id.tv_submit_evaluation_float_layer);
|
||||
llStar = itemView.findViewById(R.id.ll_star);
|
||||
llNumber = itemView.findViewById(R.id.ll_number);
|
||||
|
||||
ivStar1 = itemView.findViewById(R.id.iv_star1);
|
||||
ivStar2 = itemView.findViewById(R.id.iv_star2);
|
||||
ivStar3 = itemView.findViewById(R.id.iv_star3);
|
||||
ivStar4 = itemView.findViewById(R.id.iv_star4);
|
||||
ivStar5 = itemView.findViewById(R.id.iv_star5);
|
||||
ivStarList.add(ivStar1);
|
||||
ivStarList.add(ivStar2);
|
||||
ivStarList.add(ivStar3);
|
||||
ivStarList.add(ivStar4);
|
||||
ivStarList.add(ivStar5);
|
||||
|
||||
tvNumber1 = itemView.findViewById(R.id.tv_number1);
|
||||
tvNumber2 = itemView.findViewById(R.id.tv_number2);
|
||||
tvNumber3 = itemView.findViewById(R.id.tv_number3);
|
||||
tvNumber4 = itemView.findViewById(R.id.tv_number4);
|
||||
tvNumber5 = itemView.findViewById(R.id.tv_number5);
|
||||
tvNumberList.add(tvNumber1);
|
||||
tvNumberList.add(tvNumber2);
|
||||
tvNumberList.add(tvNumber3);
|
||||
tvNumberList.add(tvNumber4);
|
||||
tvNumberList.add(tvNumber5);
|
||||
|
||||
vNumberFloatLayer1 = itemView.findViewById(R.id.v_number1_float_layer);
|
||||
vNumberFloatLayer2 = itemView.findViewById(R.id.v_number2_float_layer);
|
||||
vNumberFloatLayer3 = itemView.findViewById(R.id.v_number3_float_layer);
|
||||
vNumberFloatLayer4 = itemView.findViewById(R.id.v_number4_float_layer);
|
||||
vNumberFloatLayer5 = itemView.findViewById(R.id.v_number5_float_layer);
|
||||
numberFloatLayerList.add(vNumberFloatLayer1);
|
||||
numberFloatLayerList.add(vNumberFloatLayer2);
|
||||
numberFloatLayerList.add(vNumberFloatLayer3);
|
||||
numberFloatLayerList.add(vNumberFloatLayer4);
|
||||
numberFloatLayerList.add(vNumberFloatLayer5);
|
||||
|
||||
vStarFloatLayer1 = itemView.findViewById(R.id.v_star1_float_layer);
|
||||
vStarFloatLayer2 = itemView.findViewById(R.id.v_star2_float_layer);
|
||||
vStarFloatLayer3 = itemView.findViewById(R.id.v_star3_float_layer);
|
||||
vStarFloatLayer4 = itemView.findViewById(R.id.v_star4_float_layer);
|
||||
vStarFloatLayer5 = itemView.findViewById(R.id.v_star5_float_layer);
|
||||
starFloatLayerList.add(vStarFloatLayer1);
|
||||
starFloatLayerList.add(vStarFloatLayer2);
|
||||
starFloatLayerList.add(vStarFloatLayer3);
|
||||
starFloatLayerList.add(vStarFloatLayer4);
|
||||
starFloatLayerList.add(vStarFloatLayer5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVariableLayout() {
|
||||
return R.layout.message_adapter_evaluation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutViews(TUIMessageBean msg, int position) {
|
||||
EvaluationMessageBean evaluationMessageBean = (EvaluationMessageBean) msg;
|
||||
TUICustomerServicePresenter presenter = new TUICustomerServicePresenter();
|
||||
presenter.setMessage(evaluationMessageBean);
|
||||
EvaluationBean evaluationBean = evaluationMessageBean.getEvaluationBean();
|
||||
if (evaluationBean == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EvaluationBean.Menu selectedMenu = evaluationBean.getSelectedMenu();
|
||||
int expiredTime = evaluationBean.getExpireTime();
|
||||
tvInviteToEvaluation.setText(evaluationBean.getHead());
|
||||
if (!TextUtils.isEmpty(evaluationBean.getTail())) {
|
||||
tvEvaluationTail.setText(evaluationBean.getTail());
|
||||
}
|
||||
|
||||
if (selectedMenu == null) {
|
||||
|
||||
tvEvaluationTail.setVisibility(View.GONE);
|
||||
} else {
|
||||
|
||||
tvEvaluationTail.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (evaluationBean.getType() == EvaluationBean.EVALUATION_TYPE_STAR) {
|
||||
llStar.setVisibility(View.VISIBLE);
|
||||
llNumber.setVisibility(View.GONE);
|
||||
} else {
|
||||
llStar.setVisibility(View.GONE);
|
||||
llNumber.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
tvSubmitEvaluation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (selectedIndex == UNSELECT) {
|
||||
return;
|
||||
}
|
||||
|
||||
EvaluationBean.Menu submitMenu = evaluationBean.getMenuList().get(selectedIndex);
|
||||
presenter.sendEvaluationMessage(submitMenu, evaluationBean.getSessionID());
|
||||
}
|
||||
});
|
||||
|
||||
if (selectedMenu == null && V2TIMManager.getInstance().getServerTime() < expiredTime && selectedIndex != UNSELECT) {
|
||||
|
||||
vSubmitEvaluationFloatLayer.setVisibility(View.GONE);
|
||||
tvSubmitEvaluation.setClickable(true);
|
||||
} else {
|
||||
|
||||
vSubmitEvaluationFloatLayer.setVisibility(View.VISIBLE);
|
||||
tvSubmitEvaluation.setClickable(false);
|
||||
}
|
||||
|
||||
if (selectedMenu == null && V2TIMManager.getInstance().getServerTime() < expiredTime) {
|
||||
|
||||
if (evaluationBean.getType() == EvaluationBean.EVALUATION_TYPE_STAR) {
|
||||
for (int i = 0; i < ivStarList.size(); i++) {
|
||||
ivStarList.get(i).setBackgroundResource(R.drawable.evaluation_star_default);
|
||||
starFloatLayerList.get(i).setVisibility(View.GONE);
|
||||
int finalI = i;
|
||||
ivStarList.get(i).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
selectedIndex = finalI;
|
||||
|
||||
vSubmitEvaluationFloatLayer.setVisibility(View.GONE);
|
||||
tvSubmitEvaluation.setClickable(true);
|
||||
for (int j = 0; j < ivStarList.size(); j++) {
|
||||
if (j <= finalI) {
|
||||
ivStarList.get(j).setBackgroundResource(R.drawable.evaluation_star_active);
|
||||
} else {
|
||||
ivStarList.get(j).setBackgroundResource(R.drawable.evaluation_star_default);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < tvNumberList.size(); i++) {
|
||||
int finalI = i;
|
||||
tvNumberList.get(i).setBackgroundResource(TUIThemeManager.getAttrResId(rootView.getContext(), R.attr.number_default_bg));
|
||||
tvNumberList.get(i).setTextColor(
|
||||
rootView.getResources().getColor(TUIThemeManager.getAttrResId(rootView.getContext(), R.attr.number_default_color)));
|
||||
numberFloatLayerList.get(i).setVisibility(View.GONE);
|
||||
tvNumberList.get(i).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
selectedIndex = finalI;
|
||||
|
||||
vSubmitEvaluationFloatLayer.setVisibility(View.GONE);
|
||||
tvSubmitEvaluation.setClickable(true);
|
||||
for (int j = 0; j < tvNumberList.size(); j++) {
|
||||
if (j <= finalI) {
|
||||
tvNumberList.get(j).setBackgroundResource(R.drawable.evaluation_number_active_bg_light);
|
||||
tvNumberList.get(j).setTextColor(rootView.getResources().getColor(R.color.evaluation_number_active_color));
|
||||
} else {
|
||||
tvNumberList.get(j).setBackgroundResource(
|
||||
TUIThemeManager.getAttrResId(rootView.getContext(), R.attr.number_default_bg));
|
||||
tvNumberList.get(j).setTextColor(rootView.getResources().getColor(
|
||||
TUIThemeManager.getAttrResId(rootView.getContext(), R.attr.number_default_color)));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
List<EvaluationBean.Menu> menuList = evaluationBean.getMenuList();
|
||||
if (menuList == null || menuList.isEmpty() || menuList.size() > 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < menuList.size(); i++) {
|
||||
ivStarList.get(i).setOnClickListener(null);
|
||||
tvNumberList.get(i).setOnClickListener(null);
|
||||
int selectedMenuID = 0;
|
||||
if (selectedMenu != null) {
|
||||
selectedMenuID = Integer.valueOf(selectedMenu.getId());
|
||||
}
|
||||
|
||||
if (Integer.valueOf(menuList.get(i).getId()) <= selectedMenuID) {
|
||||
if (evaluationBean.getType() == EvaluationBean.EVALUATION_TYPE_STAR) {
|
||||
ivStarList.get(i).setBackgroundResource(R.drawable.evaluation_star_active);
|
||||
starFloatLayerList.get(i).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
tvNumberList.get(i).setBackgroundResource(TUIThemeManager.getAttrResId(rootView.getContext(), R.attr.evaluation_number_active_bg));
|
||||
tvNumberList.get(i).setTextColor(rootView.getResources().getColor(R.color.evaluation_number_active_color));
|
||||
numberFloatLayerList.get(i).setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
if (evaluationBean.getType() == EvaluationBean.EVALUATION_TYPE_STAR) {
|
||||
ivStarList.get(i).setBackgroundResource(R.drawable.evaluation_star_default);
|
||||
starFloatLayerList.get(i).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
tvNumberList.get(i).setBackgroundResource(TUIThemeManager.getAttrResId(rootView.getContext(), R.attr.number_default_bg));
|
||||
tvNumberList.get(i).setTextColor(
|
||||
rootView.getResources().getColor(TUIThemeManager.getAttrResId(rootView.getContext(), R.attr.number_default_color)));
|
||||
numberFloatLayerList.get(i).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.TUIReplyQuoteView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.face.FaceManager;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.EvaluationMessageReplyQuoteBean;
|
||||
|
||||
public class EvaluationReplyView extends TUIReplyQuoteView<EvaluationMessageReplyQuoteBean> {
|
||||
private TextView textView;
|
||||
|
||||
public EvaluationReplyView(Context context) {
|
||||
super(context);
|
||||
textView = findViewById(R.id.text_quote_tv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutResourceId() {
|
||||
return R.layout.evaluation_reply_quote_text_layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawReplyQuote(EvaluationMessageReplyQuoteBean quoteBean) {
|
||||
String text = quoteBean.getText();
|
||||
FaceManager.handlerEmojiText(textView, text, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServiceConstants;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServicePluginService;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.component.CommonPhrasesPopupCard;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.config.TUICustomerServiceConfig;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.config.TUICustomerServiceProductInfo;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.config.TUIInputViewFloatLayerData;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter.TUICustomerServicePresenter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class InputViewFloatLayerProxy {
|
||||
private RecyclerView rvFloatLayer;
|
||||
private ChatInfo chatInfo;
|
||||
public InputViewFloatLayerProxy(ChatInfo chatInfo) {
|
||||
this.chatInfo = chatInfo;
|
||||
initDataList();
|
||||
}
|
||||
|
||||
private void initDataList() {
|
||||
List<TUIInputViewFloatLayerData> dataList = new ArrayList<>();
|
||||
TUIInputViewFloatLayerData productInfoData = new TUIInputViewFloatLayerData();
|
||||
productInfoData.setContent(TUICustomerServicePluginService.getAppContext().getString(R.string.send_product_info));
|
||||
productInfoData.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
TUICustomerServicePresenter presenter = new TUICustomerServicePresenter();
|
||||
TUICustomerServiceProductInfo productInfo = TUICustomerServiceConfig.getInstance().getProductInfo();
|
||||
presenter.sendProductMessage(chatInfo.getId(), productInfo);
|
||||
}
|
||||
});
|
||||
dataList.add(productInfoData);
|
||||
|
||||
TUIInputViewFloatLayerData commonPhrasesData = new TUIInputViewFloatLayerData();
|
||||
commonPhrasesData.setContent(TUICustomerServicePluginService.getAppContext().getString(R.string.common_phrases));
|
||||
commonPhrasesData.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
showCommonPhrasesView();
|
||||
}
|
||||
});
|
||||
dataList.add(commonPhrasesData);
|
||||
|
||||
TUICustomerServiceConfig.getInstance().setInputViewFloatLayerDataList(dataList);
|
||||
}
|
||||
|
||||
public void showFloatLayerContent(ViewGroup viewGroup) {
|
||||
if (chatInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
viewGroup.setVisibility(View.VISIBLE);
|
||||
LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.input_view_float_layer_content_view, viewGroup);
|
||||
rvFloatLayer = viewGroup.findViewById(R.id.rv_float_layer);
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(viewGroup.getContext());
|
||||
linearLayoutManager.setOrientation(RecyclerView.HORIZONTAL);
|
||||
rvFloatLayer.setLayoutManager(linearLayoutManager);
|
||||
|
||||
List<TUIInputViewFloatLayerData> dataList = TUICustomerServiceConfig.getInstance().getInputViewFloatLayerDataList();
|
||||
FloatLayerAdapter floatLayerAdapter = new FloatLayerAdapter(dataList);
|
||||
rvFloatLayer.setAdapter(floatLayerAdapter);
|
||||
floatLayerAdapter.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View view, int position) {
|
||||
TUIInputViewFloatLayerData data = dataList.get(position);
|
||||
data.getOnItemClickListener().onItemClick(view, position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showCommonPhrasesView() {
|
||||
CommonPhrasesPopupCard commonPhrasesPopupCard = new CommonPhrasesPopupCard((Activity) rvFloatLayer.getContext());
|
||||
String[] commonPhrasesArray = TUICustomerServicePluginService.getAppContext().getResources().getStringArray(R.array.common_phrases_list);
|
||||
List<String> dataList = Arrays.asList(commonPhrasesArray);
|
||||
commonPhrasesPopupCard.setDataList(dataList);
|
||||
commonPhrasesPopupCard.setOnClickListener(new CommonPhrasesPopupCard.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(String content) {
|
||||
TUICustomerServicePresenter presenter = new TUICustomerServicePresenter();
|
||||
presenter.sendTextMessage(chatInfo.getId(), content);
|
||||
}
|
||||
});
|
||||
|
||||
commonPhrasesPopupCard.show(rvFloatLayer, Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
public class FloatLayerAdapter extends RecyclerView.Adapter<FloatLayerAdapter.ViewHolder> {
|
||||
private List<TUIInputViewFloatLayerData> mDataList;
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvFloatLayer;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
tvFloatLayer = itemView.findViewById(R.id.tv_float_layer);
|
||||
}
|
||||
}
|
||||
|
||||
public FloatLayerAdapter(List<TUIInputViewFloatLayerData> dataList) {
|
||||
this.mDataList = dataList;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.float_layer_item, parent, false);
|
||||
ViewHolder holder = new ViewHolder(view);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
TUIInputViewFloatLayerData data = mDataList.get(position);
|
||||
holder.tvFloatLayer.setText(data.getContent());
|
||||
holder.tvFloatLayer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick(view, holder.getBindingAdapterPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (mDataList != null) {
|
||||
return mDataList.size();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.onItemClickListener = listener;
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(View view, int position);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.MessageContentHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
|
||||
public class InvisibleHolder extends MessageContentHolder {
|
||||
private View rootView;
|
||||
public InvisibleHolder(View itemView) {
|
||||
super(itemView);
|
||||
rootView = itemView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVariableLayout() {
|
||||
return R.layout.message_adapter_invisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutVariableViews(TUIMessageBean msg, int position) {
|
||||
RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.height = 0;
|
||||
params.width = 0;
|
||||
rootView.setVisibility(View.GONE);
|
||||
rootView.setLayoutParams(params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.impl.GlideEngine;
|
||||
import com.tencent.qcloud.tuikit.tuicontact.bean.ContactItemBean;
|
||||
import com.tencent.qcloud.tuikit.tuicontact.classicui.util.ClassicUIUtils;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import java.util.List;
|
||||
|
||||
public class MemberListAdapter extends ArrayAdapter<V2TIMUserFullInfo> {
|
||||
private int mResourceID;
|
||||
private View mView;
|
||||
private ViewHolder mViewHolder;
|
||||
|
||||
public MemberListAdapter(@NonNull Context context, int resource, @NonNull List<V2TIMUserFullInfo> objects) {
|
||||
super(context, resource, objects);
|
||||
mResourceID = resource;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
|
||||
V2TIMUserFullInfo userInfo = getItem(position);
|
||||
if (convertView != null) {
|
||||
mView = convertView;
|
||||
mViewHolder = (ViewHolder) mView.getTag();
|
||||
} else {
|
||||
mView = LayoutInflater.from(getContext()).inflate(mResourceID, null);
|
||||
mView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ClassicUIUtils.startChatActivity(userInfo.getUserID(), ContactItemBean.TYPE_C2C, userInfo.getNickName(), "");
|
||||
}
|
||||
});
|
||||
mViewHolder = new ViewHolder();
|
||||
mViewHolder.avatar = mView.findViewById(R.id.customer_service_member_avatar);
|
||||
mViewHolder.name = mView.findViewById(R.id.customer_service_member_name);
|
||||
mView.setTag(mViewHolder);
|
||||
}
|
||||
|
||||
Resources res = getContext().getResources();
|
||||
int radius = res.getDimensionPixelSize(com.tencent.qcloud.tuikit.tuicontact.R.dimen.contact_profile_face_radius);
|
||||
GlideEngine.loadUserIcon(mViewHolder.avatar, userInfo.getFaceUrl(), radius);
|
||||
mViewHolder.name.setText(TextUtils.isEmpty(userInfo.getNickName()) ? userInfo.getUserID() : userInfo.getNickName());
|
||||
return mView;
|
||||
}
|
||||
|
||||
public class ViewHolder {
|
||||
ImageView avatar;
|
||||
TextView name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.classicui.widget.message.MessageContentHolder;
|
||||
import com.tencent.qcloud.tuikit.timcommon.util.TUIUtil;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.RichTextMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.CustomLinkSpanFactory;
|
||||
|
||||
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||
import io.noties.markwon.Markwon;
|
||||
import io.noties.markwon.MarkwonSpansFactory;
|
||||
import io.noties.markwon.image.AsyncDrawable;
|
||||
import io.noties.markwon.image.glide.GlideImagesPlugin;
|
||||
import io.noties.markwon.movement.MovementMethodPlugin;
|
||||
import org.commonmark.node.Link;
|
||||
|
||||
public class RichTextHolder extends MessageContentHolder {
|
||||
private TextView markdownTextView;
|
||||
private Markwon markwon;
|
||||
public RichTextHolder(View itemView) {
|
||||
super(itemView);
|
||||
markdownTextView = itemView.findViewById(R.id.rich_text_view);
|
||||
Context context = itemView.getContext();
|
||||
if (!TUIUtil.isActivityDestroyed(context)) {
|
||||
markwon = Markwon.builder(context)
|
||||
.usePlugin(GlideImagesPlugin.create(context))
|
||||
.usePlugin(MovementMethodPlugin.link())
|
||||
.usePlugin(new AbstractMarkwonPlugin() {
|
||||
@Override
|
||||
public void configureSpansFactory(@NonNull MarkwonSpansFactory.Builder builder) {
|
||||
builder.setFactory(Link.class, new CustomLinkSpanFactory());
|
||||
}
|
||||
})
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVariableLayout() {
|
||||
return R.layout.bot_rich_text_layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutVariableViews(TUIMessageBean msg, int position) {
|
||||
int paddingHorizontal = itemView.getResources().getDimensionPixelSize(com.tencent.qcloud.tuikit.timcommon.R.dimen.chat_message_area_padding_left_right);
|
||||
int paddingVertical = itemView.getResources().getDimensionPixelSize(com.tencent.qcloud.tuikit.timcommon.R.dimen.chat_message_area_padding_top_bottom);
|
||||
msgArea.setPaddingRelative(paddingHorizontal, paddingVertical, paddingHorizontal, paddingVertical);
|
||||
|
||||
RichTextMessageBean richTextMessageBean = (RichTextMessageBean) msg;
|
||||
if (markwon != null) {
|
||||
markwon.setMarkdown(markdownTextView, richTextMessageBean.getExtra());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.reply.TextReplyQuoteView;
|
||||
|
||||
public class RichTextReplyQuoteView extends TextReplyQuoteView {
|
||||
public RichTextReplyQuoteView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.tencent.qcloud.tuicore.TUIThemeManager;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.face.FaceManager;
|
||||
import com.tencent.qcloud.tuikit.tuichat.TUIChatService;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.message.TextMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.MessageRecyclerView;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.viewholder.TextMessageHolder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.StreamTextMessageBean;
|
||||
|
||||
public class StreamTextHolder extends TextMessageHolder {
|
||||
private Handler handler;
|
||||
private Runnable runnable;
|
||||
|
||||
public StreamTextHolder(View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getVariableLayout() {
|
||||
return super.getVariableLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void layoutVariableViews(TUIMessageBean msg, int position) {
|
||||
StreamTextMessageBean streamTextMessageBean = (StreamTextMessageBean)msg;
|
||||
|
||||
if (streamTextMessageBean.getMessageSource() != TUIMessageBean.MSG_SOURCE_ONLINE_PUSH) {
|
||||
streamTextMessageBean.setExtra(streamTextMessageBean.getContent());
|
||||
streamTextMessageBean.setDisplayedContentLength(streamTextMessageBean.getContent().length());
|
||||
refreshUI(msg, position);
|
||||
return;
|
||||
}
|
||||
|
||||
int repeatTime = 50;
|
||||
if (handler == null) {
|
||||
handler = new Handler();
|
||||
}
|
||||
|
||||
if (runnable == null) {
|
||||
runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String content = streamTextMessageBean.getContent();
|
||||
int displayedContentLength = streamTextMessageBean.getDisplayedContentLength();
|
||||
if (displayedContentLength >= content.length()) {
|
||||
return;
|
||||
}
|
||||
|
||||
displayedContentLength++;
|
||||
streamTextMessageBean.setDisplayedContentLength(displayedContentLength);
|
||||
String displayedContent = content.substring(0, displayedContentLength);
|
||||
streamTextMessageBean.setExtra(displayedContent);
|
||||
refreshUI(msg, position);
|
||||
|
||||
|
||||
MessageRecyclerView messageRecyclerView = (MessageRecyclerView)getRecyclerView();
|
||||
boolean canScrolledToBottom = messageRecyclerView.canScrollVertically(1);
|
||||
|
||||
if (!canScrolledToBottom && position == (messageRecyclerView.getAdapter().getItemCount() - 1)) {
|
||||
((MessageRecyclerView)getRecyclerView()).scrollToEnd();
|
||||
}
|
||||
|
||||
handler.postDelayed(this, repeatTime);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
handler.removeCallbacks(runnable);
|
||||
handler.postDelayed(runnable, repeatTime);
|
||||
}
|
||||
|
||||
private void refreshUI(TUIMessageBean msg, int position) {
|
||||
if (!(msg instanceof TextMessageBean)) {
|
||||
return;
|
||||
}
|
||||
if (hasRiskContent) {
|
||||
setRiskContent(itemView.getResources().getString(com.tencent.qcloud.tuikit.tuichat.R.string.chat_risk_send_message_failed_alert));
|
||||
}
|
||||
TextMessageBean textMessageBean = (TextMessageBean) msg;
|
||||
|
||||
if (isForwardMode || isReplyDetailMode || !textMessageBean.isSelf()) {
|
||||
int otherTextColorResId = TUIThemeManager.getAttrResId(msgBodyText.getContext(),
|
||||
com.tencent.qcloud.tuikit.tuichat.R.attr.chat_other_msg_text_color);
|
||||
int otherTextColor = msgBodyText.getResources().getColor(otherTextColorResId);
|
||||
msgBodyText.setTextColor(otherTextColor);
|
||||
} else {
|
||||
int selfTextColorResId = TUIThemeManager.getAttrResId(msgBodyText.getContext(), com.tencent.qcloud.tuikit.tuichat.R.attr.chat_self_msg_text_color);
|
||||
int selfTextColor = msgBodyText.getResources().getColor(selfTextColorResId);
|
||||
msgBodyText.setTextColor(selfTextColor);
|
||||
}
|
||||
|
||||
msgBodyText.setVisibility(View.VISIBLE);
|
||||
applyCustomConfig();
|
||||
|
||||
msgArea.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
if (selectionHelper != null) {
|
||||
selectionHelper.selectAll();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (textMessageBean.getText() != null) {
|
||||
FaceManager.handlerEmojiText(msgBodyText, textMessageBean.getText(), false);
|
||||
} else if (!TextUtils.isEmpty(textMessageBean.getExtra())) {
|
||||
FaceManager.handlerEmojiText(msgBodyText, textMessageBean.getExtra(), false);
|
||||
} else {
|
||||
FaceManager.handlerEmojiText(msgBodyText, TUIChatService.getAppContext().getString(com.tencent.qcloud.tuikit.tuichat.R.string.no_support_msg), false);
|
||||
}
|
||||
if (isForwardMode || isReplyDetailMode) {
|
||||
return;
|
||||
}
|
||||
setSelectionHelper(msg, msgBodyText, position);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.widget.message.reply.TextReplyQuoteView;
|
||||
|
||||
public class StreamTextReplyQuoteView extends TextReplyQuoteView {
|
||||
public StreamTextReplyQuoteView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.component;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.app.Activity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.tencent.qcloud.tuikit.timcommon.util.SoftKeyBoardUtil;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CommonPhrasesPopupCard {
|
||||
private PopupWindow popupWindow;
|
||||
private RecyclerView rvCommonPhrases;
|
||||
private CommonPhrasesAdapter commonPhrasesAdapter;
|
||||
private OnClickListener onClickListener;
|
||||
public CommonPhrasesPopupCard(Activity activity) {
|
||||
View popupView = LayoutInflater.from(activity).inflate(R.layout.popup_card_common_phrases, null);
|
||||
rvCommonPhrases = popupView.findViewById(R.id.rv_common_phrases);
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(activity);
|
||||
linearLayoutManager.setOrientation(RecyclerView.VERTICAL);
|
||||
rvCommonPhrases.setLayoutManager(linearLayoutManager);
|
||||
|
||||
commonPhrasesAdapter = new CommonPhrasesAdapter();
|
||||
rvCommonPhrases.setAdapter(commonPhrasesAdapter);
|
||||
popupWindow = new PopupWindow(popupView, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT, true) {
|
||||
@Override
|
||||
public void showAtLocation(View anchor, int gravity, int x, int y) {
|
||||
if (activity != null && !activity.isFinishing()) {
|
||||
Window dialogWindow = activity.getWindow();
|
||||
startAnimation(dialogWindow, true);
|
||||
}
|
||||
super.showAtLocation(anchor, gravity, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (activity != null && !activity.isFinishing()) {
|
||||
Window dialogWindow = activity.getWindow();
|
||||
startAnimation(dialogWindow, false);
|
||||
}
|
||||
|
||||
super.dismiss();
|
||||
}
|
||||
};
|
||||
popupWindow.setBackgroundDrawable(null);
|
||||
popupWindow.setTouchable(true);
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
popupWindow.setAnimationStyle(com.tencent.qcloud.tuikit.timcommon.R.style.PopupInputCardAnim);
|
||||
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
|
||||
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
if (activity.getWindow() != null) {
|
||||
SoftKeyBoardUtil.hideKeyBoard(activity.getWindow());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setDataList(List<String> dataList) {
|
||||
commonPhrasesAdapter.setDataList(dataList);
|
||||
}
|
||||
|
||||
private void startAnimation(Window window, boolean isShow) {
|
||||
ValueAnimator animator;
|
||||
if (isShow) {
|
||||
animator = ValueAnimator.ofFloat(1.0f, 0.5f);
|
||||
} else {
|
||||
animator = ValueAnimator.ofFloat(0.5f, 1.0f);
|
||||
}
|
||||
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.alpha = (float) animation.getAnimatedValue();
|
||||
window.setAttributes(lp);
|
||||
}
|
||||
});
|
||||
LinearInterpolator interpolator = new LinearInterpolator();
|
||||
animator.setDuration(200);
|
||||
animator.setInterpolator(interpolator);
|
||||
animator.start();
|
||||
}
|
||||
|
||||
public void show(View rootView, int gravity) {
|
||||
if (popupWindow != null) {
|
||||
popupWindow.showAtLocation(rootView, gravity, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public class CommonPhrasesAdapter extends RecyclerView.Adapter<CommonPhrasesAdapter.ViewHolder> {
|
||||
private List<String> mDataList = new ArrayList<>();
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvCommonPhrases;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
tvCommonPhrases = itemView.findViewById(R.id.tv_common_phrases);
|
||||
}
|
||||
}
|
||||
|
||||
public CommonPhrasesAdapter() {}
|
||||
|
||||
public void setDataList(List<String> dataList) {
|
||||
this.mDataList = dataList;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public CommonPhrasesAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.common_phrases_item, parent, false);
|
||||
CommonPhrasesAdapter.ViewHolder holder = new CommonPhrasesAdapter.ViewHolder(view);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CommonPhrasesAdapter.ViewHolder holder, int position) {
|
||||
String content = mDataList.get(position);
|
||||
holder.tvCommonPhrases.setText(content);
|
||||
holder.tvCommonPhrases.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
popupWindow.dismiss();
|
||||
if (onClickListener != null) {
|
||||
onClickListener.onClick(content);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (mDataList != null) {
|
||||
return mDataList.size();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnClickListener(OnClickListener listener) {
|
||||
this.onClickListener = listener;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface OnClickListener {
|
||||
void onClick(String content);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.component;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.app.Activity;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
import com.tencent.qcloud.tuicore.util.ToastUtil;
|
||||
import com.tencent.qcloud.tuikit.timcommon.util.SoftKeyBoardUtil;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
|
||||
public class ProductInfoPopupCard {
|
||||
private PopupWindow popupWindow;
|
||||
private TextView titleTv;
|
||||
private EditText editNameText, editDescriptionText, editPictureText, editJumpText;
|
||||
private Button positiveBtn;
|
||||
private View tvClose;
|
||||
private OnClickListener positiveOnClickListener;
|
||||
public ProductInfoPopupCard(Activity activity) {
|
||||
View popupView = LayoutInflater.from(activity).inflate(R.layout.popup_card_product_info, null);
|
||||
titleTv = popupView.findViewById(R.id.popup_card_title);
|
||||
editNameText = popupView.findViewById(R.id.product_name_edit);
|
||||
editDescriptionText = popupView.findViewById(R.id.product_description_edit);
|
||||
editPictureText = popupView.findViewById(R.id.product_picture_edit);
|
||||
editJumpText = popupView.findViewById(R.id.product_jump_edit);
|
||||
positiveBtn = popupView.findViewById(R.id.product_popup_card_positive_btn);
|
||||
tvClose = popupView.findViewById(R.id.tv_close);
|
||||
|
||||
popupWindow = new PopupWindow(popupView, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT, true) {
|
||||
@Override
|
||||
public void showAtLocation(View anchor, int gravity, int x, int y) {
|
||||
if (activity != null && !activity.isFinishing()) {
|
||||
Window dialogWindow = activity.getWindow();
|
||||
startAnimation(dialogWindow, true);
|
||||
}
|
||||
super.showAtLocation(anchor, gravity, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
if (activity != null && !activity.isFinishing()) {
|
||||
Window dialogWindow = activity.getWindow();
|
||||
startAnimation(dialogWindow, false);
|
||||
}
|
||||
|
||||
super.dismiss();
|
||||
}
|
||||
};
|
||||
popupWindow.setBackgroundDrawable(null);
|
||||
popupWindow.setTouchable(true);
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
popupWindow.setAnimationStyle(com.tencent.qcloud.tuikit.timcommon.R.style.PopupInputCardAnim);
|
||||
popupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
|
||||
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss() {
|
||||
if (activity.getWindow() != null) {
|
||||
SoftKeyBoardUtil.hideKeyBoard(activity.getWindow());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
positiveBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String name = editNameText.getText().toString();
|
||||
String description = editDescriptionText.getText().toString();
|
||||
String pictureUrl = editPictureText.getText().toString();
|
||||
String jumpUrl = editJumpText.getText().toString();
|
||||
|
||||
if (TextUtils.isEmpty(name) || TextUtils.isEmpty(description) || TextUtils.isEmpty(pictureUrl) || TextUtils.isEmpty(jumpUrl)) {
|
||||
ToastUtil.toastShortMessage(activity.getString(R.string.product_info_input_empty));
|
||||
return;
|
||||
}
|
||||
|
||||
if (positiveOnClickListener != null) {
|
||||
positiveOnClickListener.onClick();
|
||||
}
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
tvClose.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void startAnimation(Window window, boolean isShow) {
|
||||
ValueAnimator animator;
|
||||
if (isShow) {
|
||||
animator = ValueAnimator.ofFloat(1.0f, 0.5f);
|
||||
} else {
|
||||
animator = ValueAnimator.ofFloat(0.5f, 1.0f);
|
||||
}
|
||||
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||
@Override
|
||||
public void onAnimationUpdate(ValueAnimator animation) {
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.alpha = (float) animation.getAnimatedValue();
|
||||
window.setAttributes(lp);
|
||||
}
|
||||
});
|
||||
LinearInterpolator interpolator = new LinearInterpolator();
|
||||
animator.setDuration(200);
|
||||
animator.setInterpolator(interpolator);
|
||||
animator.start();
|
||||
}
|
||||
|
||||
public void show(View rootView, int gravity) {
|
||||
if (popupWindow != null) {
|
||||
popupWindow.showAtLocation(rootView, gravity, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
titleTv.setText(title);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
editNameText.setText(name);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return editNameText.getText().toString();
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
editDescriptionText.setText(description);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return editDescriptionText.getText().toString();
|
||||
}
|
||||
|
||||
public void setPictureUrl(String url) {
|
||||
editPictureText.setText(url);
|
||||
}
|
||||
|
||||
public String getPictureUrl() {
|
||||
return editPictureText.getText().toString();
|
||||
}
|
||||
|
||||
public void setJumpUrl(String url) {
|
||||
editJumpText.setText(url);
|
||||
}
|
||||
|
||||
public String getJumpUrl() {
|
||||
return editJumpText.getText().toString();
|
||||
}
|
||||
|
||||
public void setOnPositive(OnClickListener clickListener) {
|
||||
positiveOnClickListener = clickListener;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface OnClickListener {
|
||||
void onClick();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.config;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServiceConstants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TUICustomerServiceConfig {
|
||||
private static TUICustomerServiceConfig instance;
|
||||
|
||||
public static TUICustomerServiceConfig getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new TUICustomerServiceConfig();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
private TUICustomerServiceProductInfo productInfo;
|
||||
private List<TUIInputViewFloatLayerData> inputViewFloatLayerDataList = new ArrayList<>();
|
||||
private List<String> customerServiceAccounts = new ArrayList<>();
|
||||
|
||||
public List<TUIInputViewFloatLayerData> getInputViewFloatLayerDataList() {
|
||||
return inputViewFloatLayerDataList;
|
||||
}
|
||||
|
||||
private TUICustomerServiceConfig() {
|
||||
customerServiceAccounts.add(TUICustomerServiceConstants.DEFAULT_CUSTOMER_SERVICE_ACCOUNT);
|
||||
}
|
||||
|
||||
public void setInputViewFloatLayerDataList(List<TUIInputViewFloatLayerData> inputViewFloatLayerDataList) {
|
||||
this.inputViewFloatLayerDataList = inputViewFloatLayerDataList;
|
||||
}
|
||||
|
||||
public void setProductInfo(TUICustomerServiceProductInfo productInfo) {
|
||||
this.productInfo = productInfo;
|
||||
}
|
||||
|
||||
public TUICustomerServiceProductInfo getProductInfo() {
|
||||
if (this.productInfo != null) {
|
||||
return this.productInfo;
|
||||
} else {
|
||||
TUICustomerServiceProductInfo defaultProductInfo = new TUICustomerServiceProductInfo();
|
||||
defaultProductInfo.setName("Handwoven leather handbag 2023 new women's mini simple and elegant high-end and classy");
|
||||
defaultProductInfo.setDescription("$788");
|
||||
defaultProductInfo.setPictureUrl("https://qcloudimg.tencent-cloud.cn/raw/a811f634eab5023f973c9b224bc07a51.png");
|
||||
defaultProductInfo.setJumpUrl("https://cloud.tencent.com/document/product/269");
|
||||
return defaultProductInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getCustomerServiceAccounts() {
|
||||
return customerServiceAccounts;
|
||||
}
|
||||
|
||||
public void setCustomerServiceAccounts(List<String> customerServiceAccounts) {
|
||||
if (customerServiceAccounts == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.customerServiceAccounts = customerServiceAccounts;
|
||||
}
|
||||
|
||||
public boolean isOnlineShopping(String userID) {
|
||||
if (TextUtils.isEmpty(userID)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return userID.contains("#online_shopping_mall");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.config;
|
||||
public class TUICustomerServiceProductInfo {
|
||||
private String name;
|
||||
private String description;
|
||||
private String pictureUrl;
|
||||
private String jumpUrl;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getPictureUrl() {
|
||||
return pictureUrl;
|
||||
}
|
||||
|
||||
public void setPictureUrl(String pictureUrl) {
|
||||
this.pictureUrl = pictureUrl;
|
||||
}
|
||||
|
||||
public String getJumpUrl() {
|
||||
return jumpUrl;
|
||||
}
|
||||
|
||||
public void setJumpUrl(String jumpUrl) {
|
||||
this.jumpUrl = jumpUrl;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.config;
|
||||
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.classicui.widget.InputViewFloatLayerProxy;
|
||||
|
||||
public class TUIInputViewFloatLayerData {
|
||||
private String content;
|
||||
private InputViewFloatLayerProxy.OnItemClickListener OnItemClickListener;
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public InputViewFloatLayerProxy.OnItemClickListener getOnItemClickListener() {
|
||||
return OnItemClickListener;
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(InputViewFloatLayerProxy.OnItemClickListener onItemClickListener) {
|
||||
OnItemClickListener = onItemClickListener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.model;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServiceConstants;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.config.TUICustomerServiceConfig;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.TUICustomerServiceLog;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TUICustomerServiceProvider {
|
||||
private static final String TAG = "TUICustomerServiceProvider";
|
||||
public TUICustomerServiceProvider() {}
|
||||
|
||||
public void getCustomerServiceUserInfo(V2TIMValueCallback<List<V2TIMUserFullInfo>> callback) {
|
||||
V2TIMManager.getInstance().getUsersInfo(
|
||||
TUICustomerServiceConfig.getInstance().getCustomerServiceAccounts(), new V2TIMValueCallback<List<V2TIMUserFullInfo>>() {
|
||||
@Override
|
||||
public void onSuccess(List<V2TIMUserFullInfo> v2TIMUserFullInfos) {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(v2TIMUserFullInfos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
TUICustomerServiceLog.e(TAG, "getCustomerServiceUserInfo error:" + code + ", desc:" + desc);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.presenter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||
import com.tencent.imsdk.v2.V2TIMUserFullInfo;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuichat.TUIChatService;
|
||||
import com.tencent.qcloud.tuikit.tuichat.util.ChatMessageBuilder;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServiceConstants;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BranchMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CollectionMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.EvaluationBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.config.TUICustomerServiceProductInfo;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.model.TUICustomerServiceProvider;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util.TUICustomerServiceLog;
|
||||
import java.util.List;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class TUICustomerServicePresenter {
|
||||
private static final String TAG = "TUICustomerServicePresenter";
|
||||
private TUIMessageBean messageBean;
|
||||
private TUICustomerServiceProvider provider;
|
||||
|
||||
public TUICustomerServicePresenter() {
|
||||
provider = new TUICustomerServiceProvider();
|
||||
}
|
||||
|
||||
public void setMessage(TUIMessageBean currentMessage) {
|
||||
messageBean = currentMessage;
|
||||
}
|
||||
|
||||
public TUIMessageBean getMessageBean() {
|
||||
return messageBean;
|
||||
}
|
||||
|
||||
public void getCustomerServiceUserInfo(V2TIMValueCallback<List<V2TIMUserFullInfo>> callback) {
|
||||
provider.getCustomerServiceUserInfo(callback);
|
||||
}
|
||||
|
||||
public boolean allowSelection() {
|
||||
if (messageBean instanceof BranchMessageBean) {
|
||||
BranchMessageBean branchMessageBean = (BranchMessageBean) messageBean;
|
||||
if (branchMessageBean.getBranchBean().getSelectedItem() != null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else if (messageBean instanceof CollectionMessageBean) {
|
||||
CollectionMessageBean collectionMessageBean = (CollectionMessageBean) messageBean;
|
||||
if (collectionMessageBean.getCollectionBean().getSelectedItem() != null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnItemContentSelected(String content) {
|
||||
if (messageBean == null) {
|
||||
TUICustomerServiceLog.e(TAG, "OnItemContentSelected, messageBean is null");
|
||||
return;
|
||||
}
|
||||
|
||||
String chatID = messageBean.getUserId();
|
||||
TUIMessageBean messageBean = ChatMessageBuilder.buildTextMessage(content);
|
||||
TUIChatService.getInstance().sendMessage(messageBean, chatID, V2TIMConversation.V2TIM_C2C, false);
|
||||
}
|
||||
|
||||
public void sendTextMessage(String userID, String content) {
|
||||
TUIMessageBean messageBean = ChatMessageBuilder.buildTextMessage(content);
|
||||
TUIChatService.getInstance().sendMessage(messageBean, userID, V2TIMConversation.V2TIM_C2C, false);
|
||||
}
|
||||
|
||||
public void sendHelloMessage(String userID) {
|
||||
JSONObject getEvaluationSettingJson = new JSONObject();
|
||||
try {
|
||||
getEvaluationSettingJson.put(TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY, 0);
|
||||
getEvaluationSettingJson.put(TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_BUSINESS_ID_SRC_KEY,
|
||||
TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_SAY_HELLO);
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(getEvaluationSettingJson.toString())) {
|
||||
TUIMessageBean messageBean = ChatMessageBuilder.buildCustomMessage(getEvaluationSettingJson.toString(), "", null);
|
||||
TUIChatService.getInstance().sendMessage(messageBean, userID, V2TIMConversation.V2TIM_C2C, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendEvaluationMessage(EvaluationBean.Menu submitMenu, String sessionID) {
|
||||
if (messageBean == null) {
|
||||
TUICustomerServiceLog.e(TAG, "sendEvaluationMessage, messageBean is null");
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject submitMenuJson = new JSONObject();
|
||||
try {
|
||||
submitMenuJson.put(TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY, 0);
|
||||
submitMenuJson.put(TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_BUSINESS_ID_SRC_KEY,
|
||||
TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_EVALUATION_SELECTED);
|
||||
JSONObject menuSelectedJson = new JSONObject();
|
||||
menuSelectedJson.put(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_ID, submitMenu.getId());
|
||||
menuSelectedJson.put(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_CONTENT, submitMenu.getContent());
|
||||
menuSelectedJson.put(TUICustomerServiceConstants.CUSTOMER_SERVICE_SESSION_ID, sessionID);
|
||||
submitMenuJson.put(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_MENU_SELECTED, menuSelectedJson);
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(submitMenuJson.toString())) {
|
||||
String chatID = messageBean.getUserId();
|
||||
TUIMessageBean messageBean = ChatMessageBuilder.buildCustomMessage(submitMenuJson.toString(), "", null);
|
||||
TUIChatService.getInstance().sendMessage(messageBean, chatID, V2TIMConversation.V2TIM_C2C, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void triggerEvaluation(String userID) {
|
||||
JSONObject triggerEvaluationJson = new JSONObject();
|
||||
try {
|
||||
triggerEvaluationJson.put(TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY, 0);
|
||||
triggerEvaluationJson.put(TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_BUSINESS_ID_SRC_KEY,
|
||||
TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_TRIGGER_EVALUATION);
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(triggerEvaluationJson.toString())) {
|
||||
TUIMessageBean messageBean = ChatMessageBuilder.buildCustomMessage(triggerEvaluationJson.toString(), "", null);
|
||||
TUIChatService.getInstance().sendMessage(messageBean, userID, V2TIMConversation.V2TIM_C2C, true);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendProductMessage(String userID, TUICustomerServiceProductInfo productInfo) {
|
||||
if (productInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSONObject productMessageJson = new JSONObject();
|
||||
try {
|
||||
productMessageJson.put(TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_MESSAGE_KEY, 0);
|
||||
productMessageJson.put(TUIConstants.TUICustomerServicePlugin.CUSTOMER_SERVICE_BUSINESS_ID_SRC_KEY,
|
||||
TUIConstants.TUICustomerServicePlugin.BUSINESS_ID_SRC_CUSTOMER_SERVICE_CARD);
|
||||
JSONObject productJson = new JSONObject();
|
||||
productJson.put(TUICustomerServiceConstants.CUSTOMER_SERVICE_HEADER, productInfo.getName());
|
||||
productJson.put(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_DESCRIPTION, productInfo.getDescription());
|
||||
productJson.put(TUICustomerServiceConstants.CUSTOMER_SERVICE_CARD_PIC, productInfo.getPictureUrl());
|
||||
productJson.put(TUICustomerServiceConstants.CUSTOMER_SERVICE_CARD_URL, productInfo.getJumpUrl());
|
||||
productMessageJson.put(TUICustomerServiceConstants.CUSTOMER_SERVICE_CONTENT, productJson);
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(productMessageJson.toString())) {
|
||||
TUIMessageBean messageBean = ChatMessageBuilder.buildCustomMessage(productMessageJson.toString(), "", null);
|
||||
TUIChatService.getInstance().sendMessage(messageBean, userID, V2TIMConversation.V2TIM_C2C, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util;
|
||||
|
||||
import android.text.TextPaint;
|
||||
import androidx.annotation.NonNull;
|
||||
import io.noties.markwon.LinkResolver;
|
||||
import io.noties.markwon.core.MarkwonTheme;
|
||||
import io.noties.markwon.core.spans.LinkSpan;
|
||||
|
||||
public class CustomLinkSpan extends LinkSpan {
|
||||
public CustomLinkSpan(@NonNull MarkwonTheme theme, @NonNull String link, @NonNull LinkResolver resolver) {
|
||||
super(theme, link, resolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(@NonNull TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
ds.setUnderlineText(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import io.noties.markwon.MarkwonConfiguration;
|
||||
import io.noties.markwon.RenderProps;
|
||||
import io.noties.markwon.core.CoreProps;
|
||||
import io.noties.markwon.core.factory.LinkSpanFactory;
|
||||
|
||||
public class CustomLinkSpanFactory extends LinkSpanFactory {
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getSpans(@NonNull MarkwonConfiguration configuration, @NonNull RenderProps props) {
|
||||
return new CustomLinkSpan(configuration.theme(), CoreProps.LINK_DESTINATION.require(props), configuration.linkResolver());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util;
|
||||
|
||||
import com.tencent.imsdk.common.IMLog;
|
||||
|
||||
public class TUICustomerServiceLog extends IMLog {
|
||||
private static final String PRE = "TUICustomerServiceLog-";
|
||||
|
||||
private static String mixTag(String tag) {
|
||||
return PRE + tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print INFO level log
|
||||
*
|
||||
* @param strTag TAG
|
||||
* @param strInfo
|
||||
*/
|
||||
public static void v(String strTag, String strInfo) {
|
||||
IMLog.v(mixTag(strTag), strInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print DEBUG level log
|
||||
*
|
||||
* @param strTag TAG
|
||||
* @param strInfo
|
||||
*/
|
||||
public static void d(String strTag, String strInfo) {
|
||||
IMLog.d(mixTag(strTag), strInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print INFO level log
|
||||
*
|
||||
* @param strTag TAG
|
||||
* @param strInfo
|
||||
*/
|
||||
public static void i(String strTag, String strInfo) {
|
||||
IMLog.i(mixTag(strTag), strInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print WARN level log
|
||||
*
|
||||
* @param strTag TAG
|
||||
* @param strInfo
|
||||
*/
|
||||
public static void w(String strTag, String strInfo) {
|
||||
IMLog.w(mixTag(strTag), strInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print WARN level log
|
||||
*
|
||||
* @param strTag TAG
|
||||
* @param strInfo
|
||||
*/
|
||||
public static void w(String strTag, String strInfo, Throwable e) {
|
||||
IMLog.w(mixTag(strTag), strInfo + e.getMessage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Print ERROR level log
|
||||
*
|
||||
* @param strTag TAG
|
||||
* @param strInfo
|
||||
*/
|
||||
public static void e(String strTag, String strInfo) {
|
||||
IMLog.e(mixTag(strTag), strInfo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.tencent.imsdk.v2.V2TIMCustomElem;
|
||||
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServiceConstants;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BotBranchBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.BranchBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CardBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.CollectionBean;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.bean.EvaluationBean;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class TUICustomerServiceMessageParser {
|
||||
private static final String TAG = "TUICustomerServiceMessageParser";
|
||||
|
||||
public static BranchBean getBranchInfo(V2TIMMessage v2TIMMessage) {
|
||||
V2TIMCustomElem customElem = v2TIMMessage.getCustomElem();
|
||||
if (customElem == null || customElem.getData() == null || customElem.getData().length == 0) {
|
||||
TUICustomerServiceLog.e(TAG, "getBranchInfo fail, customElem or data is empty");
|
||||
return null;
|
||||
}
|
||||
|
||||
BranchBean branchBean = new BranchBean();
|
||||
String data = new String(customElem.getData());
|
||||
try {
|
||||
JSONObject branchJson = new JSONObject(data);
|
||||
JSONObject contentJson = new JSONObject(branchJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_CONTENT));
|
||||
if (contentJson == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
branchBean.setHead(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_HEADER));
|
||||
branchBean.setTail(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_TAIL));
|
||||
String selectItemString = contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_SELECTED);
|
||||
if (!TextUtils.isEmpty(selectItemString)) {
|
||||
JSONObject selectedJson = new JSONObject(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_SELECTED));
|
||||
String itemContent = selectedJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_CONTENT);
|
||||
if (!TextUtils.isEmpty(itemContent)) {
|
||||
BranchBean.Item selectedItem = new BranchBean.Item();
|
||||
selectedItem.setContent(itemContent);
|
||||
selectedItem.setDescription(selectedJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_DESCRIPTION));
|
||||
branchBean.setSelectedItem(selectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
List<BranchBean.Item> itemList = new ArrayList<>();
|
||||
JSONArray itemJsonArray = contentJson.optJSONArray(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEMS);
|
||||
if (itemJsonArray != null) {
|
||||
for (int i = 0; i < itemJsonArray.length(); i++) {
|
||||
JSONObject itemObject = itemJsonArray.optJSONObject(i);
|
||||
if (itemObject != null) {
|
||||
BranchBean.Item item = new BranchBean.Item();
|
||||
item.setContent(itemObject.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_CONTENT));
|
||||
item.setDescription(itemObject.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_DESCRIPTION));
|
||||
itemList.add(item);
|
||||
}
|
||||
}
|
||||
branchBean.setItemList(itemList);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return branchBean;
|
||||
}
|
||||
|
||||
public static BotBranchBean getBotBranchInfo(V2TIMMessage v2TIMMessage) {
|
||||
V2TIMCustomElem customElem = v2TIMMessage.getCustomElem();
|
||||
if (customElem == null || customElem.getData() == null || customElem.getData().length == 0) {
|
||||
TUICustomerServiceLog.e(TAG, "getBranchInfo fail, customElem or data is empty");
|
||||
return null;
|
||||
}
|
||||
|
||||
BotBranchBean botBranchBean = new BotBranchBean();
|
||||
String data = new String(customElem.getData());
|
||||
try {
|
||||
JSONObject branchJson = new JSONObject(data);
|
||||
botBranchBean.setSubType(branchJson.optString(TUICustomerServiceConstants.BOT_SUBTYPE));
|
||||
|
||||
JSONObject contentJson = new JSONObject(branchJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_CONTENT));
|
||||
if (contentJson == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
botBranchBean.setTitle(contentJson.optString(TUICustomerServiceConstants.BOT_TITLE));
|
||||
botBranchBean.setContent(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_CONTENT));
|
||||
List<BotBranchBean.Item> itemList = new ArrayList<>();
|
||||
JSONArray itemJsonArray = contentJson.optJSONArray(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEMS);
|
||||
if (itemJsonArray != null) {
|
||||
for (int i = 0; i < itemJsonArray.length(); i++) {
|
||||
JSONObject itemObject = itemJsonArray.optJSONObject(i);
|
||||
if (itemObject != null) {
|
||||
BotBranchBean.Item item = new BotBranchBean.Item();
|
||||
item.setContent(itemObject.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_CONTENT));
|
||||
itemList.add(item);
|
||||
}
|
||||
}
|
||||
botBranchBean.setItemList(itemList);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return botBranchBean;
|
||||
}
|
||||
|
||||
public static CollectionBean getCollectionInfo(V2TIMMessage v2TIMMessage) {
|
||||
V2TIMCustomElem customElem = v2TIMMessage.getCustomElem();
|
||||
if (customElem == null || customElem.getData() == null || customElem.getData().length == 0) {
|
||||
TUICustomerServiceLog.e(TAG, "getCollectionInfo fail, customElem or data is empty");
|
||||
return null;
|
||||
}
|
||||
|
||||
CollectionBean collectionBean = new CollectionBean();
|
||||
String data = new String(customElem.getData());
|
||||
try {
|
||||
JSONObject collectionJson = new JSONObject(data);
|
||||
JSONObject contentJson = new JSONObject(collectionJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_CONTENT));
|
||||
if (contentJson == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
collectionBean.setHead(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_HEADER));
|
||||
collectionBean.setType(contentJson.optInt(TUICustomerServiceConstants.CUSTOMER_SERVICE_TYPE));
|
||||
String selectItemString = contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_SELECTED);
|
||||
if (!TextUtils.isEmpty(selectItemString)) {
|
||||
JSONObject selectedJson = new JSONObject(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_SELECTED));
|
||||
String itemContent = selectedJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_CONTENT);
|
||||
if (!TextUtils.isEmpty(itemContent)) {
|
||||
CollectionBean.FormItem selectedItem = new CollectionBean.FormItem();
|
||||
selectedItem.setContent(itemContent);
|
||||
selectedItem.setDescription(selectedJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_DESCRIPTION));
|
||||
collectionBean.setSelectedItem(selectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
List<CollectionBean.FormItem> itemList = new ArrayList<>();
|
||||
JSONArray itemJsonArray = contentJson.optJSONArray(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEMS);
|
||||
if (itemJsonArray != null) {
|
||||
for (int i = 0; i < itemJsonArray.length(); i++) {
|
||||
JSONObject itemObject = itemJsonArray.optJSONObject(i);
|
||||
if (itemObject != null) {
|
||||
CollectionBean.FormItem item = new CollectionBean.FormItem();
|
||||
item.setContent(itemObject.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_CONTENT));
|
||||
item.setDescription(itemObject.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_DESCRIPTION));
|
||||
itemList.add(item);
|
||||
}
|
||||
}
|
||||
collectionBean.setItemList(itemList);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return collectionBean;
|
||||
}
|
||||
|
||||
public static EvaluationBean getEvaluationInfo(V2TIMMessage v2TIMMessage) {
|
||||
V2TIMCustomElem customElem = v2TIMMessage.getCustomElem();
|
||||
if (customElem == null || customElem.getData() == null || customElem.getData().length == 0) {
|
||||
TUICustomerServiceLog.e(TAG, "getEvaluationInfo fail, customElem or data is empty");
|
||||
return null;
|
||||
}
|
||||
|
||||
EvaluationBean evaluationBean = new EvaluationBean();
|
||||
String data = new String(customElem.getData());
|
||||
try {
|
||||
JSONObject collectionJson = new JSONObject(data);
|
||||
JSONObject contentJson = new JSONObject(collectionJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_MENU_CONTENT));
|
||||
if (contentJson == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
evaluationBean.setHead(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_MENU_CONTENT_HEAD));
|
||||
evaluationBean.setType(contentJson.optInt(TUICustomerServiceConstants.CUSTOMER_SERVICE_TYPE));
|
||||
evaluationBean.setSessionID(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_SESSION_ID));
|
||||
evaluationBean.setTail(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_TAIL));
|
||||
evaluationBean.setExpireTime(contentJson.optInt(TUICustomerServiceConstants.CUSTOMER_SERVICE_EXPIRED_TIME));
|
||||
String selectMenuString = contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_SELECTED);
|
||||
if (!TextUtils.isEmpty(selectMenuString)) {
|
||||
EvaluationBean.Menu selectedMenu = new EvaluationBean.Menu();
|
||||
JSONObject selectedJson = new JSONObject(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_SELECTED));
|
||||
String menuContent = selectedJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_CONTENT);
|
||||
if (!TextUtils.isEmpty(menuContent)) {
|
||||
selectedMenu.setContent(menuContent);
|
||||
}
|
||||
|
||||
String id = selectedJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_ID);
|
||||
if (!TextUtils.isEmpty(id)) {
|
||||
selectedMenu.setId(id);
|
||||
evaluationBean.setSelectedMenu(selectedMenu);
|
||||
}
|
||||
}
|
||||
|
||||
List<EvaluationBean.Menu> menuList = new ArrayList<>();
|
||||
JSONArray menuJsonArray = contentJson.optJSONArray(TUICustomerServiceConstants.CUSTOMER_SERVICE_MENU);
|
||||
if (menuJsonArray != null) {
|
||||
for (int i = 0; i < menuJsonArray.length(); i++) {
|
||||
JSONObject itemObject = menuJsonArray.optJSONObject(i);
|
||||
if (itemObject != null) {
|
||||
EvaluationBean.Menu menu = new EvaluationBean.Menu();
|
||||
menu.setContent(itemObject.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_CONTENT));
|
||||
menu.setId(itemObject.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_ID));
|
||||
menuList.add(menu);
|
||||
}
|
||||
}
|
||||
Collections.sort(menuList, new Comparator<EvaluationBean.Menu>() {
|
||||
@Override
|
||||
public int compare(EvaluationBean.Menu menu, EvaluationBean.Menu t1) {
|
||||
return Integer.valueOf(menu.getId()) - Integer.valueOf(t1.getId());
|
||||
}
|
||||
});
|
||||
evaluationBean.setMenuList(menuList);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return evaluationBean;
|
||||
}
|
||||
|
||||
public static CardBean getCardInfo(V2TIMMessage v2TIMMessage) {
|
||||
V2TIMCustomElem customElem = v2TIMMessage.getCustomElem();
|
||||
if (customElem == null || customElem.getData() == null || customElem.getData().length == 0) {
|
||||
TUICustomerServiceLog.e(TAG, "getEvaluationInfo fail, customElem or data is empty");
|
||||
return null;
|
||||
}
|
||||
|
||||
CardBean cardBean = new CardBean();
|
||||
String data = new String(customElem.getData());
|
||||
try {
|
||||
JSONObject collectionJson = new JSONObject(data);
|
||||
JSONObject contentJson = new JSONObject(collectionJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_CONTENT));
|
||||
if (contentJson == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
cardBean.setHeader(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_HEADER));
|
||||
cardBean.setDesc(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_ITEM_DESCRIPTION));
|
||||
cardBean.setPic(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_CARD_PIC));
|
||||
cardBean.setUrl(contentJson.optString(TUICustomerServiceConstants.CUSTOMER_SERVICE_CARD_URL));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return cardBean;
|
||||
}
|
||||
|
||||
public static String getRichText(V2TIMMessage v2TIMMessage) {
|
||||
V2TIMCustomElem customElem = v2TIMMessage.getCustomElem();
|
||||
if (customElem == null || customElem.getData() == null || customElem.getData().length == 0) {
|
||||
TUICustomerServiceLog.e(TAG, "getRichText fail, customElem or data is empty");
|
||||
return "";
|
||||
}
|
||||
|
||||
String richTextContent = "";
|
||||
String data = new String(customElem.getData());
|
||||
try {
|
||||
JSONObject richTextJson = new JSONObject(data);
|
||||
richTextContent = richTextJson.getString(TUICustomerServiceConstants.CUSTOMER_SERVICE_CONTENT);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return richTextContent;
|
||||
}
|
||||
|
||||
public static String getStreamText(V2TIMMessage v2TIMMessage) {
|
||||
V2TIMCustomElem customElem = v2TIMMessage.getCustomElem();
|
||||
if (customElem == null || customElem.getData() == null || customElem.getData().length == 0) {
|
||||
TUICustomerServiceLog.e(TAG, "getStreamText fail, customElem or data is empty");
|
||||
return "";
|
||||
}
|
||||
|
||||
String displayContent = "";
|
||||
String data = new String(customElem.getData());
|
||||
try {
|
||||
JSONObject streamTextJson = new JSONObject(data);
|
||||
JSONArray itemJsonArray = streamTextJson.optJSONArray(TUICustomerServiceConstants.BOT_CHUNKS);
|
||||
if (itemJsonArray != null) {
|
||||
for (int i = 0; i < itemJsonArray.length(); i++) {
|
||||
String contentChunk = itemJsonArray.getString(i);
|
||||
displayContent = displayContent + contentChunk;
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return displayContent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.tencent.qcloud.tuikit.tuicustomerserviceplugin.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextPaint;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.View;
|
||||
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuicore.TUIThemeManager;
|
||||
import com.tencent.qcloud.tuicore.util.ErrorMessageConverter;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.dialog.TUIKitDialog;
|
||||
import com.tencent.qcloud.tuikit.timcommon.component.interfaces.IUIKitCallback;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.R;
|
||||
import com.tencent.qcloud.tuikit.tuicustomerserviceplugin.TUICustomerServiceConstants;
|
||||
|
||||
public class TUICustomerServiceUtils {
|
||||
|
||||
public static <T> void callbackOnError(IUIKitCallback<T> callBack, String module, int errCode, String desc) {
|
||||
if (callBack != null) {
|
||||
callBack.onError(module, errCode, ErrorMessageConverter.convertIMError(errCode, desc));
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> void callbackOnError(IUIKitCallback<T> callBack, int errCode, String desc) {
|
||||
if (callBack != null) {
|
||||
callBack.onError(null, errCode, ErrorMessageConverter.convertIMError(errCode, desc));
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> void callbackOnSuccess(IUIKitCallback<T> callBack, T data) {
|
||||
if (callBack != null) {
|
||||
callBack.onSuccess(data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkCustomerServiceAbility(long param, IUIKitCallback<Boolean> callback) {
|
||||
V2TIMManager.getInstance().callExperimentalAPI("isCommercialAbilityEnabled", param, new V2TIMValueCallback<Object>() {
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
callbackOnError(callback, code, desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Object object) {
|
||||
boolean enabled = ((Integer) object > 0);
|
||||
|
||||
if (callback != null) {
|
||||
callback.onSuccess(enabled);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void showNotSupportDialog(Context context) {
|
||||
String content = context.getResources().getString(R.string.customer_service_unsupport_tips);
|
||||
String buyingGuidelines = context.getResources().getString(R.string.customer_service_buying_guidelines);
|
||||
int buyingGuidelinesIndex = content.lastIndexOf(buyingGuidelines);
|
||||
final int foregroundColor = context.getResources().getColor(TUIThemeManager.getAttrResId(context, com.tencent.qcloud.tuicore.R.attr.core_primary_color));
|
||||
SpannableString spannedString = new SpannableString(content);
|
||||
ForegroundColorSpan colorSpan = new ForegroundColorSpan(foregroundColor);
|
||||
spannedString.setSpan(colorSpan, buyingGuidelinesIndex, buyingGuidelinesIndex + buyingGuidelines.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
||||
ClickableSpan clickableSpan = new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
openWebUrl(context, TUIConstants.BuyingFeature.BUYING_GROUP_CHAT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
ds.setUnderlineText(false);
|
||||
}
|
||||
};
|
||||
spannedString.setSpan(clickableSpan, buyingGuidelinesIndex, buyingGuidelinesIndex + buyingGuidelines.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
||||
|
||||
TUIKitDialog.TUIIMUpdateDialog.getInstance()
|
||||
.createDialog(context)
|
||||
.setShowOnlyDebug(true)
|
||||
.setMovementMethod(LinkMovementMethod.getInstance())
|
||||
.setHighlightColor(Color.TRANSPARENT)
|
||||
.setCancelable(true)
|
||||
.setCancelOutside(true)
|
||||
.setTitle(spannedString)
|
||||
.setDialogWidth(0.75f)
|
||||
.setDialogFeatureName(TUIConstants.BuyingFeature.BUYING_FEATURE_MESSAGE_RECEIPT)
|
||||
.setPositiveButton(context.getResources().getString(R.string.customer_service_i_know),
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TUIKitDialog.TUIIMUpdateDialog.getInstance().dismiss();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
private static void openWebUrl(Context context, String url) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
Uri contentUrl = Uri.parse(url);
|
||||
intent.setData(contentUrl);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 471 B |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 639 B |
|
After Width: | Height: | Size: 896 B |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 857 B |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="customer_service_item_text_color_light">#368DFF</color>
|
||||
<color name="customer_service_reply_quote_text_color_light">#888888</color>
|
||||
<color name="product_close_color_light">#3370ff</color>
|
||||
<color name="evaluation_number_default_color_light">#006eff</color>
|
||||
<color name="submit_bg_color_light">#3370ff</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="TUICustomerServiceLightTheme" parent="TUIBaseLightTheme">
|
||||
<item name="customer_service_item_text_color">@color/customer_service_item_text_color_light</item>
|
||||
<item name="product_close_color">@color/product_close_color_light</item>
|
||||
<item name="number_default_color">@color/evaluation_number_default_color_light</item>
|
||||
<item name="submit_bg_color">@color/submit_bg_color_light</item>
|
||||
<item name="customer_service_icon">@drawable/customer_service_icon_light</item>
|
||||
<item name="customer_service_item_arrow">@drawable/customer_service_item_arrow_light</item>
|
||||
<item name="evaluation_number_active_bg">@drawable/evaluation_number_active_bg_light</item>
|
||||
<item name="send_suggest_icon">@drawable/send_suggest_icon_light</item>
|
||||
<item name="number_default_bg">@drawable/evaluation_number_default_bg_light</item>
|
||||
<item name="title_refresh">@drawable/title_refresh_light</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 487 B |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 679 B |
|
After Width: | Height: | Size: 972 B |
|
After Width: | Height: | Size: 930 B |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="customer_service_item_text_color_lively">#ff7756</color>
|
||||
<color name="customer_service_reply_quote_text_color_lively">#FFE1EC</color>
|
||||
<color name="product_close_color_lively">#ff5739</color>
|
||||
<color name="evaluation_number_default_color_lively">#ff7756</color>
|
||||
<color name="submit_bg_color_lively">#ff9d85</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="TUICustomerServiceLivelyTheme" parent="TUIBaseLivelyTheme">
|
||||
<item name="customer_service_item_text_color">@color/customer_service_item_text_color_lively</item>
|
||||
<item name="product_close_color">@color/product_close_color_lively</item>
|
||||
<item name="number_default_color">@color/evaluation_number_default_color_lively</item>
|
||||
<item name="submit_bg_color">@color/submit_bg_color_lively</item>
|
||||
<item name="customer_service_icon">@drawable/customer_service_icon_lively</item>
|
||||
<item name="customer_service_item_arrow">@drawable/customer_service_item_arrow_lively</item>
|
||||
<item name="evaluation_number_active_bg">@drawable/evaluation_number_active_bg_lively</item>
|
||||
<item name="send_suggest_icon">@drawable/send_suggest_icon_lively</item>
|
||||
<item name="number_default_bg">@drawable/evaluation_number_default_bg_lively</item>
|
||||
<item name="title_refresh">@drawable/title_refresh_lively</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 471 B |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 639 B |
|
After Width: | Height: | Size: 896 B |
|
After Width: | Height: | Size: 965 B |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="customer_service_item_text_color_serious">#368DFF</color>
|
||||
<color name="customer_service_reply_quote_text_color_serious">#D4E2FF</color>
|
||||
<color name="product_close_color_serious">#3370ff</color>
|
||||
<color name="evaluation_number_default_color_serious">#006eff</color>
|
||||
<color name="submit_bg_color_serious">#3370ff</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="TUICustomerServiceSeriousTheme" parent="TUIBaseSeriousTheme">
|
||||
<item name="customer_service_item_text_color">@color/customer_service_item_text_color_serious</item>
|
||||
<item name="product_close_color">@color/product_close_color_serious</item>
|
||||
<item name="number_default_color">@color/evaluation_number_default_color_serious</item>
|
||||
<item name="submit_bg_color">@color/submit_bg_color_serious</item>
|
||||
<item name="customer_service_icon">@drawable/customer_service_icon_serious</item>
|
||||
<item name="customer_service_item_arrow">@drawable/customer_service_item_arrow_serious</item>
|
||||
<item name="evaluation_number_active_bg">@drawable/evaluation_number_active_bg_serious</item>
|
||||
<item name="send_suggest_icon">@drawable/send_suggest_icon_serious</item>
|
||||
<item name="number_default_bg">@drawable/evaluation_number_default_bg_serious</item>
|
||||
<item name="title_refresh">@drawable/title_refresh_serious</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
After Width: | Height: | Size: 406 B |
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="line">
|
||||
<stroke
|
||||
android:color="#bbbbbb"
|
||||
android:width="0.5dp"
|
||||
android:dashWidth="2dp"
|
||||
android:dashGap="2dp">
|
||||
</stroke>
|
||||
</shape>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners
|
||||
android:radius="4dp" />
|
||||
|
||||
<solid android:color="@color/evaluation_background_color"/>
|
||||
</shape>
|
||||
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<stroke
|
||||
android:color="#c5cbd4"
|
||||
android:width="1dp"/>
|
||||
|
||||
<corners
|
||||
android:radius="16dp" />
|
||||
|
||||
<solid android:color="#f6f7f9"/>
|
||||
</shape>
|
||||
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners
|
||||
android:radius="4dp" />
|
||||
|
||||
<solid android:color="?attr/submit_bg_color"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<stroke
|
||||
android:color="#dddddd"
|
||||
android:width="1dp"/>
|
||||
|
||||
<corners
|
||||
android:radius="8dp" />
|
||||
|
||||
<solid android:color="@color/white"/>
|
||||
</shape>
|
||||