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" /> + +