From ab953b47851cdc0a0a93ceb81db52293b2d010de Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Mon, 7 Nov 2022 16:48:16 +0800 Subject: [PATCH 1/7] update --- .../yunbao/common/utils/CommonIconUtil.java | 3 + common/src/main/res/mipmap-mdpi/good_nub.png | Bin 2134 -> 3053 bytes .../src/main/res/mipmap-mdpi/user_card_id.png | Bin 0 -> 1707 bytes .../main/res/mipmap-mdpi/user_card_man.png | Bin 0 -> 2129 bytes .../main/res/mipmap-mdpi/user_card_woman.png | Bin 0 -> 2461 bytes common/src/main/res/values/strings.xml | 4 + .../dialog/LiveOldUserDialogFragment.java | 810 ++++++++++++++++++ .../live/dialog/LiveUserDialogFragment.java | 699 +++------------ .../yunbao/live/views/LiveRoomViewHolder.java | 3 +- .../main/res/drawable/background_ff63c1.xml | 9 + .../main/res/drawable/bg_user_card_fans.xml | 9 + .../main/res/drawable/bg_user_card_guard.xml | 9 + .../main/res/drawable/bg_user_card_honor.xml | 9 + .../src/main/res/drawable/bg_user_card_lv.xml | 9 + .../res/layout/dialog_live_user_bottom_1.xml | 100 +-- .../main/res/layout/dialog_new_live_user.xml | 432 ++++++++++ .../res/mipmap-mdpi/icon_user_card_follow.png | Bin 0 -> 1584 bytes .../yunbao/main/activity/LoginActivity.java | 9 + .../yunbao/main/activity/MainActivity.java | 2 +- 19 files changed, 1447 insertions(+), 660 deletions(-) create mode 100644 common/src/main/res/mipmap-mdpi/user_card_id.png create mode 100644 common/src/main/res/mipmap-mdpi/user_card_man.png create mode 100644 common/src/main/res/mipmap-mdpi/user_card_woman.png create mode 100644 live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java create mode 100644 live/src/main/res/drawable/background_ff63c1.xml create mode 100644 live/src/main/res/drawable/bg_user_card_fans.xml create mode 100644 live/src/main/res/drawable/bg_user_card_guard.xml create mode 100644 live/src/main/res/drawable/bg_user_card_honor.xml create mode 100644 live/src/main/res/drawable/bg_user_card_lv.xml create mode 100644 live/src/main/res/layout/dialog_new_live_user.xml create mode 100644 live/src/main/res/mipmap-mdpi/icon_user_card_follow.png diff --git a/common/src/main/java/com/yunbao/common/utils/CommonIconUtil.java b/common/src/main/java/com/yunbao/common/utils/CommonIconUtil.java index 391d7873b..2b6deafd9 100644 --- a/common/src/main/java/com/yunbao/common/utils/CommonIconUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/CommonIconUtil.java @@ -11,5 +11,8 @@ public class CommonIconUtil { public static int getSexIcon(int key) { return key == 1 ? R.mipmap.icon_sex_male_1 : R.mipmap.icon_sex_female_1; } + public static int getSexIconForUserCard(int key) { + return key == 1 ? R.mipmap.user_card_man : R.mipmap.user_card_woman; + } } diff --git a/common/src/main/res/mipmap-mdpi/good_nub.png b/common/src/main/res/mipmap-mdpi/good_nub.png index 8c586bd752d9770f79ad1a88072bfa14aa6c24b7..52c9ae2341b928ecf19abaf8eab140b1f63a1d58 100644 GIT binary patch literal 3053 zcmWkwc{J4f8y?I>mWs-jis{F-FClf^62`toNVsL^S|Z8PYKf>&;VL&|EJGMeb|On@ zLS;#I*&^Fm#x~~rd4KL7@AI7JJm)>nInO!oIdANFGksnz5iT4K$7^UnwA^Lw-BICW z+r@))g@#?iduW+z;c%r1+)St6b~Vd&OMPt|<+JE79F7fl-o#2*-`@mGR)Hi77Idb~ z9G0sAFAhV}ePq76?)eLuG9X7DC1Oyh3Z`p7QpCIfUP*3iuYvI@n9+eG{NHYtEaa(8fLOkHtdX+U{(zHnF=JSS?x(6 zt1=6dVE8FATt^-N^M%kD2-Iuv&ILLl7@O z!ge#%Wx`k*eEctn8B3$Zyhi|#s|;in7|(=&b@U5EOoY09LGK4j-Pr8`?ytk(4t&PI zY#1>Rv@yZI5z!I66hrft@Yf1co(_5|DCqNl6)luQLlcne5#0>D*O_)quwF%F@0epw&RYJk}HfZyhkper!h<6~@EI zYUJFG%I`z)8gd*0?MW;n8A?u|+Ixta1oVHIJv%M&+99G`K%nK0x4)Ggk zd<=58u!aPnh(o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A7vk1sPf ztd?V&x;oh>FsUmXO0Dnywv&g!hrzWI-2|UehX;YqaJ#=2pDm``AeJ`%NARmqN?)9weua zy%I?RX5S8)4~IrL#&Y^(E-)&h=g5mS8Jm7Q*3b%M@zbdqhi^6qPwh(}&^ z`=6t@TRZRKJaN~1r0aR9V?)4*_RIZ)j0?YXXFoYT9Y2tt=knj*4B0oxN9YyB`WIU9 BpVt5Y literal 0 HcmV?d00001 diff --git a/common/src/main/res/mipmap-mdpi/user_card_man.png b/common/src/main/res/mipmap-mdpi/user_card_man.png new file mode 100644 index 0000000000000000000000000000000000000000..6bf8269f35354742d674cba975d9b8447de57b22 GIT binary patch literal 2129 zcmX|B3pkW%8=jgDC@US=EyYSKEg^?C#|9}Phpkvi^~aWD(%*qh!Wf3ZGMk7bq65;2 z#OylMvgtx*%)vCqVVLA>42F6B_nY18|E~Go?|I+ne(vXf?(h1B?0&>aS?OCP91f@K ze30OQo=4GbqJT#$D`cZLdaMYvbG5_ao>A8<2CPK;Wsx3E_PFwoTSYh=9_Q}j<=_VM8KXIgtDj;<~VHG6&mca^WTu zQkdA5+>Op>VqlG+30F34s;DiXlPU}T1zUp@tfVF9&Q-m3?r zLghpTHY`e^9}x{!W!h!vu2H^=};Oh{w`l?^jekjgLy)NXzWQ!8G?UgeSu7M5U91}}v$ zw**5HY+ecr{u+gJHWc-OWDx{n7@31KHWc!qdI;tgfi(rUd63-$ycxLP3&W_23+4UL zHV(gWp=$!-8BijC(RnEN4CMn*+6QzIkh-B_0BBrzF$k}RKsXCkgOJXFTpns#p zDP7yP^p(#UuifM3w145^!O$r6JDsduYs;q|au-DY@Bgw*xbb=7N9oqh)$3U&#z$TV z#59l2j%hN7aKBr8C8r_m$#`e0b=iY@W38+a*QLVv2BW;HGt{`ERi&j3`;#}J58Bb0 zVCQwbvH17ZUY^I)-d8BDRwV@gkeXFUT+Zxr;Nb)PynRC+Kjo#+#sWlD*SU4wOH(I> zYt(ga5)F#WynISF>mD%J7~)Q7{$^j0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Y#niu)f@$`6qM literal 0 HcmV?d00001 diff --git a/common/src/main/res/mipmap-mdpi/user_card_woman.png b/common/src/main/res/mipmap-mdpi/user_card_woman.png new file mode 100644 index 0000000000000000000000000000000000000000..1a869f675ae941f87ac5b12bd681823c876d9ce0 GIT binary patch literal 2461 zcmYjS2{e@L7avJNl%<7a%dSEwOJrn??E0jnk|j%snlRQOdm7odEG<%5K3PMSitNiE z4YC_cw#3-F|98%GeE)Oq`+I)(KKK5f``q)s=M6K|*J5VmVnm@(%sSfY#>i@fJTiM} z5&Y)NVTLTb?a-IdC{$rI)7DKo#HVpL)>1>|wQ*0QP_!sRJyQ)WS3U6aqZkSW{{9r= z>-(1=E@Eb85EuwJ+}|`L;^RZ%)Ln!G1pM7X;#3asU(nMN9z6Ifh$M%G{;fqg)u=ki zp*!d9a4OkJLkM!j#(#$=?xj?+8P80!=p#AvI5J?Ffaf}VNVbI{tc_Eke?4^GQ`G0 zMFrH=QSSKd8$5kV8AxX*%+FJX86FN_ze030L`6YN48+AjRu)W5z{ij9{X5Lg0+9%V zgRr;=jg1f)2~VCtNC>=p2RS*AoD8+Ku&@BHU&Hh?ym|#QGw|#g{Q3nO8&FsXKYv1E zBBZ21Lj%;*Kx-=u4?|fQBqhPt7Ibt#ZZ5R7L3=xtlt6DUkVx?752U5RhYygR4habm z9}h2HKt=`>6u{gZG&RA?mrzs$)zvUI2Ho8-G6K(^Lsb=wj>6Owq^3f7IgF139uJ>C zLuMxQ_d{tZ@=8K>Hq_U{+qbZ}2?PT4^}*z%IW~M9`7ok9jP*@W+pILZHveor{IfxO zfNo)(Y%>u}_{Bc=+f9W;b8XssAG4an`2Np(u^*a8S4`TLwGP^qIui$7Nf>U1Sizyn z3jQ>uS9AsQ28@@4nb^Pm^Y-Y;OJVPI6qqH~q{!u6LR(HFtIxg^7xN@2%UCo@|ELM} zsLQTW@8~t7pRpXD9c^k}|02QW2D=VNL#gZ? zNrgaDvEKT@K}!})*}eIua;B;3A~uZ6Q^Mfj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D>L4U1gP8GW&?+nnLOMReuZSN~>s7uv~lwWi7~?rS*V zkn}P)+({xMMpVVm*=0qXr`Z(vQ#^S#I+ccUGFLS-YfDTol7z-X z4f8p>LW@*ZVxL#p-K!G7jbORu<&Mmpa?Z@<4D$Q8RySmg=V;qfjxEM|c8i`sFFiaq zU3CW&T;O@!+vDtVhf<0Ff8Tz%zTHr?u)opQx=V_5@XliRgh7$_IRpJ447Ho)`}*X2 zHyV2)o=vk#@_8&Z{gK=#b69@)j(FNbwRDP8UYgWzdGpP@8?Ws%)a< z8n`l68fpIJLWOmu2CZK*kMsf!?-|L_2A%WRAIbwz45;rs_FAe!)ub!uN GBk+GyGgbZo literal 0 HcmV?d00001 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 0c7d1c2fa..413db6e14 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -702,6 +702,9 @@ 立即支付 使用者等級 主播等級 + 用户等級 + 貴族等級 + 榮譽墻 連接已斷開,請重新開播 空空如也 聊天 @@ -947,4 +950,5 @@ 聊聊天 想在其他APP上方也顯示小窗,\n可前往設置進行授權。 恭喜 %s 在幸運天使中抽中 %s!下一個幸運天使就是你哦! + 守護團%s人 diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java new file mode 100644 index 000000000..f979a9dd7 --- /dev/null +++ b/live/src/main/java/com/yunbao/live/dialog/LiveOldUserDialogFragment.java @@ -0,0 +1,810 @@ +package com.yunbao.live.dialog; + +import android.app.Dialog; +import android.graphics.drawable.Drawable; +import android.os.Bundle; +import android.text.TextUtils; +import android.util.Log; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.core.content.ContextCompat; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.opensource.svgaplayer.SVGADrawable; +import com.opensource.svgaplayer.SVGAImageView; +import com.opensource.svgaplayer.SVGAParser; +import com.opensource.svgaplayer.SVGAVideoEntity; +import com.tencent.imsdk.v2.V2TIMCallback; +import com.tencent.imsdk.v2.V2TIMManager; +import com.yunbao.common.CommonAppConfig; +import com.yunbao.common.Constants; +import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.LiveBean; +import com.yunbao.common.bean.UserBean; +import com.yunbao.common.dialog.AbsDialogFragment; +import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.CommonHttpUtil; +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.RouteUtil; +import com.yunbao.common.utils.SVGAViewUtils; +import com.yunbao.common.utils.ToastUtil; +import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.R; +import com.yunbao.live.activity.LiveActivity; +import com.yunbao.live.activity.LiveReportActivity; +import com.yunbao.live.bean.ImpressBean; +import com.yunbao.live.custom.MyTextView; +import com.yunbao.live.event.LiveRoomChangeEvent; +import com.yunbao.live.http.LiveHttpConsts; +import com.yunbao.live.http.LiveHttpUtil; +import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; +import com.yunbao.live.utils.LiveTextRender; +import com.yunbao.live.views.LiveRoomViewHolder; + +import org.greenrobot.eventbus.EventBus; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import io.rong.imlib.IRongCoreCallback; +import io.rong.imlib.IRongCoreEnum; +import io.rong.imlib.chatroom.base.RongChatRoomClient; +import pl.droidsonroids.gif.GifImageView; + +/** + * Created by cxf on 2018/10/15. + * 直播间个人资料弹窗 + */ + +public class LiveOldUserDialogFragment extends AbsDialogFragment implements View.OnClickListener { + + private static final int TYPE_AUD_AUD = 1;//观众点别的观众 + private static final int TYPE_ANC_AUD = 2;//主播点观众 + private static final int TYPE_AUD_ANC = 3;//观众点主播 + private static final int TYPE_AUD_SELF = 4;//观众点自己 + private static final int TYPE_ANC_SELF = 5;//主播点自己 + + private static final int SETTING_ACTION_SELF = 0;//设置 自己点自己 + private static final int SETTING_ACTION_AUD = 30;//设置 普通观众点普通观众 或所有人点超管 + private static final int SETTING_ACTION_ADM = 40;//设置 房间管理员点普通观众 + private static final int SETTING_ACTION_SUP = 60;//设置 超管点主播 + private static final int SETTING_ACTION_ANC_AUD = 501;//设置 主播点普通观众 + private static final int SETTING_ACTION_ANC_ADM = 502;//设置 主播点房间管理员 + private ViewGroup mBottomContainer; + private ImageView mAvatar; + private ImageView mLevelAnchor; + private ImageView mLevel; + private TextView mLevelText; + private TextView mLevelAnchorText; + private ImageView mSex; + private TextView mName; + private TextView mID; + private TextView mCity; + private LinearLayout mImpressGroup; + private TextView mFollow; + private TextView mSign; + private TextView mFans; + private TextView mConsume;//消费 + private TextView mVotes;//收入 + private TextView mConsumeTip; + private TextView mVotesTip; + private String mLiveUid; + private String mStream; + private String mAvatarUrl; + private String mToUid; + private TextView mFollowText; + private ImageView mFollowImage; + private int mType; + private int mAction; + private String mToName;//对方的名字 + private UserBean mUserBean; + private boolean mFollowing; + private Drawable mFollowDrawable; + private Drawable mUnFollowDrawable; + SVGAImageView gift_svga; + LinearLayout ry_view; + ImageView medalIco1, shawl; + ImageView ry_ico1, ry_ico2, ry_ico3, ry_ico4, good_nub_ico; + View no_gz; + GifImageView btn_live; + + @Override + protected int getLayoutId() { + return R.layout.dialog_live_user; + } + + @Override + protected int getDialogStyle() { + return R.style.dialog2; + } + + @Override + protected boolean canCancel() { + return true; + } + + private LiveRoomCheckLivePresenter mCheckLivePresenter; + + private void gotoLive(String live_id) { + DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() { + @Override + public void onConfirmClick(Dialog dialog, String content) { + RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveUid, new IRongCoreCallback.OperationCallback() { + @Override + public void onSuccess() { + Log.i("tx", "退出成功"); + //连接socket + LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + + } + }); + } + + @Override + public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { + + } + }); + V2TIMManager.getInstance().quitGroup("g" + mLiveUid, new V2TIMCallback() { + @Override + public void onSuccess() { + + Log.i("tx", "退出成功" + mLiveUid); + //连接socket + LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + + } + }); + } + + @Override + public void onError(int code, String desc) { + Log.i("tx", "退出失败"); + } + }); + LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); + + if (mCheckLivePresenter == null) { + mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { + @Override + public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { + if (liveBean == null) { + return; + } + LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); +// if (mFromLiveRoom) { +// ((UserHomeActivity) mContext).onBackPressed(); + dismiss(); + EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); +// } else { +// LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); +// } + } + }); + } + mCheckLivePresenter.checkLive(liveBean); + } + } + }); + + + } + }); + } + + @Override + protected void setWindowAttributes(Window window) { + WindowManager.LayoutParams params = window.getAttributes(); + window.setWindowAnimations(R.style.bottomToTopAnim); + params.width = WindowManager.LayoutParams.MATCH_PARENT; + params.height = WindowManager.LayoutParams.WRAP_CONTENT; + params.gravity = Gravity.BOTTOM; + window.setAttributes(params); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + Bundle bundle = getArguments(); + if (bundle == null) { + return; + } + mLiveUid = bundle.getString(Constants.LIVE_UID); + mToUid = bundle.getString(Constants.TO_UID); + if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mToUid)) { + return; + } + mStream = bundle.getString(Constants.STREAM); + //头像边框 + gift_svga = (SVGAImageView) mRootView.findViewById(R.id.gift_svga); + + btn_live = mRootView.findViewById(R.id.btn_live); + btn_live.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + gotoLive(mToUid); + } + }); + + mBottomContainer = mRootView.findViewById(R.id.bottom_container); + ry_view = (LinearLayout) mRootView.findViewById(R.id.ry_view); + no_gz = (View) mRootView.findViewById(R.id.no_gz); + ry_ico1 = (ImageView) mRootView.findViewById(R.id.ry_ico1); + good_nub_ico = (ImageView) mRootView.findViewById(R.id.good_nub_ico); + ry_ico2 = (ImageView) mRootView.findViewById(R.id.ry_ico2); + ry_ico3 = (ImageView) mRootView.findViewById(R.id.ry_ico3); + ry_ico4 = (ImageView) mRootView.findViewById(R.id.ry_ico4); + mAvatar = (ImageView) mRootView.findViewById(R.id.avatar); + mLevelAnchor = (ImageView) mRootView.findViewById(R.id.anchor_level); + mLevel = (ImageView) mRootView.findViewById(R.id.level); + shawl = (ImageView) mRootView.findViewById(R.id.shawl); + mLevelText = mRootView.findViewById(R.id.level_text); + mLevelAnchorText = mRootView.findViewById(R.id.level_anchor_text); + mSex = (ImageView) mRootView.findViewById(R.id.sex); + mName = (TextView) mRootView.findViewById(R.id.name); + mID = (TextView) mRootView.findViewById(R.id.id_val); + mCity = (TextView) mRootView.findViewById(R.id.city); + mSign = mRootView.findViewById(R.id.sign); + mImpressGroup = (LinearLayout) mRootView.findViewById(R.id.impress_group); + mFollow = (TextView) mRootView.findViewById(R.id.follow); + mFans = (TextView) mRootView.findViewById(R.id.fans); + mConsume = (TextView) mRootView.findViewById(R.id.consume); + mVotes = (TextView) mRootView.findViewById(R.id.votes); + mConsumeTip = (TextView) mRootView.findViewById(R.id.consume_tip); + mVotesTip = (TextView) mRootView.findViewById(R.id.votes_tip); + medalIco1 = (ImageView) mRootView.findViewById(R.id.medal_ico1); + mAvatar.setOnClickListener(this); + // mRootView.findViewById(R.id.btn_close).setOnClickListener(this); + getType(); + LayoutInflater inflater = LayoutInflater.from(mContext); + View bottomView = null; + if (mType == TYPE_AUD_ANC) { + if (mImpressGroup.getVisibility() != View.VISIBLE) { + mImpressGroup.setVisibility(View.VISIBLE); + } + bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mBottomContainer, false); + } else if (mType == TYPE_AUD_AUD) { + bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mBottomContainer, false); + } else if (mType == TYPE_ANC_AUD) { + bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_2, mBottomContainer, false); + } else if (mType == TYPE_AUD_SELF) { + bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_3, mBottomContainer, false); + } + if (bottomView != null) { + mFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_user_home_follow_1); + mUnFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_user_home_follow_0); + mBottomContainer.addView(bottomView); + mFollowText = bottomView.findViewById(R.id.follow_text); + mFollowImage = (ImageView) findViewById(R.id.follow_img); + View btnFollow = bottomView.findViewById(R.id.btn_follow); + if (btnFollow != null) { + btnFollow.setOnClickListener(this); + } + View btnPriMsg = bottomView.findViewById(R.id.btn_pri_msg); + if (btnPriMsg != null) { + btnPriMsg.setOnClickListener(this); + } + View btnHomePage = bottomView.findViewById(R.id.btn_home_page); + if (btnHomePage != null) { + btnHomePage.setOnClickListener(this); + } + } + loadData(); + } + + private void getType() { + String uid = CommonAppConfig.getInstance().getUid(); + if (mToUid.equals(mLiveUid)) { + if (mLiveUid.equals(uid)) {//主播点自己 + mType = TYPE_ANC_SELF; + } else {//观众点主播 + mType = TYPE_AUD_ANC; + } + } else { + if (mLiveUid.equals(uid)) {//主播点观众 + mType = TYPE_ANC_AUD; + } else { + if (mToUid.equals(uid)) {//观众点自己 + mType = TYPE_AUD_SELF; + } else {//观众点别的观众 + mType = TYPE_AUD_AUD; + } + } + } + } + + private void loadData() { + LiveHttpUtil.getLiveUser(mToUid, mLiveUid, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + showData(info[0]); + } + } + }); + } + + private void showData(String data) { + JSONObject obj = JSON.parseObject(data); + mUserBean = JSON.toJavaObject(obj, UserBean.class); + if (mUserBean.getIslive().equals("1")) { + btn_live.setVisibility(View.VISIBLE); + } else { + btn_live.setVisibility(View.GONE); + } + + //装扮相关 + 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); + } + } + } + + medalIco1.setVisibility(View.GONE); + no_gz.setVisibility(View.GONE); + if (dress.getJSONArray("medal").size() >= 1) { + JSONObject display = (JSONObject) dress.getJSONArray("medal").get(0); + if (display.getString("display_src") != null) { + ImgLoader.display(mContext, display.getString("display_src"), medalIco1); + medalIco1.setVisibility(View.VISIBLE); + no_gz.setVisibility(View.VISIBLE); + } + } + if (dress.getJSONArray("wraps").size() >= 1) { + JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0); + ImgLoader.display(mContext, display.getString("display_src"), shawl); + } + + JSONObject display = (JSONObject) dress.getJSONArray("medal").get(0); + + if (dress.getJSONArray("medal_no") != null) { + Log.e("tag", dress.getJSONArray("medal_no").size() + ""); + ry_view.setVisibility(View.VISIBLE); + JSONObject ry1 = (JSONObject) dress.getJSONArray("medal_no").get(0); + ImgLoader.display(mContext, ry1.get("display_src").toString(), ry_ico1); + ry_ico1.setVisibility(View.VISIBLE); + + if (dress.getJSONArray("medal_no").size() >= 2) { + JSONObject ry2 = (JSONObject) dress.getJSONArray("medal_no").get(1); + ImgLoader.display(mContext, ry2.get("display_src").toString(), ry_ico2); + ry_ico2.setVisibility(View.VISIBLE); + } + if (dress.getJSONArray("medal_no").size() >= 3) { + JSONObject ry3 = (JSONObject) dress.getJSONArray("medal_no").get(2); + ImgLoader.display(mContext, ry3.get("display_src").toString(), ry_ico3); + ry_ico3.setVisibility(View.VISIBLE); + } + + if (dress.getJSONArray("medal_no").size() >= 4) { + JSONObject ry4 = (JSONObject) dress.getJSONArray("medal_no").get(3); + ImgLoader.display(mContext, ry4.get("display_src").toString(), ry_ico4); + ry_ico4.setVisibility(View.VISIBLE); + } + + + } else { + ry_view.setVisibility(View.GONE); + } + + CommonAppConfig appConfig = CommonAppConfig.getInstance(); + + if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) { + good_nub_ico.setVisibility(View.VISIBLE); + mID.setText("ID:" + mUserBean.getGoodnum()); + } else { + good_nub_ico.setVisibility(View.GONE); + mID.setText(mUserBean.getLiangNameTip()); + } + mToName = obj.getString("user_nicename"); + mName.setText(mToName); + mCity.setText(obj.getString("city")); + ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar); + mAvatarUrl = obj.getString("avatar"); + int levelAnchor = obj.getIntValue("level_anchor"); + int level = obj.getIntValue("level"); + mSign.setText(obj.getString("signature")); + LevelBean anchorLevelBean = appConfig.getAnchorLevel(obj.getIntValue("level_anchor")); + if (anchorLevelBean != null) { + ImgLoader.display(mContext, anchorLevelBean.getBgIcon(), mLevelAnchor); + } + LevelBean levelBean = appConfig.getLevel(obj.getIntValue("level")); + if (levelBean != null) { + ImgLoader.display(mContext, levelBean.getBgIcon(), mLevel); + } + mLevelAnchorText.setText(String.valueOf(levelAnchor)); + mLevelText.setText(String.valueOf(level)); + mSex.setImageResource(CommonIconUtil.getSexIcon(obj.getIntValue("sex"))); + mFollow.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("follows"))); + mFans.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("fans"))); + mConsume.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("consumption"))); + mVotes.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("votestotal"))); + mConsumeTip.setText(WordUtil.getString(R.string.live_user_send) + appConfig.getCoinName()); + mVotesTip.setText(WordUtil.getString(R.string.live_user_get) + appConfig.getVotesName()); + if (mType == TYPE_AUD_ANC) { + showImpress(obj.getString("label")); + } + mFollowing = obj.getIntValue("isattention") == 1; + if (mFollowText != null) { + mFollowText.setText(mFollowing ? WordUtil.getString(R.string.following) : WordUtil.getString(R.string.follow)); + } + if (mFollowImage != null) { + mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable); + } + mAction = obj.getIntValue("action"); + if (mAction == SETTING_ACTION_AUD) {//设置 普通观众点普通观众 或所有人点超管 + View btnReport = mRootView.findViewById(R.id.btn_report); + btnReport.setVisibility(View.VISIBLE); + btnReport.setOnClickListener(this); + } else if (mAction == SETTING_ACTION_ADM//设置 房间管理员点普通观众 + || mAction == SETTING_ACTION_SUP//设置 超管点主播 + || mAction == SETTING_ACTION_ANC_AUD//设置 主播点普通观众 + || mAction == SETTING_ACTION_ANC_ADM) {//设置 主播点房间管理员 + View btnSetting = mRootView.findViewById(R.id.btn_setting); + btnSetting.setVisibility(View.VISIBLE); + btnSetting.setOnClickListener(this); + } + } + + private void showImpress(String impressJson) { + List list = JSON.parseArray(impressJson, ImpressBean.class); + if (list.size() > 2) { + list = list.subList(0, 2); + } + LayoutInflater inflater = LayoutInflater.from(mContext); + for (int i = 0, size = list.size(); i < size; i++) { + MyTextView myTextView = (MyTextView) inflater.inflate(R.layout.view_impress_item_2, mImpressGroup, false); + ImpressBean bean = list.get(i); + bean.setCheck(1); + myTextView.setBean(bean); + mImpressGroup.addView(myTextView); + } + TextView textView = (TextView) inflater.inflate(R.layout.view_impress_item_add, mImpressGroup, false); + textView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + addImpress(); + } + }); + mImpressGroup.addView(textView); + } + + + /** + * 添加主播印象 + */ + private void addImpress() { + dismiss(); + ((LiveActivity) mContext).openAddImpressWindow(mLiveUid); + } + + @Override + public void onClick(View v) { + int i = v.getId(); + if (i == R.id.btn_close) { + dismiss(); + + } else if (i == R.id.btn_follow) { + setAttention(); + + } else if (i == R.id.btn_pri_msg) { + openChatRoomWindow(); + + } else if (i == R.id.btn_home_page) { + forwardHomePage(); + + } else if (i == R.id.btn_setting) { + setting(); + + } else if (i == R.id.btn_report) { + report(); + + } else if (i == R.id.avatar) { + forwardHomePage(); + } + } + + /** + * 打开私信聊天窗口 + */ + private void openChatRoomWindow() { + if (mUserBean != null) { + dismiss(); +// ToastUtil.show("私聊暫不可用"); +// if (!mToUid.equals(CommonAppConfig.getInstance().getUid())) { +// SystemMessageActivity.forward(mContext, "-1", mToUid, mToName, mAvatarUrl); +// } + + ((LiveActivity) mContext).openChatListWindow(); + } + } + + /** + * 关注 + */ + private void setAttention() { + CommonHttpUtil.setAttention(mToUid, mAttentionCallback); + } + + private CommonCallback mAttentionCallback = new CommonCallback() { + + @Override + public void callback(Integer isAttention) { + mFollowing = isAttention == 1; + if (mFollowText != null) { + mFollowText.setText(mFollowing ? R.string.following : R.string.follow); + } + if (mFollowImage != null) { + mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable); + } + if (isAttention == 1 && mLiveUid.equals(mToUid)) {//关注了主播 + ((LiveActivity) mContext).sendSystemMessage( + CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor)); + } + } + }; + + /** + * 跳转到个人主页 + */ + private void forwardHomePage() { + dismiss(); + Constants.mStream = mStream; + RouteUtil.forwardUserHome(mContext, mToUid, true, mLiveUid, 0); +// String url = HtmlConfig.PERSONAL + "?touid=" + mToUid + "&&isHomePage=1" + "&&fromType=0"; +// Constants.myUrl = url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken(); + } + + /** + * 举报 + */ + private void report() { + LiveReportActivity.forward(mContext, mToUid); + } + + /** + * 设置 + *

