按测试反馈修改红包详情UI逻辑和新增礼物显示

This commit is contained in:
zlzw 2023-07-06 15:13:33 +08:00
parent 4d61c7e176
commit 3e91068866
6 changed files with 44 additions and 8 deletions

View File

@ -14,6 +14,8 @@ public class RedPacketDetailsBean extends BaseModel {
private String avatar; private String avatar;
@SerializedName("red_packet_money") @SerializedName("red_packet_money")
private long money;// 红包金豆总数量 private long money;// 红包金豆总数量
@SerializedName("amount_diamond")
private long diamond;// 红包价值钻石
@SerializedName("red_packet_quantity") @SerializedName("red_packet_quantity")
private int quantity; // 领取的红包总数量 private int quantity; // 领取的红包总数量
@SerializedName("red_packet_quantity_already") @SerializedName("red_packet_quantity_already")
@ -81,6 +83,14 @@ public class RedPacketDetailsBean extends BaseModel {
this.details = details; this.details = details;
} }
public long getDiamond() {
return diamond;
}
public void setDiamond(long diamond) {
this.diamond = diamond;
}
@Override @Override
public String toString() { public String toString() {
return "RedPacketDetailsBean{" + return "RedPacketDetailsBean{" +
@ -88,6 +98,7 @@ public class RedPacketDetailsBean extends BaseModel {
", avatarThumb='" + avatarThumb + '\'' + ", avatarThumb='" + avatarThumb + '\'' +
", avatar='" + avatar + '\'' + ", avatar='" + avatar + '\'' +
", money=" + money + ", money=" + money +
", diamond=" + diamond +
", quantity=" + quantity + ", quantity=" + quantity +
", already=" + already + ", already=" + already +
", details=" + details + ", details=" + details +
@ -105,6 +116,8 @@ public class RedPacketDetailsBean extends BaseModel {
private String avatarThumb; private String avatarThumb;
@SerializedName("avatar") @SerializedName("avatar")
private String avatar; private String avatar;
@SerializedName("gifticon")
private String gifticon;
public long getMoney() { public long getMoney() {
@ -151,6 +164,14 @@ public class RedPacketDetailsBean extends BaseModel {
this.avatar = avatar; this.avatar = avatar;
} }
public String getGifticon() {
return gifticon;
}
public void setGifticon(String gifticon) {
this.gifticon = gifticon;
}
@Override @Override
public String toString() { public String toString() {
return "Detail{" + return "Detail{" +
@ -159,6 +180,7 @@ public class RedPacketDetailsBean extends BaseModel {
", time='" + time + '\'' + ", time='" + time + '\'' +
", avatarThumb='" + avatarThumb + '\'' + ", avatarThumb='" + avatarThumb + '\'' +
", avatar='" + avatar + '\'' + ", avatar='" + avatar + '\'' +
", gifticon='" + gifticon + '\'' +
'}'; '}';
} }
} }

View File

@ -61,11 +61,15 @@ public class RedPacketInfoActivity extends AbsActivity implements View.OnClickLi
} else { } else {
status.setText(R.string.red_packet_info_status_timeout); status.setText(R.string.red_packet_info_status_timeout);
} }
if (bean.getAmountRefund() == 0) { if (bean.getRedPacketStatus() == 1 && bean.getAmountRefund() == 0){
gold.setVisibility(View.GONE); gold.setVisibility(View.GONE);
backAccountText.setText(R.string.red_packet_info_residue_none); backAccountText.setText(R.string.red_packet_info_residue_none);
} else { } else{
gold.setVisibility(View.VISIBLE); gold.setVisibility(View.VISIBLE);
backAccountText.setText(mContext.getString(R.string.red_packet_info_residue_back) + " +" + bean.getAmountDiamond());
}
if (bean.getRedPacketStatus() == 2 && bean.getAmountRefund() == 0) {
icon.setImageResource(R.mipmap.gold_coin);
backAccountText.setText(mContext.getString(R.string.red_packet_info_residue_back) + " +" + bean.getAmountRefund()); backAccountText.setText(mContext.getString(R.string.red_packet_info_residue_back) + " +" + bean.getAmountRefund());
} }
} }

View File

