update 红包记录列表

This commit is contained in:
zlzw 2023-06-26 14:57:11 +08:00
parent 5f33fa38f6
commit 3bf594d0b5
14 changed files with 701 additions and 24 deletions

View File

@ -15,6 +15,7 @@
app:srcCompat="@mipmap/diamond" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginStart="8dp"
@ -53,4 +54,13 @@
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:layout_marginTop="5dp"
app:layout_constraintTop_toBottomOf="@+id/linearLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/linearLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:scaleType="centerCrop"
android:layout_marginStart="21dp"
android:layout_marginTop="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:riv_border_color="#FFFFFF"
app:riv_border_width="2dp"
app:riv_oval="true" />
<ImageView
android:id="@+id/icon2"
android:layout_width="20dp"
android:layout_height="20dp"
app:layout_constraintEnd_toStartOf="@+id/money"
android:layout_marginEnd="2dp"
app:layout_constraintTop_toTopOf="@+id/money"
app:srcCompat="@mipmap/diamond" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginBottom="-5dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="@+id/avatar"
app:layout_constraintStart_toEndOf="@+id/avatar"
app:layout_constraintTop_toTopOf="@+id/avatar">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="#000000"
android:textSize="14sp" />
<TextView
android:id="@+id/time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="#90000000"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="@+id/money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="26dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:visibility="gone"
android:layout_width="0dp"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:layout_marginTop="5dp"
app:layout_constraintTop_toBottomOf="@+id/linearLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/linearLayout" />
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -147,6 +147,15 @@
<activity
android:name=".activity.CustomerServiceWebViewActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.RedPacketListActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.RedPacketInfoActivity"
android:screenOrientation="portrait" />
<activity
android:name=".activity.RedPacketUsersActivity"
android:screenOrientation="portrait" />
</application>
</manifest>

View File

@ -1,23 +0,0 @@
package com.yunbao.main.activity;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.main.R;
public class RedPacketActivity extends AbsActivity {
private RecyclerView recyclerView;
@Override
protected int getLayoutId() {
return R.layout.activity_red_packet;
}
@Override
public void init() {
super.init();
((TextView)findViewById(R.id.titleView)).setText("紅包記錄");
recyclerView=findViewById(R.id.recyclerView);
}
}

View File

@ -0,0 +1,29 @@
package com.yunbao.main.activity;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.main.R;
public class RedPacketInfoActivity extends AbsActivity implements View.OnClickListener{
@Override
protected int getLayoutId() {
return R.layout.activity_red_packet_info;
}
@Override
protected void main() {
super.main();
findViewById(R.id.red_packet_info).setOnClickListener(this);
}
@Override
public void onClick(View v) {
int id=v.getId();
if(id==R.id.red_packet_info){
startActivity(new Intent(this, RedPacketUsersActivity.class));
}
}
}

View File

@ -0,0 +1,49 @@
package com.yunbao.main.activity;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.main.R;
import com.yunbao.main.adapter.RedPacketListRecyclerAdapter;
import com.yunbao.main.bean.RedPacketListBean;
import java.util.ArrayList;
import java.util.List;
public class RedPacketListActivity extends AbsActivity {
private RecyclerView recyclerView;
private RedPacketListRecyclerAdapter adapter;
@Override
protected int getLayoutId() {
return R.layout.activity_red_packet;
}
@Override
public void main() {
super.main();
((TextView) findViewById(R.id.titleView)).setText("紅包記錄");
recyclerView = findViewById(R.id.recyclerView);
adapter = new RedPacketListRecyclerAdapter(this);
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(adapter);
initData();
}
private void initData() {
List<RedPacketListBean> list = new ArrayList<>();
for (int i = 1; i <= 5; i++) {
RedPacketListBean bean = new RedPacketListBean();
bean.setTitle("攢人氣紅包" + i);
bean.setTimer("X月X日 " + i);
bean.setMoney(i * 1000 + "");
list.add(bean);
}
adapter.setList(list);
}
}

View File

