Commit c60419b9 by ydl

修改私聊消息样式

parent 1ed4124c
......@@ -20,8 +20,8 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_PROD;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD;
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
ext {
kotlin_version = "1.3.21"
dev_mode = false
dev_mode = true
ydl_app = [
appName : "心理咨询壹点灵",
......
......@@ -92,8 +92,8 @@ public class NimApplication {
//options.buildNimUserCache = true;
options.shouldHandleReceipt = true;
options.toolBarOptions = new YDLToolBarOptions();
options.messageLeftBackground = R.drawable.im_nim_message_item_left_selector;
options.messageRightBackground = R.drawable.im_nim_message_item_right_selector;
options.messageLeftBackground = R.drawable.message_receive_content_bg;
options.messageRightBackground = R.drawable.message_send_content_bg;
return options;
}
......
......@@ -10,10 +10,12 @@ public class CustomAttachConsultCallStatus extends CustomAttachment{
private final String KEY_CALLER="caller";
private final String KEY_CALLEE="callee";
private final String KEY_DURATION="duration";
private final String KEY_IS_CONSULT_ORDER = "isConsultOrder"; //是否是咨询单,true是
private String status;
private String caller;
private String callee;
private String duration;
private String isConsultOrder;
public CustomAttachConsultCallStatus() {
super(CustomAttachmentType.TYPE_CUSTOMER_CONSULT_CALL_STATUS);
......@@ -25,6 +27,7 @@ public class CustomAttachConsultCallStatus extends CustomAttachment{
this.caller=data.getString(KEY_CALLER);
this.callee=data.getString(KEY_CALLEE);
this.duration=data.getString(KEY_DURATION);
this.isConsultOrder=data.getString(KEY_IS_CONSULT_ORDER);
}
@Override
......@@ -34,6 +37,7 @@ public class CustomAttachConsultCallStatus extends CustomAttachment{
data.put(KEY_CALLER, caller);
data.put(KEY_CALLEE, callee);
data.put(KEY_DURATION, duration);
data.put(KEY_IS_CONSULT_ORDER, isConsultOrder);
return data;
}
......@@ -52,4 +56,6 @@ public class CustomAttachConsultCallStatus extends CustomAttachment{
public String getDuration() {
return duration;
}
}
public String getIsConsultOrder() {return isConsultOrder;}
}
\ No newline at end of file
......@@ -45,10 +45,8 @@ public class MsgViewHolderConsultCallStatus extends MsgViewHolderBase {
if (isReceivedMessage()) {
typeImage.setImageResource(R.drawable.im_avchat_left_type_audio);
statusLabel.setTextColor(context.getResources().getColor(R.color.platform_color_grey_999999));
} else {
typeImage.setImageResource(R.drawable.im_avchat_right_type_audio);
statusLabel.setTextColor(Color.WHITE);
}
if (TextUtils.equals("1", customAttachTipMsg.getStatus())) {
......@@ -62,7 +60,30 @@ public class MsgViewHolderConsultCallStatus extends MsgViewHolderBase {
statusLabel.setText(customAttachTipMsg.getCaller());
}
}
//只有倾诉加角标,咨询不加
if (!"true".equals(customAttachTipMsg.getIsConsultOrder())) {
showAudioSmallTip();
}
}
@Override
protected int leftBackground() {
CustomAttachConsultCallStatus customAttachTipMsg = (CustomAttachConsultCallStatus) message.getAttachment();
if (!"true".equals(customAttachTipMsg.getIsConsultOrder())) {
return R.drawable.message_receive_content_tip_bg;
} else {
return R.drawable.message_receive_content_bg;
}
}
@Override
protected int rightBackground() {
CustomAttachConsultCallStatus customAttachTipMsg = (CustomAttachConsultCallStatus) message.getAttachment();
if (!"true".equals(customAttachTipMsg.getIsConsultOrder())) {
return R.drawable.message_send_content_tip_bg;
} else {
return R.drawable.message_send_content_bg;
}
}
}
......@@ -107,7 +107,7 @@ public class MsgViewHolderAudio extends MsgViewHolderBase {
containerView.setBackgroundResource(NimUIKitImpl.getOptions().messageRightBackground);
containerView.setPadding(ScreenUtil.dip2px(10), ScreenUtil.dip2px(8), ScreenUtil.dip2px(15), ScreenUtil.dip2px(8));
animationView.setBackgroundResource(R.drawable.im_nim_audio_animation_list_right);
durationLabel.setTextColor(Color.WHITE);
durationLabel.setTextColor(Color.BLACK);
}
}
......
......@@ -63,6 +63,9 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem
public ImageView nameIconView;
protected TextView audioRightSmallTip;
protected TextView audioLeftSmallTip;
// contentContainerView的默认长按事件。如果子类需要不同的处理,可覆盖onItemLongClick方法
// 但如果某些子控件会拦截触摸消息,导致contentContainer收不到长按事件,子控件也可在inflate时重新设置
protected View.OnLongClickListener longClickListener;
......@@ -190,6 +193,9 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem
readReceiptTextView = findViewById(R.id.textViewAlreadyRead);
ackMsgTextView = findViewById(R.id.team_ack_msg);
audioRightSmallTip = findViewById(R.id.audio_right_small_tip);
audioLeftSmallTip = findViewById(R.id.audio_left_small_tip);
// 这里只要inflate出来后加入一次即可
if (contentContainer.getChildCount() == 0) {
View.inflate(view.getContext(), getContentResId(), contentContainer);
......@@ -371,7 +377,7 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem
LinearLayout bodyContainer = (LinearLayout) view.findViewById(R.id.message_item_body);
// 调整container的位置
int index = isReceivedMessage() ? 0 : 4;
int index = isReceivedMessage() ? 0 : 5;
if (bodyContainer.getChildAt(index) != contentContainer) {
bodyContainer.removeView(contentContainer);
bodyContainer.addView(contentContainer, index);
......@@ -437,4 +443,14 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem
protected void hideItemBg() {
contentContainer.setBackgroundColor(0x00000000);
}
protected void showAudioSmallTip() {
if (isReceivedMessage()) {
audioRightSmallTip.setVisibility(View.VISIBLE);
audioLeftSmallTip.setVisibility(View.GONE);
}else {
audioRightSmallTip.setVisibility(View.GONE);
audioLeftSmallTip.setVisibility(View.VISIBLE);
}
}
}
......@@ -10,6 +10,7 @@ import com.yidianling.common.tools.RxImageTool;
import com.yidianling.im.R;
import com.yidianling.nimbase.business.session.emoji.MoonUtil;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.nimbase.common.util.sys.ScreenUtil;
import com.yidianling.uikit.api.NimUIKit;
import com.yidianling.uikit.api.NimUIKitImpl;
......@@ -51,8 +52,10 @@ public class MsgViewHolderText extends MsgViewHolderBase {
private void layoutDirection() {
if (isReceivedMessage()) {
bodyTextView.setBackgroundResource(NimUIKitImpl.getOptions().messageLeftBackground);
bodyTextView.setPadding(ScreenUtil.dip2px(13), ScreenUtil.dip2px(13), ScreenUtil.dip2px(13), ScreenUtil.dip2px(13));
} else {
bodyTextView.setBackgroundResource(NimUIKitImpl.getOptions().messageRightBackground);
bodyTextView.setPadding(ScreenUtil.dip2px(13), ScreenUtil.dip2px(13), ScreenUtil.dip2px(13), ScreenUtil.dip2px(13));
}
int textWidth = RxDeviceTool.getScreenWidth(context) - RxImageTool.dp2px(122f);
bodyTextView.setMaxWidth(textWidth);
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:bottomLeftRadius="8dp"
android:bottomRightRadius="8dp"
android:topRightRadius="8dp"/>
<solid android:color="#ffffff"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:shape="rectangle">
<corners android:bottomLeftRadius="8dp"
android:topRightRadius="8dp"/>
<solid android:color="#191DA1F2"/>
</shape>
</item>
<item>
<shape
android:shape="rectangle">
<corners android:bottomLeftRadius="8dp"
android:bottomRightRadius="8dp"
android:topRightRadius="8dp"/>
<solid android:color="#ffffff"/>
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:bottomLeftRadius="8dp"
android:bottomRightRadius="8dp"
android:topLeftRadius="8dp"/>
<solid android:color="#CDEBFE"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:shape="rectangle">
<corners android:topLeftRadius="8dp"
android:bottomRightRadius="8dp"/>
<solid android:color="#191DA1F2"/>
</shape>
</item>
<item>
<shape
android:shape="rectangle">
<corners android:bottomLeftRadius="8dp"
android:bottomRightRadius="8dp"
android:topLeftRadius="8dp"/>
<solid android:color="#CDEBFE"/>
</shape>
</item>
</layer-list>
\ No newline at end of file
......@@ -24,6 +24,6 @@
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp"
android:text="无人接听"
android:textColor="@color/im_color_grey_999999"
android:textColor="@color/platform_color_242424"
android:textSize="14sp"/>
</LinearLayout>
......@@ -162,6 +162,17 @@
android:textColor="#666666"
android:textSize="12sp"/>
<TextView
android:id="@+id/audio_left_small_tip"
android:layout_width="18dp"
android:layout_height="18dp"
android:text="倾"
android:gravity="center"
android:textColor="#1DA1F2"
android:textSize="10dp"
android:visibility="gone"
android:background="#191DA1F2"/>
<FrameLayout
android:id="@+id/message_item_content"
android:layout_width="wrap_content"
......@@ -169,6 +180,17 @@
android:layout_gravity="center"
android:background="@android:color/transparent" />
<TextView
android:id="@+id/audio_right_small_tip"
android:layout_width="18dp"
android:layout_height="18dp"
android:text="倾"
android:gravity="center"
android:textColor="#1DA1F2"
android:textSize="10dp"
android:visibility="gone"
android:background="#191DA1F2"/>
</LinearLayout>
</FrameLayout>
</RelativeLayout>
......@@ -25,7 +25,7 @@
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:paddingLeft="2dip"
android:textColor="@color/im_color_black_333333"
android:textColor="@color/platform_color_242424"
android:textSize="12sp"/>
</FrameLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment