完成新个人名片

完成直播间主播靓号标识
This commit is contained in:
zlzw 2022-11-09 11:00:49 +08:00
parent 5ed5b15737
commit 71713e5b37
8 changed files with 128 additions and 46 deletions

View File

@ -479,6 +479,7 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
mLiveRoomViewHolder.setAvatar(u.getAvatar()); mLiveRoomViewHolder.setAvatar(u.getAvatar());
mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor()); mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor());
mLiveRoomViewHolder.setLiveUid(u.getId()); mLiveRoomViewHolder.setLiveUid(u.getId());
mLiveRoomViewHolder.setAnchorGoodNumber(u.getGoodName());
} }
mLiveRoomViewHolder.initHourRankList(); mLiveRoomViewHolder.initHourRankList();
mLiveRoomViewHolder.startAnchorLight(); mLiveRoomViewHolder.startAnchorLight();
@ -624,28 +625,28 @@ public class LiveAnchorActivity extends LiveActivity implements LiveFunctionClic
// } // }
// } else { // } else {
// SocketRyChatUtil.closeLive(mLiveUid, mSocketRyClient); // SocketRyChatUtil.closeLive(mLiveUid, mSocketRyClient);
//断开socket //断开socket
if (mSocketRyClient != null) { if (mSocketRyClient != null) {
mSocketRyClient.disConnect(); 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) { if (mLivePushViewHolder != null) {
mLivePushViewHolder.release(); mLivePushViewHolder.release();
} }
if (mLiveLinkMicPresenter != null) { if (mLiveLinkMicPresenter != null) {
mLiveLinkMicPresenter.release(); mLiveLinkMicPresenter.release();
} }
mLivePushViewHolder = null; mLivePushViewHolder = null;
mLiveLinkMicPresenter = null; mLiveLinkMicPresenter = null;
// } // }
} else { } else {
ToastUtil.show(msg); ToastUtil.show(msg);

View File

@ -46,7 +46,6 @@ import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient; import com.yunbao.common.http.HttpClient;
import com.yunbao.common.http.JsonBean;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.BitmapUtil; import com.yunbao.common.utils.BitmapUtil;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
@ -597,6 +596,7 @@ public class LiveRyAnchorActivity extends LiveActivity implements LiveFunctionCl
mLiveRoomViewHolder.setName(u.getUserNiceName()); mLiveRoomViewHolder.setName(u.getUserNiceName());
mLiveRoomViewHolder.setAvatar(u.getAvatar()); mLiveRoomViewHolder.setAvatar(u.getAvatar());
mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor()); mLiveRoomViewHolder.setAnchorLevel(u.getLevelAnchor());
mLiveRoomViewHolder.setAnchorGoodNumber(u.getGoodName());
mLiveRoomViewHolder.initHourRankList(); mLiveRoomViewHolder.initHourRankList();
} }
mLiveRoomViewHolder.startAnchorLight(); mLiveRoomViewHolder.startAnchorLight();

View File

