update:守护列表改版

This commit is contained in:
zlzw 2022-08-29 16:41:00 +08:00
parent 639b3c09bf
commit 25e13dc1b7
9 changed files with 217 additions and 21 deletions

View File

@ -24,6 +24,9 @@ public class Constants {
public static final String STREAM = "stream";
public static final String LIMIT = "limit";
public static final String UID = "uid";
public static final String USER_NAME = "userName";//用户名
public static final String USER_ICON = "userIcon";//用户头像
public static final String TIP = "tip";
public static final String SHOW_INVITE = "showInvite";
public static final String USER_BEAN = "userBean";
@ -47,6 +50,7 @@ public class Constants {
public static final String LIVE_CLASS_PREFIX = "liveClass_";
public static final String LIVE_ADMIN_ROOM = "liveAdminRoom";
public static final String LIVE_ANCHER_NAME = "ancherName";//主播名
public static final String LIVE_ANCHER_ICON = "ancherIcon";//主播头像
public static final String HAS_GAME = "hasGame";
public static final String OPEN_FLASH = "openFlash";
public static final String SHARE_QR_CODE_FILE = "shareQrCodeFile.png";

View File

@ -119,6 +119,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
protected int mSocketUserType;//socket用户类型 30 普通用户 40 管理员 50 主播 60超管
public static String mStream;
protected String mAncherName;
protected String mAncherIcon;
public static String mLiveUid;
protected String mDanmuPrice;//弹幕价格
protected String mCoinName;//钻石名称
@ -134,6 +135,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
private LiveChatRoomDialogFragment mLiveChatRoomDialogFragment;//私信聊天窗口
protected LiveGuardInfo mLiveGuardInfo;
private HashSet<DialogFragment> mDialogFragmentSet;
private LiveEnterRoomBean userBean;//用户信息
// public static boolean isRy = true;
@Override
@ -261,6 +263,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
mLiveRoomViewHolder.onEnterRoom(bean);
}
}
public void setEnterRoomData(LiveEnterRoomBean bean){
userBean=bean;
}
/**
@ -1328,6 +1333,8 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
bundle.putString(Constants.LIVE_UID, mLiveUid);
bundle.putString(Constants.LIVE_ANCHER_NAME, mAncherName);
bundle.putString(Constants.STREAM, mStream);
bundle.putString(Constants.LIVE_ANCHER_ICON,mAncherIcon);
bundle.putString(Constants.USER_ICON,userBean.getUserBean().getAvatar());
fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "LiveGuardBuyDialogFragment");
}

View File

@ -275,6 +275,7 @@ public class LiveAudienceActivity extends LiveActivity {
mLiveUid = mLiveBean.getUid();
mStream = mLiveBean.getStream();
mAncherName = liveBean.getUserNiceName();
mAncherIcon = liveBean.getAvatar();
Log.e("收到socket--->", "mLiveUid--------------------------->" + mLiveUid);
//加载当前页面数据
@ -552,6 +553,7 @@ public class LiveAudienceActivity extends LiveActivity {
mLiveUid = liveBean.getUid();
mStream = liveBean.getStream();
mAncherName = liveBean.getUserNiceName();
mAncherIcon = liveBean.getAvatar();
manager.onAdd(liveBean, mLiveType, mLiveTypeVal, mLiveSDK);
}

View File

@ -8,7 +8,10 @@ import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
@ -17,10 +20,13 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.makeramen.roundedimageview.RoundedImageView;
import com.opensource.svgaplayer.SVGAImageView;
import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.Constants;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.RouteUtil;
@ -49,17 +55,27 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
private RecyclerView mRights;//权益列表
private RecyclerView mBuys;//购买列表
private RoundedImageView userIcon, userIconOne, userIconTwo;
private SVGAImageView iconCover;
private TextView anchorName;
private TextView guardCoin2;
private TextView guardBuy;
private TextView guard_tips;
private Button submit;
private LinearLayout buy2;
private RelativeLayout buy1;
private TextView mCoin;
private String mCoinName;
private TextView mCoinNameTextView;
private View mBtnBuy;
private List<GuardRightBean> mRightList=new ArrayList<>();//权限列表
private List<GuardRightBean> mRightList = new ArrayList<>();//权限列表
private List<GuardBuyBean> mBuyList;//商品列表
private long mCoinVal;//余额
private String mLiveUid;
private String mStream;
private String mAncherName;
private String mAncherIcon;
private String mUserIcon;
private LiveGuardInfo mLiveGuardInfo;
private GuardBuyBean mTargetBuyBean;
@ -106,11 +122,26 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
mRights = mRootView.findViewById(R.id.guard_rights);
mBuys = mRootView.findViewById(R.id.guard_buys);
anchorName = mRootView.findViewById(R.id.guard_anchor_name);
userIcon = mRootView.findViewById(R.id.guard_imageView);
userIconOne = mRootView.findViewById(R.id.guard_imageView_one);
userIconTwo = mRootView.findViewById(R.id.guard_imageView_two);
iconCover = mRootView.findViewById(R.id.gift_svga);
guardCoin2 = mRootView.findViewById(R.id.guard_coin2);
guardBuy = mRootView.findViewById(R.id.guard_buy);
submit = mRootView.findViewById(R.id.guard_submit);
buy1 = mRootView.findViewById(R.id.buy1);
buy2 = mRootView.findViewById(R.id.buy2);
guard_tips = mRootView.findViewById(R.id.guard_textView2);
iconCover.setImageResource(R.drawable.guardian_img_wings);
mBtnBuy.setOnClickListener(this);
submit.setOnClickListener(this);
guardBuy.setOnClickListener(this);
mRights.setHasFixedSize(true);
mRights.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
mBuys.setHasFixedSize(true);
mBuys.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false){
mBuys.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false) {
@Override
public boolean canScrollHorizontally() {//购买列表禁止滑动
return false;
@ -128,10 +159,13 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
if (bundle != null) {
mLiveUid = bundle.getString(Constants.LIVE_UID);
mStream = bundle.getString(Constants.STREAM);
mAncherName=bundle.getString(Constants.LIVE_ANCHER_NAME);
mAncherName = bundle.getString(Constants.LIVE_ANCHER_NAME);
mAncherIcon = bundle.getString(Constants.LIVE_ANCHER_ICON);
mUserIcon = bundle.getString(Constants.USER_ICON);
String coinName = WordUtil.getString(R.string.diamond);
mCoinName = coinName;
mCoinNameTextView.setText(WordUtil.getString(R.string.guard_my) + coinName + ":");
// mCoinNameTextView.setText(WordUtil.getString(R.string.guard_my) + coinName + ":");
mCoinNameTextView.setText("快为您喜欢的主播开通守护吧");
anchorName.setText(String.format("成爲%s的守護", mAncherName));
}
LiveHttpUtil.getGuardBuyList(new HttpCallback() {
@ -147,6 +181,7 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
e.printStackTrace();
}
mCoin.setText(String.valueOf(mCoinVal));
guardCoin2.setText(WordUtil.getString(R.string.guard_my) + mCoinName + ":" + mCoinVal);
buyItemsAdapter.setItems(mBuyList);
mGuardRightAdapter.setList(mRightList);
buyItemsAdapter.notifyDataSetChanged();
@ -158,13 +193,46 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
}
}
});
setIcon();
}
private void setIcon() {
int guardType = mLiveGuardInfo.getMyGuardType();
if (guardType == Constants.GUARD_TYPE_NONE) {
iconCover.setBackgroundResource(R.drawable.guardian_img_wings);
buy1.setVisibility(View.VISIBLE);
buy2.setVisibility(View.GONE);
} else {
buy2.setVisibility(View.VISIBLE);
buy1.setVisibility(View.GONE);
userIconOne.setVisibility(View.VISIBLE);
userIconTwo.setVisibility(View.VISIBLE);
iconCover.setImageResource(R.drawable.guardian_img_two);
ImgLoader.display(mContext, mAncherIcon, userIconOne);
ImgLoader.display(mContext, mUserIcon, userIconTwo);
String title = "";
switch (guardType) {
case Constants.GUARD_TYPE_DAY:
title = "您是當前主播的周守護";
break;
case Constants.GUARD_TYPE_MONTH:
title = "您是當前主播的月守護";
break;
case Constants.GUARD_TYPE_YEAR:
title = "您是當前主播的年守護";
break;
}
anchorName.setText(title);
guard_tips.setText("守護日期截止到:"+ mLiveGuardInfo.getMyGuardEndTime());
}
}
private void refreshList(int index) {
if (!mRightList.isEmpty()) {
GuardBuyBean guardBuyBean = mBuyList.get(index - 1);
mTargetBuyBean=guardBuyBean;
mTargetBuyBean = guardBuyBean;
for (GuardRightBean bean : mRightList) {
bean.setChecked(false);
}
@ -178,18 +246,15 @@ public class LiveNewGuardBuyDialogFragment extends AbsDialogFragment implements
}
@Override
public void onClick(View view) {
int i = view.getId();
if (i == R.id.guard_btn_buy) {
if (i == R.id.guard_btn_buy || i == R.id.guard_submit) {
clickBuyGuard();
} else if (i == R.id.guard_buy) {
forwardMyCoin();
}
// else if (i == R.id.coin) {
// forwardMyCoin();
//
// }
}
/**

View File

@ -187,7 +187,6 @@ public class LiveNewGuardListDialogFragment extends AbsDialogFragment implements
}
});
System.out.println(">>>>>>>>>>>>>设置数据");
mRefreshView.initData();
}

View File

@ -1796,6 +1796,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
if (bean == null) {
return;
}
if (mLiveEnterRoomAnimPresenter != null) {
mLiveEnterRoomAnimPresenter.enterRoom(bean);
}
@ -1810,6 +1811,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
}
setGuardIcon(tmp);
}
((LiveActivity)mContext).setEnterRoomData(bean);
}
/**

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:width="267dp" android:height="42dp">
<shape android:shape="rectangle">
<gradient android:type="linear" android:useLevel="true" android:startColor="#ffa98cfd" android:endColor="#ff9d7afd" android:angle="90" />
<corners android:radius="21dp" />
</shape>
</item>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

View File

@ -118,19 +118,21 @@
<RelativeLayout
android:id="@+id/guard_relativeLayout"
android:layout_width="match_parent"
android:layout_height="77dp"
android:layout_marginTop="-20dp"
android:layout_height="90dp"
android:layout_marginTop="-30dp"
android:background="@drawable/img_guard_bottom"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/guard_constraintLayout">
<RelativeLayout
android:id="@+id/buy1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
app:layout_constraintStart_toStartOf="parent"
tools:visibility="gone">
<TextView
@ -139,7 +141,7 @@
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:textColor="@color/textColor2"
android:textColor="#9E7CFD"
android:textSize="14sp" />
<TextView
@ -151,7 +153,8 @@
android:layout_toRightOf="@id/guard_coin_name"
android:drawablePadding="4dp"
android:textColor="@color/global"
android:textSize="14sp" />
android:textSize="14sp"
android:visibility="gone" />
<TextView
android:id="@+id/guard_btn_buy"
@ -167,18 +170,123 @@
android:textColor="@color/white"
android:textSize="14sp" />
</RelativeLayout>
<LinearLayout
android:id="@+id/buy2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="@+id/guard_coin2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#9F9F9F"
android:textSize="12sp" />
<TextView
android:id="@+id/guard_buy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:text="充值"
android:textColor="#F7B500"
android:textSize="12sp" />
<ImageView
android:layout_width="4dp"
android:layout_height="8dp"
android:layout_marginStart="4dp"
android:src="@drawable/icon_top_up" />
</LinearLayout>
<Button
android:id="@+id/guard_submit"
android:layout_width="267dp"
android:layout_height="42dp"
android:layout_marginTop="2dp"
android:background="@drawable/bg_new_guard_but"
android:text="繼續守護"
android:textColor="#FFFFFF"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/guard_imageView"
<RelativeLayout
android:layout_width="243dp"
android:layout_height="117dp"
android:layout_above="@id/guard_rootView"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_marginBottom="-102dp"
android:gravity="center"
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/guardian_img_wings" />
app:layout_constraintTop_toTopOf="parent">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/guard_imageView"
android:layout_width="0dp"
android:layout_height="58dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:scaleType="centerCrop"
android:src="@drawable/guardian_img_wings"
android:visibility="invisible"
app:riv_oval="true" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/guard_imageView_two"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_centerHorizontal="true"
android:layout_marginStart="-5dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="@+id/guard_imageView"
android:scaleType="centerCrop"
android:src="@drawable/guardian_img_wings"
android:visibility="invisible"
app:riv_oval="true" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/guard_imageView_one"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:layout_toStartOf="@id/guard_imageView"
android:scaleType="centerCrop"
android:src="@drawable/guardian_img_wings"
android:visibility="invisible"
app:riv_oval="true" />
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/gift_svga"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:src="@drawable/guardian_img_two"
android:visibility="visible"
app:autoPlay="true" />
</RelativeLayout>
</RelativeLayout>