+ * 某个大神说,角色是权限的集合。。 + *

+ * 理论上,角色的权限应该有服务端以数组或集合的形式返回,这样可以在后台动态配置某种角色的权限,而不是这样口头约定写死。。。 + * 然而,是服务端这样做的,我也很无奈。。。也许他们不知道如何做成动态配置的吧。。 + *

+ * 我一直想通过不断重构把代码写的像艺术品,然而,最近发现,这完全是多此一举,自讨苦吃。。是我太天真了。。 + * 下面是我发现的一篇文章,说的非常好,也点醒了我。。如果你们发现当前代码写的太烂,不堪入目的话,请阅读下面的文章。 + *

+ * https://www.jianshu.com/p/71521541cd25?utm_campaign=haruki&utm_content=note&utm_medium=reader_share&utm_source=weixin_timeline&from=timeline + */ + private void setting() { + List list = new ArrayList<>(); + switch (mAction) { + case SETTING_ACTION_ADM://设置 房间管理员点普通观众 + list.add(R.string.live_setting_kick); +// list.add(R.string.live_setting_gap); + list.add(R.string.live_setting_gap_2); + break; + case SETTING_ACTION_SUP://设置 超管点主播 + list.add(R.string.live_setting_close_live); + list.add(R.string.live_setting_close_live_2); + list.add(R.string.live_setting_forbid_account); + break; + case SETTING_ACTION_ANC_AUD://设置 主播点普通观众 + list.add(R.string.live_setting_kick); +// list.add(R.string.live_setting_gap); + list.add(R.string.live_setting_gap_2); + list.add(R.string.live_setting_admin); + list.add(R.string.live_setting_admin_list); + break; + case SETTING_ACTION_ANC_ADM://设置 主播点房间管理员 + list.add(R.string.live_setting_kick); +// list.add(R.string.live_setting_gap); + list.add(R.string.live_setting_gap_2); + list.add(R.string.live_setting_admin_cancel); + list.add(R.string.live_setting_admin_list); + break; + } + + DialogUitl.showStringArrayDialog(mContext, list.toArray(new Integer[list.size()]), mArrayDialogCallback); + } + + private DialogUitl.StringArrayDialogCallback mArrayDialogCallback = new DialogUitl.StringArrayDialogCallback() { + @Override + public void onItemClick(String text, int tag) { + if (tag == R.string.live_setting_kick) { + kick(); + + } else if (tag == R.string.live_setting_gap) {//永久禁言->改成三天禁言 + setShutUp(); + + } else if (tag == R.string.live_setting_gap_2) {//本场禁言 + setShutUp2(); + + } else if (tag == R.string.live_setting_admin || tag == R.string.live_setting_admin_cancel) { + setAdmin(); + + } else if (tag == R.string.live_setting_admin_list) { + adminList(); + + } else if (tag == R.string.live_setting_close_live) { + closeLive(); + + } else if (tag == R.string.live_setting_forbid_account) { + forbidAccount(); + + } else if (tag == R.string.live_setting_close_live_2) {//禁用直播 + closeLive2(); + } + } + }; + + /** + * 查看管理员列表 + */ + private void adminList() { + dismiss(); + ((LiveActivity) mContext).openAdminListWindow(); + } + + /** + * 踢人 + */ + private void kick() { + LiveHttpUtil.kicking(mLiveUid, mToUid, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + ((LiveActivity) mContext).kickUser(mToUid, mToName); + } else { + ToastUtil.show(msg); + } + } + }); + } + + /** + * 永久禁言->改成三天禁言 + */ + private void setShutUp() { + LiveHttpUtil.setShutUp(mLiveUid, "0", 0, mToUid, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + ((LiveActivity) mContext).setShutUp(mToUid, mToName, 0); + } else { + ToastUtil.show(msg); + } + } + }); + } + + /** + * 本场禁言 + */ + private void setShutUp2() { + LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + ((LiveActivity) mContext).setShutUp(mToUid, mToName, 1); + } else { + ToastUtil.show(msg); + } + } + }); + } + + + /** + * 设置或取消管理员 + */ + private void setAdmin() { + LiveHttpUtil.setAdmin(mLiveUid, mToUid, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + int res = JSON.parseObject(info[0]).getIntValue("isadmin"); + if (res == 1) {//被设为管理员 + mAction = SETTING_ACTION_ANC_ADM; + } else {//被取消管理员 + mAction = SETTING_ACTION_ANC_AUD; + } + ((LiveActivity) mContext).sendSetAdminMessage(res, mToUid, mToName); + } + } + }); + } + + + /** + * 超管关闭直播间 + */ + private void closeLive() { + dismiss(); + LiveHttpUtil.superCloseRoom(mLiveUid, 0, mSuperCloseRoomCallback); + } + + /** + * 超管关闭直播间并禁止主播直播 + */ + private void closeLive2() { + dismiss(); + LiveHttpUtil.superCloseRoom(mLiveUid, 1, mSuperCloseRoomCallback); + } + + /** + * 超管关闭直播间并禁用主播账户 + */ + private void forbidAccount() { + dismiss(); + LiveHttpUtil.superCloseRoom(mLiveUid, 2, mSuperCloseRoomCallback); + } + + private HttpCallback mSuperCloseRoomCallback = new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0) { + ToastUtil.show(JSON.parseObject(info[0]).getString("msg")); + ((LiveActivity) mContext).superCloseRoom(); + } else { + ToastUtil.show(msg); + } + } + }; + + @Override + public void onDestroy() { + LiveHttpUtil.cancel(LiveHttpConsts.GET_LIVE_USER); + if (mAvatar != null) { + ImgLoader.clear(mContext, mAvatar); + mAvatar.setImageDrawable(null); + } + mAvatar = null; + super.onDestroy(); + } +} 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 fc82e3358..d22945541 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -3,7 +3,9 @@ package com.yunbao.live.dialog; import android.app.Dialog; import android.graphics.drawable.Drawable; import android.os.Bundle; + import androidx.core.content.ContextCompat; + import android.text.TextUtils; import android.util.Log; import android.view.Gravity; @@ -26,6 +28,7 @@ import com.tencent.imsdk.v2.V2TIMCallback; import com.tencent.imsdk.v2.V2TIMManager; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; +import com.yunbao.common.bean.FansMedalBean; import com.yunbao.common.bean.LevelBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.AbsDialogFragment; @@ -70,6 +73,7 @@ import pl.droidsonroids.gif.GifImageView; */ public class LiveUserDialogFragment extends AbsDialogFragment implements View.OnClickListener { + private String TAG = "用户弹窗"; private static final int TYPE_AUD_AUD = 1;//观众点别的观众 private static final int TYPE_ANC_AUD = 2;//主播点观众 @@ -84,46 +88,30 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private static final int SETTING_ACTION_ANC_AUD = 501;//设置 主播点普通观众 private static final int SETTING_ACTION_ANC_ADM = 502;//设置 主播点房间管理员 private ViewGroup mBottomContainer; - private ImageView mAvatar; - private ImageView mLevelAnchor; - private ImageView mLevel; - private TextView mLevelText; - private TextView mLevelAnchorText; - private ImageView mSex; + private String mLiveUid; + private String mToUid; + private String mStream; + private int mType; + private TextView mFollowText; private TextView mName; private TextView mID; - private TextView mCity; - private LinearLayout mImpressGroup; - private TextView mFollow; - private TextView mSign; - private TextView mFans; - private TextView mConsume;//消费 - private TextView mVotes;//收入 - private TextView mConsumeTip; - private TextView mVotesTip; - private String mLiveUid; - private String mStream; - private String mAvatarUrl; - private String mToUid; - private TextView mFollowText; + private TextView userLv; + private TextView mLvDesc; + private TextView mFansVal; private ImageView mFollowImage; - private int mType; - private int mAction; - private String mToName;//对方的名字 + private ImageView mSex; + private ImageView good_nub_ico; + private ImageView mLiveIcon; + private ImageView mLiveIcon2; + private ImageView mNoble; private UserBean mUserBean; - private boolean mFollowing; - private Drawable mFollowDrawable; - private Drawable mUnFollowDrawable; - SVGAImageView gift_svga; - LinearLayout ry_view; - ImageView medalIco1, shawl; - ImageView ry_ico1, ry_ico2, ry_ico3, ry_ico4, good_nub_ico; - View no_gz; GifImageView btn_live; + SVGAImageView gift_svga; + @Override protected int getLayoutId() { - return R.layout.dialog_live_user; + return R.layout.dialog_new_live_user; } @Override @@ -138,80 +126,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private LiveRoomCheckLivePresenter mCheckLivePresenter; - private void gotoLive(String live_id) { - DialogUitl.showSimpleDialog(mContext, "是否確認前往對方直播間?", new DialogUitl.SimpleCallback() { - @Override - public void onConfirmClick(Dialog dialog, String content) { - RongChatRoomClient.getInstance().quitChatRoom("g" + mLiveUid, new IRongCoreCallback.OperationCallback() { - @Override - public void onSuccess() { - Log.i("tx", "退出成功"); - //连接socket - LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - - } - }); - } - - @Override - public void onError(IRongCoreEnum.CoreErrorCode coreErrorCode) { - - } - }); - V2TIMManager.getInstance().quitGroup("g" + mLiveUid, new V2TIMCallback() { - @Override - public void onSuccess() { - - Log.i("tx", "退出成功" + mLiveUid); - //连接socket - LiveHttpUtil.qBackRoom(mLiveUid, mStream, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - - } - }); - } - - @Override - public void onError(int code, String desc) { - Log.i("tx", "退出失败"); - } - }); - LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class); - - if (mCheckLivePresenter == null) { - mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { - @Override - public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { - if (liveBean == null) { - return; - } - LiveRoomViewHolder.mHandler.removeCallbacksAndMessages(null); -// if (mFromLiveRoom) { -// ((UserHomeActivity) mContext).onBackPressed(); - dismiss(); - EventBus.getDefault().post(new LiveRoomChangeEvent(liveBean, liveType, liveTypeVal)); -// } else { -// LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); -// } - } - }); - } - mCheckLivePresenter.checkLive(liveBean); - } - } - }); - - - } - }); - } @Override protected void setWindowAttributes(Window window) { @@ -236,53 +150,12 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On return; } mStream = bundle.getString(Constants.STREAM); - //头像边框 - gift_svga = (SVGAImageView) mRootView.findViewById(R.id.gift_svga); - - btn_live = mRootView.findViewById(R.id.btn_live); - btn_live.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - gotoLive(mToUid); - } - }); - - mBottomContainer = mRootView.findViewById(R.id.bottom_container); - ry_view = (LinearLayout) mRootView.findViewById(R.id.ry_view); - no_gz = (View) mRootView.findViewById(R.id.no_gz); - ry_ico1 = (ImageView) mRootView.findViewById(R.id.ry_ico1); - good_nub_ico = (ImageView) mRootView.findViewById(R.id.good_nub_ico); - ry_ico2 = (ImageView) mRootView.findViewById(R.id.ry_ico2); - ry_ico3 = (ImageView) mRootView.findViewById(R.id.ry_ico3); - ry_ico4 = (ImageView) mRootView.findViewById(R.id.ry_ico4); - mAvatar = (ImageView) mRootView.findViewById(R.id.avatar); - mLevelAnchor = (ImageView) mRootView.findViewById(R.id.anchor_level); - mLevel = (ImageView) mRootView.findViewById(R.id.level); - shawl = (ImageView) mRootView.findViewById(R.id.shawl); - mLevelText = mRootView.findViewById(R.id.level_text); - mLevelAnchorText = mRootView.findViewById(R.id.level_anchor_text); - mSex = (ImageView) mRootView.findViewById(R.id.sex); - mName = (TextView) mRootView.findViewById(R.id.name); - mID = (TextView) mRootView.findViewById(R.id.id_val); - mCity = (TextView) mRootView.findViewById(R.id.city); - mSign = mRootView.findViewById(R.id.sign); - mImpressGroup = (LinearLayout) mRootView.findViewById(R.id.impress_group); - mFollow = (TextView) mRootView.findViewById(R.id.follow); - mFans = (TextView) mRootView.findViewById(R.id.fans); - mConsume = (TextView) mRootView.findViewById(R.id.consume); - mVotes = (TextView) mRootView.findViewById(R.id.votes); - mConsumeTip = (TextView) mRootView.findViewById(R.id.consume_tip); - mVotesTip = (TextView) mRootView.findViewById(R.id.votes_tip); - medalIco1 = (ImageView) mRootView.findViewById(R.id.medal_ico1); - mAvatar.setOnClickListener(this); - // mRootView.findViewById(R.id.btn_close).setOnClickListener(this); getType(); + initView(); + initListener(); LayoutInflater inflater = LayoutInflater.from(mContext); View bottomView = null; if (mType == TYPE_AUD_ANC) { - if (mImpressGroup.getVisibility() != View.VISIBLE) { - mImpressGroup.setVisibility(View.VISIBLE); - } bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mBottomContainer, false); } else if (mType == TYPE_AUD_AUD) { bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mBottomContainer, false); @@ -292,8 +165,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_3, mBottomContainer, false); } if (bottomView != null) { - mFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_user_home_follow_1); - mUnFollowDrawable = ContextCompat.getDrawable(mContext, R.mipmap.icon_user_home_follow_0); mBottomContainer.addView(bottomView); mFollowText = bottomView.findViewById(R.id.follow_text); mFollowImage = (ImageView) findViewById(R.id.follow_img); @@ -313,6 +184,42 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On loadData(); } + private void initView() { + gift_svga = (SVGAImageView) mRootView.findViewById(R.id.gift_svga); + btn_live = mRootView.findViewById(R.id.btn_live); + mBottomContainer = mRootView.findViewById(R.id.bottom_container); + mSex = (ImageView) mRootView.findViewById(R.id.sex); + mName = (TextView) mRootView.findViewById(R.id.name); + mID = (TextView) mRootView.findViewById(R.id.id_val); + good_nub_ico = (ImageView) mRootView.findViewById(R.id.good_nub_ico); + userLv = mRootView.findViewById(R.id.lv_val); + mLvDesc = mRootView.findViewById(R.id.lv_desc); + mLiveIcon = mRootView.findViewById(R.id.user_card_lv_icon); + mLiveIcon2 = mRootView.findViewById(R.id.live_icon); + mNoble = mRootView.findViewById(R.id.user_card_noble); + mFansVal = mRootView.findViewById(R.id.fans_val); + } + + private void initListener() { + btn_live.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + // gotoLive(mToUid); + } + }); + } + + private void loadData() { + LiveHttpUtil.getLiveUser(mToUid, mLiveUid, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (code == 0 && info.length > 0) { + showData(info[0]); + } + } + }); + } + private void getType() { String uid = CommonAppConfig.getInstance().getUid(); if (mToUid.equals(mLiveUid)) { @@ -334,18 +241,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } } - private void loadData() { - LiveHttpUtil.getLiveUser(mToUid, mLiveUid, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - showData(info[0]); - } - } - }); - } - private void showData(String data) { + Log.i(TAG, "showData: " + data); JSONObject obj = JSON.parseObject(data); mUserBean = JSON.toJavaObject(obj, UserBean.class); if (mUserBean.getIslive().equals("1")) { @@ -353,457 +250,53 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else { btn_live.setVisibility(View.GONE); } + mName.setText(obj.getString("user_nicename")); + if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) { + good_nub_ico.setVisibility(View.VISIBLE); + mID.setText(mUserBean.getGoodnum()); + } else { + good_nub_ico.setVisibility(View.GONE); + mID.setText(mUserBean.getId()); + } + mSex.setImageResource(CommonIconUtil.getSexIconForUserCard(obj.getIntValue("sex"))); + LevelBean levelBean; + if (mLiveUid.equals(mUserBean.getId())) { + levelBean = CommonAppConfig.getInstance().getAnchorLevel(mUserBean.getLevelAnchor()); + userLv.setText(mUserBean.getLevelAnchor() + ""); + mLvDesc.setText(R.string.live_user_level_anchor); + } else { + levelBean = CommonAppConfig.getInstance().getLevel(mUserBean.getLevel()); + userLv.setText(mUserBean.getLevel() + ""); + mLvDesc.setText(R.string.live_user_card_level); + } + new LiveTextRender().getLevelImage(mContext, levelBean.getLevel(), new ImgLoader.DrawableCallback() { + @Override + public void onLoadSuccess(Drawable drawable) { + ImgLoader.display2(mContext, drawable, mLiveIcon); + } + @Override + public void onLoadFailed() { + + } + }); + ImgLoader.display(mContext, levelBean.getBgIcon(), mLiveIcon2); + FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level")); + if (fansMedalBean != null) { + ImgLoader.display(mContext, fansMedalBean.getThumb(), mNoble); + } else { + mNoble.setVisibility(View.INVISIBLE); + } + mFansVal.setText(mUserBean.getFans()+""); //装扮相关 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); - } - } - } - - medalIco1.setVisibility(View.GONE); - no_gz.setVisibility(View.GONE); - if (dress.getJSONArray("medal").size() >= 1) { - JSONObject display = (JSONObject) dress.getJSONArray("medal").get(0); - if (display.getString("display_src") != null) { - ImgLoader.display(mContext, display.getString("display_src"), medalIco1); - medalIco1.setVisibility(View.VISIBLE); - no_gz.setVisibility(View.VISIBLE); - } - } - if (dress.getJSONArray("wraps").size() >= 1) { - JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0); - ImgLoader.display(mContext, display.getString("display_src"), shawl); - } - - JSONObject display = (JSONObject) dress.getJSONArray("medal").get(0); - - if (dress.getJSONArray("medal_no") != null) { - Log.e("tag", dress.getJSONArray("medal_no").size() + ""); - ry_view.setVisibility(View.VISIBLE); - JSONObject ry1 = (JSONObject) dress.getJSONArray("medal_no").get(0); - ImgLoader.display(mContext, ry1.get("display_src").toString(), ry_ico1); - ry_ico1.setVisibility(View.VISIBLE); - - if (dress.getJSONArray("medal_no").size() >= 2) { - JSONObject ry2 = (JSONObject) dress.getJSONArray("medal_no").get(1); - ImgLoader.display(mContext, ry2.get("display_src").toString(), ry_ico2); - ry_ico2.setVisibility(View.VISIBLE); - } - if (dress.getJSONArray("medal_no").size() >= 3) { - JSONObject ry3 = (JSONObject) dress.getJSONArray("medal_no").get(2); - ImgLoader.display(mContext, ry3.get("display_src").toString(), ry_ico3); - ry_ico3.setVisibility(View.VISIBLE); - } - - if (dress.getJSONArray("medal_no").size() >= 4) { - JSONObject ry4 = (JSONObject) dress.getJSONArray("medal_no").get(3); - ImgLoader.display(mContext, ry4.get("display_src").toString(), ry_ico4); - ry_ico4.setVisibility(View.VISIBLE); - } - - - } else { - ry_view.setVisibility(View.GONE); - } - - CommonAppConfig appConfig = CommonAppConfig.getInstance(); - - if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) { - good_nub_ico.setVisibility(View.VISIBLE); - mID.setText("ID:" + mUserBean.getGoodnum()); - } else { - good_nub_ico.setVisibility(View.GONE); - mID.setText(mUserBean.getLiangNameTip()); - } - mToName = obj.getString("user_nicename"); - mName.setText(mToName); - mCity.setText(obj.getString("city")); - ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar); - mAvatarUrl = obj.getString("avatar"); - int levelAnchor = obj.getIntValue("level_anchor"); - int level = obj.getIntValue("level"); - mSign.setText(obj.getString("signature")); - LevelBean anchorLevelBean = appConfig.getAnchorLevel(obj.getIntValue("level_anchor")); - if (anchorLevelBean != null) { - ImgLoader.display(mContext, anchorLevelBean.getBgIcon(), mLevelAnchor); - } - LevelBean levelBean = appConfig.getLevel(obj.getIntValue("level")); - if (levelBean != null) { - ImgLoader.display(mContext, levelBean.getBgIcon(), mLevel); - } - mLevelAnchorText.setText(String.valueOf(levelAnchor)); - mLevelText.setText(String.valueOf(level)); - mSex.setImageResource(CommonIconUtil.getSexIcon(obj.getIntValue("sex"))); - mFollow.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("follows"))); - mFans.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("fans"))); - mConsume.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("consumption"))); - mVotes.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("votestotal"))); - mConsumeTip.setText(WordUtil.getString(R.string.live_user_send) + appConfig.getCoinName()); - mVotesTip.setText(WordUtil.getString(R.string.live_user_get) + appConfig.getVotesName()); - if (mType == TYPE_AUD_ANC) { - showImpress(obj.getString("label")); - } - mFollowing = obj.getIntValue("isattention") == 1; - if (mFollowText != null) { - mFollowText.setText(mFollowing ? WordUtil.getString(R.string.following) : WordUtil.getString(R.string.follow)); - } - if (mFollowImage != null) { - mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable); - } - mAction = obj.getIntValue("action"); - if (mAction == SETTING_ACTION_AUD) {//设置 普通观众点普通观众 或所有人点超管 - View btnReport = mRootView.findViewById(R.id.btn_report); - btnReport.setVisibility(View.VISIBLE); - btnReport.setOnClickListener(this); - } else if (mAction == SETTING_ACTION_ADM//设置 房间管理员点普通观众 - || mAction == SETTING_ACTION_SUP//设置 超管点主播 - || mAction == SETTING_ACTION_ANC_AUD//设置 主播点普通观众 - || mAction == SETTING_ACTION_ANC_ADM) {//设置 主播点房间管理员 - View btnSetting = mRootView.findViewById(R.id.btn_setting); - btnSetting.setVisibility(View.VISIBLE); - btnSetting.setOnClickListener(this); - } } - private void showImpress(String impressJson) { - List list = JSON.parseArray(impressJson, ImpressBean.class); - if (list.size() > 2) { - list = list.subList(0, 2); - } - LayoutInflater inflater = LayoutInflater.from(mContext); - for (int i = 0, size = list.size(); i < size; i++) { - MyTextView myTextView = (MyTextView) inflater.inflate(R.layout.view_impress_item_2, mImpressGroup, false); - ImpressBean bean = list.get(i); - bean.setCheck(1); - myTextView.setBean(bean); - mImpressGroup.addView(myTextView); - } - TextView textView = (TextView) inflater.inflate(R.layout.view_impress_item_add, mImpressGroup, false); - textView.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - addImpress(); - } - }); - mImpressGroup.addView(textView); - } - - - /** - * 添加主播印象 - */ - private void addImpress() { - dismiss(); - ((LiveActivity) mContext).openAddImpressWindow(mLiveUid); - } @Override public void onClick(View v) { - int i = v.getId(); - if (i == R.id.btn_close) { - dismiss(); - } else if (i == R.id.btn_follow) { - setAttention(); - - } else if (i == R.id.btn_pri_msg) { - openChatRoomWindow(); - - } else if (i == R.id.btn_home_page) { - forwardHomePage(); - - } else if (i == R.id.btn_setting) { - setting(); - - } else if (i == R.id.btn_report) { - report(); - - } else if (i == R.id.avatar) { - forwardHomePage(); - } - } - - /** - * 打开私信聊天窗口 - */ - private void openChatRoomWindow() { - if (mUserBean != null) { - dismiss(); -// ToastUtil.show("私聊暫不可用"); -// if (!mToUid.equals(CommonAppConfig.getInstance().getUid())) { -// SystemMessageActivity.forward(mContext, "-1", mToUid, mToName, mAvatarUrl); -// } - - ((LiveActivity) mContext).openChatListWindow(); - } - } - - /** - * 关注 - */ - private void setAttention() { - CommonHttpUtil.setAttention(mToUid, mAttentionCallback); - } - - private CommonCallback mAttentionCallback = new CommonCallback() { - - @Override - public void callback(Integer isAttention) { - mFollowing = isAttention == 1; - if (mFollowText != null) { - mFollowText.setText(mFollowing ? R.string.following : R.string.follow); - } - if (mFollowImage != null) { - mFollowImage.setImageDrawable(mFollowing ? mFollowDrawable : mUnFollowDrawable); - } - if (isAttention == 1 && mLiveUid.equals(mToUid)) {//关注了主播 - ((LiveActivity) mContext).sendSystemMessage( - CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor)); - } - } - }; - - /** - * 跳转到个人主页 - */ - private void forwardHomePage() { - dismiss(); - Constants.mStream = mStream; - RouteUtil.forwardUserHome(mContext, mToUid, true, mLiveUid, 0); -// String url = HtmlConfig.PERSONAL + "?touid=" + mToUid + "&&isHomePage=1" + "&&fromType=0"; -// Constants.myUrl = url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken(); - } - - /** - * 举报 - */ - private void report() { - LiveReportActivity.forward(mContext, mToUid); - } - - /** - * 设置 - *

