私聊改造:bugfix

This commit is contained in:
huangjian
2023-02-07 11:51:11 +08:00
parent 86465b9932
commit 3b8796c378
9 changed files with 48 additions and 28 deletions

View File

@@ -347,9 +347,9 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
public int getPanelTriggerId() { public int getPanelTriggerId() {
return R.id.emoji_button; return R.id.emoji_button;
} }
}).logTrack(false)//output log })
.logTrack(false)//output log
.build(); .build();
messageListView.setPanelSwitchHelper(mHelper); messageListView.setPanelSwitchHelper(mHelper);
} }
@@ -859,6 +859,10 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
@Override @Override
public void onRecordSuccess(File audioFile, long audioLength, RecordType recordType) { public void onRecordSuccess(File audioFile, long audioLength, RecordType recordType) {
if (audioLength < 1000) {
SingleToastUtil.showToast("说话时间太短!");
return;
}
IMMessage audioMessage = MessageBuilder.createAudioMessage(container.account, container.sessionType, audioFile, audioLength); IMMessage audioMessage = MessageBuilder.createAudioMessage(container.account, container.sessionType, audioFile, audioLength);
container.proxy.sendMessage(audioMessage); container.proxy.sendMessage(audioMessage);
} }

View File

@@ -1056,7 +1056,9 @@ public class MessageListPanelEx {
private boolean enableRevokeButton(IMMessage selectedItem) { private boolean enableRevokeButton(IMMessage selectedItem) {
return selectedItem.getStatus() == MsgStatusEnum.success return selectedItem.getStatus() == MsgStatusEnum.success
&& selectedItem.getMsgType() == MsgTypeEnum.text && (selectedItem.getMsgType() == MsgTypeEnum.text ||
selectedItem.getMsgType() == MsgTypeEnum.audio ||
selectedItem.getMsgType() == MsgTypeEnum.image)
&& !recordOnly && !recordOnly
&& selectedItem.getDirect() == MsgDirectionEnum.Out && selectedItem.getDirect() == MsgDirectionEnum.Out
&& CurrentTimeUtils.getCurrentTime() - selectedItem.getTime() < 2 * 60 * 1000; && CurrentTimeUtils.getCurrentTime() - selectedItem.getTime() < 2 * 60 * 1000;

View File

@@ -49,6 +49,7 @@ public class AddBlackListActivity extends BaseMvpActivity<IAddBlackListView, Add
private ImageView ivHeadWear; private ImageView ivHeadWear;
private IOSSwitchView switchTop; private IOSSwitchView switchTop;
private IOSSwitchView switchAddBlack; private IOSSwitchView switchAddBlack;
private TextView tvId;
public static void start(Context context, String contactId) { public static void start(Context context, String contactId) {
Intent intent = new Intent(); Intent intent = new Intent();
@@ -113,6 +114,7 @@ public class AddBlackListActivity extends BaseMvpActivity<IAddBlackListView, Add
switchTop = findViewById(R.id.switch_top); switchTop = findViewById(R.id.switch_top);
switchAddBlack = findViewById(R.id.switch_add_black); switchAddBlack = findViewById(R.id.switch_add_black);
ivHeadWear = findViewById(R.id.iv_head_wear); ivHeadWear = findViewById(R.id.iv_head_wear);
tvId = findViewById(R.id.tv_id);
} }
void changeText(boolean contains) { void changeText(boolean contains) {
@@ -122,7 +124,7 @@ public class AddBlackListActivity extends BaseMvpActivity<IAddBlackListView, Add
/** /**
* 初始化目标的信息 * 初始化目标的信息
*/ */
@SuppressLint("CheckResult") @SuppressLint({"CheckResult", "SetTextI18n"})
private void initTarget() { private void initTarget() {
UserModel.get() UserModel.get()
.getUserInfo(Long.parseLong(account)) .getUserInfo(Long.parseLong(account))
@@ -131,6 +133,7 @@ public class AddBlackListActivity extends BaseMvpActivity<IAddBlackListView, Add
ImageLoadUtils.loadAvatar(AddBlackListActivity.this, userInfo.getAvatar(), ivAvatar, true); ImageLoadUtils.loadAvatar(AddBlackListActivity.this, userInfo.getAvatar(), ivAvatar, true);
// 名字 // 名字
tvName.setText(RegexUtil.getPrintableString(userInfo.getNick())); tvName.setText(RegexUtil.getPrintableString(userInfo.getNick()));
tvId.setText("ID:" + userInfo.getErbanNo());
HeadWearInfo headWearInfo = userInfo.getUserHeadwear(); HeadWearInfo headWearInfo = userInfo.getUserHeadwear();
if (headWearInfo != null && !TextUtils.isEmpty(headWearInfo.getPic())) { if (headWearInfo != null && !TextUtils.isEmpty(headWearInfo.getPic())) {
NobleUtil.loadHeadWear( NobleUtil.loadHeadWear(

View File

@@ -68,9 +68,9 @@
android:layout_below="@id/tv_name" android:layout_below="@id/tv_name"
android:layout_alignStart="@id/tv_name" android:layout_alignStart="@id/tv_name"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:text="ID:953842"
android:textColor="#ffbabbcd" android:textColor="#ffbabbcd"
android:textSize="12sp" /> android:textSize="12sp"
tools:text="ID:953842" />
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@@ -25,5 +25,5 @@ only_arm64=false
channel_file=channel.txt channel_file=channel.txt
version_name=5.6.0.3 version_name=5.9.0.3
version_code=560 version_code=590

View File

@@ -97,6 +97,7 @@ dependencies {
api 'com.github.DSAppTeam:PanelSwitchHelper:v1.5.2' api 'com.github.DSAppTeam:PanelSwitchHelper:v1.5.2'
api 'io.github.razerdp:BasePopup:3.2.1'
} }
repositories { repositories {

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

View File

@@ -1,10 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_root" android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/nim_shape_767676_8dp" android:background="@drawable/nim_shape_767676_8dp"
android:orientation="vertical" > android:orientation="vertical">
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_height="wrap_content"
android:src="@drawable/nim_bottom_arrow" />
</LinearLayout> </LinearLayout>

View File

@@ -1,17 +1,11 @@
package com.netease.nim.uikit.common.ui.dialog; package com.netease.nim.uikit.common.ui.dialog;
import static android.widget.LinearLayout.SHOW_DIVIDER_BEGINNING;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.util.Pair; import android.util.Pair;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView; import android.widget.TextView;
import com.netease.nim.uikit.R; import com.netease.nim.uikit.R;
@@ -20,8 +14,10 @@ import com.netease.nim.uikit.common.util.sys.ScreenUtil;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import razerdp.basepopup.BasePopupWindow;
public class CustomPopupWindow extends PopupWindow {
public class CustomPopupWindow extends BasePopupWindow {
private final Context context; private final Context context;
private final LinearLayout llRoot; private final LinearLayout llRoot;
@@ -29,15 +25,17 @@ public class CustomPopupWindow extends PopupWindow {
private int orientation; private int orientation;
public CustomPopupWindow(Context context, int orientation) { public CustomPopupWindow(Context context, int orientation) {
super(context);
this.context = context; this.context = context;
this.orientation = orientation; this.orientation = orientation;
llRoot = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.nim_custom_popup_window, null);
setContentView(llRoot); setContentView(createPopupById(R.layout.nim_custom_popup_window));
llRoot.setShowDividers(SHOW_DIVIDER_BEGINNING); llRoot = findViewById(R.id.ll_root);
llRoot.setOrientation(orientation); llRoot.setOrientation(orientation);
setBackgroundDrawable(new ColorDrawable()); setOutSideDismiss(true);
setOutsideTouchable(true); setBackgroundColor(Color.TRANSPARENT);
setFocusable(true); hideKeyboardOnShow(false);
setPopupAnimationStyle(-1);
} }
public void addItem(String itemText, View.OnClickListener listener) { public void addItem(String itemText, View.OnClickListener listener) {
@@ -51,9 +49,8 @@ public class CustomPopupWindow extends PopupWindow {
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, ScreenUtil.dip2px(30)) new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, ScreenUtil.dip2px(30))
); );
} }
setHeight(ScreenUtil.dip2px(30 * (orientation == LinearLayout.HORIZONTAL ? 1 : itemTextList.size()))); setPopupGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
setWidth(WindowManager.LayoutParams.WRAP_CONTENT); showPopupWindow(anchor);
showAsDropDown(anchor, xoff, yoff);
} }
private TextView createTextView(CharSequence text, View.OnClickListener listener) { private TextView createTextView(CharSequence text, View.OnClickListener listener) {