@ -42,6 +42,7 @@ import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.NobleUtil; import com.yunbao.common.utils.NobleUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SVGAViewUtils; import com.yunbao.common.utils.SVGAViewUtils;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R; import com.yunbao.live.R;
@ -109,6 +110,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private TextView mNobleVal; private TextView mNobleVal;
private TextView mReport; private TextView mReport;
private TextView mGuard; private TextView mGuard;
private TextView mUnion;
private TextView mHonorVal;
private ImageView mFollowImage; private ImageView mFollowImage;
private ImageView mSex; private ImageView mSex;
private ImageView good_nub_ico; private ImageView good_nub_ico;
@ -121,6 +124,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private ImageView honorIcon; private ImageView honorIcon;
private UserBean mUserBean; private UserBean mUserBean;
private LinearLayout mGuardLayout; private LinearLayout mGuardLayout;
private LinearLayout mUnionLayout;
private boolean mFollowing; private boolean mFollowing;
GifImageView btn_live; GifImageView btn_live;
SVGAImageView gift_svga; SVGAImageView gift_svga;
@ -226,6 +230,9 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
mGuard = mRootView.findViewById(R.id.guard_val); mGuard = mRootView.findViewById(R.id.guard_val);
mNobleIcon = mRootView.findViewById(R.id.noble_icon); mNobleIcon = mRootView.findViewById(R.id.noble_icon);
honorIcon = mRootView.findViewById(R.id.honor_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() { private void initListener() {
@ -274,6 +281,7 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
private void showData(String data) { private void showData(String data) {
Log.i(TAG, "showData: " + data); Log.i(TAG, "showData: " + data);
boolean isAnchor = mLiveUid.equals(mToUid);
JSONObject obj = JSON.parseObject(data); JSONObject obj = JSON.parseObject(data);
mUserBean = JSON.toJavaObject(obj, UserBean.class); mUserBean = JSON.toJavaObject(obj, UserBean.class);
if (mUserBean.getIslive().equals("1")) { if (mUserBean.getIslive().equals("1")) {
@ -281,8 +289,13 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} else { } else {
btn_live.setVisibility(View.GONE); btn_live.setVisibility(View.GONE);
} }
if (mLiveUid.equals(mToUid)) { if (isAnchor) {
mGuardLayout.setVisibility(View.VISIBLE); 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")); mName.setText(obj.getString("user_nicename"));
if (mUserBean.getGoodnum() != null && !mUserBean.getGoodnum().equals("")) { 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); ImgLoader.display(mContext, levelBean.getBgIcon(), mLiveIcon2);
FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level")); FansMedalBean fansMedalBean = CommonAppConfig.getInstance().getAnchorFansMedal(obj.getIntValue("medal_level"));
if (fansMedalBean != null) { if (fansMedalBean != null && !isAnchor) {
ImgLoader.display(mContext, fansMedalBean.getThumb(), mNoble); ImgLoader.display(mContext, fansMedalBean.getThumb(), mNoble);
} else { } else {
mNoble.setVisibility(View.INVISIBLE); mNoble.setVisibility(View.GONE);
} }
mGuard.setText(String.format(mGuard.getText().toString(), guardNumber)); mGuard.setText(String.format(mGuard.getText().toString(), guardNumber));
mFansVal.setText(WordUtil.getString(R.string.fans) + ":" + mUserBean.getFans()); 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()); mSignDesc.setText(mUserBean.getSignature());
mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id()))); mNobleVal.setText(NobleUtil.nobleIdToStringName(Integer.parseInt(mUserBean.getNoble_id())));
ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar); ImgLoader.displayAvatar(mContext, obj.getString("avatar"), mAvatar);
JSONObject dress = obj.getJSONObject("dress"); JSONObject dress = obj.getJSONObject("dress");
mHonorVal.setText(dress.getInteger("medal_num") + "");
if (obj.containsKey("level_thumb")) { if (obj.containsKey("level_thumb")) {
ImgLoader.display(mContext, obj.getJSONObject("level_thumb").getString("icon"), mLiveIcon2); ImgLoader.display(mContext, obj.getJSONObject("level_thumb").getString("icon"), mLiveIcon2);
}else{ } else {
mLiveIcon2.setVisibility(View.INVISIBLE); mLiveIcon2.setVisibility(View.INVISIBLE);
} }
if (dress.containsKey("medal")) { if (dress.containsKey("medal")) {
@ -345,25 +359,31 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
} }
if (item != null) { if (item != null) {
String url = item.getString("display_src"); 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"); url = url.replace("qny.shayucm.com", "downs.yaoulive.com");
mNobleIcon.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, url, mNobleIcon); ImgLoader.display(mContext, url, mNobleIcon);
}else{ } else {
mNobleIcon.setVisibility(View.INVISIBLE); mNobleIcon.setVisibility(View.INVISIBLE);
} }
} }
}else{ } else {
mNobleIcon.setVisibility(View.INVISIBLE); mNobleIcon.setVisibility(View.INVISIBLE);
} }
if (obj.containsKey("medal_no")) { if (dress.containsKey("medal_no")) {
JSONObject item = null; JSONObject item = null;
if (obj.getJSONArray("medal_no").size() > 0) { if (dress.getJSONArray("medal_no").size() > 0) {
item = obj.getJSONArray("medal_no").getJSONObject(0); item = dress.getJSONArray("medal_no").getJSONObject(0);
String url=item.getString("display_src"); String url = item.getString("display_src");
url = url.replace("qny.shayucm.com", "downs.yaoulive.com"); url = url.replace("qny.shayucm.com", "downs.yaoulive.com");
honorIcon.setVisibility(View.VISIBLE);
ImgLoader.display(mContext, url, honorIcon); ImgLoader.display(mContext, url, honorIcon);
} }
}else{ } else {
honorIcon.setVisibility(View.INVISIBLE); honorIcon.setVisibility(View.INVISIBLE);
} }

View File

