add:观众列表最多5名显示且可以滑动
add:守护icon显示当前房间守护值最大的用户
This commit is contained in:
parent
cfcad83328
commit
54716d9a92
@ -1308,7 +1308,6 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
* 打开购买守护的弹窗
|
||||
*/
|
||||
public void openBuyGuardWindow() {
|
||||
System.out.println("点击购买守护 > "+TextUtils.isEmpty(mLiveUid)+" "+TextUtils.isEmpty(mStream)+" "+mLiveGuardInfo);
|
||||
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream) || mLiveGuardInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -89,11 +89,7 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if(mList.size()>6) {
|
||||
return 5;
|
||||
}else{
|
||||
return mList.size();
|
||||
}
|
||||
return Math.min(mList.size(), 5);
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
@ -157,8 +157,7 @@ public class LiveGuardDialogFragment extends AbsDialogFragment implements View.O
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
System.err.println("点击购买守护2");
|
||||
// dismiss();
|
||||
dismiss();
|
||||
((LiveActivity) mContext).openBuyGuardWindow();
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,7 @@ import java.lang.ref.WeakReference;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import pl.droidsonroids.gif.GifImageView;
|
||||
@ -120,7 +121,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
RelativeLayout chat_view;
|
||||
private ImageView mAvatar;
|
||||
private ImageView UserMore;
|
||||
private ImageView userGuard;
|
||||
private RoundedImageView userGuard;
|
||||
private ImageView mLevelAnchor;
|
||||
public static TextView mName;
|
||||
private TextView mID;
|
||||
@ -216,6 +217,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
static RoundedImageView mic_ico2;
|
||||
|
||||
static GifImageView dr_pk_end_gif;
|
||||
private SVGAImageView gift_svga;
|
||||
|
||||
public static Handler mHandler;
|
||||
private static final int WHAT_PK_TIME = 2;//pk时间变化 what
|
||||
@ -628,7 +630,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mTvMedalRank = (TextView) findViewById(R.id.medal_rank_num);
|
||||
mGuardNum = (TextView) findViewById(R.id.guard_num);
|
||||
UserMore = (ImageView) findViewById(R.id.user_more);
|
||||
userGuard = (ImageView) findViewById(R.id.user_guard);
|
||||
userGuard = (RoundedImageView) findViewById(R.id.user_guard);
|
||||
gift_svga = (SVGAImageView) findViewById(R.id.gift_svga);
|
||||
tv_avatarOther_name = (TextView) findViewById(R.id.tv_avatarOther_name);
|
||||
room_hot = (TextView) findViewById(R.id.room_hot);
|
||||
fans = (TextView) findViewById(R.id.fans);
|
||||
@ -1166,7 +1169,27 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
|
||||
getIsHot();
|
||||
getGuardInfo();
|
||||
}
|
||||
private void getGuardInfo(){
|
||||
LiveHttpUtil.getUserList(mLiveUid, mStream, "guard", 1, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
JSONObject json=JSONObject.parseObject(info[0]);
|
||||
JSONArray userlist = json.getJSONArray("userlist");
|
||||
if(userlist.size()!=0){
|
||||
setGuardIcon(JSONArray.parseArray(userlist.toJSONString(),LiveUserGiftBean.class).get(0));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private void setGuardIcon(LiveUserGiftBean guard){
|
||||
if (guard!=null){
|
||||
ImgLoader.displayAvatar(mContext, guard.getAvatar(), userGuard);
|
||||
gift_svga.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 守护信息发生变化
|
||||
@ -1374,6 +1397,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
public void refreshUserList(JSONObject obj) {
|
||||
List<LiveUserGiftBean> list = JSON.parseArray(obj.getString("userlist"), LiveUserGiftBean.class);
|
||||
mLiveUserAdapter.refreshList(list);
|
||||
getGuardInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -770,7 +770,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
@Override
|
||||
public void onUpUserList(JSONObject obj) {
|
||||
|
||||
mLiveRoomViewHolder.refreshUserList(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
BIN
live/src/main/res/drawable/img_guardian_online.png
Normal file
BIN
live/src/main/res/drawable/img_guardian_online.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -117,14 +117,36 @@
|
||||
android:layout_alignParentRight="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop">
|
||||
|
||||
<ImageView
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/user_guard"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_width="27dp"
|
||||
android:layout_height="27dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_oval="true"
|
||||
android:src="@mipmap/img_guardian_empty"/>
|
||||
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/gift_svga"
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:src="@drawable/img_guardian_online"
|
||||
android:visibility="gone"
|
||||
app:autoPlay="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/user_recyclerView"
|
||||
android:layout_width="wrap_content"
|
||||
|
Loading…
Reference in New Issue
Block a user