parent
0d7b507235
commit
20d7acc16c
@ -0,0 +1,30 @@
|
||||
package com.example.orangesale_end.activity.holder;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.orangesale_end.R;
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder
|
||||
{
|
||||
public TextView shproductid;
|
||||
public TextView shuserid;
|
||||
public ImageView imageView;
|
||||
public TextView shid;
|
||||
public TextView shproductnum;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
shid = itemView.findViewById(R.id.shid);
|
||||
shuserid=itemView.findViewById(R.id.userid);
|
||||
shproductnum=itemView.findViewById(R.id.shproductnum);
|
||||
imageView=itemView.findViewById(R.id.shoppingproductpicture);
|
||||
shproductid=itemView.findViewById(R.id.shproductid);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.example.orangesale_end.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.orangesale_end.R;
|
||||
import com.example.orangesale_end.activity.holder.ViewHolder;
|
||||
import com.example.orangesale_end.entity.OrangeShoppingcart;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ShoppingcartAdapter extends RecyclerView.Adapter<ViewHolder> {
|
||||
private Context context;
|
||||
private List <OrangeShoppingcart> orangeShoppingcarts;
|
||||
|
||||
public ShoppingcartAdapter(List<OrangeShoppingcart> orangeShoppingcarts, Context context) {
|
||||
this.orangeShoppingcarts = orangeShoppingcarts;
|
||||
this.context=context;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view=View.inflate(context,R.layout.item_review_shopping,null);
|
||||
ViewHolder viewHolder=new ViewHolder(view);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
OrangeShoppingcart orangeShoppingcart=orangeShoppingcarts.get(position);
|
||||
holder.imageView.setImageResource(orangeShoppingcart.getImgUrl());
|
||||
holder.shid.setText(String.valueOf(orangeShoppingcart.getId()));
|
||||
holder.shproductid.setText(String.valueOf(orangeShoppingcart.getProductId()));
|
||||
holder.shproductnum.setText(String.valueOf(orangeShoppingcart.getNum()));
|
||||
holder.shuserid.setText(String.valueOf(orangeShoppingcart.getUserId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return orangeShoppingcarts.size();
|
||||
}
|
||||
|
||||
/* @Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
|
||||
ViewHolder viewHolder;
|
||||
if (view==null)
|
||||
{
|
||||
view=LayoutInflater.from(context).inflate(R.layout.item_gridview_shopping,null);
|
||||
viewHolder=new ViewHolder();
|
||||
viewHolder.shproductid=view.findViewById(R.id.shproductid);
|
||||
viewHolder.shuserid=view.findViewById(R.id.userid);
|
||||
viewHolder.imageView=view.findViewById(R.id.shoppingproductpicture);
|
||||
viewHolder.shid=view.findViewById(R.id.shid);
|
||||
viewHolder.shproductnum=view.findViewById(R.id.shproductnum);
|
||||
view.setTag(viewHolder);
|
||||
}
|
||||
else {
|
||||
viewHolder = (ViewHolder)view.getTag();
|
||||
}
|
||||
OrangeShoppingcart orangeShoppingcart = orangeShoppingcarts.get(i);
|
||||
if (orangeShoppingcart!=null)
|
||||
{
|
||||
viewHolder.shuserid.setText(String.valueOf(orangeShoppingcart.getUserId()));
|
||||
viewHolder.shproductid.setText(String.valueOf(orangeShoppingcart.getProductId()));
|
||||
viewHolder.imageView.setImageResource(
|
||||
orangeShoppingcart.getImgUrl());
|
||||
viewHolder.shid.setText(String.valueOf(orangeShoppingcart.getId()));
|
||||
viewHolder.shproductnum.setText(String.valueOf(orangeShoppingcart.getNum()));
|
||||
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package com.example.orangesale_end.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class OrangeShoppingcart implements Serializable {
|
||||
/**
|
||||
* 自增主键
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String productId;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String num;
|
||||
private Integer imgUrl;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public OrangeShoppingcart() {
|
||||
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(String productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(String num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrangeShoppingcart{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", productId=" + productId +
|
||||
", num=" + num +
|
||||
", imgUrl=" + imgUrl +
|
||||
'}';
|
||||
}
|
||||
|
||||
public OrangeShoppingcart(String id, String userId, String productId,String num, int imgUrl) {
|
||||
this.id = id;
|
||||
this.userId = userId;
|
||||
this.productId = productId;
|
||||
this.num = num;
|
||||
this.imgUrl = imgUrl;
|
||||
|
||||
}
|
||||
|
||||
public int getImgUrl() {
|
||||
return imgUrl;
|
||||
}
|
||||
|
||||
public void setImgUrl(int imgUrl) {
|
||||
this.imgUrl = imgUrl;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.example.orangesale_end.util;
|
||||
|
||||
|
||||
/**
|
||||
* 常量
|
||||
* @author llw
|
||||
*/
|
||||
public class Constant {
|
||||
|
||||
public static final String CAR_JSON = "{ \"code\" : 200 ,\n" +
|
||||
" \"orderData\" : [\n" +
|
||||
" {\n" +
|
||||
"\n" +
|
||||
" \"productproduce\":\"活力早餐\",\n" +
|
||||
" \"cartlist\": [\n" +
|
||||
" {\n" +
|
||||
" \"id\": 1,\n" +
|
||||
" \"productproduce\": \"活力早餐\",\n" +
|
||||
" \"defaultPic\": \"https://tse2-mm.cn.bing.net/th/id/OIP-C.FKgYJy9NYrL4RZKo42VCIAHaE8?w=292&h=195&c=7&r=0&o=5&dpr=1.3&pid=1.7\",\n" +
|
||||
" \"productId\": 1,\n" +
|
||||
" \"productName\": \"纯奶吐司\",\n"+
|
||||
" \"price\": 10,\n" +
|
||||
" \"count\":1\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"id\": 2,\n" +
|
||||
" \"productproduce\": \"甜品慕斯\",\n" +
|
||||
" \"defaultPic\": \"https://img14.360buyimg.com/n0/jfs/t2971/15/167732091/93002/204c1016/574d9d9aNe4e6fa7a.jpg\",\n" +
|
||||
" \"productId\": 2,\n" +
|
||||
" \"productName\": \"草莓慕斯蛋糕\",\n"+
|
||||
" \"price\": 19.9,\n" +
|
||||
" \"count\": 1\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
" }\n" +
|
||||
" ,\n" +
|
||||
" {\n" +
|
||||
" \"productproduce\":\"中式传统糕点\",\n" +
|
||||
" \"cartlist\": [\n" +
|
||||
" {\n" +
|
||||
" \"id\": 1,\n" +
|
||||
" \"productp\": \"中式传统糕点\",\n" +
|
||||
" \"defaultPic\": \"https://img.alicdn.com/imgextra/i4/2208137990237/O1CN01ap4J4O1DcaTrhAIvA_!!2208137990237.jpg\",\n" +
|
||||
" \"productId\": 1,\n" +
|
||||
" \"productName\": \"桃酥\",\n" +
|
||||
" \"price\": 10.9,\n" +
|
||||
" \"count\":1\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
" }\n" +
|
||||
" ,\n" +
|
||||
" {\n" +
|
||||
" \"productproduce\":\"中式新糕点\",\n" +
|
||||
" \"cartlist\": [\n" +
|
||||
" {\n" +
|
||||
" \"id\": 1,\n" +
|
||||
" \"productproduce\":\"中式新糕点\",\n" +
|
||||
" \"defaultPic\": \"https://ts1.cn.mm.bing.net/th/id/R-C.528c10e20ecf8276a0d05363506924e1?rik=wzIkFM3Eu7TH6A&riu=http%3a%2f%2fimg.zcool.cn%2fcommunity%2f011f6258d54bc5a801219c77be307c.jpg%401280w_1l_2o_100sh.jpg&ehk=fM6ac87gUuwrvLINm7jeR804iZweyvlAWbbCi2%2bEknU%3d&risl=&pid=ImgRaw&r=0\",\n" +
|
||||
" \"productId\": 1,\n" +
|
||||
" \"productName\": \"冰皮绿豆糕\",\n" +
|
||||
" \"price\": 15.9,\n" +
|
||||
" \"count\":1\n" +
|
||||
" },\n" +
|
||||
"}";
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke android:color="#000"
|
||||
android:width="0.5dp"/>
|
||||
</shape>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke android:color="#000"
|
||||
android:width="0.5dp"/>
|
||||
<corners android:topRightRadius="4dp"
|
||||
android:bottomRightRadius="4dp" />
|
||||
</shape>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke android:color="#000"
|
||||
android:width="0.5dp"/>
|
||||
<corners android:topLeftRadius="4dp"
|
||||
android:bottomLeftRadius="4dp" />
|
||||
</shape>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp"/>
|
||||
<gradient
|
||||
android:startColor="#FF5C13"
|
||||
android:endColor="#FC7D0B"
|
||||
android:angle="90" />
|
||||
</shape>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp"/>
|
||||
<gradient
|
||||
android:startColor="#FF5C13"
|
||||
android:endColor="#FC7D0B"
|
||||
android:angle="90" />
|
||||
</shape>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:pathData="M12,22.5c-5.79,0 -10.5,-4.71 -10.5,-10.5S6.21,1.5 12,1.5 22.5,6.21 22.5,12 17.79,22.5 12,22.5zM12,3c-4.963,0 -9,4.037 -9,9s4.037,9 9,9 9,-4.037 9,-9S16.963,3 12,3z"
|
||||
android:fillColor="#a9b7b7"/>
|
||||
</vector>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#eb4f38"
|
||||
android:pathData="M12,1.546c-5.764,0 -10.454,4.69 -10.454,10.454 0,5.765 4.689,10.454 10.454,10.454S22.454,17.765 22.454,12C22.454,6.236 17.765,1.546 12,1.546zM17.044,10.276 L11.039,16.346c-0.001,0.001 -0.005,0.002 -0.006,0.005 -0.002,0.001 -0.002,0.005 -0.005,0.006 -0.048,0.046 -0.107,0.075 -0.163,0.107 -0.028,0.016 -0.05,0.04 -0.08,0.051 -0.09,0.036 -0.185,0.055 -0.28,0.055 -0.096,0 -0.193,-0.019 -0.284,-0.056 -0.03,-0.013 -0.054,-0.038 -0.082,-0.054 -0.056,-0.031 -0.113,-0.059 -0.161,-0.107 -0.001,-0.001 -0.002,-0.005 -0.004,-0.006 -0.001,-0.002 -0.005,-0.002 -0.006,-0.005l-2.954,-3.035c-0.289,-0.297 -0.282,-0.772 0.015,-1.061 0.297,-0.288 0.771,-0.283 1.061,0.015l2.42,2.487 5.467,-5.527c0.291,-0.295 0.767,-0.298 1.061,-0.006C17.333,9.506 17.335,9.981 17.044,10.276z" />
|
||||
</vector>
|
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout 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"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="商品序号"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/shproductid"
|
||||
app:layout_constraintStart_toStartOf="@+id/shoppingproductpicture" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shproductid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="商品id"
|
||||
app:layout_constraintStart_toStartOf="@+id/shid"
|
||||
app:layout_constraintTop_toTopOf="@+id/shoppingproductpicture" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/userid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="用户id"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/shid"
|
||||
app:layout_constraintStart_toStartOf="@+id/shid" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/shoppingproductpicture"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shproductnum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="商品数量"
|
||||
app:layout_constraintBaseline_toBaselineOf="@+id/shid"
|
||||
app:layout_constraintStart_toStartOf="@+id/shid" />
|
||||
</LinearLayout>
|
@ -1,6 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<<<<<<< HEAD
|
||||
<color name="colorPrimary">#ffc0cb</color>
|
||||
<color name="colorPrimaryDark">#ffc0cb</color>
|
||||
<color name="colorAccent">#ffc0cb</color>
|
||||
=======
|
||||
<color name="colorPrimary">#008577</color>
|
||||
<color name="colorPrimaryDark">#00574B</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
>>>>>>> 76999d0 (last)
|
||||
</resources>
|
||||
|
@ -0,0 +1,20 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
|
Binary file not shown.
@ -1,6 +1,10 @@
|
||||
include ':app'
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
rootProject.name='yemamacake'
|
||||
=======
|
||||
rootProject.name='OrangeSale_End'
|
||||
>>>>>>> 8d271bc (end_code)
|
||||
=======
|
||||
rootProject.name='OrangeSale_End'
|
||||
>>>>>>> 76999d0 (last)
|
||||
|
Loading…
Reference in new issue