- * 某个大神说,角色是权限的集合。。 - *

- * 理论上,角色的权限应该有服务端以数组或集合的形式返回,这样可以在后台动态配置某种角色的权限,而不是这样口头约定写死。。。 - * 然而,是服务端这样做的,我也很无奈。。。也许他们不知道如何做成动态配置的吧。。 - *

- * 我一直想通过不断重构把代码写的像艺术品,然而,最近发现,这完全是多此一举,自讨苦吃。。是我太天真了。。 - * 下面是我发现的一篇文章,说的非常好,也点醒了我。。如果你们发现当前代码写的太烂,不堪入目的话,请阅读下面的文章。 - *

- * https://www.jianshu.com/p/71521541cd25?utm_campaign=haruki&utm_content=note&utm_medium=reader_share&utm_source=weixin_timeline&from=timeline - */ - private void setting() { - List list = new ArrayList<>(); - switch (mAction) { - case SETTING_ACTION_ADM://设置 房间管理员点普通观众 - list.add(R.string.live_setting_kick); -// list.add(R.string.live_setting_gap); - list.add(R.string.live_setting_gap_2); - break; - case SETTING_ACTION_SUP://设置 超管点主播 - list.add(R.string.live_setting_close_live); - list.add(R.string.live_setting_close_live_2); - list.add(R.string.live_setting_forbid_account); - break; - case SETTING_ACTION_ANC_AUD://设置 主播点普通观众 - list.add(R.string.live_setting_kick); -// list.add(R.string.live_setting_gap); - list.add(R.string.live_setting_gap_2); - list.add(R.string.live_setting_admin); - list.add(R.string.live_setting_admin_list); - break; - case SETTING_ACTION_ANC_ADM://设置 主播点房间管理员 - list.add(R.string.live_setting_kick); -// list.add(R.string.live_setting_gap); - list.add(R.string.live_setting_gap_2); - list.add(R.string.live_setting_admin_cancel); - list.add(R.string.live_setting_admin_list); - break; - } - - DialogUitl.showStringArrayDialog(mContext, list.toArray(new Integer[list.size()]), mArrayDialogCallback); - } - - private DialogUitl.StringArrayDialogCallback mArrayDialogCallback = new DialogUitl.StringArrayDialogCallback() { - @Override - public void onItemClick(String text, int tag) { - if (tag == R.string.live_setting_kick) { - kick(); - - } else if (tag == R.string.live_setting_gap) {//永久禁言->改成三天禁言 - setShutUp(); - - } else if (tag == R.string.live_setting_gap_2) {//本场禁言 - setShutUp2(); - - } else if (tag == R.string.live_setting_admin || tag == R.string.live_setting_admin_cancel) { - setAdmin(); - - } else if (tag == R.string.live_setting_admin_list) { - adminList(); - - } else if (tag == R.string.live_setting_close_live) { - closeLive(); - - } else if (tag == R.string.live_setting_forbid_account) { - forbidAccount(); - - } else if (tag == R.string.live_setting_close_live_2) {//禁用直播 - closeLive2(); - } - } - }; - - /** - * 查看管理员列表 - */ - private void adminList() { - dismiss(); - ((LiveActivity) mContext).openAdminListWindow(); - } - - /** - * 踢人 - */ - private void kick() { - LiveHttpUtil.kicking(mLiveUid, mToUid, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - ((LiveActivity) mContext).kickUser(mToUid, mToName); - } else { - ToastUtil.show(msg); - } - } - }); - } - - /** - * 永久禁言->改成三天禁言 - */ - private void setShutUp() { - LiveHttpUtil.setShutUp(mLiveUid, "0", 0, mToUid, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - ((LiveActivity) mContext).setShutUp(mToUid, mToName, 0); - } else { - ToastUtil.show(msg); - } - } - }); - } - - /** - * 本场禁言 - */ - private void setShutUp2() { - LiveHttpUtil.setShutUp(mLiveUid, mStream, 1, mToUid, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - ((LiveActivity) mContext).setShutUp(mToUid, mToName, 1); - } else { - ToastUtil.show(msg); - } - } - }); - } - - - /** - * 设置或取消管理员 - */ - private void setAdmin() { - LiveHttpUtil.setAdmin(mLiveUid, mToUid, new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0 && info.length > 0) { - int res = JSON.parseObject(info[0]).getIntValue("isadmin"); - if (res == 1) {//被设为管理员 - mAction = SETTING_ACTION_ANC_ADM; - } else {//被取消管理员 - mAction = SETTING_ACTION_ANC_AUD; - } - ((LiveActivity) mContext).sendSetAdminMessage(res, mToUid, mToName); - } - } - }); - } - - - /** - * 超管关闭直播间 - */ - private void closeLive() { - dismiss(); - LiveHttpUtil.superCloseRoom(mLiveUid, 0, mSuperCloseRoomCallback); - } - - /** - * 超管关闭直播间并禁止主播直播 - */ - private void closeLive2() { - dismiss(); - LiveHttpUtil.superCloseRoom(mLiveUid, 1, mSuperCloseRoomCallback); - } - - /** - * 超管关闭直播间并禁用主播账户 - */ - private void forbidAccount() { - dismiss(); - LiveHttpUtil.superCloseRoom(mLiveUid, 2, mSuperCloseRoomCallback); - } - - private HttpCallback mSuperCloseRoomCallback = new HttpCallback() { - @Override - public void onSuccess(int code, String msg, String[] info) { - if (code == 0) { - ToastUtil.show(JSON.parseObject(info[0]).getString("msg")); - ((LiveActivity) mContext).superCloseRoom(); - } else { - ToastUtil.show(msg); - } - } - }; - - @Override - public void onDestroy() { - LiveHttpUtil.cancel(LiveHttpConsts.GET_LIVE_USER); - if (mAvatar != null) { - ImgLoader.clear(mContext, mAvatar); - mAvatar.setImageDrawable(null); - } - mAvatar = null; - super.onDestroy(); } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 28b94428a..d2fa2e27d 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -125,6 +125,7 @@ import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveFansMedalDialogFragment; import com.yunbao.live.dialog.LiveGameDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment; +import com.yunbao.live.dialog.LiveOldUserDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.event.LiveAudienceEvent; @@ -2410,7 +2411,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis */ public void showUserDialog(String toUid) { if (!TextUtils.isEmpty(mLiveUid) && !TextUtils.isEmpty(toUid)) { - LiveUserDialogFragment fragment = new LiveUserDialogFragment(); + LiveOldUserDialogFragment fragment = new LiveOldUserDialogFragment(); Bundle bundle = new Bundle(); bundle.putString(Constants.LIVE_UID, mLiveUid); bundle.putString(Constants.STREAM, mStream); diff --git a/live/src/main/res/drawable/background_ff63c1.xml b/live/src/main/res/drawable/background_ff63c1.xml new file mode 100644 index 000000000..6004c4a80 --- /dev/null +++ b/live/src/main/res/drawable/background_ff63c1.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/live/src/main/res/drawable/bg_user_card_fans.xml b/live/src/main/res/drawable/bg_user_card_fans.xml new file mode 100644 index 000000000..60ab9e052 --- /dev/null +++ b/live/src/main/res/drawable/bg_user_card_fans.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_user_card_guard.xml b/live/src/main/res/drawable/bg_user_card_guard.xml new file mode 100644 index 000000000..bcfe90830 --- /dev/null +++ b/live/src/main/res/drawable/bg_user_card_guard.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_user_card_honor.xml b/live/src/main/res/drawable/bg_user_card_honor.xml new file mode 100644 index 000000000..7ad95101b --- /dev/null +++ b/live/src/main/res/drawable/bg_user_card_honor.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_user_card_lv.xml b/live/src/main/res/drawable/bg_user_card_lv.xml new file mode 100644 index 000000000..3190220a6 --- /dev/null +++ b/live/src/main/res/drawable/bg_user_card_lv.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_live_user_bottom_1.xml b/live/src/main/res/layout/dialog_live_user_bottom_1.xml index 94900faef..f3a185349 100644 --- a/live/src/main/res/layout/dialog_live_user_bottom_1.xml +++ b/live/src/main/res/layout/dialog_live_user_bottom_1.xml @@ -1,56 +1,19 @@ + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + android:background="#eeeeee" /> + android:orientation="horizontal"> - - - - - - - - - - - - + android:orientation="horizontal"> + android:src="@mipmap/icon_user_home_msg" /> + android:textSize="13sp" /> @@ -90,22 +50,20 @@ android:id="@+id/btn_home_page" android:layout_width="0dp" android:layout_height="match_parent" - android:layout_weight="1" - > + android:layout_weight="1"> + android:orientation="horizontal"> + android:visibility="gone" /> + android:textSize="16sp" + android:textStyle="bold" /> + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/dialog_new_live_user.xml b/live/src/main/res/layout/dialog_new_live_user.xml new file mode 100644 index 000000000..4e03956bc --- /dev/null +++ b/live/src/main/res/layout/dialog_new_live_user.xml @@ -0,0 +1,432 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-mdpi/icon_user_card_follow.png b/live/src/main/res/mipmap-mdpi/icon_user_card_follow.png new file mode 100644 index 0000000000000000000000000000000000000000..39b6ca9f3d113a45be57b765511fdb8d22133cc6 GIT binary patch literal 1584 zcmV-02G9A4P)Px)>PbXFRA}DSS!-+*RTTaZ6cO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?F$O28{MPFl zibvTe9?HSmQI2K%r6J2zJ~@_+C$$Na#bkVw>h(QU%0E8cE@x*r7B0~S?fyZU){~O7 i(YzLncRg{;UjG9P1}2=du&j>&0000 response) { + super.onError(response); + String message = response.message(); + System.out.println(">>>>>"+message); + } }); } diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 527df2269..4ac27b9b8 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -489,7 +489,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene public void run() { if (IMLoginManager.get(mContext).isHint()) { HintDialog fragment = new HintDialog(); - fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog"); + fragment.show(((FragmentActivity) MainActivity.this).getSupportFragmentManager(), "HintDialog"); fragment.setListener(new HintDialog.HintListener() { @Override public void requestPermission() { 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 2/7] =?UTF-8?q?update=20=E4=B8=AA=E4=BA=BA=E5=90=8D?= =?UTF-8?q?=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 @@ 觀眾 觀眾 粉絲 + 獲讚 私信 選擇房間類型 公開房 From a66a32038c3b1f3d70e546080f3067e94d606661 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 8 Nov 2022 11:38:20 +0800 Subject: [PATCH 3/7] update --- .../com/yunbao/common/utils/NobleUtil.java | 2 +- .../live/dialog/LiveUserDialogFragment.java | 86 +++++++++++++++++-- .../yunbao/live/views/LiveRoomViewHolder.java | 2 +- .../main/res/layout/dialog_new_live_user.xml | 2 +- 4 files changed, 83 insertions(+), 9 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 40a7d458d..868b3984a 100644 --- a/common/src/main/java/com/yunbao/common/utils/NobleUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/NobleUtil.java @@ -32,6 +32,6 @@ public class NobleUtil { case 6:return "皇帝"; case 7:return "超皇"; } - 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 a918c7249..9224bd156 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -1,6 +1,7 @@ package com.yunbao.live.dialog; import android.app.Dialog; +import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Bundle; @@ -102,6 +103,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private TextView mPraise; private TextView mSignDesc; private TextView mNobleVal; + private TextView mReport; private ImageView mFollowImage; private ImageView mSex; private ImageView good_nub_ico; @@ -109,7 +111,9 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private ImageView mLiveIcon2; private ImageView mNoble; private ImageView mAvatar; + private ImageView shawl; private UserBean mUserBean; + private boolean mFollowing; GifImageView btn_live; SVGAImageView gift_svga; @@ -165,7 +169,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else if (mType == TYPE_AUD_AUD) { bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mBottomContainer, false); } else if (mType == TYPE_ANC_AUD) { - bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_2, mBottomContainer, false); + bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mBottomContainer, false); } else if (mType == TYPE_AUD_SELF) { bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_3, mBottomContainer, false); } @@ -207,6 +211,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On mSignDesc = mRootView.findViewById(R.id.sign); mAvatar = mRootView.findViewById(R.id.avatar); mNobleVal = mRootView.findViewById(R.id.noble_val); + shawl = (ImageView) mRootView.findViewById(R.id.shawl); + mReport = mRootView.findViewById(R.id.btn_report); } private void initListener() { @@ -216,6 +222,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On // gotoLive(mToUid); } }); + mAvatar.setOnClickListener(this); + mReport.setOnClickListener(this); } private void loadData() { @@ -251,6 +259,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } private void showData(String data) { + ToastUtil.show(mLiveUid+"="+mToUid); Log.i(TAG, "showData: " + data); JSONObject obj = JSON.parseObject(data); mUserBean = JSON.toJavaObject(obj, UserBean.class); @@ -271,11 +280,11 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On LevelBean levelBean; if (mLiveUid.equals(mUserBean.getId())) { levelBean = CommonAppConfig.getInstance().getAnchorLevel(mUserBean.getLevelAnchor()); - userLv.setText("Lv."+mUserBean.getLevelAnchor() ); + userLv.setText("Lv." + mUserBean.getLevelAnchor()); mLvDesc.setText(R.string.live_user_level_anchor); } else { levelBean = CommonAppConfig.getInstance().getLevel(mUserBean.getLevel()); - userLv.setText("Lv."+mUserBean.getLevel()); + userLv.setText("Lv." + mUserBean.getLevel()); mLvDesc.setText(R.string.live_user_card_level); } new LiveTextRender().getLevelImage(mContext, levelBean.getLevel(), new ImgLoader.DrawableCallback() { @@ -296,14 +305,19 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else { mNoble.setVisibility(View.INVISIBLE); } - mFansVal.setText(WordUtil.getString(R.string.fans)+":"+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); + mFollowing = obj.getIntValue("isattention") == 1; + updateFollow(); //装扮相关 JSONObject dress = obj.getJSONObject("dress"); + if (dress.getJSONArray("wraps").size() >= 1) { + JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0); + ImgLoader.display(mContext, display.getString("display_src"), shawl); + } 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")) { @@ -334,9 +348,69 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } + private void updateFollow() { + if (mFollowText != null) { + mFollowText.setText(mFollowing ? R.string.following : R.string.follow); + if (mFollowing) { + mFollowText.setTextColor(Color.parseColor("#B1B1B1")); + } else { + mFollowText.setTextColor(Color.parseColor("#FA6400")); + } + } + if (mFollowImage != null) { + if (mFollowing) { + mFollowImage.setVisibility(View.GONE); + } else { + mFollowImage.setVisibility(View.VISIBLE); + } + } + } + + /** + * 关注 + */ + private void setAttention() { + CommonHttpUtil.setAttention(mToUid, new CommonCallback() { + + @Override + public void callback(Integer isAttention) { + mFollowing = isAttention == 1; + updateFollow(); + if (isAttention == 1 && mLiveUid.equals(mToUid)) {//关注了主播 + ((LiveActivity) mContext).sendSystemMessage( + CommonAppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor)); + } + } + }); + } + + /** + * 跳转到个人主页 + */ + private void forwardHomePage() { + dismiss(); + Constants.mStream = mStream; + RouteUtil.forwardUserHome(mContext, mToUid, true, mLiveUid, 0); + } + + /** + * 举报 + */ + private void report() { + LiveReportActivity.forward(mContext, mToUid); + } @Override public void onClick(View v) { - + int i = v.getId(); + if (i == R.id.btn_follow) { + setAttention(); + } else if (i == R.id.btn_home_page) { + forwardHomePage(); + } else if (i == R.id.btn_report) { + report(); + } else if (i == R.id.avatar) { + forwardHomePage(); + } } } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index d2fa2e27d..79bad907b 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -2411,7 +2411,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis */ public void showUserDialog(String toUid) { if (!TextUtils.isEmpty(mLiveUid) && !TextUtils.isEmpty(toUid)) { - LiveOldUserDialogFragment fragment = new LiveOldUserDialogFragment(); + LiveUserDialogFragment fragment = new LiveUserDialogFragment(); Bundle bundle = new Bundle(); bundle.putString(Constants.LIVE_UID, mLiveUid); bundle.putString(Constants.STREAM, mStream); 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 65c09bd95..0f8d3fa1a 100644 --- a/live/src/main/res/layout/dialog_new_live_user.xml +++ b/live/src/main/res/layout/dialog_new_live_user.xml @@ -8,7 +8,7 @@ From 34dd3ca8835bac066c9b4ad32b847b629eac4749 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 8 Nov 2022 13:17:35 +0800 Subject: [PATCH 4/7] update --- common/src/main/res/values/strings.xml | 1 + .../live/dialog/LiveUserDialogFragment.java | 33 ++++++++++++++++++- .../main/res/layout/dialog_new_live_user.xml | 3 +- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 413db6e14..9816117cc 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -93,6 +93,7 @@ 請選擇正確的日期 溫馨提示:可以免費修改昵稱一次,之後修改需要鑽石1800一次 關注 + 主播哪裡做的不好~\n哥哥確定要取消關注嗎? 已關注 我的關注 我的黑名單 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 9224bd156..bccc68faa 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -47,6 +47,7 @@ import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveReportActivity; +import com.yunbao.live.bean.GuardUserBean; import com.yunbao.live.bean.ImpressBean; import com.yunbao.common.bean.LiveBean; import com.yunbao.live.custom.MyTextView; @@ -62,6 +63,7 @@ import org.greenrobot.eventbus.EventBus; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import io.rong.imlib.IRongCoreCallback; @@ -94,6 +96,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private String mToUid; private String mStream; private int mType; + private int guardNumber; private TextView mFollowText; private TextView mName; private TextView mID; @@ -104,6 +107,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private TextView mSignDesc; private TextView mNobleVal; private TextView mReport; + private TextView mGuard; private ImageView mFollowImage; private ImageView mSex; private ImageView good_nub_ico; @@ -113,6 +117,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private ImageView mAvatar; private ImageView shawl; private UserBean mUserBean; + private LinearLayout mGuardLayout; private boolean mFollowing; GifImageView btn_live; SVGAImageView gift_svga; @@ -162,6 +167,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On getType(); initView(); initListener(); + initGuardList(); LayoutInflater inflater = LayoutInflater.from(mContext); View bottomView = null; if (mType == TYPE_AUD_ANC) { @@ -213,6 +219,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On mNobleVal = mRootView.findViewById(R.id.noble_val); shawl = (ImageView) mRootView.findViewById(R.id.shawl); mReport = mRootView.findViewById(R.id.btn_report); + mGuardLayout = mRootView.findViewById(R.id.btn_guard); + mGuard = mRootView.findViewById(R.id.guard_val); } private void initListener() { @@ -224,6 +232,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On }); mAvatar.setOnClickListener(this); mReport.setOnClickListener(this); + mGuardLayout.setOnClickListener(this); } private void loadData() { @@ -259,7 +268,6 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } private void showData(String data) { - ToastUtil.show(mLiveUid+"="+mToUid); Log.i(TAG, "showData: " + data); JSONObject obj = JSON.parseObject(data); mUserBean = JSON.toJavaObject(obj, UserBean.class); @@ -268,6 +276,9 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else { btn_live.setVisibility(View.GONE); } + if (mLiveUid.equals(mToUid)) { + mGuardLayout.setVisibility(View.VISIBLE); + } mName.setText(obj.getString("user_nicename")); if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) { good_nub_ico.setVisibility(View.VISIBLE); @@ -305,6 +316,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else { mNoble.setVisibility(View.INVISIBLE); } + mGuard.setText(String.format(mGuard.getText().toString(), guardNumber)); mFansVal.setText(WordUtil.getString(R.string.fans) + ":" + mUserBean.getFans()); mSignDesc.setText(mUserBean.getSignature()); mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id()))); @@ -370,6 +382,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On * 关注 */ private void setAttention() { + if(mFollowing) { + //DialogUitl.showSimpleDialog(mContext,WordUtil.getString(R.string.unfollow)); + return; + } + attention(); + } + private void attention(){ CommonHttpUtil.setAttention(mToUid, new CommonCallback() { @Override @@ -400,6 +419,18 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On LiveReportActivity.forward(mContext, mToUid); } + private void initGuardList() { + LiveHttpUtil.getGuardList(mLiveUid, 1, new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + List list = JSON.parseArray(Arrays.toString(info), GuardUserBean.class); + if (list != null) { + guardNumber = list.size(); + } + } + }); + } + @Override public void onClick(View v) { int i = v.getId(); 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 0f8d3fa1a..7dbc7d359 100644 --- a/live/src/main/res/layout/dialog_new_live_user.xml +++ b/live/src/main/res/layout/dialog_new_live_user.xml @@ -34,11 +34,12 @@ android:background="@drawable/bg_user_card_guard" android:gravity="center" android:orientation="horizontal" - android:visibility="visible" + android:visibility="invisible" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> Date: Tue, 8 Nov 2022 13:53:24 +0800 Subject: [PATCH 5/7] update --- .../com/yunbao/common/utils/DialogUitl.java | 14 +++- .../drawable/bg_dialog_unfollow_cancel.xml | 9 +++ .../main/res/layout/dialog_live_unfollow.xml | 71 +++++++++++++++++++ common/src/main/res/values/strings.xml | 2 + .../live/dialog/LiveUserDialogFragment.java | 28 +++++++- 5 files changed, 120 insertions(+), 4 deletions(-) create mode 100644 common/src/main/res/drawable/bg_dialog_unfollow_cancel.xml create mode 100644 common/src/main/res/layout/dialog_live_unfollow.xml diff --git a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java index a72d6cac7..b8b2583f7 100644 --- a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java +++ b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java @@ -19,6 +19,8 @@ import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.LayoutRes; + import com.yunbao.common.R; import java.util.ArrayList; @@ -320,6 +322,7 @@ public class DialogUitl { private int mLength; private SimpleCallback mClickCallback; private SimpleCallback3 mClickCallback3; + private int mView = 0; public Builder(Context context) { mContext = context; @@ -385,9 +388,18 @@ public class DialogUitl { return this; } + public Builder setView(@LayoutRes int layoutRes) { + mView = layoutRes; + return this; + } + public Dialog build() { final Dialog dialog = new Dialog(mContext, mBackgroundDimEnabled ? R.style.dialog : R.style.dialog2); - dialog.setContentView(mInput ? R.layout.dialog_input : R.layout.dialog_simple); + if (mView != 0) { + dialog.setContentView(mView); + } else { + dialog.setContentView(mInput ? R.layout.dialog_input : R.layout.dialog_simple); + } dialog.setCancelable(mCancelable); dialog.setCanceledOnTouchOutside(mCancelable); TextView titleView = (TextView) dialog.findViewById(R.id.title); diff --git a/common/src/main/res/drawable/bg_dialog_unfollow_cancel.xml b/common/src/main/res/drawable/bg_dialog_unfollow_cancel.xml new file mode 100644 index 000000000..4edc8b6fc --- /dev/null +++ b/common/src/main/res/drawable/bg_dialog_unfollow_cancel.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_live_unfollow.xml b/common/src/main/res/layout/dialog_live_unfollow.xml new file mode 100644 index 000000000..9121dcf67 --- /dev/null +++ b/common/src/main/res/layout/dialog_live_unfollow.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 9816117cc..f3a2d6462 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -94,6 +94,8 @@ 溫馨提示:可以免費修改昵稱一次,之後修改需要鑽石1800一次 關注 主播哪裡做的不好~\n哥哥確定要取消關注嗎? + 繼續關注 + 不再關注 已關注 我的關注 我的黑名單 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 bccc68faa..ae38a32c2 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -47,6 +47,7 @@ import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveReportActivity; +import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.bean.GuardUserBean; import com.yunbao.live.bean.ImpressBean; import com.yunbao.common.bean.LiveBean; @@ -382,13 +383,32 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On * 关注 */ private void setAttention() { - if(mFollowing) { - //DialogUitl.showSimpleDialog(mContext,WordUtil.getString(R.string.unfollow)); + if (mFollowing) { + DialogUitl.Builder builder = new DialogUitl.Builder(mContext) + .setContent(WordUtil.getString(R.string.unfollow)) + .setConfrimString(WordUtil.getString(R.string.unfollow_confrim)) + .setCancelString(WordUtil.getString(R.string.unfollow_cancel)) + .setView(R.layout.dialog_live_unfollow) + .setClickCallback3(new DialogUitl.SimpleCallback3() { + + + @Override + public void onConfirmClick(Dialog dialog) { + dialog.dismiss(); + } + + @Override + public void onCancel() { + attention(); + } + }); + builder.build().show(); return; } attention(); } - private void attention(){ + + private void attention() { CommonHttpUtil.setAttention(mToUid, new CommonCallback() { @Override @@ -442,6 +462,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On report(); } else if (i == R.id.avatar) { forwardHomePage(); + } else if (i == R.id.btn_guard) { + ((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity); } } } From 5ed5b15737163e768bc93afb44d45f02a15c9643 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 8 Nov 2022 16:50:37 +0800 Subject: [PATCH 6/7] udpate --- .../com/yunbao/common/bean/NewLevelModel.java | 4 +- .../java/com/yunbao/common/bean/UserBean.java | 11 +++++ .../live/dialog/LiveUserDialogFragment.java | 47 ++++++++++++++++++- .../main/res/layout/dialog_new_live_user.xml | 6 ++- 4 files changed, 63 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java b/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java index 4b666f6c1..4ecb0defb 100644 --- a/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java +++ b/common/src/main/java/com/yunbao/common/bean/NewLevelModel.java @@ -9,9 +9,9 @@ public class NewLevelModel extends BaseModel { @SerializedName("id") private String id; - @SerializedName("levemin") + @SerializedName("levelmin") private String levemin; - @SerializedName("levemax") + @SerializedName("levelmax") private String levemax; @SerializedName("thumb") private String thumb; diff --git a/common/src/main/java/com/yunbao/common/bean/UserBean.java b/common/src/main/java/com/yunbao/common/bean/UserBean.java index a9dd62735..2f8df56aa 100644 --- a/common/src/main/java/com/yunbao/common/bean/UserBean.java +++ b/common/src/main/java/com/yunbao/common/bean/UserBean.java @@ -5,6 +5,7 @@ import android.os.Parcelable; import android.text.TextUtils; import com.alibaba.fastjson.annotation.JSONField; +import com.google.gson.annotations.SerializedName; /** * Created by cxf on 2017/8/14. @@ -56,6 +57,8 @@ public class UserBean implements Parcelable { private String mobile; private String front_task; private String is_admin; + @SerializedName("user_love_num") + private int praise; //是否隐藏 private boolean isHide = false; @@ -363,6 +366,14 @@ public class UserBean implements Parcelable { return level; } + public int getPraise() { + return praise; + } + + public void setPraise(int praise) { + this.praise = praise; + } + public void setLevel(int level) { this.level = level; } 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 ae38a32c2..90359ef7a 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -115,8 +115,10 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private ImageView mLiveIcon; private ImageView mLiveIcon2; private ImageView mNoble; + private ImageView mNobleIcon; private ImageView mAvatar; private ImageView shawl; + private ImageView honorIcon; private UserBean mUserBean; private LinearLayout mGuardLayout; private boolean mFollowing; @@ -222,6 +224,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On mReport = mRootView.findViewById(R.id.btn_report); mGuardLayout = mRootView.findViewById(R.id.btn_guard); mGuard = mRootView.findViewById(R.id.guard_val); + mNobleIcon = mRootView.findViewById(R.id.noble_icon); + honorIcon = mRootView.findViewById(R.id.honor_icon); } private void initListener() { @@ -319,13 +323,54 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } mGuard.setText(String.format(mGuard.getText().toString(), guardNumber)); mFansVal.setText(WordUtil.getString(R.string.fans) + ":" + mUserBean.getFans()); + mPraise.setText(WordUtil.getString(R.string.praise) + ":" + mUserBean.getPraise()); 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 (obj.containsKey("level_thumb")) { + ImgLoader.display(mContext, obj.getJSONObject("level_thumb").getString("icon"), mLiveIcon2); + }else{ + mLiveIcon2.setVisibility(View.INVISIBLE); + } + if (dress.containsKey("medal")) { + JSONObject item = null; + for (Object medal : dress.getJSONArray("medal")) { + JSONObject _item = (JSONObject) medal; + if (_item.getInteger("is_use") == 1) { + item = _item; + break; + } + } + if (item != null) { + String url = item.getString("display_src"); + if(url!=null) { + url = url.replace("qny.shayucm.com", "downs.yaoulive.com"); + ImgLoader.display(mContext, url, mNobleIcon); + }else{ + mNobleIcon.setVisibility(View.INVISIBLE); + } + } + }else{ + mNobleIcon.setVisibility(View.INVISIBLE); + } + if (obj.containsKey("medal_no")) { + JSONObject item = null; + if (obj.getJSONArray("medal_no").size() > 0) { + item = obj.getJSONArray("medal_no").getJSONObject(0); + String url=item.getString("display_src"); + url = url.replace("qny.shayucm.com", "downs.yaoulive.com"); + ImgLoader.display(mContext, url, honorIcon); + } + }else{ + honorIcon.setVisibility(View.INVISIBLE); + } + mFollowing = obj.getIntValue("isattention") == 1; updateFollow(); //装扮相关 - JSONObject dress = obj.getJSONObject("dress"); + if (dress.getJSONArray("wraps").size() >= 1) { JSONObject display = (JSONObject) dress.getJSONArray("wraps").get(0); ImgLoader.display(mContext, display.getString("display_src"), shawl); 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 7dbc7d359..d55e691c4 100644 --- a/live/src/main/res/layout/dialog_new_live_user.xml +++ b/live/src/main/res/layout/dialog_new_live_user.xml @@ -354,9 +354,10 @@ android:gravity="center"> Date: Wed, 9 Nov 2022 11:00:49 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=96=B0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E5=90=8D=E7=89=87=20=E5=AE=8C=E6=88=90=E7=9B=B4?= =?UTF-8?q?=E6=92=AD=E9=97=B4=E4=B8=BB=E6=92=AD=E9=9D=93=E5=8F=B7=E6=A0=87?= =?UTF-8?q?=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../live/activity/LiveAnchorActivity.java | 41 +++++++++-------- .../live/activity/LiveRyAnchorActivity.java | 2 +- .../live/dialog/LiveUserDialogFragment.java | 46 +++++++++++++------ .../yunbao/live/views/LiveRoomViewHolder.java | 19 ++++++-- .../live/views/PortraitLiveManager.java | 1 + .../res/drawable/bg_live_anchor_goodnum.xml | 10 ++++ .../main/res/layout/dialog_new_live_user.xml | 21 +++++++++ live/src/main/res/layout/view_live_room.xml | 34 ++++++++++---- 8 files changed, 128 insertions(+), 46 deletions(-) create mode 100644 live/src/main/res/drawable/bg_live_anchor_goodnum.xml diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java index f2fe4670a..00e4d0596 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java @@ -479,6 +479,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic mLiveRoomViewHolder.setAvatar(u.getAvatar()); mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor()); mLiveRoomViewHolder.setLiveUid(u.getId()); + mLiveRoomViewHolder.setAnchorGoodNumber(u.getGoodName()); } mLiveRoomViewHolder.initHourRankList(); mLiveRoomViewHolder.startAnchorLight(); @@ -624,28 +625,28 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic // } // } else { // SocketRyChatUtil.closeLive(mLiveUid, mSocketRyClient); - //断开socket - if (mSocketRyClient != null) { - mSocketRyClient.disConnect(); - } + //断开socket + if (mSocketRyClient != null) { + mSocketRyClient.disConnect(); + } + } + if (mLiveEndViewHolder == null) { + mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot, mLiveBean.getUid()); + mLiveEndViewHolder.subscribeActivityLifeCycle(); + mLiveEndViewHolder.addToParent(); + mLiveEndViewHolder.showData(mLiveBean, mStream); + if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) { + LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom(); } - if (mLiveEndViewHolder == null) { - mLiveEndViewHolder = new LiveEndViewHolder(mContext, mRoot, mLiveBean.getUid()); - mLiveEndViewHolder.subscribeActivityLifeCycle(); - mLiveEndViewHolder.addToParent(); - mLiveEndViewHolder.showData(mLiveBean, mStream); - if (LiveLinkMicPkPresenter.mTRTCCloud1 != null) { - LiveLinkMicPkPresenter.mTRTCCloud1.exitRoom(); - } - if (mLivePushViewHolder != null) { - mLivePushViewHolder.release(); - } - if (mLiveLinkMicPresenter != null) { - mLiveLinkMicPresenter.release(); - } - mLivePushViewHolder = null; - mLiveLinkMicPresenter = null; + if (mLivePushViewHolder != null) { + mLivePushViewHolder.release(); + } + if (mLiveLinkMicPresenter != null) { + mLiveLinkMicPresenter.release(); + } + mLivePushViewHolder = null; + mLiveLinkMicPresenter = null; // } } else { ToastUtil.show(msg); diff --git a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java index b5e6fef88..0ce840e06 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveRyAnchorActivity.java @@ -46,7 +46,6 @@ import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; -import com.yunbao.common.http.JsonBean; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.BitmapUtil; import com.yunbao.common.utils.Bus; @@ -597,6 +596,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl mLiveRoomViewHolder.setName(u.getUserNiceName()); mLiveRoomViewHolder.setAvatar(u.getAvatar()); mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor()); + mLiveRoomViewHolder.setAnchorGoodNumber(u.getGoodName()); mLiveRoomViewHolder.initHourRankList(); } mLiveRoomViewHolder.startAnchorLight(); 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 90359ef7a..98a0992bd 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -42,6 +42,7 @@ 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.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; @@ -109,6 +110,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private TextView mNobleVal; private TextView mReport; private TextView mGuard; + private TextView mUnion; + private TextView mHonorVal; private ImageView mFollowImage; private ImageView mSex; private ImageView good_nub_ico; @@ -121,6 +124,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private ImageView honorIcon; private UserBean mUserBean; private LinearLayout mGuardLayout; + private LinearLayout mUnionLayout; private boolean mFollowing; GifImageView btn_live; SVGAImageView gift_svga; @@ -226,6 +230,9 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On mGuard = mRootView.findViewById(R.id.guard_val); mNobleIcon = mRootView.findViewById(R.id.noble_icon); honorIcon = mRootView.findViewById(R.id.honor_icon); + mUnionLayout = mRootView.findViewById(R.id.btn_union); + mUnion = mRootView.findViewById(R.id.union_val); + mHonorVal = mRootView.findViewById(R.id.honor_val); } private void initListener() { @@ -274,6 +281,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On private void showData(String data) { Log.i(TAG, "showData: " + data); + boolean isAnchor = mLiveUid.equals(mToUid); JSONObject obj = JSON.parseObject(data); mUserBean = JSON.toJavaObject(obj, UserBean.class); if (mUserBean.getIslive().equals("1")) { @@ -281,8 +289,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } else { btn_live.setVisibility(View.GONE); } - if (mLiveUid.equals(mToUid)) { + if (isAnchor) { mGuardLayout.setVisibility(View.VISIBLE); + if (obj.containsKey("user_president_name") && !StringUtil.isEmpty(obj.getString("user_president_name"))) { + mUnion.setText(obj.getString("user_president_name")); + mUnionLayout.setVisibility(View.VISIBLE); + } + mNoble.setVisibility(View.GONE); } mName.setText(obj.getString("user_nicename")); if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) { @@ -316,22 +329,23 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On }); ImgLoader.display(mContext, levelBean.getBgIcon(), mLiveIcon2); FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level")); - if (fansMedalBean != null) { + if (fansMedalBean != null && !isAnchor) { ImgLoader.display(mContext, fansMedalBean.getThumb(), mNoble); } else { - mNoble.setVisibility(View.INVISIBLE); + mNoble.setVisibility(View.GONE); } mGuard.setText(String.format(mGuard.getText().toString(), guardNumber)); mFansVal.setText(WordUtil.getString(R.string.fans) + ":" + mUserBean.getFans()); - mPraise.setText(WordUtil.getString(R.string.praise) + ":" + mUserBean.getPraise()); + mPraise.setText(WordUtil.getString(R.string.praise) + ":" + obj.getInteger("user_love_num")); 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"); + mHonorVal.setText(dress.getInteger("medal_num") + ""); if (obj.containsKey("level_thumb")) { ImgLoader.display(mContext, obj.getJSONObject("level_thumb").getString("icon"), mLiveIcon2); - }else{ + } else { mLiveIcon2.setVisibility(View.INVISIBLE); } if (dress.containsKey("medal")) { @@ -345,25 +359,31 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On } if (item != null) { String url = item.getString("display_src"); - if(url!=null) { + if (item.containsKey("noble_medal") && !isAnchor) { + mNoble.setVisibility(View.VISIBLE); + ImgLoader.display(mContext, item.getString("noble_medal"), mNoble); + } + if (url != null) { url = url.replace("qny.shayucm.com", "downs.yaoulive.com"); + mNobleIcon.setVisibility(View.VISIBLE); ImgLoader.display(mContext, url, mNobleIcon); - }else{ + } else { mNobleIcon.setVisibility(View.INVISIBLE); } } - }else{ + } else { mNobleIcon.setVisibility(View.INVISIBLE); } - if (obj.containsKey("medal_no")) { + if (dress.containsKey("medal_no")) { JSONObject item = null; - if (obj.getJSONArray("medal_no").size() > 0) { - item = obj.getJSONArray("medal_no").getJSONObject(0); - String url=item.getString("display_src"); + if (dress.getJSONArray("medal_no").size() > 0) { + item = dress.getJSONArray("medal_no").getJSONObject(0); + String url = item.getString("display_src"); url = url.replace("qny.shayucm.com", "downs.yaoulive.com"); + honorIcon.setVisibility(View.VISIBLE); ImgLoader.display(mContext, url, honorIcon); } - }else{ + } else { honorIcon.setVisibility(View.INVISIBLE); } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 79bad907b..9881fcb9a 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -125,7 +125,6 @@ import com.yunbao.live.dialog.LiveFaceUnityDialogFragment; import com.yunbao.live.dialog.LiveFansMedalDialogFragment; import com.yunbao.live.dialog.LiveGameDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment; -import com.yunbao.live.dialog.LiveOldUserDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.event.LiveAudienceEvent; @@ -299,6 +298,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis private List wishlist = new ArrayList<>(); private TextView mHourRank, mHotText; private LinearLayout msg; //默认悬浮窗布局 + private LinearLayout mAnchorLayout; + private ImageView mGoodNumberIcon; private View msg2; //悬浮窗来私信的布局 private ConstraintLayout msgLayout; //悬浮窗 private TextView msgNumber;//悬浮窗左上角数标 @@ -766,6 +767,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis fans = (TextView) findViewById(R.id.fans); fans_btn = (LinearLayout) findViewById(R.id.fans_btn); wishListLayout = (LinearLayout) findViewById(R.id.wish_list_layout); + mAnchorLayout = (LinearLayout) findViewById(R.id.group_1); + mGoodNumberIcon = (ImageView) findViewById(R.id.good_nub_ico); if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) { fans_btn.setVisibility(View.GONE); @@ -1051,6 +1054,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis Log.e("PortraitLiveManager", error); } }); + } public synchronized void showStart(StarChallengeStatusModel data) { @@ -1972,12 +1976,12 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } else if (i == R.id.btn_prize_pool_level) { ((LiveActivity) mContext).openPrizePoolWindow(); } else if (i == R.id.user_more) { - ((LiveActivity) mContext).openUserMoreListWindow(1, false, false,mContext instanceof LiveRyAnchorActivity); + ((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveRyAnchorActivity); } else if (i == R.id.hot_btn) { - ((LiveActivity) mContext).openUserMoreListWindow(1, false, false,mContext instanceof LiveRyAnchorActivity); + ((LiveActivity) mContext).openUserMoreListWindow(1, false, false, mContext instanceof LiveRyAnchorActivity); } else if (i == R.id.noble_seat) { - ((LiveActivity) mContext).openUserMoreListWindow(1, false, true,mContext instanceof LiveRyAnchorActivity); + ((LiveActivity) mContext).openUserMoreListWindow(1, false, true, mContext instanceof LiveRyAnchorActivity); } else if (i == R.id.btn_close) { close(); //小屏 @@ -2878,6 +2882,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "faceUi"); } + public void setAnchorGoodNumber(String goodNumber) { + if (!StringUtil.isEmpty(goodNumber) && !goodNumber.equals("0")) { + mAnchorLayout.setBackgroundResource(R.drawable.bg_live_anchor_goodnum); + mGoodNumberIcon.setVisibility(View.VISIBLE); + } + } + private static class LiveRoomHandler extends Handler { private LiveRoomViewHolder mLiveRoomViewHolder; diff --git a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java index a613dcd6e..2dd6bd48e 100644 --- a/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java +++ b/live/src/main/java/com/yunbao/live/views/PortraitLiveManager.java @@ -263,6 +263,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe mLiveRoomViewHolder.setName(data.getUserNiceName()); mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip()); mLiveRoomViewHolder.setTitle(data.getTitle()); + mLiveRoomViewHolder.setAnchorGoodNumber(data.getGoodNum()); mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), ""); diff --git a/live/src/main/res/drawable/bg_live_anchor_goodnum.xml b/live/src/main/res/drawable/bg_live_anchor_goodnum.xml new file mode 100644 index 000000000..4b4a916f9 --- /dev/null +++ b/live/src/main/res/drawable/bg_live_anchor_goodnum.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file 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 d55e691c4..629330d43 100644 --- a/live/src/main/res/layout/dialog_new_live_user.xml +++ b/live/src/main/res/layout/dialog_new_live_user.xml @@ -221,6 +221,27 @@ android:layout_gravity="center" android:layout_marginStart="6dp"/> + + + + - + android:gravity="center" + android:orientation="horizontal"> + + + + + + @@ -389,8 +405,8 @@ android:layout_height="wrap_content" android:layout_alignTop="@id/hour_rank_layout" android:layout_marginStart="10dp" - android:visibility="visible" - android:layout_toEndOf="@id/live_wks_layout"> + android:layout_toEndOf="@id/live_wks_layout" + android:visibility="visible"> @@ -2042,6 +2058,7 @@ android:textStyle="bold" /> + +