UserInfoDialog展示逻辑优化
This commit is contained in:
@@ -41,6 +41,7 @@ import com.yizhuan.xchat_android_core.super_admin.model.SuperAdminModel;
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SAdminOptUtil;
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SaAttachmentFactory;
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
@@ -75,6 +76,7 @@ public class ButtonItemFactory {
|
||||
*/
|
||||
public static List<ViewItem> createCommonButtonItems(
|
||||
Context context,
|
||||
UserInfo userInfo,
|
||||
long uid,
|
||||
boolean isNeedGiftItem,
|
||||
boolean isNeedRoomItem,
|
||||
@@ -380,32 +382,6 @@ public class ButtonItemFactory {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看资料弹窗
|
||||
*/
|
||||
public static ViewItem createCheckUserInfoDialogItem(final Context context, final String account) {
|
||||
return new ViewItem("查看资料", R.drawable.icon_send_gift_ture, () -> new UserInfoDialog(context, Long.valueOf(account)).show());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看资料页面
|
||||
*/
|
||||
public static ButtonItem createCheckUserInfoActivityItem(final Context context, final String account) {
|
||||
return new ButtonItem("查看资料", () -> UserInfoActivity.Companion.start(context, Long.valueOf(account)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下麦旁听,用户卡片
|
||||
*/
|
||||
public static ViewItem createDownMicItem(ViewItem.OnClickListener onClickListener) {
|
||||
return new ViewItem(BasicConfig.INSTANCE.getAppContext().getString(R.string.down_mic_text), onClickListener);
|
||||
// return new ButtonItem(BasicConfig.INSTANCE.getAppContext().getString(R.string.down_mic_text),
|
||||
// 0, ButtonItem.BUTTON_TYPE_BOTTOM, R.layout.item_room_user_dialog_bottom_button,
|
||||
// onClickListener);
|
||||
}
|
||||
|
||||
|
||||
//设置管理员
|
||||
public static ViewItem createMarkManagerListItem(final String roomId, final String account, final boolean mark) {
|
||||
String title = BasicConfig.INSTANCE.getAppContext().getString(mark ? R.string.set_manager : R.string.remove_manager);
|
||||
@@ -545,67 +521,6 @@ public class ButtonItemFactory {
|
||||
return new ButtonItem("举报", () -> UIHelper.showReportPage(context, uid, reportType));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 禁麦,用户卡片
|
||||
*/
|
||||
public static ViewItem createLockMicItem(final int position, ViewItem.OnClickListener onClickListener) {
|
||||
return new ViewItem("闭麦", onClickListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁麦 个人弹窗的
|
||||
*/
|
||||
public static ButtonItem createLockMicDialogItem(final int position, ButtonItem.OnClickListener onClickListener) {
|
||||
return new ButtonItem("禁麦", 0, ButtonItem.BUTTON_TYPE_BOTTOM,
|
||||
R.layout.item_room_user_dialog_bottom_button, onClickListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消禁麦 个人弹窗
|
||||
*/
|
||||
public static ButtonItem createOpenMicItem(final int position, ButtonItem.OnClickListener onClickListener) {
|
||||
return new ButtonItem("解禁", onClickListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消禁麦
|
||||
*/
|
||||
public static ViewItem createFreeMicItem(final int position, ViewItem.OnClickListener onClickListener) {
|
||||
return new ViewItem(BasicConfig.INSTANCE.getAppContext().getString(R.string.no_forbid_mic), onClickListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消禁麦, 资料卡片
|
||||
*/
|
||||
public static ViewItem createFreeMicCardItem(final int position, ViewItem.OnClickListener onClickListener) {
|
||||
return new ViewItem("开麦", onClickListener);
|
||||
}
|
||||
|
||||
public static ButtonItem createManagerListItem(final Context context) {
|
||||
ButtonItem buttonItem = new ButtonItem("管理员", () -> RoomManagerListActivity.start(context));
|
||||
return buttonItem;
|
||||
}
|
||||
|
||||
public static ButtonItem createBlackListItem(final Context context) {
|
||||
ButtonItem buttonItem = new ButtonItem("黑名单", () -> RoomBlackListActivity.start(context));
|
||||
return buttonItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* 锁麦,资料卡片
|
||||
*/
|
||||
public static ViewItem createLockMicListItem(final Context context, ViewItem.OnClickListener onClickListener) {
|
||||
return new ViewItem("锁麦", onClickListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解封,资料卡片
|
||||
*/
|
||||
public static ViewItem createUnLockMicListItem(final Context context, ViewItem.OnClickListener onClickListener) {
|
||||
return new ViewItem("解锁", onClickListener);
|
||||
}
|
||||
|
||||
public static List<ViewItem> createMiniWorldGroupButtonItems(
|
||||
Context context,
|
||||
long uid,
|
||||
|
@@ -994,7 +994,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
* 显示资料卡片
|
||||
*/
|
||||
private fun showUserCardDialog(account: String) {
|
||||
val list = ButtonItemFactory.createCommonButtonItems(
|
||||
UserInfoDialog.showNewUserInfoDialog(
|
||||
mContext,
|
||||
JavaUtil.str2long(account),
|
||||
true,
|
||||
@@ -1002,8 +1002,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
true,
|
||||
this@BaseRoomFragment
|
||||
)
|
||||
GiftDialog.GIFT_DIALOG_FROM = "房间"
|
||||
UserInfoDialog(mContext, JavaUtil.str2long(account), list, true).show()
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@@ -1186,7 +1184,7 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
inputEdit.isFocusableInTouchMode = true
|
||||
inputEdit.requestFocus()
|
||||
KeyBoardUtils.showKeyBoard(context, inputEdit)
|
||||
},200)
|
||||
}, 200)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -193,15 +193,7 @@ public class OnlineUserFragment extends BaseMvpFragment<IHomePartyUserListView,
|
||||
|
||||
String account = (chatRoomMember != null ?
|
||||
chatRoomMember.getAccount() : String.valueOf(onlineChatMember.uid));
|
||||
List<ViewItem> list = ButtonItemFactory.createCommonButtonItems(
|
||||
getActivity(), JavaUtil.str2long(account), false, true, true, null);
|
||||
GiftDialog.GIFT_DIALOG_FROM = "房间";
|
||||
new UserInfoDialog(
|
||||
mContext,
|
||||
JavaUtil.str2long(account),
|
||||
list,
|
||||
true
|
||||
).show();
|
||||
UserInfoDialog.showNewUserInfoDialog(mContext,JavaUtil.str2long(account),true, false, true, null);
|
||||
} else {
|
||||
if (UserModel.get().getCacheLoginUserInfo().getNobleUsers() != null) {
|
||||
toast(R.string.already_noble);
|
||||
|
@@ -128,15 +128,9 @@ public class RoomCharmRankingListFragment extends BaseMvpFragment<IRoomCharmRank
|
||||
}
|
||||
|
||||
private void showUserInfoDialog(long uid) {
|
||||
List<ViewItem> buttonList = ButtonItemFactory.createCommonButtonItems(
|
||||
mContext, uid, false, true, true, null);
|
||||
|
||||
GiftDialog.GIFT_DIALOG_FROM = "房间";
|
||||
new UserInfoDialog(
|
||||
mContext,
|
||||
uid,
|
||||
buttonList,
|
||||
true
|
||||
).show();
|
||||
UserInfoDialog.showNewUserInfoDialog(mContext, uid);
|
||||
}
|
||||
|
||||
private void loadData(){
|
||||
|
@@ -141,15 +141,7 @@ public class RoomContributeFragment extends BaseMvpFragment<IRoomContributeListV
|
||||
}
|
||||
|
||||
private void showUserInfoDialog(long uid) {
|
||||
List<ViewItem> buttonList = ButtonItemFactory.createCommonButtonItems(
|
||||
mContext, uid, false, true, true, null);
|
||||
GiftDialog.GIFT_DIALOG_FROM = "房间";
|
||||
new UserInfoDialog(
|
||||
mContext,
|
||||
uid,
|
||||
buttonList,
|
||||
true
|
||||
).show();
|
||||
UserInfoDialog.showNewUserInfoDialog(mContext, uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1171,7 +1171,7 @@ public class MessageView extends FrameLayout {
|
||||
.append(" " + nick + " ", new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
new UserInfoDialog(mContext, joinMiniWorldNoticeAttachment.getUid()).show();
|
||||
UserInfoDialog.showNewUserInfoDialog(mContext, joinMiniWorldNoticeAttachment.getUid());
|
||||
}
|
||||
}, new ForegroundColorSpan(roomTipNickColor))
|
||||
.append("加入")
|
||||
@@ -1280,7 +1280,7 @@ public class MessageView extends FrameLayout {
|
||||
.append(" " + nick + " ", new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
new UserInfoDialog(mContext, userInfo.getUid()).show();
|
||||
UserInfoDialog.showNewUserInfoDialog(mContext, userInfo.getUid());
|
||||
}
|
||||
}, new ForegroundColorSpan(roomTipNickColor))
|
||||
.append("关注房主不迷路哦")
|
||||
@@ -1666,7 +1666,7 @@ public class MessageView extends FrameLayout {
|
||||
// 内容
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(attachment.getRoleType() == 1 ? "房主" : "管理员", new ForegroundColorSpan(Color.WHITE))
|
||||
.append("(" + attachment.getNick() + ") ", new ForegroundColorSpan(roomTipColor),
|
||||
.append("(" + attachment.getNick() + ") ", new ForegroundColorSpan(roomTipColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
|
@@ -92,8 +92,7 @@ public class FamilyCurrencyBillAdapter extends BaseMultiItemQuickAdapter<VMBillI
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (item.getUid() > 0) {
|
||||
UserInfoDialog userInfoDialog = new UserInfoDialog(mContext, item.getUid());
|
||||
userInfoDialog.show();
|
||||
UserInfoDialog.showNewUserInfoDialog(mContext,item.getUid());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -54,8 +54,7 @@ public class TeamWeeklyBillAdapter extends BaseAdapter<TeamTransactionRecordInfo
|
||||
.into(civImg);
|
||||
|
||||
civImg.setOnClickListener(v -> {
|
||||
UserInfoDialog userInfoDialog = new UserInfoDialog(context, item.getUid());
|
||||
userInfoDialog.show();
|
||||
UserInfoDialog.showNewUserInfoDialog(context,item.getUid());
|
||||
});
|
||||
|
||||
tvNick.setText(item.getNick());
|
||||
|
@@ -27,6 +27,7 @@ import com.netease.nimlib.sdk.chatroom.model.ChatRoomKickOutEvent;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.UIHelper;
|
||||
import com.yizhuan.erban.avroom.ButtonItemFactory;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.avroom.adapter.UpMicAdapter;
|
||||
import com.yizhuan.erban.avroom.giftvalue.GiftValueDialogUiHelper;
|
||||
@@ -37,6 +38,7 @@ import com.yizhuan.erban.ui.user.UserInfoActivity;
|
||||
import com.yizhuan.erban.ui.user.adapter.SkillPicsAdapter;
|
||||
import com.yizhuan.erban.ui.user.decorationsend.UserInfoSkillDecoration;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.widget.dialog.CommonLoadingDialog;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.erban.ui.widget.recyclerview.decoration.SpacingDecoration;
|
||||
import com.yizhuan.erban.utils.RegexUtil;
|
||||
@@ -81,6 +83,7 @@ import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.StringUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.callback.CallBack;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
@@ -167,19 +170,50 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
|
||||
private RecyclerView recyclerViewSkill;
|
||||
|
||||
public UserInfoDialog(Context context, long uid, List<ViewItem> buttons, boolean isInRoom) {
|
||||
private UserInfoDialog(Context context, UserInfo userInfo, long uid, List<ViewItem> buttons, boolean isInRoom) {
|
||||
super(context, R.style.ErbanUserInfoDialog);
|
||||
this.context = context;
|
||||
this.uid = uid;
|
||||
this.buttons = buttons;
|
||||
this.userInfo = userInfo;
|
||||
isMySelf = (this.uid == AuthModel.get().getCurrentUid());
|
||||
homePartyModel = new HomePartyModel();
|
||||
mSuperAdminModel = new SuperAdminModel();
|
||||
this.isInRoom = isInRoom;
|
||||
}
|
||||
|
||||
public UserInfoDialog(Context context, long uid) {
|
||||
this(context, uid, null, false);
|
||||
public static void showNewUserInfoDialog(Context context, long uid){
|
||||
showNewUserInfoDialog(context, uid,true,true,true,null);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
public static void showNewUserInfoDialog(Context context,
|
||||
long uid,
|
||||
boolean isInRoom,
|
||||
boolean isNeedGiftItem,
|
||||
boolean isNeedRoomItem,
|
||||
GiftDialog.OnGiftDialogBtnClickListener listener) {
|
||||
CommonLoadingDialog loadingDialog = new CommonLoadingDialog(context, "loading...").showDialog();
|
||||
UserModel.get().getUserInfo(uid)
|
||||
.compose(RxHelper.bindContext(context))
|
||||
.subscribe(userInfo -> {
|
||||
List<ViewItem> list = ButtonItemFactory.createCommonButtonItems(
|
||||
context,
|
||||
userInfo,
|
||||
uid,
|
||||
isNeedGiftItem,
|
||||
isNeedRoomItem,
|
||||
isInRoom,
|
||||
listener
|
||||
);
|
||||
new UserInfoDialog(context, userInfo, uid, list, isInRoom).show();
|
||||
loadingDialog.dismiss();
|
||||
}, throwable -> {
|
||||
SingleToastUtil.showToast(throwable.getMessage());
|
||||
loadingDialog.dismiss();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -247,24 +281,7 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
subscribe = IMNetEaseManager.get().getChatRoomEventObservable().subscribe(this::onReceiveRoomEvent);
|
||||
initAttentData();
|
||||
initDatingData();
|
||||
UserModel.get().getUserInfo(uid)
|
||||
.subscribe(new SingleObserver<UserInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(UserInfo userInfo) {
|
||||
UserInfoDialog.this.userInfo = userInfo;
|
||||
updateView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
});
|
||||
updateView();
|
||||
}
|
||||
|
||||
private void initAttentData() {
|
||||
@@ -702,8 +719,7 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
//如果没贵族信息,就加载头像作为背景
|
||||
if (avatarBg == null || !avatarBg.equals(userInfo.getAvatar())) {
|
||||
avatarBg = userInfo.getAvatar();
|
||||
ImageLoadUtils.loadImageWithBlurTransformation(
|
||||
context, userInfo.getAvatar(), ivAvatarBg);
|
||||
ImageLoadUtils.loadImageWithBlur(context, userInfo.getAvatar(), ivAvatarBg,10, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package com.yizhuan.erban.ui.widget.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -33,10 +34,18 @@ public class CommonLoadingDialog extends BaseDialog {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.layout_progress_dialog);
|
||||
|
||||
tvTip = (TextView) findViewById(R.id.tv_tip);
|
||||
tvTip.setText(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
Window window = getWindow();
|
||||
if (window != null) {
|
||||
window.getAttributes().dimAmount = 0f;
|
||||
window.setAttributes(window.getAttributes());
|
||||
}
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
|
@@ -37,6 +37,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_banner"
|
||||
app:riv_corner_radius_top_left="@dimen/dp_10"
|
||||
app:riv_corner_radius_top_right="@dimen/dp_10"
|
||||
tools:contentDescription="头像高斯模糊做背景" />
|
||||
|
@@ -215,7 +215,7 @@ public class MWTeamRoomMessageAct extends BaseMessageActivity implements IMWTeam
|
||||
}
|
||||
});
|
||||
GiftDialog.GIFT_DIALOG_FROM = "话题群聊";
|
||||
new UserInfoDialog(mContext, Long.valueOf(uid), list, false).show();
|
||||
UserInfoDialog.showNewUserInfoDialog(mContext, Long.valueOf(uid));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -238,7 +238,7 @@ public class MiniWorldTeamMessageActivity extends BaseMessageActivity implements
|
||||
}
|
||||
});
|
||||
GiftDialog.GIFT_DIALOG_FROM = "话题群聊";
|
||||
new UserInfoDialog(mContext, Long.valueOf(uid), list, false).show();
|
||||
UserInfoDialog.showNewUserInfoDialog(mContext, Long.valueOf(uid));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -293,6 +293,7 @@ public class PublicChatHallMessageFragment extends TFragment implements ModulePr
|
||||
inputPanel.updateSendMessageButton();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void handleAvatarClick(PublicChatHallAvatarClickEvent event) {
|
||||
PublicChatHallModel.get().getOwnerInfo()
|
||||
@@ -334,7 +335,7 @@ public class PublicChatHallMessageFragment extends TFragment implements ModulePr
|
||||
}
|
||||
});
|
||||
GiftDialog.GIFT_DIALOG_FROM = "公聊大厅";
|
||||
new UserInfoDialog(event.getContext(), Long.valueOf(event.getMessage().getFromAccount()), list, false).show();
|
||||
UserInfoDialog.showNewUserInfoDialog(event.getContext(), Long.valueOf(event.getMessage().getFromAccount()));
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.data_dard_homepage_click,"资料卡片-主页");
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user