@ -45,7 +45,7 @@ public class RedPacketUsersActivity extends AbsActivity implements View.OnClickL
avatar = findViewById(R.id.avatar); avatar = findViewById(R.id.avatar);
title = findViewById(R.id.title); title = findViewById(R.id.title);
money = findViewById(R.id.money); money = findViewById(R.id.money);
icon = findViewById(R.id.avatar); icon = findViewById(R.id.icon);
open = findViewById(R.id.open_packet); open = findViewById(R.id.open_packet);
redPacketId=getIntent().getIntExtra("id",0); redPacketId=getIntent().getIntExtra("id",0);
adapter = new RedPacketUserRecyclerAdapter(this); adapter = new RedPacketUserRecyclerAdapter(this);
@ -81,7 +81,7 @@ public class RedPacketUsersActivity extends AbsActivity implements View.OnClickL
private void setData(RedPacketDetailsBean bean){ private void setData(RedPacketDetailsBean bean){
ImgLoader.display(mContext,bean.getAvatarThumb(),avatar); ImgLoader.display(mContext,bean.getAvatarThumb(),avatar);
title.setText(bean.getNiceName()); title.setText(bean.getNiceName());
money.setText(bean.getMoney()+""); money.setText(bean.getDiamond()+"");
open.setText(mContext.getString(R.string.red_packet_user_tips)+" "+bean.getAlready()+"/"+bean.getQuantity()); open.setText(mContext.getString(R.string.red_packet_user_tips)+" "+bean.getAlready()+"/"+bean.getQuantity());
} }

View File

@ -5,6 +5,7 @@ import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -13,6 +14,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.makeramen.roundedimageview.RoundedImageView; import com.makeramen.roundedimageview.RoundedImageView;
import com.yunbao.common.bean.RedPacketDetailsBean; import com.yunbao.common.bean.RedPacketDetailsBean;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
import java.util.ArrayList; import java.util.ArrayList;
@ -53,6 +55,7 @@ public class RedPacketUserRecyclerAdapter extends RecyclerView.Adapter<RedPacket
public class ItemViewHolder extends RecyclerView.ViewHolder { public class ItemViewHolder extends RecyclerView.ViewHolder {
private TextView title, timer, money; private TextView title, timer, money;
private RoundedImageView icon; private RoundedImageView icon;
private ImageView giftIcon;
public ItemViewHolder(@NonNull View itemView) { public ItemViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
@ -60,15 +63,22 @@ public class RedPacketUserRecyclerAdapter extends RecyclerView.Adapter<RedPacket
timer = itemView.findViewById(R.id.time); timer = itemView.findViewById(R.id.time);
money = itemView.findViewById(R.id.money); money = itemView.findViewById(R.id.money);
icon = itemView.findViewById(R.id.avatar); icon = itemView.findViewById(R.id.avatar);
giftIcon = itemView.findViewById(R.id.icon2);
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private void setData(RedPacketDetailsBean.Detail bean) { private void setData(RedPacketDetailsBean.Detail bean) {
title.setText(bean.getNiceName()); title.setText(bean.getNiceName());
timer.setText(bean.getTime()); timer.setText(bean.getTime());
money.setText(bean.getMoney()+""); money.setText(bean.getMoney() + "");
ImgLoader.display(mContext,bean.getAvatarThumb(),icon); ImgLoader.display(mContext, bean.getAvatarThumb(), icon);
itemView.setTag(bean); itemView.setTag(bean);
if (!StringUtil.isEmpty(bean.getGifticon())) {
ImgLoader.display(mContext, bean.getGifticon(), giftIcon);
money.setText("x1");
} else {
giftIcon.setImageResource(R.mipmap.gold_coin);
}
} }
} }
} }

View File

@ -215,7 +215,7 @@
android:layout_width="22dp" android:layout_width="22dp"
android:layout_height="22dp" android:layout_height="22dp"
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
app:srcCompat="@mipmap/gold_coin" /> app:srcCompat="@mipmap/diamond" />
<TextView <TextView
android:id="@+id/backAccountText" android:id="@+id/backAccountText"

View File

@ -65,7 +65,7 @@
android:layout_marginEnd="6dp" android:layout_marginEnd="6dp"
app:layout_constraintEnd_toStartOf="@+id/money" app:layout_constraintEnd_toStartOf="@+id/money"
app:layout_constraintTop_toTopOf="@+id/money" app:layout_constraintTop_toTopOf="@+id/money"
app:srcCompat="@mipmap/gold_coin" /> app:srcCompat="@mipmap/diamond" />
<TextView <TextView
android:id="@+id/open_packet" android:id="@+id/open_packet"