6.5.4礼物冠名

This commit is contained in:
18401019693 2023-08-09 18:11:42 +08:00
parent fea46aab1f
commit dffa71e346
9 changed files with 60 additions and 40 deletions

View File

@ -16,6 +16,11 @@ import java.util.List;
public class GiftAlreadyWallAdapter extends RecyclerView.Adapter { public class GiftAlreadyWallAdapter extends RecyclerView.Adapter {
private List<GiftWallModel> giftWall = new ArrayList<>(); private List<GiftWallModel> giftWall = new ArrayList<>();
private boolean sbWy;//是否正在直播
public GiftAlreadyWallAdapter(boolean sbWy) {
this.sbWy = sbWy;
}
@NonNull @NonNull
@Override @Override
@ -27,7 +32,7 @@ public class GiftAlreadyWallAdapter extends RecyclerView.Adapter {
@Override @Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
GiftAlreadyWallViewHolder withoutWallViewHolder = (GiftAlreadyWallViewHolder) holder; GiftAlreadyWallViewHolder withoutWallViewHolder = (GiftAlreadyWallViewHolder) holder;
withoutWallViewHolder.showData(giftWall.get(position)); withoutWallViewHolder.showData(giftWall.get(position), sbWy);
} }
@Override @Override

View File

@ -7,6 +7,7 @@ public class GiftWallItemEvent extends BaseModel {
private GiftWallModel giftWallModel; private GiftWallModel giftWallModel;
private boolean unlit; private boolean unlit;
public GiftWallModel getGiftWallModel() { public GiftWallModel getGiftWallModel() {
return giftWallModel; return giftWallModel;
} }

View File

@ -25,7 +25,7 @@ public class GiftAlreadyWallViewHolder extends RecyclerView.ViewHolder {
giftNumber = itemView.findViewById(R.id.gift_number); giftNumber = itemView.findViewById(R.id.gift_number);
} }
public void showData(GiftWallModel giftWallModel) { public void showData(GiftWallModel giftWallModel,boolean sbWy) {
giftTitle.setText(giftWallModel.getGiftname()); giftTitle.setText(giftWallModel.getGiftname());
giftNumber.setText("*" + giftWallModel.getGiftCountNumber()); giftNumber.setText("*" + giftWallModel.getGiftCountNumber());
ImgLoader.display(itemView.getContext(), giftWallModel.getGifticon(), giftImg); ImgLoader.display(itemView.getContext(), giftWallModel.getGifticon(), giftImg);

View File

@ -130,7 +130,7 @@
<TextView <TextView
android:id="@+id/gift_details_btn" android:id="@+id/gift_details_btn"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="28dp" android:layout_height="24dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="23dp" android:layout_marginTop="23dp"
android:background="@drawable/background_skip_button" android:background="@drawable/background_skip_button"

View File

@ -89,7 +89,7 @@ public class GiftWallActivity extends AbsActivity {
ViewClicksAntiShake.clicksAntiShake(layoutLitIcon, () -> { ViewClicksAntiShake.clicksAntiShake(layoutLitIcon, () -> {
selectTab(textLitIcon, viewLitIcon); selectTab(textLitIcon, viewLitIcon);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid, mLiveUid, isLive)); transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid, mLiveUid, isLive,false));
transaction.commit(); transaction.commit();
}); });
ViewClicksAntiShake.clicksAntiShake(layoutUnlitIcon, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(layoutUnlitIcon, new ViewClicksAntiShake.ViewClicksCallBack() {
@ -157,7 +157,7 @@ public class GiftWallActivity extends AbsActivity {
isAttention = intent.getIntExtra("isAttention", 0); isAttention = intent.getIntExtra("isAttention", 0);
isLive = intent.getBooleanExtra("isLive", false); isLive = intent.getBooleanExtra("isLive", false);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid, mLiveUid, isLive)); transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid, mLiveUid, isLive, false));
transaction.commit(); transaction.commit();
ImgLoader.display(GiftWallActivity.this, mAvatarUrl, avatar); ImgLoader.display(GiftWallActivity.this, mAvatarUrl, avatar);
anchorName.setText(mAnchorName); anchorName.setText(mAnchorName);
@ -192,7 +192,7 @@ public class GiftWallActivity extends AbsActivity {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onGiftWallItemEvent(GiftWallItemEvent event) { public void onGiftWallItemEvent(GiftWallItemEvent event) {
new XPopup.Builder(this) new XPopup.Builder(this)
.asCustom(new GiftWallItemPopup(this, event.getGiftWallModel(), event.isUnlit(), mLiveUid, mStream)) .asCustom(new GiftWallItemPopup(this, event.getGiftWallModel(), event.isUnlit(), mLiveUid, mLiveUid, mStream, false))
.show(); .show();
} }

View File

@ -21,15 +21,10 @@ import com.yunbao.common.event.LiveGiftDialogEvent;
import com.yunbao.common.fragment.AllServiceChampionFragment; import com.yunbao.common.fragment.AllServiceChampionFragment;
import com.yunbao.common.fragment.GiftWithoutWallFragment; import com.yunbao.common.fragment.GiftWithoutWallFragment;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.R; import com.yunbao.live.R;
import com.yunbao.live.activity.LiveActivity;
import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.live.views.GiftAlreadyWallFragment; import com.yunbao.live.views.GiftAlreadyWallFragment;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -50,7 +45,7 @@ public class GiftWallDialog extends AbsDialogFragment {
private List<View> tabView = new ArrayList<>(); private List<View> tabView = new ArrayList<>();
private String mStream, mAnchorName, mLiveUid, mAvatarUrl, toUid; private String mStream, mAnchorName, mLiveUid, mAvatarUrl, toUid;
private int isAttention = 0;//是否关注 0=没关注, private int isAttention = 0;//是否关注 0=没关注,
private boolean isLive;//是否正在直播 private boolean isLive, sbWy;//是否正在直播
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
@ -83,7 +78,7 @@ public class GiftWallDialog extends AbsDialogFragment {
ViewClicksAntiShake.clicksAntiShake(layoutLitIcon, () -> { ViewClicksAntiShake.clicksAntiShake(layoutLitIcon, () -> {
selectTab(textLitIcon, viewLitIcon); selectTab(textLitIcon, viewLitIcon);
FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid, toUid,isLive)); transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid, toUid, isLive,sbWy));
transaction.commit(); transaction.commit();
}); });
ViewClicksAntiShake.clicksAntiShake(layoutUnlitIcon, new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(layoutUnlitIcon, new ViewClicksAntiShake.ViewClicksCallBack() {
@ -146,10 +141,12 @@ public class GiftWallDialog extends AbsDialogFragment {
} }
}); });
} }
private void forwardHomePage() { private void forwardHomePage() {
dismiss(); dismiss();
RouteUtil.forwardUserHome(mContext, mLiveUid, false, mLiveUid, 0); RouteUtil.forwardUserHome(mContext, mLiveUid, false, mLiveUid, 0);
} }
private void initDate() { private void initDate() {
Bundle bundle = getArguments(); Bundle bundle = getArguments();
if (bundle == null) { if (bundle == null) {
@ -162,8 +159,9 @@ public class GiftWallDialog extends AbsDialogFragment {
toUid = bundle.getString("toUid"); toUid = bundle.getString("toUid");
isAttention = bundle.getInt("isAttention"); isAttention = bundle.getInt("isAttention");
isLive = bundle.getBoolean("isLive"); isLive = bundle.getBoolean("isLive");
sbWy = bundle.getBoolean("SBW");
FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid, toUid,isLive)); transaction.replace(R.id.context_layout_gift, GiftAlreadyWallFragment.newInstance(mStream, mLiveUid, toUid, isLive,sbWy));
transaction.commit(); transaction.commit();
ImgLoader.display(getContext(), mAvatarUrl, avatar); ImgLoader.display(getContext(), mAvatarUrl, avatar);
anchorName.setText(mAnchorName); anchorName.setText(mAnchorName);
@ -227,7 +225,13 @@ public class GiftWallDialog extends AbsDialogFragment {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onGiftWallItemEvent(GiftWallItemEvent event) { public void onGiftWallItemEvent(GiftWallItemEvent event) {
new XPopup.Builder(getActivity()) new XPopup.Builder(getActivity())
.asCustom(new GiftWallItemPopup(getActivity(), event.getGiftWallModel(), event.isUnlit(), mLiveUid, mStream)) .asCustom(new GiftWallItemPopup(getActivity(),
event.getGiftWallModel(),
event.isUnlit(),
mLiveUid,
toUid,
mStream,
sbWy))
.show(); .show();
} }

View File

@ -3,6 +3,7 @@ package com.yunbao.live.dialog;
import android.content.Context; import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.text.TextUtils;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -14,6 +15,7 @@ import com.yunbao.common.CommonAppConfig;
import com.yunbao.common.R; import com.yunbao.common.R;
import com.yunbao.common.bean.GiftWallGiftDetail; import com.yunbao.common.bean.GiftWallGiftDetail;
import com.yunbao.common.bean.GiftWallModel; import com.yunbao.common.bean.GiftWallModel;
import com.yunbao.common.event.LiveGiftDialogEvent;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
@ -21,7 +23,6 @@ import com.yunbao.common.utils.Bus;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
import com.yunbao.common.event.LiveGiftDialogEvent;
public class GiftWallItemPopup extends CenterPopupView { public class GiftWallItemPopup extends CenterPopupView {
private CardView layout; private CardView layout;
@ -29,16 +30,18 @@ public class GiftWallItemPopup extends CenterPopupView {
private TextView price, giftDetailsBtn, distanceNaming, vacantPositionAwaits, giftDetails, vacantPosition; private TextView price, giftDetailsBtn, distanceNaming, vacantPositionAwaits, giftDetails, vacantPosition;
private GiftWallModel giftWallModel; private GiftWallModel giftWallModel;
private boolean unlit; private boolean unlit;
private String mLiveUid, mStream; private String mLiveUid, mStream, toUid;
private boolean isAnchor = false; private boolean isAnchor = false, sbWy;
public GiftWallItemPopup(@NonNull Context context, GiftWallModel giftWallModel, public GiftWallItemPopup(@NonNull Context context, GiftWallModel giftWallModel,
boolean unlit, String mLiveUid, String mStream) { boolean unlit, String mLiveUid, String toUid, String mStream, boolean sbWy) {
super(context); super(context);
this.giftWallModel = giftWallModel; this.giftWallModel = giftWallModel;
this.unlit = unlit; this.unlit = unlit;
this.mLiveUid = mLiveUid; this.mLiveUid = mLiveUid;
this.toUid = toUid;
this.mStream = mStream; this.mStream = mStream;
this.sbWy = sbWy;
if (this.mLiveUid.equals(CommonAppConfig.getInstance().getUid())) { if (this.mLiveUid.equals(CommonAppConfig.getInstance().getUid())) {
isAnchor = true; isAnchor = true;
} }
@ -66,7 +69,12 @@ public class GiftWallItemPopup extends CenterPopupView {
} else { } else {
giftDetailsBtn.setText(getContext().getText(R.string.instant_light)); giftDetailsBtn.setText(getContext().getText(R.string.instant_light));
} }
if(isAnchor){
if (sbWy && TextUtils.equals(mLiveUid, toUid)) {
giftDetailsBtn.setBackgroundResource(R.drawable.background_skip_button);
giftDetailsBtn.setEnabled(true);
giftDetailsBtn.setTextColor(Color.parseColor("#F16D00"));
}else {
giftDetailsBtn.setBackgroundResource(R.drawable.background_skip_unselect_button); giftDetailsBtn.setBackgroundResource(R.drawable.background_skip_unselect_button);
giftDetailsBtn.setEnabled(false); giftDetailsBtn.setEnabled(false);
giftDetailsBtn.setTextColor(Color.parseColor("#F2F2F2")); giftDetailsBtn.setTextColor(Color.parseColor("#F2F2F2"));

View File

@ -1,8 +1,6 @@
package com.yunbao.live.views; package com.yunbao.live.views;
import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -20,7 +18,6 @@ import com.yunbao.common.event.LiveGiftDialogEvent;
import com.yunbao.common.fragment.BaseFragment; import com.yunbao.common.fragment.BaseFragment;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.live.LiveNetManager;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.Bus;
import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.common.views.weight.ViewClicksAntiShake;
import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.event.LiveAudienceEvent;
@ -34,7 +31,7 @@ public class GiftAlreadyWallFragment extends BaseFragment {
private RecyclerView alreadyList; private RecyclerView alreadyList;
private GiftAlreadyWallAdapter alreadyWallAdapter; private GiftAlreadyWallAdapter alreadyWallAdapter;
private TextView litIcon, giftAll, unlitIconHint, instantLight; private TextView litIcon, giftAll, unlitIconHint, instantLight;
private boolean isAnchor; private boolean isAnchor, sbWy;
@Override @Override
public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) { public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) {
@ -48,6 +45,7 @@ public class GiftAlreadyWallFragment extends BaseFragment {
mLiveUid = bundle.getString("mLiveUid"); mLiveUid = bundle.getString("mLiveUid");
toUid = bundle.getString("toUid"); toUid = bundle.getString("toUid");
isAnchor = bundle.getBoolean("isAnchor"); isAnchor = bundle.getBoolean("isAnchor");
isAnchor = bundle.getBoolean("SBW");
} }
@Override @Override
@ -59,22 +57,20 @@ public class GiftAlreadyWallFragment extends BaseFragment {
giftAll = contentView.findViewById(R.id.gift_all); giftAll = contentView.findViewById(R.id.gift_all);
instantLight = contentView.findViewById(R.id.instant_light); instantLight = contentView.findViewById(R.id.instant_light);
unlitIconHint = contentView.findViewById(R.id.unlit_icon_hint); unlitIconHint = contentView.findViewById(R.id.unlit_icon_hint);
alreadyWallAdapter = new GiftAlreadyWallAdapter(); alreadyWallAdapter = new GiftAlreadyWallAdapter(sbWy);
alreadyList.setLayoutManager(new GridLayoutManager(getContext(), 3, GridLayoutManager.VERTICAL, false)); alreadyList.setLayoutManager(new GridLayoutManager(getContext(), 3, GridLayoutManager.VERTICAL, false));
alreadyList.setAdapter(alreadyWallAdapter); alreadyList.setAdapter(alreadyWallAdapter);
if (mLiveUid.equals(CommonAppConfig.getInstance().getUid())) { if (mLiveUid.equals(CommonAppConfig.getInstance().getUid())) {
instantLight.setBackgroundResource(R.drawable.background_skip_unselect_button); instantLight.setVisibility(View.VISIBLE);
instantLight.setEnabled(false); } else {
instantLight.setTextColor(Color.parseColor("#F2F2F2")); instantLight.setVisibility(View.GONE);
} }
if (isAnchor) { if (isAnchor) {
unlitIconHint.setText(getContext().getString(R.string.unlit_icon_hint)); unlitIconHint.setText(getContext().getString(R.string.unlit_icon_hint));
} else { } else {
unlitIconHint.setText(getContext().getString(R.string.unlit_icon_hint2)); unlitIconHint.setText(getContext().getString(R.string.unlit_icon_hint2));
} }
if (TextUtils.equals(IMLoginManager.get(getContext()).getUserInfo().getId() + "", toUid)) {
instantLight.setVisibility(View.VISIBLE);
}
ViewClicksAntiShake.clicksAntiShake(contentView.findViewById(R.id.instant_light), new ViewClicksAntiShake.ViewClicksCallBack() { ViewClicksAntiShake.clicksAntiShake(contentView.findViewById(R.id.instant_light), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override @Override
public void onViewClicks() { public void onViewClicks() {
@ -137,7 +133,11 @@ public class GiftAlreadyWallFragment extends BaseFragment {
} }
public static GiftAlreadyWallFragment newInstance(String mStream, String mLiveUid, String toUid, boolean isAnchor) { public static GiftAlreadyWallFragment newInstance(String mStream,
String mLiveUid,
String toUid,
boolean isAnchor,
boolean sbWy) {
GiftAlreadyWallFragment liveGiftFragment = new GiftAlreadyWallFragment(); GiftAlreadyWallFragment liveGiftFragment = new GiftAlreadyWallFragment();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("mStream", mStream); bundle.putString("mStream", mStream);
@ -145,6 +145,7 @@ public class GiftAlreadyWallFragment extends BaseFragment {
bundle.putString("mLiveUid", mLiveUid); bundle.putString("mLiveUid", mLiveUid);
bundle.putString("toUid", toUid); bundle.putString("toUid", toUid);
bundle.putBoolean("isAnchor", isAnchor); bundle.putBoolean("isAnchor", isAnchor);
bundle.putBoolean("SBW", sbWy);
liveGiftFragment.setArguments(bundle); liveGiftFragment.setArguments(bundle);
return liveGiftFragment; return liveGiftFragment;
} }

View File

@ -2682,6 +2682,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
bundle.putString("toUid", toUid); bundle.putString("toUid", toUid);
bundle.putInt("isAttention", isAttention); bundle.putInt("isAttention", isAttention);
bundle.putBoolean("isLive", isAnchor); bundle.putBoolean("isLive", isAnchor);
bundle.putBoolean("SBW", !(mContext instanceof LiveRyAnchorActivity));
giftWallDialog.setArguments(bundle); giftWallDialog.setArguments(bundle);
giftWallDialog.show(((AbsActivity) mContext).getSupportFragmentManager(), "GiftWallDialog"); giftWallDialog.show(((AbsActivity) mContext).getSupportFragmentManager(), "GiftWallDialog");