@ -0,0 +1,52 @@
package com.yunbao.main.activity;
import android.view.View;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.common.activity.AbsActivity;
import com.yunbao.main.R;
import com.yunbao.main.adapter.RedPacketUserRecyclerAdapter;
import com.yunbao.main.bean.RedPacketListBean;
import java.util.ArrayList;
import java.util.List;
public class RedPacketUsersActivity extends AbsActivity implements View.OnClickListener{
private RecyclerView recyclerView;
private RedPacketUserRecyclerAdapter adapter;
@Override
protected int getLayoutId() {
return R.layout.activity_red_packet_users;
}
@Override
protected void main() {
super.main();
recyclerView = findViewById(R.id.recyclerView);
adapter = new RedPacketUserRecyclerAdapter(this);
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(adapter);
initData();
}
@Override
public void onClick(View v) {
int id=v.getId();
}
private void initData() {
List<RedPacketListBean> list = new ArrayList<>();
for (int i = 1; i <= 5; i++) {
RedPacketListBean bean = new RedPacketListBean();
bean.setTitle("攢人氣紅包 - 主播昵稱的直播間" + i);
bean.setTimer("X月X日 " + i);
bean.setMoney(i * 1000 + "");
list.add(bean);
}
adapter.setList(list);
}
}

View File

@ -0,0 +1,69 @@
package com.yunbao.main.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.main.R;
import com.yunbao.main.activity.RedPacketInfoActivity;
import com.yunbao.main.bean.RedPacketListBean;
import java.util.List;
public class RedPacketListRecyclerAdapter extends RecyclerView.Adapter<RedPacketListRecyclerAdapter.ItemViewHolder> {
private List<RedPacketListBean> list;
private Context mContext;
public RedPacketListRecyclerAdapter(Context mContext) {
this.mContext = mContext;
}
public void setList(List<RedPacketListBean> list) {
this.list = list;
notifyDataSetChanged();
}
@NonNull
@Override
public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ItemViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_red_packet, parent, false));
}
@Override
public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
holder.setData(list.get(position));
}
@Override
public int getItemCount() {
return list.size();
}
public class ItemViewHolder extends RecyclerView.ViewHolder {
private TextView title, timer, money;
private ImageView icon;
public ItemViewHolder(@NonNull View itemView) {
super(itemView);
title = itemView.findViewById(R.id.title);
timer = itemView.findViewById(R.id.time);
money = itemView.findViewById(R.id.money);
icon = itemView.findViewById(R.id.icon);
itemView.setOnClickListener(v -> mContext.startActivity(new Intent(mContext, RedPacketInfoActivity.class)));
}
private void setData(RedPacketListBean bean) {
title.setText(bean.getTitle());
timer.setText(bean.getTimer());
money.setText(bean.getMoney());
itemView.setTag(bean);
}
}
}

View File

@ -0,0 +1,69 @@
package com.yunbao.main.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.yunbao.main.R;
import com.yunbao.main.activity.RedPacketInfoActivity;
import com.yunbao.main.bean.RedPacketListBean;
import java.util.List;
public class RedPacketUserRecyclerAdapter extends RecyclerView.Adapter<RedPacketUserRecyclerAdapter.ItemViewHolder> {
private List<RedPacketListBean> list;
private Context mContext;
public RedPacketUserRecyclerAdapter(Context mContext) {
this.mContext = mContext;
}
public void setList(List<RedPacketListBean> list) {
this.list = list;
notifyDataSetChanged();
}
@NonNull
@Override
public ItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ItemViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_user_red_packet, parent, false));
}
@Override
public void onBindViewHolder(@NonNull ItemViewHolder holder, int position) {
holder.setData(list.get(position));
}
@Override
public int getItemCount() {
return list.size();
}
public class ItemViewHolder extends RecyclerView.ViewHolder {
private TextView title, timer, money;
private ImageView icon;
public ItemViewHolder(@NonNull View itemView) {
super(itemView);
title = itemView.findViewById(R.id.title);
timer = itemView.findViewById(R.id.time);
money = itemView.findViewById(R.id.money);
icon = itemView.findViewById(R.id.icon);
itemView.setOnClickListener(v -> mContext.startActivity(new Intent(mContext, RedPacketInfoActivity.class)));
}
private void setData(RedPacketListBean bean) {
title.setText(bean.getTitle());
timer.setText(bean.getTimer());
money.setText(bean.getMoney());
itemView.setTag(bean);
}
}
}

