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 {
private List<GiftWallModel> 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

View File

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

View File

@ -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);

View File

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

View File

@ -89,7 +89,7 @@ public class GiftWallActivity extends AbsActivity {
ViewClicksAntiShake.clicksAntiShake(layoutLitIcon, () -> {
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();
}

View File

@ -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<View> 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();
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();
}

View File

@ -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"));

View File

@ -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<GiftAlreadyWallModel>() {
@Override
@ -111,7 +107,7 @@ public class GiftAlreadyWallFragment extends BaseFragment {
}
});
}else {
} else {
LiveNetManager.get(getActivity()).
giftUserSendWall(mLiveUid, toUid, new HttpCallback<GiftAlreadyWallModel>() {
@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;
}

View File

@ -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");