|
|
@@ -22,10 +22,12 @@ import android.widget.FrameLayout;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
+
|
|
|
import androidx.annotation.NonNull;
|
|
|
import androidx.annotation.Nullable;
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
|
+
|
|
|
import com.bumptech.glide.Glide;
|
|
|
import com.bumptech.glide.request.RequestOptions;
|
|
|
import com.google.gson.Gson;
|
|
|
@@ -73,6 +75,8 @@ import com.tencent.qcloud.tuikit.tuichat.presenter.GroupChatPresenter;
|
|
|
import com.tencent.qcloud.tuikit.tuichat.util.ChatMessageBuilder;
|
|
|
import com.tencent.qcloud.tuikit.tuichat.util.TUIChatLog;
|
|
|
import com.tencent.qcloud.tuikit.tuichat.util.TUIChatUtils;
|
|
|
+import com.tencent.qcloud.tuikit.tuichat.util.ViewTool;
|
|
|
+
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Comparator;
|
|
|
@@ -141,8 +145,8 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
}
|
|
|
|
|
|
private void initViews() {
|
|
|
- inflate(getContext(), R.layout.chat_minimalist_layout, this);
|
|
|
-
|
|
|
+ ViewTool.inflateFragmentPixelsById(getContext(), R.layout.chat_minimalist_layout, this, 1194, 834);
|
|
|
+// inflate(getContext(), R.layout.chat_minimalist_layout, this);
|
|
|
mMessageRecyclerView = findViewById(R.id.chat_message_layout);
|
|
|
mInputView = findViewById(R.id.chat_input_layout);
|
|
|
mInputView.setChatLayout(this);
|
|
|
@@ -341,7 +345,7 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
});
|
|
|
|
|
|
loadMessages(
|
|
|
- chatInfo.getLocateMessage(), chatInfo.getLocateMessage() == null ? TUIChatConstants.GET_MESSAGE_FORWARD : TUIChatConstants.GET_MESSAGE_TWO_WAY);
|
|
|
+ chatInfo.getLocateMessage(), chatInfo.getLocateMessage() == null ? TUIChatConstants.GET_MESSAGE_FORWARD : TUIChatConstants.GET_MESSAGE_TWO_WAY);
|
|
|
initHeader();
|
|
|
}
|
|
|
|
|
|
@@ -463,11 +467,11 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
|
|
|
private void loadFace(String faceUrl) {
|
|
|
Glide.with(this)
|
|
|
- .load(faceUrl)
|
|
|
- .apply(new RequestOptions()
|
|
|
- .error(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light)
|
|
|
- .placeholder(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light))
|
|
|
- .into(chatAvatar);
|
|
|
+ .load(faceUrl)
|
|
|
+ .apply(new RequestOptions()
|
|
|
+ .error(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light)
|
|
|
+ .placeholder(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light))
|
|
|
+ .into(chatAvatar);
|
|
|
}
|
|
|
|
|
|
private void onHeaderUserClick(View v) {
|
|
|
@@ -514,9 +518,9 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
private void startCall(int callActionType) {
|
|
|
if (callActionType == TUIConstants.TUICalling.ACTION_ID_AUDIO_CALL || callActionType == TUIConstants.TUICalling.ACTION_ID_VIDEO_CALL) {
|
|
|
String type =
|
|
|
- callActionType == TUIConstants.TUICalling.ACTION_ID_AUDIO_CALL ? TUIConstants.TUICalling.TYPE_AUDIO : TUIConstants.TUICalling.TYPE_VIDEO;
|
|
|
+ callActionType == TUIConstants.TUICalling.ACTION_ID_AUDIO_CALL ? TUIConstants.TUICalling.TYPE_AUDIO : TUIConstants.TUICalling.TYPE_VIDEO;
|
|
|
String title = callActionType == TUIConstants.TUICalling.ACTION_ID_AUDIO_CALL ? getResources().getString(R.string.chat_start_audio_call)
|
|
|
- : getResources().getString(R.string.chat_start_video_call);
|
|
|
+ : getResources().getString(R.string.chat_start_video_call);
|
|
|
if (TUIChatUtils.isGroupChat(getChatInfo().getType())) {
|
|
|
Bundle bundle = new Bundle();
|
|
|
bundle.putString(TUIConstants.TUICalling.GROUP_ID, getChatInfo().getId());
|
|
|
@@ -528,7 +532,7 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
TUICore.startActivity(getContext(), "StartGroupMemberSelectMinimalistActivity", bundle, 11);
|
|
|
} else {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put(TUIConstants.TUICalling.PARAM_NAME_USERIDS, new String[] {getChatInfo().getId()});
|
|
|
+ map.put(TUIConstants.TUICalling.PARAM_NAME_USERIDS, new String[]{getChatInfo().getId()});
|
|
|
map.put(TUIConstants.TUICalling.PARAM_NAME_TYPE, type);
|
|
|
TUICore.callService(TUIConstants.TUICalling.SERVICE_NAME, TUIConstants.TUICalling.METHOD_NAME_CALL, map);
|
|
|
}
|
|
|
@@ -542,7 +546,8 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
List<TUIMessageBean> tuiMessageBeans = mAdapter.getItemList(firstPosition, lastPosition);
|
|
|
presenter.sendMessageReadReceipt(tuiMessageBeans, new IUIKitCallback<Void>() {
|
|
|
@Override
|
|
|
- public void onSuccess(Void data) {}
|
|
|
+ public void onSuccess(Void data) {
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public void onError(String module, int errCode, String errMsg) {
|
|
|
@@ -606,11 +611,11 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
return;
|
|
|
}
|
|
|
Glide.with(getContext())
|
|
|
- .load(faceUrl)
|
|
|
- .apply(new RequestOptions()
|
|
|
- .error(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light)
|
|
|
- .placeholder(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light))
|
|
|
- .into(chatAvatar);
|
|
|
+ .load(faceUrl)
|
|
|
+ .apply(new RequestOptions()
|
|
|
+ .error(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light)
|
|
|
+ .placeholder(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light))
|
|
|
+ .into(chatAvatar);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -644,11 +649,11 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
return;
|
|
|
}
|
|
|
Glide.with(getContext())
|
|
|
- .load(faceUrl)
|
|
|
- .apply(new RequestOptions()
|
|
|
- .error(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light)
|
|
|
- .placeholder(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light))
|
|
|
- .into(chatAvatar);
|
|
|
+ .load(faceUrl)
|
|
|
+ .apply(new RequestOptions()
|
|
|
+ .error(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light)
|
|
|
+ .placeholder(com.tencent.qcloud.tuikit.timcommon.R.drawable.core_default_user_icon_light))
|
|
|
+ .into(chatAvatar);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -769,22 +774,23 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
@Override
|
|
|
public void onDeleteMessageClick(TUIMessageBean msg) {
|
|
|
TUIKitDialog tipsDialog = new TUIKitDialog(getContext())
|
|
|
- .builder()
|
|
|
- .setCancelable(true)
|
|
|
- .setCancelOutside(true)
|
|
|
- .setTitle(getContext().getString(R.string.chat_delete_msg_tip))
|
|
|
- .setDialogWidth(0.75f)
|
|
|
- .setPositiveButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.sure),
|
|
|
- new OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- deleteMessage(msg);
|
|
|
- }
|
|
|
- })
|
|
|
- .setNegativeButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.cancel), new OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {}
|
|
|
- });
|
|
|
+ .builder()
|
|
|
+ .setCancelable(true)
|
|
|
+ .setCancelOutside(true)
|
|
|
+ .setTitle(getContext().getString(R.string.chat_delete_msg_tip))
|
|
|
+ .setDialogWidth(0.75f)
|
|
|
+ .setPositiveButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.sure),
|
|
|
+ new OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ deleteMessage(msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setNegativeButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.cancel), new OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ }
|
|
|
+ });
|
|
|
tipsDialog.show();
|
|
|
}
|
|
|
|
|
|
@@ -1184,24 +1190,25 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
return;
|
|
|
}
|
|
|
TUIKitDialog tipsDialog = new TUIKitDialog(getContext())
|
|
|
- .builder()
|
|
|
- .setCancelable(true)
|
|
|
- .setCancelOutside(true)
|
|
|
- .setTitle(getContext().getString(R.string.chat_delete_msg_tip))
|
|
|
- .setDialogWidth(0.75f)
|
|
|
- .setPositiveButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.sure),
|
|
|
- new OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- final List<TUIMessageBean> messageInfoList = mAdapter.getSelectedItem();
|
|
|
- deleteMessageInfos(messageInfoList);
|
|
|
- resetForwardState();
|
|
|
- }
|
|
|
- })
|
|
|
- .setNegativeButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.cancel), new OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {}
|
|
|
- });
|
|
|
+ .builder()
|
|
|
+ .setCancelable(true)
|
|
|
+ .setCancelOutside(true)
|
|
|
+ .setTitle(getContext().getString(R.string.chat_delete_msg_tip))
|
|
|
+ .setDialogWidth(0.75f)
|
|
|
+ .setPositiveButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.sure),
|
|
|
+ new OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ final List<TUIMessageBean> messageInfoList = mAdapter.getSelectedItem();
|
|
|
+ deleteMessageInfos(messageInfoList);
|
|
|
+ resetForwardState();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setNegativeButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.cancel), new OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ }
|
|
|
+ });
|
|
|
tipsDialog.show();
|
|
|
}
|
|
|
});
|
|
|
@@ -1243,23 +1250,24 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
|
|
|
private void showForwardLimitDialog(final List<TUIMessageBean> messageInfoList) {
|
|
|
TUIKitDialog tipsDialog = new TUIKitDialog(getContext())
|
|
|
- .builder()
|
|
|
- .setCancelable(true)
|
|
|
- .setCancelOutside(true)
|
|
|
- .setTitle(getContext().getString(R.string.forward_oneByOne_limit_number_tip))
|
|
|
- .setDialogWidth(0.75f)
|
|
|
- .setPositiveButton(getContext().getString(R.string.forward_mode_merge),
|
|
|
- new OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- startSelectForwardActivity(TUIChatConstants.FORWARD_MODE_MERGE, messageInfoList);
|
|
|
- resetForwardState();
|
|
|
- }
|
|
|
- })
|
|
|
- .setNegativeButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.cancel), new OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {}
|
|
|
- });
|
|
|
+ .builder()
|
|
|
+ .setCancelable(true)
|
|
|
+ .setCancelOutside(true)
|
|
|
+ .setTitle(getContext().getString(R.string.forward_oneByOne_limit_number_tip))
|
|
|
+ .setDialogWidth(0.75f)
|
|
|
+ .setPositiveButton(getContext().getString(R.string.forward_mode_merge),
|
|
|
+ new OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ startSelectForwardActivity(TUIChatConstants.FORWARD_MODE_MERGE, messageInfoList);
|
|
|
+ resetForwardState();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setNegativeButton(getContext().getString(com.tencent.qcloud.tuicore.R.string.cancel), new OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ }
|
|
|
+ });
|
|
|
tipsDialog.show();
|
|
|
}
|
|
|
|
|
|
@@ -1294,7 +1302,7 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
showNotSupportDialog();
|
|
|
if (msg.isNeedReadReceipt()) {
|
|
|
toastMsg = getResources().getString(R.string.chat_message_read_receipt)
|
|
|
- + getResources().getString(com.tencent.qcloud.tuicore.R.string.TUIKitErrorUnsupporInterfaceSuffix);
|
|
|
+ + getResources().getString(com.tencent.qcloud.tuicore.R.string.TUIKitErrorUnsupporInterfaceSuffix);
|
|
|
}
|
|
|
}
|
|
|
ToastUtil.toastLongMessage(toastMsg);
|
|
|
@@ -1338,7 +1346,7 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
showNotSupportDialog();
|
|
|
if (msg.isNeedReadReceipt()) {
|
|
|
toastMsg = getResources().getString(R.string.chat_message_read_receipt)
|
|
|
- + getResources().getString(com.tencent.qcloud.tuicore.R.string.TUIKitErrorUnsupporInterfaceSuffix);
|
|
|
+ + getResources().getString(com.tencent.qcloud.tuicore.R.string.TUIKitErrorUnsupporInterfaceSuffix);
|
|
|
}
|
|
|
}
|
|
|
ToastUtil.toastLongMessage(toastMsg);
|
|
|
@@ -1434,31 +1442,31 @@ public class ChatView extends LinearLayout implements IChatLayout {
|
|
|
};
|
|
|
spannedString.setSpan(clickableSpan2, buyingGuidelinesIndex, buyingGuidelinesIndex + buyingGuidelines.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
|
|
|
TUIKitDialog.TUIIMUpdateDialog.getInstance()
|
|
|
- .createDialog(getContext())
|
|
|
- .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(getResources().getString(R.string.chat_no_more_reminders),
|
|
|
- new OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- TUIKitDialog.TUIIMUpdateDialog.getInstance().dismiss();
|
|
|
- TUIKitDialog.TUIIMUpdateDialog.getInstance().setNeverShow(true);
|
|
|
- }
|
|
|
- })
|
|
|
- .setNegativeButton(getResources().getString(R.string.chat_i_know),
|
|
|
- new OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- TUIKitDialog.TUIIMUpdateDialog.getInstance().dismiss();
|
|
|
- }
|
|
|
- })
|
|
|
- .show();
|
|
|
+ .createDialog(getContext())
|
|
|
+ .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(getResources().getString(R.string.chat_no_more_reminders),
|
|
|
+ new OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ TUIKitDialog.TUIIMUpdateDialog.getInstance().dismiss();
|
|
|
+ TUIKitDialog.TUIIMUpdateDialog.getInstance().setNeverShow(true);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setNegativeButton(getResources().getString(R.string.chat_i_know),
|
|
|
+ new OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ TUIKitDialog.TUIIMUpdateDialog.getInstance().dismiss();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .show();
|
|
|
}
|
|
|
|
|
|
private void openWebUrl(String url) {
|