私聊改造: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

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

View File

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

View File

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