diff --git a/common/src/main/java/com/yunbao/common/adapter/GiftAlreadyWallAdapter.java b/common/src/main/java/com/yunbao/common/adapter/GiftAlreadyWallAdapter.java index 815c8f949..b2c596d4a 100644 --- a/common/src/main/java/com/yunbao/common/adapter/GiftAlreadyWallAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/GiftAlreadyWallAdapter.java @@ -16,6 +16,11 @@ import java.util.List; public class GiftAlreadyWallAdapter extends RecyclerView.Adapter { private List giftWall = new ArrayList<>(); + private boolean sbWy;//是否正在直播 + + public GiftAlreadyWallAdapter(boolean sbWy) { + this.sbWy = sbWy; + } @NonNull @Override @@ -27,7 +32,7 @@ public class GiftAlreadyWallAdapter extends RecyclerView.Adapter { @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { GiftAlreadyWallViewHolder withoutWallViewHolder = (GiftAlreadyWallViewHolder) holder; - withoutWallViewHolder.showData(giftWall.get(position)); + withoutWallViewHolder.showData(giftWall.get(position), sbWy); } @Override diff --git a/common/src/main/java/com/yunbao/common/event/GiftWallItemEvent.java b/common/src/main/java/com/yunbao/common/event/GiftWallItemEvent.java index 301d46608..97596c1a2 100644 --- a/common/src/main/java/com/yunbao/common/event/GiftWallItemEvent.java +++ b/common/src/main/java/com/yunbao/common/event/GiftWallItemEvent.java @@ -7,6 +7,7 @@ public class GiftWallItemEvent extends BaseModel { private GiftWallModel giftWallModel; private boolean unlit; + public GiftWallModel getGiftWallModel() { return giftWallModel; } diff --git a/common/src/main/java/com/yunbao/common/views/GiftAlreadyWallViewHolder.java b/common/src/main/java/com/yunbao/common/views/GiftAlreadyWallViewHolder.java index f9e376a54..56fd9798d 100644 --- a/common/src/main/java/com/yunbao/common/views/GiftAlreadyWallViewHolder.java +++ b/common/src/main/java/com/yunbao/common/views/GiftAlreadyWallViewHolder.java @@ -25,7 +25,7 @@ public class GiftAlreadyWallViewHolder extends RecyclerView.ViewHolder { giftNumber = itemView.findViewById(R.id.gift_number); } - public void showData(GiftWallModel giftWallModel) { + public void showData(GiftWallModel giftWallModel,boolean sbWy) { giftTitle.setText(giftWallModel.getGiftname()); giftNumber.setText("*" + giftWallModel.getGiftCountNumber()); ImgLoader.display(itemView.getContext(), giftWallModel.getGifticon(), giftImg); diff --git a/common/src/main/res/layout/popup_gift_wall_item.xml b/common/src/main/res/layout/popup_gift_wall_item.xml index d7fd2c668..ddc60f91b 100644 --- a/common/src/main/res/layout/popup_gift_wall_item.xml +++ b/common/src/main/res/layout/popup_gift_wall_item.xml @@ -130,7 +130,7 @@ { selectTab(textLitIcon, viewLitIcon); 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(); }); ViewClicksAntiShake.clicksAntiShake(layoutUnlitIcon, new ViewClicksAntiShake.ViewClicksCallBack() { @@ -157,7 +157,7 @@ public class GiftWallActivity extends AbsActivity { isAttention = intent.getIntExtra("isAttention", 0); isLive = intent.getBooleanExtra("isLive", false); 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(); ImgLoader.display(GiftWallActivity.this, mAvatarUrl, avatar); anchorName.setText(mAnchorName); @@ -192,7 +192,7 @@ public class GiftWallActivity extends AbsActivity { @Subscribe(threadMode = ThreadMode.MAIN) public void onGiftWallItemEvent(GiftWallItemEvent event) { 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(); } diff --git a/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java b/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java index e1a6fe9e4..4dc1ded9b 100644 --- a/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/GiftWallDialog.java @@ -21,15 +21,10 @@ import com.yunbao.common.event.LiveGiftDialogEvent; import com.yunbao.common.fragment.AllServiceChampionFragment; import com.yunbao.common.fragment.GiftWithoutWallFragment; 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.RouteUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; -import com.yunbao.live.activity.LiveActivity; -import com.yunbao.live.event.LiveAudienceEvent; import com.yunbao.live.views.GiftAlreadyWallFragment; import org.greenrobot.eventbus.Subscribe; @@ -50,7 +45,7 @@ public class GiftWallDialog extends AbsDialogFragment { private List tabView = new ArrayList<>(); private String mStream, mAnchorName, mLiveUid, mAvatarUrl, toUid; private int isAttention = 0;//是否关注 0=没关注, - private boolean isLive;//是否正在直播 + private boolean isLive, sbWy;//是否正在直播 @Override public void onActivityCreated(Bundle savedInstanceState) { @@ -83,7 +78,7 @@ public class GiftWallDialog extends AbsDialogFragment { ViewClicksAntiShake.clicksAntiShake(layoutLitIcon, () -> { selectTab(textLitIcon, viewLitIcon); 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(); }); ViewClicksAntiShake.clicksAntiShake(layoutUnlitIcon, new ViewClicksAntiShake.ViewClicksCallBack() { @@ -129,7 +124,7 @@ public class GiftWallDialog extends AbsDialogFragment { public void onViewClicks() { new XPopup.Builder(getContext()) .enableDrag(false) - .asCustom(new MedalAchievementPopup(getContext(), isLive, toUid,mLiveUid)) + .asCustom(new MedalAchievementPopup(getContext(), isLive, toUid, mLiveUid)) .show(); } }); @@ -146,10 +141,12 @@ public class GiftWallDialog extends AbsDialogFragment { } }); } + private void forwardHomePage() { - dismiss(); + dismiss(); RouteUtil.forwardUserHome(mContext, mLiveUid, false, mLiveUid, 0); } + private void initDate() { Bundle bundle = getArguments(); if (bundle == null) { @@ -162,14 +159,15 @@ public class GiftWallDialog extends AbsDialogFragment { toUid = bundle.getString("toUid"); isAttention = bundle.getInt("isAttention"); isLive = bundle.getBoolean("isLive"); + sbWy = bundle.getBoolean("SBW"); 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(); ImgLoader.display(getContext(), mAvatarUrl, avatar); anchorName.setText(mAnchorName); - if (isLive){ + if (isLive) { textLitIcon.setText(getContext().getString(R.string.lit_icon)); - }else { + } else { textLitIcon.setText(getContext().getString(R.string.been_sent)); } } @@ -227,7 +225,13 @@ public class GiftWallDialog extends AbsDialogFragment { @Subscribe(threadMode = ThreadMode.MAIN) public void onGiftWallItemEvent(GiftWallItemEvent event) { 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(); } diff --git a/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java b/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java index e07a3d1a3..6da7e16ba 100644 --- a/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/GiftWallItemPopup.java @@ -3,6 +3,7 @@ package com.yunbao.live.dialog; import android.content.Context; import android.graphics.Color; +import android.text.TextUtils; import android.widget.ImageView; import android.widget.TextView; @@ -14,6 +15,7 @@ import com.yunbao.common.CommonAppConfig; import com.yunbao.common.R; import com.yunbao.common.bean.GiftWallGiftDetail; import com.yunbao.common.bean.GiftWallModel; +import com.yunbao.common.event.LiveGiftDialogEvent; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; 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.views.weight.ViewClicksAntiShake; import com.yunbao.live.event.LiveAudienceEvent; -import com.yunbao.common.event.LiveGiftDialogEvent; public class GiftWallItemPopup extends CenterPopupView { private CardView layout; @@ -29,16 +30,18 @@ public class GiftWallItemPopup extends CenterPopupView { private TextView price, giftDetailsBtn, distanceNaming, vacantPositionAwaits, giftDetails, vacantPosition; private GiftWallModel giftWallModel; private boolean unlit; - private String mLiveUid, mStream; - private boolean isAnchor = false; + private String mLiveUid, mStream, toUid; + private boolean isAnchor = false, sbWy; 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); this.giftWallModel = giftWallModel; this.unlit = unlit; this.mLiveUid = mLiveUid; + this.toUid = toUid; this.mStream = mStream; + this.sbWy = sbWy; if (this.mLiveUid.equals(CommonAppConfig.getInstance().getUid())) { isAnchor = true; } @@ -66,7 +69,12 @@ public class GiftWallItemPopup extends CenterPopupView { } else { 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.setEnabled(false); giftDetailsBtn.setTextColor(Color.parseColor("#F2F2F2")); diff --git a/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java b/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java index 060ab069a..c8874c3f5 100644 --- a/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java +++ b/live/src/main/java/com/yunbao/live/views/GiftAlreadyWallFragment.java @@ -1,8 +1,6 @@ package com.yunbao.live.views; -import android.graphics.Color; import android.os.Bundle; -import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -20,7 +18,6 @@ import com.yunbao.common.event.LiveGiftDialogEvent; import com.yunbao.common.fragment.BaseFragment; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; -import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.Bus; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.event.LiveAudienceEvent; @@ -34,7 +31,7 @@ public class GiftAlreadyWallFragment extends BaseFragment { private RecyclerView alreadyList; private GiftAlreadyWallAdapter alreadyWallAdapter; private TextView litIcon, giftAll, unlitIconHint, instantLight; - private boolean isAnchor; + private boolean isAnchor, sbWy; @Override public View createView(LayoutInflater layoutInflater, ViewGroup viewGroup) { @@ -48,6 +45,7 @@ public class GiftAlreadyWallFragment extends BaseFragment { mLiveUid = bundle.getString("mLiveUid"); toUid = bundle.getString("toUid"); isAnchor = bundle.getBoolean("isAnchor"); + isAnchor = bundle.getBoolean("SBW"); } @Override @@ -59,22 +57,20 @@ public class GiftAlreadyWallFragment extends BaseFragment { giftAll = contentView.findViewById(R.id.gift_all); instantLight = contentView.findViewById(R.id.instant_light); 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.setAdapter(alreadyWallAdapter); - if(mLiveUid.equals(CommonAppConfig.getInstance().getUid())){ - instantLight.setBackgroundResource(R.drawable.background_skip_unselect_button); - instantLight.setEnabled(false); - instantLight.setTextColor(Color.parseColor("#F2F2F2")); + if (mLiveUid.equals(CommonAppConfig.getInstance().getUid())) { + instantLight.setVisibility(View.VISIBLE); + } else { + instantLight.setVisibility(View.GONE); } if (isAnchor) { unlitIconHint.setText(getContext().getString(R.string.unlit_icon_hint)); } else { 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() { @Override public void onViewClicks() { @@ -89,7 +85,7 @@ public class GiftAlreadyWallFragment extends BaseFragment { @Override protected void loadData() { - if (isAnchor){ + if (isAnchor) { LiveNetManager.get(getActivity()). giftAlreadyWall(mLiveUid, toUid, new HttpCallback() { @Override @@ -111,7 +107,7 @@ public class GiftAlreadyWallFragment extends BaseFragment { } }); - }else { + } else { LiveNetManager.get(getActivity()). giftUserSendWall(mLiveUid, toUid, new HttpCallback() { @Override @@ -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(); Bundle bundle = new Bundle(); bundle.putString("mStream", mStream); @@ -145,6 +145,7 @@ public class GiftAlreadyWallFragment extends BaseFragment { bundle.putString("mLiveUid", mLiveUid); bundle.putString("toUid", toUid); bundle.putBoolean("isAnchor", isAnchor); + bundle.putBoolean("SBW", sbWy); liveGiftFragment.setArguments(bundle); return liveGiftFragment; } diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index ddbc18bbd..981f40e02 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -453,7 +453,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis } } } - }else if("checkNewLetter".equals(str)){ + } else if ("checkNewLetter".equals(str)) { checkNewLetter(); } } @@ -2682,6 +2682,7 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis bundle.putString("toUid", toUid); bundle.putInt("isAttention", isAttention); bundle.putBoolean("isLive", isAnchor); + bundle.putBoolean("SBW", !(mContext instanceof LiveRyAnchorActivity)); giftWallDialog.setArguments(bundle); giftWallDialog.show(((AbsActivity) mContext).getSupportFragmentManager(), "GiftWallDialog");