Merge branch 'v1.5.0/optimize' into v1.5.0/test

This commit is contained in:
Max
2023-11-07 10:01:40 +08:00
249 changed files with 447 additions and 177 deletions

View File

@@ -17,6 +17,7 @@ import com.netease.nimlib.sdk.RequestCallbackWrapper;
import com.netease.nimlib.sdk.uinfo.constant.GenderEnum;
import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
import com.nnbc123.app.R;
import com.nnbc123.app.support.LevelIconHelper;
import com.nnbc123.app.ui.utils.ImageLoadUtils;
import com.nnbc123.app.ui.widget.NobleAvatarView;
import com.nnbc123.app.utils.RegexUtil;
@@ -97,20 +98,25 @@ public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMembe
// 官字
baseViewHolder.getView(R.id.iv_user_official).setVisibility(onlineChatMember.isOfficial() ? View.VISIBLE : View.GONE);
//经验等级
AppCompatImageView ivUserExper = baseViewHolder.getView(R.id.iv_user_exper);
String experLevelUrl = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, onlineChatMember.chatRoomMember);
boolean isExperLevelUrlEmpty = TextUtils.isEmpty(experLevelUrl);
ivUserExper.setVisibility(!isExperLevelUrlEmpty ? View.VISIBLE : View.GONE);
if (!isExperLevelUrlEmpty) {
ImageLoadUtils.loadImage(mContext, experLevelUrl, ivUserExper);
AppCompatImageView wealthView = baseViewHolder.getView(R.id.iv_user_exper);
Integer wealthIconId = LevelIconHelper.INSTANCE.getWealthIconByUrl(experLevelUrl);
if (wealthIconId != null) {
wealthView.setImageResource(wealthIconId);
wealthView.setVisibility(View.VISIBLE);
} else {
wealthView.setVisibility(View.GONE);
}
//魅力等级
AppCompatImageView ivUserCharm = baseViewHolder.getView(R.id.iv_user_charm);
String charmLevelUrl = NobleUtil.getLevel(UserLevelResourceType.CHARM_URL, onlineChatMember.chatRoomMember);
boolean isCharmLevelUrlEmpty = TextUtils.isEmpty(charmLevelUrl);
ivUserCharm.setVisibility(!isCharmLevelUrlEmpty ? View.VISIBLE : View.GONE);
if (!isCharmLevelUrlEmpty) {
ImageLoadUtils.loadImage(mContext, charmLevelUrl, ivUserCharm);
AppCompatImageView charmView = baseViewHolder.getView(R.id.iv_user_charm);
Integer charmIconId = LevelIconHelper.INSTANCE.getCharmIconByUrl(charmLevelUrl);
if (charmIconId != null) {
charmView.setImageResource(charmIconId);
charmView.setVisibility(View.VISIBLE);
} else {
charmView.setVisibility(View.GONE);
}
// 官方主播铭牌标识

View File

@@ -61,6 +61,7 @@ import com.nnbc123.app.avroom.dialog.PKResultDialog;
import com.nnbc123.app.common.widget.CustomAutoWidthImageSpan;
import com.nnbc123.app.common.widget.CustomImageSpan;
import com.nnbc123.app.common.widget.OriginalDrawStatusClickSpan;
import com.nnbc123.app.support.LevelIconHelper;
import com.nnbc123.app.ui.utils.ImageLoadKt;
import com.nnbc123.app.ui.utils.ImageLoadUtils;
import com.nnbc123.app.ui.widget.DividerItemDecoration;
@@ -283,9 +284,9 @@ public class MessageView extends FrameLayout {
sysIconHeight = Utils.dip2px(context, 14);
smallFace = Utils.dip2px(context, 22);
bigFace = Utils.dip2px(context, 30);
//经验等级图片后台已经更换尺寸了,公屏同步下,尺寸是26:20
expLevelHeight = Utils.dip2px(context, 20);
expLevelWidth = expLevelHeight * 26 / 20;//expLevelHeight * 114 / 45
//经验等级图片后台已经更换尺寸了,公屏同步下,尺寸是38:18
expLevelHeight = Utils.dip2px(context, 18);
expLevelWidth = expLevelHeight * 38 / 18;//expLevelHeight * 114 / 45
giftLength = Utils.dip2px(context, 35);
// 内容区域
layoutManger = new LinearLayoutManager(context, RecyclerView.VERTICAL, false);
@@ -2059,8 +2060,26 @@ public class MessageView extends FrameLayout {
builder.append(ivOfficialMask, SizeUtils.dp2px(mContext, 62), expLevelHeight);
}
//等级
builder.append(userLevel, expLevelWidth, expLevelHeight);
builder.append(charmLevel, expLevelWidth, expLevelHeight);
Integer wealthIconId = LevelIconHelper.INSTANCE.getWealthIconByUrl(userLevel);
Integer charmIconId = LevelIconHelper.INSTANCE.getCharmIconByUrl(charmLevel);
Drawable wealthDrawable = null;
Drawable charmDrawable = null;
if (wealthIconId != null) {
wealthDrawable = ResourcesCompat.getDrawable(getResources(),
wealthIconId, null);
}
if (charmIconId != null) {
charmDrawable = ResourcesCompat.getDrawable(getResources(),
charmIconId, null);
}
if (wealthDrawable != null) {
builder.append(wealthDrawable, expLevelWidth, expLevelHeight);
}
if (charmDrawable != null) {
builder.append(charmDrawable, expLevelWidth, expLevelHeight);
}
// builder.append(userLevel, expLevelWidth, expLevelHeight);
// builder.append(charmLevel, expLevelWidth, expLevelHeight);
//铭牌
String tvNamePlate = NobleUtil.getNamePlate(UserInfo.NAMEPLATE_WORD, chatRoomMessage).trim();
String ivNamePlate = NobleUtil.getNamePlate(UserInfo.NAMEPLATE_PIC, chatRoomMessage);
@@ -2587,7 +2606,16 @@ public class MessageView extends FrameLayout {
String userLevel = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, chatRoomMessage);
SpannableBuilder text = new SpannableBuilder(tvContent);
//等级
text.append(userLevel, expLevelWidth, expLevelHeight);
Integer wealthIconId = LevelIconHelper.INSTANCE.getWealthIconByUrl(userLevel);
Drawable wealthDrawable = null;
if (wealthIconId != null) {
wealthDrawable = ResourcesCompat.getDrawable(getResources(),
wealthIconId, null);
}
if (wealthDrawable != null) {
text.append(wealthDrawable, expLevelWidth, expLevelHeight);
}
// text.append(userLevel, expLevelWidth, expLevelHeight);
text.append(senderNick, new ForegroundColorSpan(appColor),
new OriginalDrawStatusClickSpan() {
@Override

View File

@@ -34,6 +34,7 @@ import com.nnbc123.app.home.helper.OpenRoomHelper
import com.nnbc123.app.qiyukefu.CustomerServerHelper
import com.nnbc123.app.skill.activity.SkillHomeActivity
import com.nnbc123.app.skill.activity.SkillHomeActivity.Companion.start
import com.nnbc123.app.support.LevelIconHelper
import com.nnbc123.app.ui.patriarch.PatriarchModeActivity
import com.nnbc123.app.ui.pay.ChargeActivity
import com.nnbc123.app.ui.relation.AttentionListActivity
@@ -327,15 +328,15 @@ class MeFragment : BaseFragment(), View.OnClickListener {
mBinding.ivUserCharm.visibility = View.GONE
mBinding.ivUserLevel.visibility = View.GONE
if (userLevelVo != null) {
val userLevelUrl = userLevelVo.getExperUrl()
val userCharmUrl = userLevelVo.getCharmUrl()
if (!TextUtils.isEmpty(userLevelUrl)) {
mBinding.ivUserLevel.visibility = View.VISIBLE
ImageLoadUtils.loadImage(mContext, userLevelUrl, mBinding.ivUserLevel)
}
if (!TextUtils.isEmpty(userCharmUrl)) {
val charmIconId = LevelIconHelper.getCharmIcon(userLevelVo.charmLevelSeq)
val wealthIconId = LevelIconHelper.getWealthIcon(userLevelVo.experLevelSeq)
if (charmIconId != null) {
mBinding.ivUserCharm.setImageResource(charmIconId)
mBinding.ivUserCharm.visibility = View.VISIBLE
ImageLoadUtils.loadImage(mContext, userCharmUrl, mBinding.ivUserCharm)
}
if (wealthIconId != null) {
mBinding.ivUserLevel.setImageResource(wealthIconId)
mBinding.ivUserLevel.visibility = View.VISIBLE
}
}
}

View File

@@ -0,0 +1,97 @@
package com.nnbc123.app.support
import androidx.collection.ArrayMap
import com.chuhai.utils.AppUtils
import com.chuhai.utils.log.ILog
/**
* Created by Max on 2023/11/3 18:00
* Desc:等级图标助手
**/
object LevelIconHelper : ILog {
private val map: ArrayMap<String, Int> by lazy() {
ArrayMap()
}
/**
* 获取魅力等级ICON
* @param iconUrl 图标地址
*/
fun getCharmIconByUrl(iconUrl: String?): Int? {
return getCharmIcon(parseLevelNumber(iconUrl))
}
/**
* 获取财富等级ICON
* @param iconUrl 图标地址
*/
fun getWealthIconByUrl(iconUrl: String?): Int? {
return getWealthIcon(parseLevelNumber(iconUrl))
}
/**
* 获取魅力等级ICON
* @param level 等级
* @return 图标资源ID
*/
fun getCharmIcon(level: Int?): Int? {
val levelName = getLevelName(level) ?: return null
return getDrawableRedIdByName("charm_ic_$levelName")
}
/**
* 获取财富等级ICON
* @param level 等级
* @return 图标资源ID
*/
fun getWealthIcon(level: Int?): Int? {
val levelName = getLevelName(level) ?: return null
return getDrawableRedIdByName("wealth_ic_$levelName")
}
private fun getDrawableRedIdByName(name: String): Int? {
val value = map[name]
if (value != null) {
return value
}
return try {
val id = AppUtils.getApp().resources.getIdentifier(
name,
"drawable",
AppUtils.getApp().packageName
)
map[name] = id
id
} catch (e: Exception) {
null
}
}
private fun parseLevelNumber(levelIconUrl: String?): Int? {
if (levelIconUrl == null) {
return null
}
// https://image.nnbc123.cn/charm_20.png
val dotIndex = levelIconUrl.lastIndexOf('.')
val separatorIndex = levelIconUrl.lastIndexOf('_') + 1
if (dotIndex > 0 && separatorIndex > 0 && dotIndex > separatorIndex) {
return levelIconUrl.substring(separatorIndex, dotIndex).toIntOrNull()
}
return null
}
private fun getLevelName(level: Int?): String? {
if (level == null) {
return null
}
if (level <= 0 || level > 110) {
return null
}
return if (level < 10) {
"0$level"
} else {
level.toString()
}
}
}

View File

@@ -7,18 +7,21 @@ import androidx.core.content.ContextCompat;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.nnbc123.app.R;
import com.nnbc123.app.friend.action.AbstractSelectFriendAction;
import com.nnbc123.app.support.LevelIconHelper;
import com.nnbc123.app.ui.im.avtivity.NimP2PMessageActivity;
import com.nnbc123.app.ui.user.UserInfoActivity;
import com.nnbc123.app.ui.utils.ImageLoadUtils;
import com.nnbc123.app.ui.widget.NobleAvatarView;
import com.nnbc123.app.vip.VipHelper;
import com.nnbc123.app.room_chat.activity.NimRoomP2PMessageActivity;
import com.nnbc123.core.level.UserLevelVo;
import com.nnbc123.core.noble.NobleUtil;
import com.nnbc123.core.user.bean.UserInfo;
import com.nnbc123.core.utils.StringExtensionKt;
@@ -91,18 +94,27 @@ public class FriendListAdapter extends BaseQuickAdapter<UserInfo, BaseViewHolder
ivNobleLevel.setVisibility(View.GONE);
}
AppCompatImageView ivUserLevel = helper.getView(R.id.iv_user_level);
ivUserLevel.setVisibility(View.GONE);
if (item.getUserLevelVo() != null && !TextUtils.isEmpty(item.getUserLevelVo().getExperUrl())) {
ivUserLevel.setVisibility(View.VISIBLE);
ImageLoadUtils.loadImage(mContext, item.getUserLevelVo().getExperUrl(), ivUserLevel);
}
AppCompatImageView ivCharmLevel = helper.getView(R.id.iv_charm_level);
ivCharmLevel.setVisibility(View.GONE);
if (item.getUserLevelVo() != null && !TextUtils.isEmpty(item.getUserLevelVo().getCharmUrl())) {
ivCharmLevel.setVisibility(View.VISIBLE);
ImageLoadUtils.loadImage(mContext, item.getUserLevelVo().getCharmUrl(), ivCharmLevel);
ImageView charmView = helper.getView(R.id.iv_charm_level);
ImageView wealthView = helper.getView(R.id.iv_user_level);
UserLevelVo userLevelVo = item.getUserLevelVo();
if (userLevelVo != null) {
Integer charmIconId = LevelIconHelper.INSTANCE.getCharmIcon(userLevelVo.charmLevelSeq);
Integer wealthIconId = LevelIconHelper.INSTANCE.getWealthIcon(userLevelVo.experLevelSeq);
if (charmIconId != null) {
charmView.setImageResource(charmIconId);
charmView.setVisibility(View.VISIBLE);
} else {
charmView.setVisibility(View.GONE);
}
if (wealthIconId != null) {
wealthView.setImageResource(wealthIconId);
wealthView.setVisibility(View.VISIBLE);
} else {
wealthView.setVisibility(View.GONE);
}
} else {
charmView.setVisibility(View.GONE);
wealthView.setVisibility(View.GONE);
}
helper.getView(R.id.container).setOnClickListener(new View.OnClickListener() {

View File

@@ -1,18 +1,22 @@
package com.nnbc123.app.ui.relation.adapter;
import androidx.appcompat.widget.AppCompatImageView;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.nnbc123.app.R;
import com.nnbc123.app.friend.action.AbstractSelectFriendAction;
import com.nnbc123.app.support.LevelIconHelper;
import com.nnbc123.app.ui.utils.ImageLoadUtils;
import com.nnbc123.app.ui.widget.NobleAvatarView;
import com.nnbc123.app.vip.VipHelper;
import com.nnbc123.core.im.friend.IMFriendModel;
import com.nnbc123.core.level.UserLevelVo;
import com.nnbc123.core.noble.NobleUtil;
import com.nnbc123.core.user.bean.FansInfo;
import com.nnbc123.core.utils.StringExtensionKt;
@@ -51,7 +55,7 @@ public class FansViewAdapter extends BaseQuickAdapter<FansInfo, BaseViewHolder>
@Override
protected void convert(BaseViewHolder baseViewHolder, final FansInfo fansInfo) {
if (fansInfo == null) return;
baseViewHolder.setText(R.id.tv_userName, StringExtensionKt.subAndReplaceDot(fansInfo.getNick(),8))
baseViewHolder.setText(R.id.tv_userName, StringExtensionKt.subAndReplaceDot(fansInfo.getNick(), 8))
.setText(R.id.tv_user_desc, fansInfo.getUserDesc() != null ?
fansInfo.getUserDesc()
: baseViewHolder.itemView.getContext().getResources().getString(R.string.msg_no_user_desc))
@@ -104,18 +108,27 @@ public class FansViewAdapter extends BaseQuickAdapter<FansInfo, BaseViewHolder>
nobleAvatarView.setSize(55, 75, 15);
nobleAvatarView.setData(fansInfo.getAvatar(), fansInfo.getNobleUsers());
AppCompatImageView ivUserLevel = baseViewHolder.getView(R.id.iv_user_level);
ivUserLevel.setVisibility(View.GONE);
if (fansInfo.getUserLevelVo() != null && !TextUtils.isEmpty(fansInfo.getUserLevelVo().getExperUrl())) {
ivUserLevel.setVisibility(View.VISIBLE);
ImageLoadUtils.loadImage(mContext, fansInfo.getUserLevelVo().getExperUrl(), ivUserLevel);
}
AppCompatImageView ivCharmLevel = baseViewHolder.getView(R.id.iv_charm_level);
ivCharmLevel.setVisibility(View.GONE);
if (fansInfo.getUserLevelVo() != null && !TextUtils.isEmpty(fansInfo.getUserLevelVo().getCharmUrl())) {
ivCharmLevel.setVisibility(View.VISIBLE);
ImageLoadUtils.loadImage(mContext, fansInfo.getUserLevelVo().getCharmUrl(), ivCharmLevel);
ImageView charmView = baseViewHolder.getView(R.id.iv_charm_level);
ImageView wealthView = baseViewHolder.getView(R.id.iv_user_level);
UserLevelVo userLevelVo = fansInfo.getUserLevelVo();
if (userLevelVo != null) {
Integer charmIconId = LevelIconHelper.INSTANCE.getCharmIcon(userLevelVo.charmLevelSeq);
Integer wealthIconId = LevelIconHelper.INSTANCE.getWealthIcon(userLevelVo.experLevelSeq);
if (charmIconId != null) {
charmView.setImageResource(charmIconId);
charmView.setVisibility(View.VISIBLE);
} else {
charmView.setVisibility(View.GONE);
}
if (wealthIconId != null) {
wealthView.setImageResource(wealthIconId);
wealthView.setVisibility(View.VISIBLE);
} else {
wealthView.setVisibility(View.GONE);
}
} else {
charmView.setVisibility(View.GONE);
wealthView.setVisibility(View.GONE);
}
AppCompatImageView ivBadge = baseViewHolder.getView(R.id.iv_noble_level);

View File

@@ -1,17 +1,24 @@
package com.nnbc123.app.ui.user;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import com.netease.nim.uikit.StatusBarUtil;
import com.nnbc123.app.R;
import com.nnbc123.app.base.BaseActivity;
import com.nnbc123.app.ui.widget.dialog.CommonTipDialog;
import com.nnbc123.library.utils.config.BasicConfig;
public class AboutActivity extends BaseActivity {
private TextView mTvVersions;
private CommonTipDialog tipsDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -27,6 +34,30 @@ public class AboutActivity extends BaseActivity {
private void initView() {
mTvVersions = findViewById(R.id.versions);
View ivGo = findViewById(R.id.iv_go);
ivGo.setOnClickListener(view -> {
tipsDialog = new CommonTipDialog(context);
tipsDialog.setOkText("确认");
tipsDialog.setTipMsg("确认前往查看备案信息");
tipsDialog.setOnActionListener(new CommonTipDialog.OnActionListener() {
@Override
public void onOk() {
if (tipsDialog != null) {
tipsDialog.dismiss();
}
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://beian.miit.gov.cn "));
startActivity(intent);
}
@Override
public void onCancel() {
if (tipsDialog != null) {
tipsDialog.dismiss();
}
}
});
tipsDialog.show();
});
}
@Override
@@ -40,4 +71,13 @@ public class AboutActivity extends BaseActivity {
StatusBarUtil.transparencyBar(this);
StatusBarUtil.StatusBarLightMode(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
if (tipsDialog != null && tipsDialog.isShowing()) {
tipsDialog.dismiss();
}
tipsDialog = null;
}
}

View File

@@ -41,6 +41,7 @@ import com.nnbc123.app.family.view.activity.FamilyMemberListActivity;
import com.nnbc123.app.family.view.activity.FamilyMemberSearchActivity;
import com.nnbc123.app.home.adapter.MainMagicIndicatorAdapter;
import com.nnbc123.app.module_hall.hall.activity.ModuleClanActivity;
import com.nnbc123.app.support.LevelIconHelper;
import com.nnbc123.app.ui.im.avtivity.NimFriendModel;
import com.nnbc123.app.ui.im.avtivity.NimP2PMessageActivity;
import com.nnbc123.app.ui.user.adapter.SelfPhotoAdapter;
@@ -426,15 +427,15 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
mBinding.ivUserCharm.setVisibility(View.GONE);
mBinding.ivUserLevel.setVisibility(View.GONE);
if (userLevelVo != null) {
String userLevelUrl = userLevelVo.getExperUrl();
String userCharmUrl = userLevelVo.getCharmUrl();
if (!TextUtils.isEmpty(userLevelUrl)) {
mBinding.ivUserLevel.setVisibility(View.VISIBLE);
ImageLoadUtils.loadImage(this, userLevelUrl, mBinding.ivUserLevel);
}
if (!TextUtils.isEmpty(userCharmUrl)) {
Integer charmIconId = LevelIconHelper.INSTANCE.getCharmIcon(userLevelVo.charmLevelSeq);
Integer wealthIconId = LevelIconHelper.INSTANCE.getWealthIcon(userLevelVo.experLevelSeq);
if (charmIconId != null) {
mBinding.ivUserCharm.setImageResource(charmIconId);
mBinding.ivUserCharm.setVisibility(View.VISIBLE);
ImageLoadUtils.loadImage(this, userCharmUrl, mBinding.ivUserCharm);
}
if (wealthIconId != null) {
mBinding.ivUserLevel.setImageResource(wealthIconId);
mBinding.ivUserLevel.setVisibility(View.VISIBLE);
}
}
}

View File

@@ -162,7 +162,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
private ImageView ivLuckyBagIntro;
private View flLuckyDesc;
private RecyclerView rvLuckyMsg;
private TextView tvGiftValue;
private EditText etSendMessage;
private Button sendGiftButton;
private View layoutEmpty;
@@ -185,7 +184,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
private WalletInfo goldWalletInfo = PayModel.get().getCurrentWalletInfo();
private int itemType = ITEM_TYPE_GOLD;
private View rlGifts;
private View llTabs;
private View llDrawGift;
private TextView tvDrawGiftTips;
private View ivDrawGiftRemoveLast;
@@ -420,7 +418,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
reloadView.setOnClickListener(this);
loadingView = findViewById(R.id.iv_loading);
rlGifts = findViewById(R.id.rl_gifts);
llTabs = findViewById(R.id.ll_tabs);
llDrawGift = findViewById(R.id.ll_draw_gift);
tvDrawGiftTips = findViewById(R.id.tv_draw_gift_tips);
ivDrawGiftRemoveLast = findViewById(R.id.iv_draw_gift_remove_last);
@@ -445,10 +442,10 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
if (AvRoomDataManager.get().isHasRoomPrivilegeCard()) {
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_PRIVILEGE, "特权卡", "特权卡"));
}
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_KNAP, "背包", "背包"));
giftIndicator = findViewById(R.id.gift_indicator);
giftIndicator.initTab(
tabInfoList,
true,
context.getResources().getColor(R.color.color_bdbfd0),
context.getResources().getColor(R.color.color_ffe710)
);
@@ -508,7 +505,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
ivLuckyBagIntro = findViewById(R.id.iv_lucky_bag_intro);
flLuckyDesc = findViewById(R.id.fl_lucky_desc);
rvLuckyMsg = findViewById(R.id.rv_lucky_msg);
tvGiftValue = findViewById(R.id.tv_gift_value);
tvSelectAll = findViewById(R.id.tv_select_all);
tvSelectAll.setSelected(false);
tvSelectAll.setOnClickListener(v -> avatarListAdapter.selectAll());
@@ -757,7 +753,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
}
});
} else if (isKnap) {
tvGiftValue.setVisibility(View.VISIBLE);
giftIndicator.getBackpackValueView().setVisibility(View.VISIBLE);
showEmptyView();
} else if (position == GiftIndicator.TYPE_LUCKY ||
position == GiftIndicator.TYPE_WEEK ||
@@ -817,7 +813,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
pagerList = beanTransformVm(context, currentGiftInfoList, isKnap, Integer.MAX_VALUE, selectGiftInfo);
setGridViewData(pagerList);
if (isKnap) {
tvGiftValue.setVisibility(View.VISIBLE);
giftIndicator.getBackpackValueView().setVisibility(View.VISIBLE);
updateTotalPrice();
} else {
if (giftNumber == -1) {
@@ -986,7 +982,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
);
drawGiftHelper.setMaxDrawSize(MAX_DRAW_SIZE);
rlGifts.setVisibility(View.GONE);
llTabs.setVisibility(View.GONE);
giftIndicator.setVisibility(View.GONE);
llTabType.setVisibility(View.GONE);
lineTabType.setVisibility(View.GONE);
giftNumLayout.setVisibility(View.GONE);
@@ -1006,7 +1002,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
getWindow().setAttributes(params);
}
rlGifts.setVisibility(View.VISIBLE);
llTabs.setVisibility(View.VISIBLE);
giftIndicator.setVisibility(View.VISIBLE);
llTabType.setVisibility(View.VISIBLE);
lineTabType.setVisibility(View.VISIBLE);
llDrawGift.setVisibility(View.GONE);
@@ -1058,7 +1054,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
SpannableBuilder text = new SpannableBuilder()
.append("总价值: ", new ForegroundColorSpan(Color.parseColor("#BABBCD")))
.append(diamond + "", new ForegroundColorSpan(Color.parseColor("#FFE710")));
tvGiftValue.setText(text.build());
giftIndicator.getBackpackValueView().setText(text.build());
}
private void showPrivilegeEmptyView() {
@@ -1105,7 +1101,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
layoutLoadFiled.setVisibility(View.GONE);
layoutEmpty.setVisibility(View.GONE);
etSendMessage.setVisibility(View.GONE);
tvGiftValue.setVisibility(View.GONE);
giftIndicator.getBackpackValueView().setVisibility(View.GONE);
llStarWeek.setVisibility(View.GONE);
flLuckyDesc.setVisibility(View.GONE);

View File

@@ -132,7 +132,6 @@ public class PrivateChatGiftDialog extends BottomSheetDialog implements View.OnC
private TextView tvWeekStarFirstUsername;
private TextView tvWeekStarEmpty;
private DrawableCenterTextView tvWeekStarIn;
private TextView tvGiftValue;
private LinearLayout layoutLoading;
private ImageView ivLoading;
private LinearLayout layoutLoadFailed;
@@ -251,10 +250,10 @@ public class PrivateChatGiftDialog extends BottomSheetDialog implements View.OnC
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NORMAL, "礼物", "礼物"));
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NOBLE, "贵族", "贵族"));
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_WEEK, "星座礼物", "星座礼物"));
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_KNAP, "背包", "背包"));
giftIndicator = findViewById(R.id.gift_indicator);
giftIndicator.initTab(
tabInfoList,
true,
Color.parseColor("#878B9C"),
Color.parseColor("#282828")
);
@@ -297,7 +296,6 @@ public class PrivateChatGiftDialog extends BottomSheetDialog implements View.OnC
tvWeekStarFirstUsername = findViewById(R.id.tv_week_star_first_username);
tvWeekStarEmpty = findViewById(R.id.tv_week_star_empty);
tvWeekStarIn = findViewById(R.id.tv_week_star_in);
tvGiftValue = findViewById(R.id.tv_gift_value);
layoutLoading = findViewById(R.id.layout_loading);
ivLoading = findViewById(R.id.iv_loading);
layoutLoadFailed = findViewById(R.id.layout_load_failed);
@@ -372,7 +370,7 @@ public class PrivateChatGiftDialog extends BottomSheetDialog implements View.OnC
if (ListUtils.isListEmpty(currentGiftInfoList)) {
currentGiftInfo = null;
if (isKnap) {
tvGiftValue.setVisibility(View.VISIBLE);
giftIndicator.getBackpackValueView().setVisibility(View.VISIBLE);
showEmptyView();
} else if (position == GiftIndicator.TYPE_LUCKY ||
position == GiftIndicator.TYPE_WEEK ||
@@ -393,7 +391,7 @@ public class PrivateChatGiftDialog extends BottomSheetDialog implements View.OnC
pagerList = beanTransformVm(context, currentGiftInfoList, isKnap, Integer.MAX_VALUE, selectGiftInfo);
setGridViewData(pagerList);
if (isKnap) {
tvGiftValue.setVisibility(View.VISIBLE);
giftIndicator.getBackpackValueView().setVisibility(View.VISIBLE);
updateTotalPrice();
} else {
if (giftNumber == -1) {
@@ -478,7 +476,7 @@ public class PrivateChatGiftDialog extends BottomSheetDialog implements View.OnC
SpannableBuilder text = new SpannableBuilder()
.append("总价值: ", new ForegroundColorSpan(Color.parseColor("#BABBCD")))
.append(diamond + "", new ForegroundColorSpan(Color.parseColor("#FFE710")));
tvGiftValue.setText(text.build());
giftIndicator.getBackpackValueView().setText(text.build());
}
private void showEmptyView() {
@@ -509,7 +507,7 @@ public class PrivateChatGiftDialog extends BottomSheetDialog implements View.OnC
layoutLoadFailed.setVisibility(View.GONE);
layoutEmpty.setVisibility(View.GONE);
etGiftMessage.setVisibility(View.GONE);
tvGiftValue.setVisibility(View.GONE);
giftIndicator.getBackpackValueView().setVisibility(View.GONE);
llStarWeek.setVisibility(View.GONE);
gridView.setVisibility(View.VISIBLE);

View File

@@ -26,6 +26,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.flexbox.FlexboxLayout;
import com.netease.nim.uikit.common.util.sys.ClipboardUtil;
import com.nnbc123.app.support.LevelIconHelper;
import com.nnbc123.core.Constants;
import com.nnbc123.core.auth.AuthModel;
import com.nnbc123.core.bean.RoomMicInfo;
@@ -550,16 +551,18 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
}
UserLevelVo userLevelVo = userInfo.getUserLevelVo();
mIvUserLevel.setVisibility(userLevelVo == null ? View.GONE : View.VISIBLE);
mIvUserLevel.setVisibility(View.GONE);
mIvUserCharm.setVisibility(View.GONE);
if (userLevelVo != null) {
mIvUserLevel.setVisibility(TextUtils.isEmpty(userLevelVo.getExperUrl()) ? View.GONE : View.VISIBLE);
if (!TextUtils.isEmpty(userLevelVo.getExperUrl())) {
ImageLoadUtils.loadImage(context, userLevelVo.getExperUrl(), mIvUserLevel);
}
if (!TextUtils.isEmpty(userLevelVo.getCharmUrl())) {
Integer charmIconId = LevelIconHelper.INSTANCE.getCharmIcon(userLevelVo.charmLevelSeq);
Integer wealthIconId = LevelIconHelper.INSTANCE.getWealthIcon(userLevelVo.experLevelSeq);
if (charmIconId != null) {
mIvUserCharm.setImageResource(charmIconId);
mIvUserCharm.setVisibility(View.VISIBLE);
ImageLoadUtils.loadImage(context, userLevelVo.getCharmUrl(), mIvUserCharm);
}
if (wealthIconId != null) {
mIvUserLevel.setImageResource(wealthIconId);
mIvUserLevel.setVisibility(View.VISIBLE);
}
}

View File

@@ -5,8 +5,11 @@ import android.content.Context;
import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -92,30 +95,47 @@ public class GiftIndicator extends LinearLayout {
private int mFalseColor;
private int mTrueColor;
private LinearLayout tabLayout;
private HorizontalScrollView scrollView;
private TextView mTvBackpackValue;
public GiftIndicator(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context)
.inflate(R.layout.gift_type_indicator, this, true);
setOrientation(LinearLayout.HORIZONTAL);
setGravity(Gravity.CENTER_VERTICAL);
tabLayout = findViewById(R.id.layout_tab);
scrollView = findViewById(R.id.scrollView);
mTvBackpackValue = findViewById(R.id.tv_backpack_value);
}
public void initTab(List<GiftTab> list, int falseColor, int trueColor) {
public void initTab(List<GiftTab> list, boolean addBackpackTab, int falseColor, int trueColor) {
tabList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
GiftTab tab = list.get(i);
View view = inflate(GiftIndicator.this.getContext(), R.layout.layout_gift_indicator_item, null);
tab.setItemView(view);
addView(view, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
UIUtil.dip2px(getContext(), 26)));
TextView tvTitle = view.findViewById(R.id.tv_title);
tvTitle.setText(tab.getUnSelectedTitle());
addTab(tabLayout, tab);
}
tabList.addAll(list);
if (addBackpackTab) {
GiftTab tab = new GiftTab(GiftIndicator.TYPE_KNAP, "背包", "背包");
addTab(this, tab);
tabList.add(tab);
}
LinearLayout.LayoutParams params = new LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
params.weight = 1f;
addView(new View(getContext()), list.size() - 1, params);
tabList = list;
mFalseColor = falseColor;
mTrueColor = trueColor;
setPosition(TYPE_NORMAL);
}
private void addTab(ViewGroup group, GiftTab tab) {
View view = inflate(GiftIndicator.this.getContext(), R.layout.layout_gift_indicator_item, null);
tab.setItemView(view);
group.addView(view, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
UIUtil.dip2px(getContext(), 26)));
TextView tvTitle = view.findViewById(R.id.tv_title);
tvTitle.setText(tab.getUnSelectedTitle());
}
public Observable<Integer> addClick() {
return Observable.create(emitter -> {
for (int i = 0; i < tabList.size(); i++) {
@@ -129,6 +149,8 @@ public class GiftIndicator extends LinearLayout {
imageView.setVisibility(GONE);
DemoCache.saveNewGiftTypeTip(false);
}
} else if (index.getType() == TYPE_KNAP) {
scrollView.postDelayed(() -> scrollView.fullScroll(View.FOCUS_RIGHT),50);
}
});
}
@@ -175,4 +197,7 @@ public class GiftIndicator extends LinearLayout {
}
}
public TextView getBackpackValueView() {
return mTvBackpackValue;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Some files were not shown because too many files have changed in this diff Show More