diff --git a/app/src/main.zip b/app/src/main.zip
new file mode 100644
index 0000000..167b98d
Binary files /dev/null and b/app/src/main.zip differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8313eaa..49017b0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.example.register">
+
@@ -25,10 +26,10 @@
-
-
+
+
-
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/register/TimeService.java b/app/src/main/java/com/example/register/TimeService.java
new file mode 100644
index 0000000..619c5fd
--- /dev/null
+++ b/app/src/main/java/com/example/register/TimeService.java
@@ -0,0 +1,107 @@
+package com.example.register;
+
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.os.AsyncTask;
+import android.os.Build;
+import android.os.IBinder;
+import android.util.Log;
+
+import androidx.annotation.Nullable;
+import androidx.core.app.NotificationCompat;
+
+import com.example.register.entity.OrangeMessage;
+import com.example.register.netrequest.OkHttpMessage;
+
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Objects;
+import java.util.Timer;
+import java.util.TimerTask;
+
+public class TimeService extends Service {
+ private static Timer timer = null;
+ private NotificationManager manager;
+ private NotificationCompat.Builder builder;
+
+ @Nullable
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ /**
+ * 清除通知
+ */
+ private void cleanAllNotification() {
+ manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ manager.cancelAll();
+ if (timer != null) {
+ timer.cancel();
+ timer = null;
+ }
+
+ }
+
+ /**
+ * 添加通知
+ */
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ long period = 60 * 1000; //1分钟一个周期
+ if (timer == null) {
+ timer = new Timer();
+ }
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ new ConsumeMessageTask().execute();
+ }
+ }, 0, period);
+
+ return super.onStartCommand(intent, flags, startId);
+ }
+
+ class ConsumeMessageTask extends AsyncTask {
+ @Override
+ protected Void doInBackground(Void... voids) {
+ /**
+ * NotificationChannel是android8.0新增的特性,如果App的targetSDKVersion>=26,
+ * 没有设置channel通知渠道的话,就会导致通知无法展示。
+ * 报错内容:Failed to post notification on channel “null”
+ */
+ OkHttpMessage okHttpMessage = new OkHttpMessage();
+ OrangeMessage orangeMessage;
+ try {
+ orangeMessage = okHttpMessage.consumeMessage();
+ if (!Objects.isNull(orangeMessage)) {
+ Log.i("orangeMessage", "run: " + orangeMessage.toString());
+ NotificationChannel channel = new NotificationChannel("channel", "通知", NotificationManager.IMPORTANCE_DEFAULT);
+ manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ manager.createNotificationChannel(channel);
+ }
+ builder = new NotificationCompat.Builder(TimeService.this);
+ Date date = new Date();
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ builder.setContentTitle("来自橙一色的系统通知消息" + " " + formatter.format(date));
+ builder.setSmallIcon(R.drawable.chengzi);
+ builder.setChannelId("channel");
+ builder.setContentText(orangeMessage.getContent());
+ builder.setAutoCancel(true);
+ builder.setDefaults(Notification.DEFAULT_ALL);
+ Notification notification = builder.build();
+ manager.notify(1, notification);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/register/IndexActivity.java b/app/src/main/java/com/example/register/activity/IndexActivity.java
similarity index 99%
rename from app/src/main/java/com/example/register/IndexActivity.java
rename to app/src/main/java/com/example/register/activity/IndexActivity.java
index 7d06d81..7696f9c 100644
--- a/app/src/main/java/com/example/register/IndexActivity.java
+++ b/app/src/main/java/com/example/register/activity/IndexActivity.java
@@ -1,4 +1,4 @@
-package com.example.register;
+package com.example.register.activity;
import android.app.Activity;
import android.app.FragmentTransaction;
diff --git a/app/src/main/java/com/example/register/loginActivity.java b/app/src/main/java/com/example/register/activity/loginActivity.java
similarity index 96%
rename from app/src/main/java/com/example/register/loginActivity.java
rename to app/src/main/java/com/example/register/activity/loginActivity.java
index fc521b2..5d91c93 100644
--- a/app/src/main/java/com/example/register/loginActivity.java
+++ b/app/src/main/java/com/example/register/activity/loginActivity.java
@@ -1,4 +1,4 @@
-package com.example.register;
+package com.example.register.activity;
import android.content.Intent;
import android.database.Cursor;
@@ -11,8 +11,7 @@ import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
-import com.example.register.IndexActivity;
-import com.example.register.registerActivity;
+import com.example.register.R;
import com.example.register.dateoperation.Database;
diff --git a/app/src/main/java/com/example/register/registerActivity.java b/app/src/main/java/com/example/register/activity/registerActivity.java
similarity index 98%
rename from app/src/main/java/com/example/register/registerActivity.java
rename to app/src/main/java/com/example/register/activity/registerActivity.java
index 2338fe0..87563c6 100644
--- a/app/src/main/java/com/example/register/registerActivity.java
+++ b/app/src/main/java/com/example/register/activity/registerActivity.java
@@ -1,4 +1,4 @@
-package com.example.register;
+package com.example.register.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.content.ContentValues;
@@ -9,13 +9,15 @@ import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.graphics.Color;
+
+import com.example.register.R;
import com.lljjcoder.citypickerview.widget.CityPicker;
-import androidx.annotation.Nullable;
+
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
-import com.example.register.R;
+
import com.example.register.dateoperation.Database;
public class registerActivity extends AppCompatActivity implements View.OnClickListener {
diff --git a/app/src/main/java/com/example/register/userActivity.java b/app/src/main/java/com/example/register/activity/userActivity.java
similarity index 93%
rename from app/src/main/java/com/example/register/userActivity.java
rename to app/src/main/java/com/example/register/activity/userActivity.java
index 9c3bb8b..7d4dd99 100644
--- a/app/src/main/java/com/example/register/userActivity.java
+++ b/app/src/main/java/com/example/register/activity/userActivity.java
@@ -1,18 +1,16 @@
-package com.example.register;
+package com.example.register.activity;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
-import android.annotation.SuppressLint;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
-import android.widget.TextView;
-import android.app.Activity;
+
+import com.example.register.CategoryActivity;
import com.example.register.R;
-import androidx.annotation.Nullable;
public class userActivity extends AppCompatActivity implements View.OnClickListener{
EditText username,sex,city;
diff --git a/app/src/main/java/com/example/register/adapter/ListViewAdapter.java b/app/src/main/java/com/example/register/adapter/ListViewAdapter.java
new file mode 100644
index 0000000..20c79d1
--- /dev/null
+++ b/app/src/main/java/com/example/register/adapter/ListViewAdapter.java
@@ -0,0 +1,78 @@
+package com.example.register.adapter;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.example.register.R;
+import com.example.register.entity.Condition;
+
+import java.util.List;
+
+public class ListViewAdapter extends BaseAdapter {
+ private List conditionList;
+ private LayoutInflater layoutInflater;
+ private int selectedPosition = -1;
+ private int selectColor = Color.GRAY;
+
+ public ListViewAdapter(Context context, List conditionList) {
+ this.conditionList = conditionList;
+ this.layoutInflater = LayoutInflater.from(context);
+ }
+
+ @Override
+ public int getCount() {
+ return conditionList.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return conditionList.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ ViewHolder viewHolder;
+ if (convertView == null) {
+ convertView = layoutInflater.inflate(R.layout.product_condition_item, null);
+ viewHolder = new ViewHolder();
+ viewHolder.imageView = convertView.findViewById(R.id.condition_icon);
+ viewHolder.jiange = convertView.findViewById(R.id.image_jiange);
+ viewHolder.textView = convertView.findViewById(R.id.condition_name);
+ viewHolder.linearLayout = convertView.findViewById(R.id.item_bg);
+ convertView.setTag(viewHolder);
+ } else {
+ viewHolder = (ViewHolder) convertView.getTag();
+ }
+ Condition condition = conditionList.get(position);
+ if (condition != null) {
+ viewHolder.imageView.setBackgroundResource(condition.getConditionIcon());
+ viewHolder.textView.setText(condition.getConditionName());
+ viewHolder.jiange.setBackgroundColor(Color.rgb(207, 207, 207));
+ if (selectedPosition == position) {
+ viewHolder.linearLayout.setBackgroundColor(selectColor);
+ }
+
+ }
+ return convertView;
+ }
+
+ class ViewHolder {
+ ImageView imageView, jiange;
+ TextView textView;
+ LinearLayout linearLayout;
+ }
+
+
+}
diff --git a/app/src/main/java/com/example/register/entity/Condition.java b/app/src/main/java/com/example/register/entity/Condition.java
new file mode 100644
index 0000000..8473fb5
--- /dev/null
+++ b/app/src/main/java/com/example/register/entity/Condition.java
@@ -0,0 +1,30 @@
+package com.example.register.entity;
+
+public class Condition {
+ private Integer conditionIcon;
+ private String conditionName;
+
+ public Integer getConditionIcon() {
+ return conditionIcon;
+ }
+
+ public void setConditionIcon(Integer conditionIcon) {
+ this.conditionIcon = conditionIcon;
+ }
+
+ public String getConditionName() {
+ return conditionName;
+ }
+
+ public void setConditionName(String conditionName) {
+ this.conditionName = conditionName;
+ }
+
+ @Override
+ public String toString() {
+ return "Condition{" +
+ "conditionIcon=" + conditionIcon +
+ ", conditionName='" + conditionName + '\'' +
+ '}';
+ }
+}
diff --git a/app/src/main/java/com/example/register/entity/OrangeMessage.java b/app/src/main/java/com/example/register/entity/OrangeMessage.java
new file mode 100644
index 0000000..ae124e8
--- /dev/null
+++ b/app/src/main/java/com/example/register/entity/OrangeMessage.java
@@ -0,0 +1,52 @@
+package com.example.register.entity;
+
+import java.sql.Timestamp;
+
+public class OrangeMessage {
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public Timestamp getSendTime() {
+ return sendTime;
+ }
+
+ public void setSendTime(Timestamp sendTime) {
+ this.sendTime = sendTime;
+ }
+
+ public String getUsed() {
+ return used;
+ }
+
+ public void setUsed(String used) {
+ this.used = used;
+ }
+
+ private Integer id;
+ private String content;
+ private Timestamp sendTime;
+ private String used;
+
+ @Override
+ public String toString() {
+ return "OrangeMessage{" +
+ "id=" + id +
+ ", content='" + content + '\'' +
+ ", sendTime=" + sendTime +
+ ", used='" + used + '\'' +
+ '}';
+ }
+}
diff --git a/app/src/main/java/com/example/register/entity/OrangeProduct.java b/app/src/main/java/com/example/register/entity/OrangeProduct.java
new file mode 100644
index 0000000..5373b5b
--- /dev/null
+++ b/app/src/main/java/com/example/register/entity/OrangeProduct.java
@@ -0,0 +1,64 @@
+package com.example.register.entity;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+
+public class OrangeProduct {
+ private Integer id;
+ private String name;
+ private BigDecimal price;
+ private String imgUrl;
+
+ @Override
+ public String toString() {
+ return "OrangeProduct{" +
+ "id=" + id +
+ ", name='" + name + '\'' +
+ ", price=" + price +
+ ", imgUrl='" + imgUrl + '\'' +
+ ", addTime=" + addTime +
+ '}';
+ }
+
+ public Timestamp getAddTime() {
+ return addTime;
+ }
+
+ public void setAddTime(Timestamp addTime) {
+ this.addTime = addTime;
+ }
+
+ private Timestamp addTime;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public String getImgUrl() {
+ return imgUrl;
+ }
+
+ public void setImgUrl(String imgUrl) {
+ this.imgUrl = imgUrl;
+ }
+}
diff --git a/app/src/main/java/com/example/register/entity/OrangeProductPack.java b/app/src/main/java/com/example/register/entity/OrangeProductPack.java
new file mode 100644
index 0000000..77b9376
--- /dev/null
+++ b/app/src/main/java/com/example/register/entity/OrangeProductPack.java
@@ -0,0 +1,66 @@
+package com.example.register.entity;
+
+import android.graphics.Bitmap;
+
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+
+public class OrangeProductPack {
+ private Integer id;
+ private String name;
+ private Timestamp addTime;
+ private Bitmap imgBitmap;
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ private BigDecimal price;
+
+ @Override
+ public String toString() {
+ return "OrangeProductPack{" +
+ "id=" + id +
+ ", name='" + name + '\'' +
+ ", addTime=" + addTime +
+ ", imgBitmap=" + imgBitmap +
+ ", price=" + price +
+ '}';
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Timestamp getAddTime() {
+ return addTime;
+ }
+
+ public void setAddTime(Timestamp addTime) {
+ this.addTime = addTime;
+ }
+
+ public Bitmap getImgBitmap() {
+ return imgBitmap;
+ }
+
+ public void setImgBitmap(Bitmap imgBitmap) {
+ this.imgBitmap = imgBitmap;
+ }
+}
diff --git a/app/src/main/java/com/example/register/entity/ShoppingCart.java b/app/src/main/java/com/example/register/entity/ShoppingCart.java
new file mode 100644
index 0000000..817ce3d
--- /dev/null
+++ b/app/src/main/java/com/example/register/entity/ShoppingCart.java
@@ -0,0 +1,44 @@
+package com.example.register.entity;
+
+public class ShoppingCart {
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Integer userId) {
+ this.userId = userId;
+ }
+
+ public Integer getProductId() {
+ return ProductId;
+ }
+
+ public void setProductId(Integer productId) {
+ ProductId = productId;
+ }
+
+ public Integer getNumber() {
+ return number;
+ }
+
+ public void setNumber(Integer number) {
+ this.number = number;
+ }
+
+ private Integer id;
+ private Integer userId;
+ private Integer ProductId;
+ /**
+ * 购买数量
+ */
+ private Integer number;
+}
diff --git a/app/src/main/java/com/example/register/User.java b/app/src/main/java/com/example/register/entity/User.java
similarity index 97%
rename from app/src/main/java/com/example/register/User.java
rename to app/src/main/java/com/example/register/entity/User.java
index e047b26..e5d718e 100644
--- a/app/src/main/java/com/example/register/User.java
+++ b/app/src/main/java/com/example/register/entity/User.java
@@ -1,4 +1,4 @@
-package com.example.register;
+package com.example.register.entity;
public class User {
private String username;
diff --git a/app/src/main/java/com/example/register/netrequest/OkHttpClientProduct.java b/app/src/main/java/com/example/register/netrequest/OkHttpClientProduct.java
new file mode 100644
index 0000000..3429d08
--- /dev/null
+++ b/app/src/main/java/com/example/register/netrequest/OkHttpClientProduct.java
@@ -0,0 +1,80 @@
+package com.example.register.netrequest;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.example.orangesale_end.entity.OrangeProduct;
+import com.example.orangesale_end.entity.OrangeProductPack;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+
+public class OkHttpClientProduct {
+
+ /**
+ * 查询商品信息
+ *
+ * @return
+ */
+ public List getProduct() throws IOException {
+ OkHttpClient okHttpClient = new OkHttpClient();
+ Request request = new Request.Builder()
+ .url("http://192.168.43.115:8081/orange/product/search")
+ .build();
+ Response response = okHttpClient.newCall(request).execute();
+ JSONObject jsonObject = JSON.parseObject(Objects.requireNonNull(response.body()).string());
+ List list = JSON.parseObject(jsonObject.getString("data"), new TypeReference>() {
+ });
+ return list;
+ }
+
+ /**
+ * 获取图片
+ *
+ * @param imgUrl
+ * @return
+ * @throws IOException
+ */
+ public Bitmap getImageBitMap(String imgUrl) throws IOException {
+ Bitmap bitmap;
+ OkHttpClient okHttpClient = new OkHttpClient();
+ Request request = new Request.Builder()
+ .url(imgUrl)
+ .build();
+ Response response = okHttpClient.newCall(request).execute();
+ byte[] bytes = Objects.requireNonNull(response.body()).bytes();
+ bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
+ return bitmap;
+
+ }
+
+ /**
+ * 封装信息
+ *
+ * @return
+ * @throws IOException
+ */
+
+ public List getProductPack() throws IOException {
+ List packList = new ArrayList<>();
+ List list = getProduct();
+ for (OrangeProduct orangeProduct : list) {
+ OrangeProductPack orangeProductPack = new OrangeProductPack();
+ orangeProductPack.setId(orangeProduct.getId());
+ orangeProductPack.setImgBitmap(getImageBitMap(orangeProduct.getImgUrl()));
+ orangeProductPack.setAddTime(orangeProduct.getAddTime());
+ orangeProductPack.setPrice(orangeProduct.getPrice());
+ packList.add(orangeProductPack);
+ }
+ return packList;
+ }
+}
diff --git a/app/src/main/java/com/example/register/netrequest/OkHttpMessage.java b/app/src/main/java/com/example/register/netrequest/OkHttpMessage.java
new file mode 100644
index 0000000..b21f0d8
--- /dev/null
+++ b/app/src/main/java/com/example/register/netrequest/OkHttpMessage.java
@@ -0,0 +1,39 @@
+package com.example.register.netrequest;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.example.orangesale_end.entity.OrangeMessage;
+
+import java.io.IOException;
+import java.util.Objects;
+
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
+
+public class OkHttpMessage {
+
+ /**
+ * 消费消息
+ *
+ * @return
+ */
+ public OrangeMessage consumeMessage() throws IOException {
+ OkHttpClient okHttpClient = new OkHttpClient();
+ Request request = new Request.Builder()
+ .url("http://192.168.43.115:8081/orange/message/consumeMessage")
+ .build();
+ Response response = okHttpClient.newCall(request).execute();
+ JSONObject jsonObject = JSON.parseObject(Objects.requireNonNull(response.body()).string());
+ OrangeMessage orangeMessage = JSON.toJavaObject(jsonObject.getJSONObject("data"), OrangeMessage.class);
+ /**
+ * 消费完消息以后,设置消息为已读
+ */
+ Request request1 = new Request.Builder()
+ .url("http://192.168.43.115:8081/orange/message/updateMessage")
+ .build();
+ okHttpClient.newCall(request1).execute();
+ return orangeMessage;
+ }
+
+}
diff --git a/app/src/main/java/com/example/register/netrequest/OkHttpUser.java b/app/src/main/java/com/example/register/netrequest/OkHttpUser.java
new file mode 100644
index 0000000..d48ed32
--- /dev/null
+++ b/app/src/main/java/com/example/register/netrequest/OkHttpUser.java
@@ -0,0 +1,71 @@
+package com.example.register.netrequest;
+
+import android.util.Log;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.example.orangesale_end.entity.OrangeUser;
+
+import java.io.IOException;
+
+import okhttp3.MediaType;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.RequestBody;
+import okhttp3.Response;
+
+public class OkHttpUser {
+ /**
+ * 用户登录验证
+ *
+ * @param orangeUser
+ */
+ public OrangeUser userLogin(OrangeUser orangeUser) throws IOException {
+ OkHttpClient okHttpClient= new OkHttpClient();
+ //数据类型为json格式
+ MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
+ //将对象转为JSON字符串
+ String jsonStr = JSONObject.toJSONString(orangeUser);
+
+ RequestBody requestBody = RequestBody.create(jsonStr, mediaType);
+ Request request = new Request.Builder()
+ .url("http://192.168.43.115:8081/orange/user/login")
+ .post(requestBody)
+ .build();
+
+ Response response = okHttpClient.newCall(request).execute();
+
+ String responseStr = response.body().string();
+ System.out.println("responseStr = " + responseStr);
+ JSONObject jsonObject = JSON.parseObject(responseStr);
+ JSONObject jsonObject1 = jsonObject.getJSONObject("data");
+ OrangeUser orangeUser1 = JSON.toJavaObject(jsonObject1, OrangeUser.class);
+ return orangeUser1;
+ }
+
+ /**
+ * 用户注册
+ *
+ * @param orangeUser
+ * @return
+ * @throws IOException
+ */
+ public boolean userRegister(OrangeUser orangeUser) throws IOException {
+ OkHttpClient okHttpClient = new OkHttpClient();
+ //数据类型为json格式
+ MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
+ //将对象转为JSON字符串
+ String jsonStr = JSONObject.toJSONString(orangeUser);
+ RequestBody requestBody = RequestBody.create(jsonStr, mediaType);
+ Request request = new Request.Builder()
+ .url("http://192.168.43.115:8081/orange/user/register")
+ .post(requestBody)
+ .build();
+ Response response = okHttpClient.newCall(request).execute();
+ JSONObject jsonObject = JSON.parseObject(response.body().string());
+ Log.i("register", "userRegister: "+jsonObject);
+ return jsonObject.getBoolean("flag");
+ }
+
+
+}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 65a59d5..9dc463a 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- tools:context=".IndexActivity">
+ tools:context=".activity.IndexActivity">
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/cart_no_product.xml b/app/src/main/res/layout/cart_no_product.xml
new file mode 100644
index 0000000..8781e18
--- /dev/null
+++ b/app/src/main/res/layout/cart_no_product.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/content_product_title.xml b/app/src/main/res/layout/content_product_title.xml
new file mode 100644
index 0000000..d9f5a7c
--- /dev/null
+++ b/app/src/main/res/layout/content_product_title.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/content_user.xml b/app/src/main/res/layout/content_user.xml
new file mode 100644
index 0000000..3266d28
--- /dev/null
+++ b/app/src/main/res/layout/content_user.xml
@@ -0,0 +1,234 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/product_condition_item.xml b/app/src/main/res/layout/product_condition_item.xml
new file mode 100644
index 0000000..27dd56d
--- /dev/null
+++ b/app/src/main/res/layout/product_condition_item.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/shopping_cart_product.xml b/app/src/main/res/layout/shopping_cart_product.xml
new file mode 100644
index 0000000..55543e4
--- /dev/null
+++ b/app/src/main/res/layout/shopping_cart_product.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/shoppingcart_title.xml b/app/src/main/res/layout/shoppingcart_title.xml
new file mode 100644
index 0000000..66d6dee
--- /dev/null
+++ b/app/src/main/res/layout/shoppingcart_title.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file