View File

@ -0,0 +1,33 @@
package com.yunbao.main.bean;
import com.yunbao.common.bean.BaseModel;
public class RedPacketListBean extends BaseModel {
private String title;
private String timer;
private String money;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTimer() {
return timer;
}
public void setTimer(String timer) {
this.timer = timer;
}
public String getMoney() {
return money;
}
public void setMoney(String money) {
this.money = money;
}
}

View File

@ -1,6 +1,8 @@
package com.yunbao.main.views;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -8,6 +10,7 @@ import android.widget.ImageView;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.main.R;
import com.yunbao.main.activity.RedPacketListActivity;
/**
* Created by cxf on 2018/9/22.
@ -38,7 +41,13 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder {
ImgLoader.display(mContext, "https://downs.yaoulive.com/gif_trophy.gif", img_trophy);
img_trophy.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
mContext.startActivity(new Intent(mContext, RedPacketListActivity.class));
return false;
}
});
}

View File

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/btn_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:onClick="backClick"
android:padding="9dp"
android:src="@mipmap/icon_dialog_charge_close"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="@color/textColor" />
<ImageView
android:id="@+id/icon"
android:layout_width="74dp"
android:layout_height="74dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_back"
app:srcCompat="@mipmap/icon_diamond2" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/icon" />
<TextView
android:id="@+id/money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title" />
<View
android:id="@+id/line"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="32dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="32dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/money" />
<LinearLayout
android:id="@+id/status"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:layout_marginTop="24dp"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/line">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="當前狀態"
android:textColor="#000000"
android:textSize="14sp" />
<TextView
android:id="@+id/red_packet_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_weight="1"
android:text="紅包已過期"
android:textColor="#000000"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/status">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="紅包詳情"
android:textColor="#000000"
android:textSize="14sp" />
<TextView
android:id="@+id/red_packet_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_weight="1"
android:text="查看"
android:textColor="#1E73D7"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/timer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/info">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="支付時間"
android:textColor="#000000"
android:textSize="14sp" />
<TextView
android:id="@+id/red_packet_timer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_weight="1"
android:text="2023年6月6日 13:50:52"
android:textColor="#000000"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/play_model"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/timer">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="支付方式"
android:textColor="#000000"
android:textSize="14sp" />
<TextView
android:id="@+id/red_packet_model"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_weight="1"
android:text="鉆石餘額"
android:textColor="#000000"
android:textSize="14sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/btn_back"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_marginTop="24dp"
android:onClick="backClick"
android:padding="9dp"
android:src="@mipmap/icon_dialog_charge_close"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="@color/textColor" />
<com.makeramen.roundedimageview.RoundedImageView
android:id="@+id/avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_back"
app:riv_border_color="#FFFFFF"
app:riv_border_width="2dp"
app:riv_oval="true" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/avatar" />
<TextView
android:id="@+id/money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="TextView"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title" />
<ImageView
android:id="@+id/icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="6dp"
app:layout_constraintEnd_toStartOf="@+id/money"
app:layout_constraintTop_toTopOf="@+id/money"
app:srcCompat="@mipmap/diamond" />
<TextView
android:id="@+id/open_packet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:text="已打開 11/20"
android:textColor="#000000"
android:textSize="12sp"
app:layout_constraintBottom_toTopOf="@+id/line"
app:layout_constraintStart_toStartOf="@+id/line" />
<View
android:id="@+id/line"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginStart="32dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="32dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/money" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
tools:listitem="@layout/item_user_red_packet"
tools:itemCount="10"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/line"
app:layout_constraintStart_toStartOf="@+id/line"
app:layout_constraintTop_toBottomOf="@+id/line" />
</androidx.constraintlayout.widget.ConstraintLayout>