!3 完成观众列表和守护icon功能
Merge pull request !3 from Yutousama/dev_live_new_user_icon
This commit is contained in:
commit
15bb24fa83
@ -1278,13 +1278,14 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
/**
|
||||
* 打开观看列表弹窗
|
||||
*/
|
||||
public void openUserMoreListWindow(int i) {
|
||||
public void openUserMoreListWindow(int i,boolean isOnly) {
|
||||
LiveUserMoreDialogFragment fragment = new LiveUserMoreDialogFragment();
|
||||
fragment.setLiveGuardInfo(mLiveGuardInfo);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_UID, mLiveUid);
|
||||
bundle.putString(Constants.STREAM, mStream);
|
||||
bundle.putString("By", i + "");
|
||||
bundle.putBoolean("only",isOnly);
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(getSupportFragmentManager(), "LiveUserMoreDialogFragment");
|
||||
LiveUserMoreDialogFragment.activity = this;
|
||||
|
@ -89,11 +89,7 @@ public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if(mList.size()>3) {
|
||||
return 3;
|
||||
}else{
|
||||
return mList.size();
|
||||
}
|
||||
return Math.min(mList.size(), 5);
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
55
live/src/main/java/com/yunbao/live/custom/RightGradual.java
Normal file
55
live/src/main/java/com/yunbao/live/custom/RightGradual.java
Normal file
@ -0,0 +1,55 @@
|
||||
package com.yunbao.live.custom;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.Xfermode;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/1/27.
|
||||
* RecyclerView右側渐变的itemDecoration
|
||||
*/
|
||||
|
||||
public class RightGradual extends RecyclerView.ItemDecoration {
|
||||
|
||||
private Paint mPaint;
|
||||
private Xfermode mXfermode;
|
||||
private LinearGradient mLinearGradient;
|
||||
private int mLayerId;
|
||||
|
||||
public RightGradual() {
|
||||
mPaint = new Paint();
|
||||
mXfermode = new PorterDuffXfermode(PorterDuff.Mode.DST_IN);
|
||||
mLinearGradient = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawOver(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
|
||||
super.onDrawOver(canvas, parent, state);
|
||||
float left=parent.getRight()-parent.getRight()/0.1f;
|
||||
float top=0f;
|
||||
float right=parent.getRight();
|
||||
float bottom=parent.getBottom();
|
||||
if(mLinearGradient==null){
|
||||
mLinearGradient=new LinearGradient(parent.getMeasuredWidth(), 0.0f, 0.0f, 0.0f, new int[]{0, Color.BLACK}, new float[]{0.0f,0.2f}, Shader.TileMode.CLAMP);
|
||||
}
|
||||
mPaint.setXfermode(mXfermode);
|
||||
mPaint.setShader(mLinearGradient);
|
||||
//mPaint.setColor(Color.BLUE);
|
||||
canvas.drawRect(left, top,right, bottom, mPaint);
|
||||
mPaint.setXfermode(null);
|
||||
canvas.restoreToCount(mLayerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
super.onDraw(c, parent, state);
|
||||
mLayerId = c.saveLayer(0.0f, 0.0f, (float) parent.getWidth(), (float) parent.getHeight(), mPaint, Canvas.ALL_SAVE_FLAG);
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@ -55,10 +56,12 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
public static LiveActivity activity = null;
|
||||
public eightbitlab.com.blurview.BlurView blurView;
|
||||
|
||||
public TextView audience_btn, guard_btn, fans_btn, tags, btn, gz_view, dayRank, weekRank;
|
||||
public TextView audience_btn, guard_btn, fans_btn, tags, btn, gz_view, dayRank, weekRank,title;
|
||||
private LinearLayout tabs;
|
||||
private RelativeLayout bottom_msg;//底部信息的布局,在榜单列表下不需要显示底部信息
|
||||
private String Tips = "1";
|
||||
private String type = "guanzhong";
|
||||
private boolean isOnly;
|
||||
ImageView no_more;
|
||||
|
||||
@Override
|
||||
@ -120,6 +123,9 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
|
||||
mLiveUid = bundle.getString(Constants.LIVE_UID);
|
||||
stream = bundle.getString(Constants.STREAM);
|
||||
isOnly = bundle.getBoolean("only",false);
|
||||
title = mRootView.findViewById(R.id.title);
|
||||
tabs = mRootView.findViewById(R.id.tabs);
|
||||
audience_btn = mRootView.findViewById(R.id.audience_btn);
|
||||
bottom_msg = mRootView.findViewById(R.id.bottom_msg);
|
||||
tags = mRootView.findViewById(R.id.tag);
|
||||
@ -183,14 +189,14 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
Up();
|
||||
type="dayRank";
|
||||
mRefreshView.initData();
|
||||
no_more.setImageBitmap(null);
|
||||
no_more.setImageResource(R.drawable.img_rank_empty);
|
||||
});
|
||||
weekRank.setOnClickListener(View->{
|
||||
Tips="5";
|
||||
Up();
|
||||
type="weekRank";
|
||||
mRefreshView.initData();
|
||||
no_more.setImageBitmap(null);
|
||||
no_more.setImageResource(R.drawable.img_rank_empty);
|
||||
});
|
||||
|
||||
mRefreshView = mRootView.findViewById(R.id.refreshView);
|
||||
@ -297,12 +303,20 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
bean.setTotal(item.getLong("total"));
|
||||
data.add(bean);
|
||||
}
|
||||
if(data.size()==0){
|
||||
no_more.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
no_more.setVisibility(View.GONE);
|
||||
}
|
||||
mRefreshView.setNotLoadMore();
|
||||
return data;
|
||||
}
|
||||
});
|
||||
mRefreshView.initData();
|
||||
|
||||
if(isOnly){
|
||||
tabs.setVisibility(View.GONE);
|
||||
title.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -319,6 +333,7 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
|
||||
void Up() {
|
||||
bottom_msg.setVisibility(View.VISIBLE);
|
||||
title.setVisibility(View.GONE);
|
||||
if (Tips.equals("1")) {
|
||||
tags.setText("開通貴族,尊享超多特權!");
|
||||
btn.setBackgroundResource(R.mipmap.btn_openvip);
|
||||
@ -350,10 +365,14 @@ public class LiveUserMoreDialogFragment extends AbsDialogFragment implements Vie
|
||||
bottom_msg.setVisibility(View.GONE);
|
||||
type="dayRank";
|
||||
setTextColor(dayRank,audience_btn,guard_btn,fans_btn,gz_view,weekRank);
|
||||
gz_view.setVisibility(View.GONE);
|
||||
no_more.setImageResource(R.drawable.img_rank_empty);
|
||||
}else if (Tips.equals("5")){
|
||||
userMoreInfoAdapter.type = "5";
|
||||
bottom_msg.setVisibility(View.GONE);
|
||||
type="weekRank";
|
||||
gz_view.setVisibility(View.GONE);
|
||||
no_more.setImageResource(R.drawable.img_rank_empty);
|
||||
setTextColor(weekRank,audience_btn,guard_btn,fans_btn,gz_view,dayRank);
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ScreenDimenUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
@ -79,6 +80,7 @@ import com.yunbao.live.bean.LiveReceiveGiftBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.bean.WishlistItemModel;
|
||||
import com.yunbao.live.custom.LiveLightView;
|
||||
import com.yunbao.live.custom.RightGradual;
|
||||
import com.yunbao.live.custom.TopGradual;
|
||||
import com.yunbao.live.dialog.LiveFansMedalDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
@ -98,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;
|
||||
@ -118,6 +121,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
RelativeLayout chat_view;
|
||||
private ImageView mAvatar;
|
||||
private ImageView UserMore;
|
||||
private RoundedImageView userGuard;
|
||||
private ImageView mLevelAnchor;
|
||||
public static TextView mName;
|
||||
private TextView mID;
|
||||
@ -213,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
|
||||
@ -625,6 +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 = (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);
|
||||
@ -650,6 +657,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
mUserRecyclerView = (RecyclerView) findViewById(R.id.user_recyclerView);
|
||||
mUserRecyclerView.setHasFixedSize(true);
|
||||
mUserRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
||||
mUserRecyclerView.addItemDecoration(new RightGradual());
|
||||
mLiveUserAdapter = new LiveUserAdapter(mContext);
|
||||
mLiveUserAdapter.setOnItemClickListener(new OnItemClickListener<UserBean>() {
|
||||
@Override
|
||||
@ -715,6 +723,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
findViewById(R.id.btn_medal_rank).setOnClickListener(this);
|
||||
findViewById(R.id.btn_noble).setOnClickListener(this);
|
||||
UserMore.setOnClickListener(this);
|
||||
userGuard.setOnClickListener(this);
|
||||
|
||||
findViewById(R.id.btn_guard).setOnClickListener(this);
|
||||
mBtnPrizePool = findViewById(R.id.btn_prize_pool_level);
|
||||
@ -1098,6 +1107,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
*/
|
||||
public void setUserList(List<LiveUserGiftBean> list) {
|
||||
if (mLiveUserAdapter != null) {
|
||||
resetUserListWidth(DpUtil.dp2px((Math.min(list.size(), 3))*38));
|
||||
mLiveUserAdapter.refreshList(list);
|
||||
}
|
||||
}
|
||||
@ -1163,7 +1173,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 守护信息发生变化
|
||||
@ -1225,9 +1255,9 @@ 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(4);
|
||||
((LiveActivity) mContext).openUserMoreListWindow(4,false);
|
||||
} else if (i == R.id.hot_btn) {
|
||||
((LiveActivity) mContext).openUserMoreListWindow(1);
|
||||
((LiveActivity) mContext).openUserMoreListWindow(1,false);
|
||||
|
||||
} else if (i == R.id.btn_close) {
|
||||
close();
|
||||
@ -1236,6 +1266,8 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
((LiveActivity) mContext).openLuckGiftTip();
|
||||
} else if (i == R.id.ft_hot_add) {
|
||||
((LiveActivity) mContext).openHotListWindow(1);
|
||||
} else if (i == R.id.user_guard){
|
||||
((LiveActivity) mContext).openUserMoreListWindow(2,true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1369,6 +1401,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();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1790,6 +1823,11 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
}
|
||||
});
|
||||
}
|
||||
public void resetUserListWidth(int width){
|
||||
ViewGroup.LayoutParams params = mUserRecyclerView.getLayoutParams();
|
||||
params.width=width;
|
||||
mUserRecyclerView.setLayoutParams(params);
|
||||
}
|
||||
|
||||
public void release() {
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.GET_USER_LIST);
|
||||
|
@ -36,6 +36,7 @@ import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.RandomUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@ -769,7 +770,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
|
||||
@Override
|
||||
public void onUpUserList(JSONObject obj) {
|
||||
|
||||
mLiveRoomViewHolder.refreshUserList(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -930,6 +931,7 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
|
||||
}
|
||||
List<LiveUserGiftBean> list = JSON.parseArray(obj.getString("userlists"), LiveUserGiftBean.class);
|
||||
mLiveRoomViewHolder.setUserList(list);
|
||||
// resetUserListWidth(list);
|
||||
mLiveRoomViewHolder.startRefreshUserList();
|
||||
if (mLiveType == Constants.LIVE_TYPE_TIME) {//计时收费
|
||||
mLiveRoomViewHolder.startRequestTimeCharge();
|
||||
|
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 |
BIN
live/src/main/res/drawable/img_rank_empty.png
Normal file
BIN
live/src/main/res/drawable/img_rank_empty.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 206 KiB |
@ -16,6 +16,7 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="18dp"
|
||||
@ -26,11 +27,13 @@
|
||||
android:textSize="18sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_rank_btn"
|
||||
android:layout_width="wrap_content"
|
||||
@ -40,6 +43,7 @@
|
||||
android:text="@string/day_rank"
|
||||
android:textColor="#fff6f7fb"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/week_rank_btn"
|
||||
android:layout_width="wrap_content"
|
||||
@ -66,10 +70,10 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
android:text="@string/live_guard"
|
||||
android:textColor="#ff646464"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fans_btn"
|
||||
|
@ -3,7 +3,6 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="38dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
|
@ -117,19 +117,49 @@
|
||||
android:layout_alignParentRight="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/user_more"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:src="@mipmap/live_users_more" />
|
||||
<RelativeLayout
|
||||
android:layout_width="38dp"
|
||||
android:layout_height="38dp"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/user_guard"
|
||||
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"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginRight="-3dp"
|
||||
android:overScrollMode="never" />
|
||||
<ImageView
|
||||
android:id="@+id/user_more"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:src="@mipmap/live_users_more" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
BIN
live/src/main/res/mipmap-mdpi/img_guardian_empty.png
Normal file
BIN
live/src/main/res/mipmap-mdpi/img_guardian_empty.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 4.8 KiB |
Loading…
Reference in New Issue
Block a user