|
|
@@ -1,78 +1,77 @@
|
|
|
-package com.tencent.qcloud.tuikit.tuichat.classicui.page;
|
|
|
+package com.tencent.qcloud.tuikit.tuichat.classicui.page
|
|
|
|
|
|
-import android.os.Bundle;
|
|
|
-import android.text.TextUtils;
|
|
|
-import android.view.WindowManager;
|
|
|
+import com.tencent.qcloud.tuikit.tuichat.presenter.C2CChatPresenter
|
|
|
+import android.os.Bundle
|
|
|
+import android.text.TextUtils
|
|
|
+import gorden.rxbus2.RxBus
|
|
|
+import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo
|
|
|
+import com.gyf.immersionbar.ImmersionBar
|
|
|
+import com.gyf.immersionbar.BarHide
|
|
|
+import android.view.WindowManager
|
|
|
+import com.tencent.qcloud.tuicore.util.ToastUtil
|
|
|
+import com.tencent.qcloud.tuikit.tuichat.util.TUIChatLog
|
|
|
+import com.tencent.qcloud.tuikit.tuichat.util.TUIChatUtils
|
|
|
+import com.tencent.qcloud.tuikit.tuichat.TUIChatConstants
|
|
|
+import com.tencent.qcloud.tuikit.tuichat.R
|
|
|
+import gorden.rxbus2.Subscribe
|
|
|
+import com.yingyangfly.baselib.utils.RxBusCodes
|
|
|
+import com.yingyangfly.baselib.dialog.EvaluateDialog
|
|
|
+import com.yingyangfly.baselib.ext.toast
|
|
|
+import gorden.rxbus2.ThreadMode
|
|
|
|
|
|
-import androidx.annotation.Nullable;
|
|
|
+class TUIC2CChatActivity : TUIBaseChatActivity() {
|
|
|
|
|
|
-import com.gyf.immersionbar.BarHide;
|
|
|
-import com.gyf.immersionbar.ImmersionBar;
|
|
|
-import com.tencent.qcloud.tuicore.util.ToastUtil;
|
|
|
-import com.tencent.qcloud.tuikit.tuichat.R;
|
|
|
-import com.tencent.qcloud.tuikit.tuichat.TUIChatConstants;
|
|
|
-import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
|
|
|
-import com.tencent.qcloud.tuikit.tuichat.presenter.C2CChatPresenter;
|
|
|
-import com.tencent.qcloud.tuikit.tuichat.util.TUIChatLog;
|
|
|
-import com.tencent.qcloud.tuikit.tuichat.util.TUIChatUtils;
|
|
|
-import com.yingyangfly.baselib.dialog.EvaluateDialog;
|
|
|
-import com.yingyangfly.baselib.utils.RxBusCodes;
|
|
|
-
|
|
|
-import gorden.rxbus2.RxBus;
|
|
|
-import gorden.rxbus2.Subscribe;
|
|
|
-import gorden.rxbus2.ThreadMode;
|
|
|
-
|
|
|
-public class TUIC2CChatActivity extends TUIBaseChatActivity {
|
|
|
- private static final String TAG = TUIC2CChatActivity.class.getSimpleName();
|
|
|
-
|
|
|
- private TUIC2CChatFragment chatFragment;
|
|
|
- private C2CChatPresenter presenter;
|
|
|
-
|
|
|
- @Override
|
|
|
- protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
- super.onCreate(savedInstanceState);
|
|
|
- RxBus.get().register(this);
|
|
|
+ private var chatFragment: TUIC2CChatFragment? = null
|
|
|
+ private var presenter: C2CChatPresenter? = null
|
|
|
+ override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
+ super.onCreate(savedInstanceState)
|
|
|
+ RxBus.get().register(this)
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void initChat(ChatInfo chatInfo) {
|
|
|
+ override fun initChat(chatInfo: ChatInfo) {
|
|
|
ImmersionBar.with(this)
|
|
|
- .hideBar(BarHide.FLAG_HIDE_BAR)
|
|
|
- .keyboardEnable(true)
|
|
|
- .keyboardMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
|
|
|
- .init(); //必须调用方可应用以上所配置的参数
|
|
|
-
|
|
|
- TUIChatLog.i(TAG, "inti chat " + chatInfo);
|
|
|
-
|
|
|
- if (!TUIChatUtils.isC2CChat(chatInfo.getType())) {
|
|
|
- TUIChatLog.e(TAG, "init C2C chat failed , chatInfo = " + chatInfo);
|
|
|
- ToastUtil.toastShortMessage("init c2c chat failed.");
|
|
|
+ .hideBar(BarHide.FLAG_HIDE_BAR)
|
|
|
+ .keyboardEnable(true)
|
|
|
+ .keyboardMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
|
|
|
+ .init() //必须调用方可应用以上所配置的参数
|
|
|
+ TUIChatLog.i(TAG, "inti chat $chatInfo")
|
|
|
+ if (!TUIChatUtils.isC2CChat(chatInfo.type)) {
|
|
|
+ TUIChatLog.e(TAG, "init C2C chat failed , chatInfo = $chatInfo")
|
|
|
+ ToastUtil.toastShortMessage("init c2c chat failed.")
|
|
|
}
|
|
|
- chatFragment = new TUIC2CChatFragment();
|
|
|
- Bundle bundle = new Bundle();
|
|
|
- bundle.putSerializable(TUIChatConstants.CHAT_INFO, chatInfo);
|
|
|
- chatFragment.setArguments(bundle);
|
|
|
- presenter = new C2CChatPresenter();
|
|
|
- presenter.initListener();
|
|
|
- chatFragment.setPresenter(presenter);
|
|
|
- getSupportFragmentManager().beginTransaction().replace(R.id.empty_view, chatFragment).commitAllowingStateLoss();
|
|
|
+ chatFragment = TUIC2CChatFragment()
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putSerializable(TUIChatConstants.CHAT_INFO, chatInfo)
|
|
|
+ chatFragment!!.arguments = bundle
|
|
|
+ presenter = C2CChatPresenter()
|
|
|
+ presenter!!.initListener()
|
|
|
+ chatFragment!!.presenter = presenter
|
|
|
+ supportFragmentManager.beginTransaction().replace(R.id.empty_view, chatFragment!!)
|
|
|
+ .commitAllowingStateLoss()
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发起评价
|
|
|
*/
|
|
|
@Subscribe(code = RxBusCodes.EVALUATE_ORDER, threadMode = ThreadMode.MAIN)
|
|
|
- public void sendVideoCallEvent(String chatId) {
|
|
|
+ fun sendVideoCallEvent(chatId: String?) {
|
|
|
if (!TextUtils.isEmpty(chatId)) {
|
|
|
- EvaluateDialog dialog = new EvaluateDialog();
|
|
|
- dialog.setId(chatId);
|
|
|
- dialog.show(getSupportFragmentManager(), "EvaluateDialog");
|
|
|
+ val dialog = EvaluateDialog()
|
|
|
+ dialog.setId(chatId!!)
|
|
|
+ dialog.onDialogClickListener = {
|
|
|
+ "评价成功".toast()
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ dialog.show(supportFragmentManager, "EvaluateDialog")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- protected void onDestroy() {
|
|
|
- super.onDestroy();
|
|
|
- RxBus.get().unRegister(this);
|
|
|
+ override fun onDestroy() {
|
|
|
+ super.onDestroy()
|
|
|
+ RxBus.get().unRegister(this)
|
|
|
+ }
|
|
|
+
|
|
|
+ companion object {
|
|
|
+ private val TAG = TUIC2CChatActivity::class.java.simpleName
|
|
|
}
|
|
|
-}
|
|
|
+}
|