From 40532a097211b29c2d8a1a57cf87a7c9b0e710bc Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 7 Nov 2022 17:39:52 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=AA=E4=BA=BA=E5=90=8D=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/utils/NobleUtil.java | 12 +++++ .../live/dialog/LiveUserDialogFragment.java | 46 +++++++++++++++++-- .../main/res/layout/dialog_new_live_user.xml | 9 ++-- live/src/main/res/values/strings.xml | 1 + 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/utils/NobleUtil.java b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java index e03d24ccd..40a7d458d 100644 --- a/common/src/main/java/com/yunbao/common/utils/NobleUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java @@ -22,4 +22,16 @@ public class NobleUtil { } return -1; } + public static String nobleIdToStringName(int id){ + switch (id){ + case 1:return "男爵"; + case 2:return "子爵"; + case 3:return "侯爵"; + case 4:return "公爵"; + case 5:return "国王"; + case 6:return "皇帝"; + case 7:return "超皇"; + } + return ""; + } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java index d22945541..a918c7249 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -38,6 +38,7 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DialogUitl; +import com.yunbao.common.utils.NobleUtil; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.ToastUtil; @@ -98,12 +99,16 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private TextView userLv; private TextView mLvDesc; private TextView mFansVal; + private TextView mPraise; + private TextView mSignDesc; + private TextView mNobleVal; private ImageView mFollowImage; private ImageView mSex; private ImageView good_nub_ico; private ImageView mLiveIcon; private ImageView mLiveIcon2; private ImageView mNoble; + private ImageView mAvatar; private UserBean mUserBean; GifImageView btn_live; SVGAImageView gift_svga; @@ -198,6 +203,10 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On mLiveIcon2 = mRootView.findViewById(R.id.live_icon); mNoble = mRootView.findViewById(R.id.user_card_noble); mFansVal = mRootView.findViewById(R.id.fans_val); + mPraise = mRootView.findViewById(R.id.praise_val); + mSignDesc = mRootView.findViewById(R.id.sign); + mAvatar = mRootView.findViewById(R.id.avatar); + mNobleVal = mRootView.findViewById(R.id.noble_val); } private void initListener() { @@ -262,11 +271,11 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On LevelBean levelBean; if (mLiveUid.equals(mUserBean.getId())) { levelBean = CommonAppConfig.getInstance().getAnchorLevel(mUserBean.getLevelAnchor()); - userLv.setText(mUserBean.getLevelAnchor() + ""); + userLv.setText("Lv."+mUserBean.getLevelAnchor() ); mLvDesc.setText(R.string.live_user_level_anchor); } else { levelBean = CommonAppConfig.getInstance().getLevel(mUserBean.getLevel()); - userLv.setText(mUserBean.getLevel() + ""); + userLv.setText("Lv."+mUserBean.getLevel()); mLvDesc.setText(R.string.live_user_card_level); } new LiveTextRender().getLevelImage(mContext, levelBean.getLevel(), new ImgLoader.DrawableCallback() { @@ -287,9 +296,40 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else { mNoble.setVisibility(View.INVISIBLE); } - mFansVal.setText(mUserBean.getFans()+""); + mFansVal.setText(WordUtil.getString(R.string.fans)+":"+mUserBean.getFans()); + mSignDesc.setText(mUserBean.getSignature()); + mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id()))); + ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar); //装扮相关 JSONObject dress = obj.getJSONObject("dress"); + if (dress.getJSONArray("avatar_frame").size() == 1) { + + JSONObject ico = (JSONObject) dress.getJSONArray("avatar_frame").get(0); + if (ico.getString("effect_src") != null) { + if (ico.getString("effect_src").contains("svga")) { + + try { + new SVGAParser(mContext).parse(new URL(ico.getString("effect_src")), new SVGAParser.ParseCompletion() { + @Override + public void onComplete(SVGAVideoEntity videoItem) { + SVGADrawable drawable = new SVGADrawable(videoItem); + gift_svga.setImageDrawable(drawable); + SVGAViewUtils.playEndClear(gift_svga); + } + + @Override + public void onError() { + } + }); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + } else { + Log.e("eee", ico.getString("effect_src")); + ImgLoader.display(mContext, ico.getString("effect_src"), gift_svga); + } + } + } } diff --git a/live/src/main/res/layout/dialog_new_live_user.xml b/live/src/main/res/layout/dialog_new_live_user.xml index 4e03956bc..65c09bd95 100644 --- a/live/src/main/res/layout/dialog_new_live_user.xml +++ b/live/src/main/res/layout/dialog_new_live_user.xml @@ -161,7 +161,7 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:paddingRight="10dp" - android:textColor="@color/textColor" + android:textColor="#B1B1B1" android:textSize="13sp" /> @@ -235,7 +235,7 @@ android:layout_height="wrap_content" android:layout_marginTop="15dp" android:layout_marginBottom="15dp" - android:textColor="@color/textColor2" + android:textColor="#B1B1B1" android:textSize="14sp" /> diff --git a/live/src/main/res/values/strings.xml b/live/src/main/res/values/strings.xml index d33c48152..4f77f04c7 100644 --- a/live/src/main/res/values/strings.xml +++ b/live/src/main/res/values/strings.xml @@ -11,6 +11,7 @@ 觀眾 觀眾 粉絲 + 獲讚 私信 選擇房間類型 公開房