@ -125,7 +125,6 @@ import com.yunbao.live.dialog.LiveFaceUnityDialogFragment;
import com.yunbao.live.dialog.LiveFansMedalDialogFragment; import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
import com.yunbao.live.dialog.LiveGameDialogFragment; import com.yunbao.live.dialog.LiveGameDialogFragment;
import com.yunbao.live.dialog.LiveHDDialogFragment; import com.yunbao.live.dialog.LiveHDDialogFragment;
import com.yunbao.live.dialog.LiveOldUserDialogFragment;
import com.yunbao.live.dialog.LiveUserDialogFragment; import com.yunbao.live.dialog.LiveUserDialogFragment;
import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience; import com.yunbao.live.dialog.LiveWishListDialogFragment4Audience;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
@ -299,6 +298,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
private List<WishlistItemModel> wishlist = new ArrayList<>(); private List<WishlistItemModel> wishlist = new ArrayList<>();
private TextView mHourRank, mHotText; private TextView mHourRank, mHotText;
private LinearLayout msg; //默认悬浮窗布局 private LinearLayout msg; //默认悬浮窗布局
private LinearLayout mAnchorLayout;
private ImageView mGoodNumberIcon;
private View msg2; //悬浮窗来私信的布局 private View msg2; //悬浮窗来私信的布局
private ConstraintLayout msgLayout; //悬浮窗 private ConstraintLayout msgLayout; //悬浮窗
private TextView msgNumber;//悬浮窗左上角数标 private TextView msgNumber;//悬浮窗左上角数标
@ -766,6 +767,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
fans = (TextView) findViewById(R.id.fans); fans = (TextView) findViewById(R.id.fans);
fans_btn = (LinearLayout) findViewById(R.id.fans_btn); fans_btn = (LinearLayout) findViewById(R.id.fans_btn);
wishListLayout = (LinearLayout) findViewById(R.id.wish_list_layout); 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) { if (LivePushTxViewHolder.mTRTCCloud != null || LivePushRyViewHolder.rtcRoom != null) {
fans_btn.setVisibility(View.GONE); fans_btn.setVisibility(View.GONE);
@ -1051,6 +1054,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
Log.e("PortraitLiveManager", error); Log.e("PortraitLiveManager", error);
} }
}); });
} }
public synchronized void showStart(StarChallengeStatusModel data) { 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) { } else if (i == R.id.btn_prize_pool_level) {
((LiveActivity) mContext).openPrizePoolWindow(); ((LiveActivity) mContext).openPrizePoolWindow();
} else if (i == R.id.user_more) { } 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) { } 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) { } 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) { } else if (i == R.id.btn_close) {
close(); close();
//小屏 //小屏
@ -2878,6 +2882,13 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
fragment.show(((LiveActivity) mContext).getSupportFragmentManager(), "faceUi"); 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 static class LiveRoomHandler extends Handler {
private LiveRoomViewHolder mLiveRoomViewHolder; private LiveRoomViewHolder mLiveRoomViewHolder;

View File

@ -263,6 +263,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
mLiveRoomViewHolder.setName(data.getUserNiceName()); mLiveRoomViewHolder.setName(data.getUserNiceName());
mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip()); mLiveRoomViewHolder.setRoomNum(data.getLiangNameTip());
mLiveRoomViewHolder.setTitle(data.getTitle()); mLiveRoomViewHolder.setTitle(data.getTitle());
mLiveRoomViewHolder.setAnchorGoodNumber(data.getGoodNum());
mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), ""); mLiveRyLinkMicPkPresenter.setLiveUid(data.getUid(), "");

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="142dp" android:height="34dp">
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="#abafb3ff" />
<gradient android:type="linear" android:useLevel="true" android:startColor="#b8b2a4ff" android:endColor="#80722cff" android:angle="90" />
<corners android:radius="17dp" />
</shape>
</item>
</selector>

View File

@ -221,6 +221,27 @@
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="6dp"/> android:layout_marginStart="6dp"/>
<LinearLayout
android:id="@+id/btn_union"
android:layout_width="88dp"
android:layout_height="23dp"
android:layout_marginStart="6dp"
android:background="@drawable/bg_user_card_guard"
android:gravity="center"
android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/union_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:text="@string/user_card_guard"
android:textColor="#FFFFFF"
android:textSize="12sp" />
</LinearLayout>
<ImageView <ImageView
android:id="@+id/user_card_noble" android:id="@+id/user_card_noble"

View File

@ -68,14 +68,30 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <LinearLayout
android:id="@+id/id_val"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:includeFontPadding="false" android:gravity="center"
android:text="1111" android:orientation="horizontal">
android:textColor="@color/white"
android:textSize="8sp" /> <ImageView
android:id="@+id/good_nub_ico"
android:layout_width="18dp"
android:layout_height="15dp"
android:layout_marginEnd="2dp"
android:src="@mipmap/good_nub"
android:visibility="gone" />
<TextView
android:id="@+id/id_val"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:text="1111"
android:textColor="@color/white"
android:textSize="8sp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
@ -389,8 +405,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@id/hour_rank_layout" android:layout_alignTop="@id/hour_rank_layout"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:visibility="visible" android:layout_toEndOf="@id/live_wks_layout"
android:layout_toEndOf="@id/live_wks_layout"> android:visibility="visible">
<include layout="@layout/view_noble_seat" /> <include layout="@layout/view_noble_seat" />
</LinearLayout> </LinearLayout>
@ -2042,6 +2058,7 @@
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/btn_event4" android:id="@+id/btn_event4"
android:layout_width="67dp" android:layout_width="67dp"
@ -2067,6 +2084,7 @@
app:indicator_width="8dp" /> app:indicator_width="8dp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/btn_event3" android:id="@+id/btn_event3"
android:layout_width="67dp" android:layout_width="67dp"