diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..603b140
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+.cxx
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..35410ca
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..770e663
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+Snack App
\ No newline at end of file
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..681f41a
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..7e7ee62
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
new file mode 100644
index 0000000..723c7f8
--- /dev/null
+++ b/.idea/dataSources.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ sqlite.xerial
+ true
+ org.sqlite.JDBC
+ jdbc:sqlite:C:\Users\HP\AppData\Local\JetBrains\IntelliJIdea2021.3\device-explorer\Pixel_5_API_30 [emulator-5554]\data\data\com.shuyue.snack\databases\OrderStore.db
+ $ProjectFileDir$
+
+
+ file://$APPLICATION_CONFIG_DIR$/jdbc-drivers/Xerial SQLiteJDBC/3.36.0.3/sqlite-jdbc-3.36.0.3.jar
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml
new file mode 100644
index 0000000..c2fe19b
--- /dev/null
+++ b/.idea/dbnavigator.xml
@@ -0,0 +1,465 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 0000000..a405918
--- /dev/null
+++ b/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dictionaries/snow.xml b/.idea/dictionaries/snow.xml
new file mode 100644
index 0000000..ed85c9e
--- /dev/null
+++ b/.idea/dictionaries/snow.xml
@@ -0,0 +1,10 @@
+
+
+
+ fujian
+ gson
+ guangxi
+ shuyue
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..47d977c
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..41a25ff
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..91e334d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/Snack App.plantuml b/Snack App.plantuml
new file mode 100644
index 0000000..1850ee7
--- /dev/null
+++ b/Snack App.plantuml
@@ -0,0 +1,29 @@
+@startuml
+
+title __SNACK APP's Component Diagram__\n
+
+ component "Snack_App.app.unitTest" {
+ [Snack_App.app.main]
+ component "Snack_App.app.main" {
+ [Snack_App.app.androidTest]
+ component "Snack_App.app.androidTest" {
+ [Snack_App.app]
+ }
+
+
+ }
+
+
+ }
+
+
+
+
+right footer
+
+
+PlantUML diagram generated by SketchIt! (https://bitbucket.org/pmesmeur/sketch.it)
+For more information about this tool, please contact philippe.mesmeur@gmail.com
+endfooter
+
+@enduml
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..31d6529
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,59 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 29
+ buildToolsVersion "29.0.3"
+
+ defaultConfig {
+ applicationId "com.shuyue.snack"
+ minSdkVersion 21
+ targetSdkVersion 29
+ versionCode 2
+ versionName '1.1'
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ // ButterKnife requires Java 8.
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: "libs", include: ["*.jar"])
+ implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'com.google.android.material:material:1.1.0'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+ implementation 'androidx.navigation:navigation-fragment:2.3.0'
+ implementation 'androidx.navigation:navigation-ui:2.3.0'
+ implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
+ implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ implementation 'androidx.mediarouter:mediarouter:1.1.0'
+ testImplementation 'junit:junit:4.13'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+
+ // 引入ButterKnife依赖
+ implementation 'com.jakewharton:butterknife:10.2.1'
+ annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
+
+ // 引入BaseRecyclerViewAdapterHelper库
+ implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
+
+ // 引入CircleImageView照片库
+ implementation 'de.hdodenhof:circleimageview:3.1.0'
+
+ // 引入Gson库
+ implementation 'com.google.code.gson:gson:2.8.6'
+ //引入地址
+ implementation 'liji.library.dev:citypickerview:1.1.0'
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/shuyue/snack/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/shuyue/snack/ExampleInstrumentedTest.java
new file mode 100644
index 0000000..92b02be
--- /dev/null
+++ b/app/src/androidTest/java/com/shuyue/snack/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.shuyue.snack;
+
+import android.content.Context;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+ assertEquals("com.shuyue.snack", appContext.getPackageName());
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..1d88a3b
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/MainActivity.java b/app/src/main/java/com/shuyue/snack/MainActivity.java
new file mode 100644
index 0000000..43c9ebf
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/MainActivity.java
@@ -0,0 +1,47 @@
+package com.shuyue.snack;
+
+import android.os.Bundle;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.navigation.NavController;
+import androidx.navigation.Navigation;
+import androidx.navigation.ui.AppBarConfiguration;
+import androidx.navigation.ui.NavigationUI;
+
+import com.google.android.material.bottomnavigation.BottomNavigationView;
+import com.shuyue.snack.dao.UserDao;
+
+public class MainActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ BottomNavigationView navView = findViewById(R.id.nav_view);
+
+ AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
+ R.id.navigation_home, R.id.navigation_snack, R.id.navigation_place, R.id.navigation_my)
+ .build();
+ NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
+ NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
+ NavigationUI.setupWithNavController(navView, navController);
+
+ // 检查登录状态
+ checkLogin();
+ }
+ /**
+ * 检查是否有登录信息
+ */
+ private void checkLogin() {
+ // 检查持久化的数据
+ if (UserDao.isLogin()) {
+ // 已登录
+ MyApplication.isLogin(true);
+ MyApplication.setUser(UserDao.getUser());
+ } else {
+ // 未登录
+ MyApplication.isLogin(false);
+ MyApplication.setUser(null);
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/MyApplication.java b/app/src/main/java/com/shuyue/snack/MyApplication.java
new file mode 100644
index 0000000..b355493
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/MyApplication.java
@@ -0,0 +1,77 @@
+package com.shuyue.snack;
+
+import android.app.Application;
+
+import com.shuyue.snack.model.Snack;
+import com.shuyue.snack.model.User;
+import com.shuyue.snack.utils.Utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MyApplication extends Application {
+
+ /**
+ * Application类上下文
+ */
+ private static MyApplication appContext;
+
+ /**
+ * 购物车的小吃
+ */
+ private static List cartSnacks;
+ private static List spsc;
+
+ /**
+ * 登录用户
+ */
+ private static User user;
+
+ /**
+ * 登录状态
+ */
+ private static boolean isLogin;
+
+ public static MyApplication getInstance() {
+ return appContext;
+ }
+
+ public static List getCartSnacks() {
+ return cartSnacks;
+ }
+
+ public static List getSC() {
+ return spsc;
+ }
+ public static User getUser() {
+ return user;
+ }
+
+ public static void setUser(User user) {
+ MyApplication.user = user;
+ }
+
+ /**
+ * 是否登录
+ *
+ * @return true: 已经登录, false: 未登录
+ */
+ public static boolean isLogin() {
+ return isLogin;
+ }
+
+ public static void isLogin(boolean isLogin) {
+ MyApplication.isLogin = isLogin;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ appContext = this;
+ // 初始化购物车集合
+ cartSnacks = new ArrayList<>();
+
+ // 初始化工具类
+ Utils.init(this);
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/activity/DetailActivity.java b/app/src/main/java/com/shuyue/snack/activity/DetailActivity.java
new file mode 100644
index 0000000..f1983f4
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/activity/DetailActivity.java
@@ -0,0 +1,130 @@
+package com.shuyue.snack.activity;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Color;
+import android.os.Build;
+import android.os.Bundle;
+import android.view.View;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.shuyue.snack.MyApplication;
+import com.shuyue.snack.R;
+import com.shuyue.snack.model.Snack;
+import com.shuyue.snack.utils.Tips;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+
+public class DetailActivity extends AppCompatActivity {
+
+ @BindView(R.id.detailImage)
+ ImageView image;
+
+ @BindView(R.id.detailName)
+ TextView name;
+
+ @BindView(R.id.detailPrice)
+ TextView price;
+
+ @BindView(R.id.detailContent)
+ TextView detail;
+
+ @BindView(R.id.detailsc)
+ Button addsc;
+ @BindView(R.id.detailAddCartBtn)
+ Button addCart;
+
+
+
+
+
+ public static void actionStart(Context context, Snack snack) {
+ Intent intent = new Intent(context, DetailActivity.class);
+ intent.putExtra("snack", snack);
+ context.startActivity(intent);
+ }
+
+ @SuppressLint("SetTextI18n")
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_detail);
+
+ fullScreen(this);
+
+ ButterKnife.bind(this);
+
+ Snack snack = (Snack) getIntent().getSerializableExtra("snack");
+
+ if (snack != null) {
+ image.setImageResource(snack.getImage());
+ name.setText(snack.getName());
+ price.setText("¥" + snack.getPrice());
+ detail.setText(snack.getDetail());
+
+ addCart.setOnClickListener(v -> {
+ if (!MyApplication.getCartSnacks().contains(snack)) {
+ // 添加到购物车
+ snack.setCount(1);
+ MyApplication.getCartSnacks().add(snack);
+ Tips.show("已添加" + snack.getName() + "到购物车");
+
+ // 关闭Activity
+ finish();
+ } else {
+ Tips.show("已在购物车中,请勿重复添加");
+ }
+ });
+
+
+ addsc.setOnClickListener(v -> {
+ if (!MyApplication.getSC().contains(snack)) {
+ // 添加到收藏
+ snack.setCount(1);
+ MyApplication.getSC().add(snack);
+ Tips.show("已添加" + snack.getName() + "到我的收藏");
+ // 关闭Activity
+ finish();
+ } else {
+ Tips.show("已在我的收藏中,请勿重复收藏");
+ }
+ });
+ }
+ }
+
+ @OnClick(R.id.detailBack)
+ void clickBack() {
+ finish();
+ }
+
+
+ /**
+ * 通过设置全屏,设置状态栏透明
+ */
+ private void fullScreen(Activity activity) {
+ Window window = activity.getWindow();
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ View decorView = ((Window) window).getDecorView();
+ int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
+ decorView.setSystemUiVisibility(option);
+ window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
+ window.setStatusBarColor(Color.TRANSPARENT);
+ } else {
+ WindowManager.LayoutParams attributes = window.getAttributes();
+ int flagTranslucentStatus = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
+ attributes.flags |= flagTranslucentStatus;
+ window.setAttributes(attributes);
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/activity/Login.java b/app/src/main/java/com/shuyue/snack/activity/Login.java
new file mode 100644
index 0000000..a2401ad
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/activity/Login.java
@@ -0,0 +1,135 @@
+package com.shuyue.snack.activity;
+
+import android.widget.ViewFlipper;
+import androidx.appcompat.app.AppCompatActivity;
+import android.os.Bundle;
+
+import android.annotation.SuppressLint;
+import android.content.Intent;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Toast;
+import androidx.appcompat.app.AppCompatActivity;
+import android.os.Bundle;
+import com.shuyue.snack.MainActivity;
+import com.shuyue.snack.R;
+
+/**
+ * 账号密码登录
+ */
+
+public class Login extends AppCompatActivity {
+ private EditText edt_Username, edt_PassWord;
+ private Button btn_Login, btn_Register;
+ boolean isFlag = false;
+ ViewFlipper flipper;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_login);
+ //设置页面标题
+ setTitle("momo超市");
+
+ edt_Username = this.findViewById(R.id.edt_UserName);
+ edt_PassWord = this.findViewById(R.id.edt_Password);
+ btn_Login = this.findViewById(R.id.btn_Login);
+ btn_Register = this.findViewById(R.id.btn_Register);
+
+ //用户名
+ edt_Username.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (hasFocus) {
+ //当点击用户名输入框时,清空密码框
+ edt_PassWord.setText("");
+ } else {
+ String username = edt_Username.getText().toString();
+ if (username.length() < 4) {
+ Toast.makeText(Login.this, "用户名长度必须大于4,请重新输入", Toast.LENGTH_SHORT).show();
+ edt_Username.setText("");
+ }
+ }
+ }
+ });
+ //密码框
+ edt_PassWord.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (hasFocus) {
+
+ } else {
+ String password = edt_PassWord.getText().toString();
+ if (password.length() < 6 || password.length() > 12) {
+ Toast.makeText(Login.this, "密码长度必须为6-12位,请重新输入", Toast.LENGTH_LONG).show();
+ edt_PassWord.setText("");
+
+ }
+ }
+ }
+ });
+ //打开数据库
+ SQLiteDatabase database = openOrCreateDatabase("OrderStore.db", MODE_PRIVATE, null);
+ //若不存在user表,则创建user表
+ String createSQL = "create table IF NOT EXISTS user(username text,password text,password2 text,phone text)";
+ database.execSQL(createSQL);//执行创表语句
+ //若不存在address表,则创建address表
+ String createSQL1 = "create table IF NOT EXISTS address(id integer primary key autoincrement, username text, cosignee text,phone text,address text)";
+ database.execSQL(createSQL1);//执行创表语句
+
+ //登录事件监听
+ btn_Login.setOnClickListener(new View.OnClickListener() {
+ @SuppressLint("Range")
+ @Override
+ public void onClick(View v) {
+ isFlag = false;
+ String username = edt_Username.getText().toString();
+ String password = edt_PassWord.getText().toString();
+ //判断输入是否为空,若为空,给出提示
+ if (username.equals("") || password.equals("")) {
+ Toast.makeText(Login.this, "请输入账号或密码", Toast.LENGTH_SHORT).show();
+ isFlag = true;
+ }
+ //查询账号密码,若数据库表为空,提示用户注册
+
+ Cursor cursor = database.query("user", new String[]{"username,password"}, null, null, null, null, null);
+ if (cursor.getCount() == 0) {
+ Toast.makeText(Login.this, "请先注册账号", Toast.LENGTH_SHORT).show();
+ isFlag=true;
+ }
+ //若数据库表不为空,查看用户输入的账号密码是否与数据库表中的相匹配,若匹配,登录成功,跳转到主界面
+ // 否则无法登录,给出账号密码错误提示
+ else {
+ while (cursor.moveToNext()){
+
+ if (username.equals(cursor.getString(cursor.getColumnIndex("username"))) && password.equals(cursor.getString(cursor.getColumnIndex("password")))) {
+ Toast.makeText(Login.this, "登录成功", Toast.LENGTH_SHORT).show();
+ Intent intent = new Intent(Login.this, MainActivity.class);
+ startActivity(intent);
+ isFlag = true;
+ break;
+ }
+ }
+ if (isFlag == false) {
+ Toast.makeText(Login.this, "账号或密码错误,请重新输入", Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ }
+
+
+ });
+ //修改密码监听事件,点击忘记密码,跳转到修改密码界面
+ //注册监听事件,点击新用户,跳转到注册界面
+ btn_Register.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(Login.this, Register.class);
+ startActivity(intent);
+ }
+ });
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/activity/LoginActivity.java b/app/src/main/java/com/shuyue/snack/activity/LoginActivity.java
new file mode 100644
index 0000000..ca70efb
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/activity/LoginActivity.java
@@ -0,0 +1,161 @@
+package com.shuyue.snack.activity;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.widget.EditText;
+import androidx.appcompat.app.AppCompatActivity;
+import com.shuyue.snack.MyApplication;
+import com.shuyue.snack.R;
+import com.shuyue.snack.dao.UserDao;
+import com.shuyue.snack.data.DataServer;
+import com.shuyue.snack.model.User;
+import com.shuyue.snack.utils.Tips;
+import butterknife.BindView;
+import android.annotation.SuppressLint;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.view.View;
+import android.widget.Button;
+import android.widget.Toast;
+import com.shuyue.snack.MainActivity;
+
+
+public class LoginActivity extends AppCompatActivity {
+ private EditText edt_Username, edt_PassWord;
+ private Button btn_Login, btn_Register;
+ boolean isFlag = false;
+
+ @BindView(R.id.edt_UserName)
+ EditText usernameEdit;
+
+ @BindView(R.id.edt_Password)
+ EditText passwordEdit;
+
+ public static void actionStart(Context context) {
+ Intent intent = new Intent(context, LoginActivity.class);
+ context.startActivity(intent);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_login);
+
+
+ edt_Username = this.findViewById(R.id.edt_UserName);
+ edt_PassWord = this.findViewById(R.id.edt_Password);
+ btn_Login = this.findViewById(R.id.btn_Login);
+ btn_Register = this.findViewById(R.id.btn_Register);
+
+
+ //打开数据库
+ SQLiteDatabase database = openOrCreateDatabase("OrderStore.db", MODE_PRIVATE, null);
+ //若不存在user表,则创建user表
+ String createSQL = "create table IF NOT EXISTS user(username text,password text,password2 text,phone text)";
+ database.execSQL(createSQL);//执行创表语句
+ //登录事件监听
+
+ btn_Login.setOnClickListener(new View.OnClickListener() {
+ @SuppressLint("Range")
+ @Override
+ public void onClick(View v) {
+ isFlag = false;
+ String username = edt_Username.getText().toString();
+ String password = edt_PassWord.getText().toString();
+ //判断输入是否为空,若为空,给出提示
+ if (username.equals("") || password.equals("")) {
+ Toast.makeText(LoginActivity.this, "请输入账号或密码!", Toast.LENGTH_SHORT).show();
+ isFlag = true;
+ }
+ //查询账号密码,若数据库表为空,提示用户注册
+
+ Cursor cursor = database.query("user", new String[]{"username,password"}, null, null, null, null, null);
+ if (cursor.getCount() == 0) {
+ Toast.makeText(LoginActivity.this, "请先注册账号!", Toast.LENGTH_SHORT).show();
+ isFlag=true;
+ }
+ //若数据库表不为空,查看用户输入的账号密码是否与数据库表中的相匹配,若匹配,登录成功,跳转到主界面
+ // 否则无法登录,给出账号密码错误提示
+ else {
+ while (cursor.moveToNext()){
+
+ if (username.equals(cursor.getString(cursor.getColumnIndex("username"))) && password.equals(cursor.getString(cursor.getColumnIndex("password")))) {
+
+ /////
+ User user = new User(username, password);
+// User loginUser = checkUserFromAccountList(user);
+
+ Tips.show("登录成功");
+ MyApplication.isLogin(true);
+ MyApplication.setUser(user);
+
+ // 持久化已登录用户数据
+ UserDao.saveUser(user);
+ UserDao.isLogin(true);
+
+ // 持久化账号,以便退出登录后不用再输入账号
+ UserDao.saveUsername(username);
+
+ // 关闭Activity
+// finish();
+
+
+// Toast.makeText(LoginActivity.this, "登录成功", Toast.LENGTH_SHORT).show();
+ Intent intent = new Intent(LoginActivity.this, MainActivity.class);
+ startActivity(intent);
+ isFlag = true;
+ break;
+ }
+ }
+ if (isFlag == false) {
+ Toast.makeText(LoginActivity.this, "账号或密码错误,请重新输入", Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ }
+ });
+
+
+ //修改密码监听事件,点击忘记密码,跳转到修改密码界面
+ //注册监听事件,点击新用户,跳转到注册界面
+ btn_Register.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent intent = new Intent(LoginActivity.this, Register.class);
+ startActivity(intent);
+ }
+ });
+
+
+
+// setTitle("登录");
+
+// ButterKnife.bind(this);
+ // 恢复账号
+// String username = UserDao.getUsername();
+// usernameEdit.setText(username);
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ finish();
+ }
+
+
+ /**
+ * 登录
+ *
+ * @return 登录成功: 查询到的用户对象, 登录失败: null
+ */
+ public User checkUserFromAccountList(User u) {
+ for (User tmp : DataServer.getAccountList()) {
+ if (tmp.equals(u)) {
+ return tmp;
+ }
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/activity/OrderActivity.java b/app/src/main/java/com/shuyue/snack/activity/OrderActivity.java
new file mode 100644
index 0000000..7927db9
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/activity/OrderActivity.java
@@ -0,0 +1,88 @@
+package com.shuyue.snack.activity;
+
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.service.autofill.Dataset;
+import android.view.ContextMenu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+
+import android.widget.Button;
+import android.widget.EditText;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.shuyue.snack.MyApplication;
+import com.shuyue.snack.R;
+import com.shuyue.snack.adaptor.OrderAdapter;
+import com.shuyue.snack.dao.OrderDao;
+import com.shuyue.snack.data.DataServer;
+import com.shuyue.snack.model.Order;
+
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class OrderActivity extends AppCompatActivity {
+
+ @BindView(R.id.orderRecyclerView)
+ RecyclerView orderRecyclerView;
+ Button check;
+ EditText query;
+//
+ public static void actionStart(Context context) {
+ Intent intent = new Intent(context, OrderActivity.class);
+ context.startActivity(intent);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_order);
+ /////
+ query=findViewById(R.id.query);
+ String name=query.getText().toString();
+ check=findViewById(R.id.check);
+ setTitle("我的订单");
+
+ ButterKnife.bind(this);
+
+ orderRecyclerView.setLayoutManager(new LinearLayoutManager(OrderActivity.this));
+
+ initAdapter();
+ }
+ ////////////
+
+ //////////////
+
+ /**
+ * 初始化订单页面
+ */
+ private void initAdapter() {
+ // 获取数据库数据
+ List orders = OrderDao.findAllByUsername(MyApplication.getUser().getUsername());
+
+ OrderAdapter adapter = new OrderAdapter(orders);
+
+ // 设置空布局
+ adapter.setEmptyView(getEmptyView());
+
+ orderRecyclerView.setAdapter(adapter);
+ }
+
+
+ public View getEmptyView() {
+ return getLayoutInflater().inflate(R.layout.empty_order_view, orderRecyclerView, false);
+ }
+
+ /**
+ * 获取查询结果
+ */
+
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/activity/Register.java b/app/src/main/java/com/shuyue/snack/activity/Register.java
new file mode 100644
index 0000000..698ee43
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/activity/Register.java
@@ -0,0 +1,243 @@
+package com.shuyue.snack.activity;
+
+import androidx.appcompat.app.AppCompatActivity;
+import android.os.Bundle;
+
+import android.annotation.SuppressLint;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.view.View;
+import android.widget.*;
+import com.shuyue.snack.R;
+
+/**
+ * 用户注册
+ */
+public class Register extends AppCompatActivity {
+
+ private Spinner sp_Provinces;
+ private Spinner sp_Cities;
+ private RadioGroup rdg_Sex;
+ private RadioButton rb_Man, rb_Woman;
+ private Button btn_Register;
+ private EditText edt_UserName, edt_Password, edt_Password2, edt_Phone;
+ private boolean isFlag = true;
+
+ @Override
+
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_register);
+ //设置页面标题
+ setTitle("注册账号");
+ //用户名及密码
+ edt_UserName = this.findViewById(R.id.edt_UserName);
+ edt_Password = this.findViewById(R.id.edt_Password);
+ edt_Password2 = this.findViewById(R.id.edt_Password2);
+
+ //手机号
+ edt_Phone = this.findViewById(R.id.edt_Phone);
+
+ //出生地
+ sp_Provinces = this.findViewById(R.id.sp_Provinces);
+ sp_Cities = this.findViewById(R.id.sp_Cities);
+
+ //性别选择
+ rdg_Sex = this.findViewById(R.id.rdg_Sex);
+ rb_Man = this.findViewById(R.id.rb_Man);
+ rb_Woman = this.findViewById(R.id.rb_Woman);
+
+ //确认注册按钮
+ btn_Register = this.findViewById(R.id.btn_Register);
+
+ //用户名输入框失焦处理
+ edt_UserName.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (hasFocus) {
+ isFlag = true;
+ } else {
+ isFlag = true;
+ String username = edt_UserName.getText().toString();
+ if (username.length() < 4) {
+ Toast.makeText(Register.this, "用户名长度必须大于4,请重新输入", Toast.LENGTH_SHORT).show();
+ edt_UserName.setText("");
+ }
+ }
+ }
+ });
+ //密码输入框失焦处理
+ edt_Password.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (hasFocus) {
+ isFlag=true;
+ } else {
+ isFlag = true;
+ String password = edt_Password.getText().toString();
+ if (password.length() < 6 || password.length() > 12) {
+ Toast.makeText(Register.this, "密码长度必须为6-12位,请重新输入", Toast.LENGTH_LONG).show();
+ edt_Password.setText("");
+ }
+ }
+ }
+ });
+ //确认密码输入框失焦处理
+ edt_Password2.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (hasFocus) {
+ isFlag=true;
+ } else {
+ isFlag = true;
+ String password = edt_Password.getText().toString();
+ String password2 = edt_Password2.getText().toString();
+
+ if (!(password.equals(password2))) {
+ Toast.makeText(Register.this, "两次密码不一致,请重新输入", Toast.LENGTH_SHORT).show();
+ edt_Password2.setText("");
+
+ } else if (password2.length() < 6 || password2.length() > 12) {
+ Toast.makeText(Register.this, "密码长度必须为6-12位", Toast.LENGTH_LONG).show();
+ edt_Password2.setText("");
+ }
+
+ }
+ }
+
+ });
+ //手机号
+ edt_Phone.setOnFocusChangeListener(new View.OnFocusChangeListener() {
+ @Override
+ public void onFocusChange(View v, boolean hasFocus) {
+ if (hasFocus) {
+ isFlag=true;
+ } else {
+ isFlag = true;
+ String phone = edt_Phone.getText().toString();
+ if (!(phone.length() == 11)) {
+ Toast.makeText(Register.this, "请输入11位手机号", Toast.LENGTH_SHORT).show();
+ edt_Phone.setText("");
+ }
+ }
+ }
+ });
+ //性别处理
+ rdg_Sex.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ switch (checkedId) {
+ case R.id.rb_Man:
+ Toast.makeText(Register.this, "男", Toast.LENGTH_LONG).show();
+ break;
+ case R.id.rb_Woman:
+ Toast.makeText(Register.this, "女", Toast.LENGTH_LONG).show();
+ break;
+ }
+ }
+ });
+ //出生地处理
+ ArrayAdapter adapter = ArrayAdapter.createFromResource(Register.this, R.array.provinces, android.R.layout.simple_spinner_item);
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
+ sp_Provinces.setAdapter(adapter);
+ sp_Provinces.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override//省市联动
+ public void onItemSelected(AdapterView> parent, View view, int position, long id) {
+
+ if (position == 0) {
+ ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.hunan, android.R.layout.simple_spinner_item);
+ sp_Cities.setAdapter(cityAdapter);
+ } else if (position == 1) {
+ ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.yunnan, android.R.layout.simple_spinner_item);
+ sp_Cities.setAdapter(cityAdapter);
+ } else if (position == 2) {
+ ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.shanxi, android.R.layout.simple_spinner_item);
+
+ sp_Cities.setAdapter(cityAdapter);
+ } else if (position == 3) {
+ ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.fj, android.R.layout.simple_spinner_item);
+
+ sp_Cities.setAdapter(cityAdapter);
+ } else if (position == 4) {
+ ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.guangxi, android.R.layout.simple_spinner_item);
+
+ sp_Cities.setAdapter(cityAdapter);
+ } else if (position == 5) {
+ ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.guangdong, android.R.layout.simple_spinner_item);
+ sp_Cities.setAdapter(cityAdapter);
+ } else if (position == 6) {
+ ArrayAdapter cityAdapter = ArrayAdapter.createFromResource(Register.this, R.array.guizhou, android.R.layout.simple_spinner_item);
+
+ sp_Cities.setAdapter(cityAdapter);
+ }
+
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView> parent) {
+
+ }
+ });
+ //打开数据库或创建数据库
+ SQLiteDatabase database = openOrCreateDatabase("OrderStore.db", MODE_PRIVATE, null);
+ String createSQL = "create table IF NOT EXISTS user(username text,password text,password2 text,phone text)";
+ database.execSQL(createSQL);
+ //确认注册处理
+ btn_Register.setOnClickListener(new View.OnClickListener() {
+ @SuppressLint("Range")
+ @Override
+ public void onClick(View v) {
+ //获取用户输入信息
+ String username = edt_UserName.getText().toString();
+ String password = edt_Password.getText().toString();
+ String password2 = edt_Password2.getText().toString();
+ String phone = edt_Phone.getText().toString();
+ //判断用户输入是否为空,若有一个输入框为空,则给出提示信息
+
+ if (username.equals("") || password.equals("") || password2.equals("") || phone.equals("")) {
+ Toast.makeText(Register.this, "请输入完整信息", Toast.LENGTH_SHORT).show();
+ isFlag = false;
+
+
+ }
+ //判断用户是否存在,若已有此账号,则不允许重复注册,否则允许注册
+ Cursor cursor = database.query("user", new String[]{"username"}, null, null, null, null, null);
+ while (cursor.moveToNext()) {
+ if (username.equals(cursor.getString(cursor.getColumnIndex("username")))) {
+ Toast.makeText(Register.this, "该账户已存在", Toast.LENGTH_SHORT).show();
+ isFlag = false;//
+ }
+ }
+
+ if(!password.equals(password2)) {
+
+ Toast.makeText(Register.this, "两次密码不一致", Toast.LENGTH_SHORT).show();
+
+ //若允许注册,则将用户输入的信息,插入到数据库表(user)中,插入成功跳转到登录界面
+ }else if (!(phone.length() == 11)){
+ Toast.makeText(Register.this, "请输入11位手机号!", Toast.LENGTH_SHORT).show();
+ }
+ else if (isFlag ) {
+ ContentValues values = new ContentValues();
+ //将数据放入values中
+ values.put("username", username);
+ values.put("password", password);
+ values.put("password2", password2);
+ values.put("phone", phone);
+ //用insert()方法将values中的数据插入到user表中
+ database.insert("user", null, values);
+ Toast.makeText(Register.this, "注册成功,请登录!", Toast.LENGTH_SHORT).show();
+ Intent intent = new Intent(Register.this, Login.class);
+ startActivity(intent);
+ database.close();
+ }
+
+
+ }
+ });
+ }
+
+
+}
diff --git a/app/src/main/java/com/shuyue/snack/activity/WelcomeActivity.java b/app/src/main/java/com/shuyue/snack/activity/WelcomeActivity.java
new file mode 100644
index 0000000..0879703
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/activity/WelcomeActivity.java
@@ -0,0 +1,36 @@
+package com.shuyue.snack.activity;
+
+import android.app.ActionBar;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.view.View;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.shuyue.snack.MainActivity;
+import com.shuyue.snack.R;
+
+public class WelcomeActivity extends AppCompatActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_welcome);
+
+ View decorView = getWindow().getDecorView();
+ // Hide the status bar.
+ int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
+ decorView.setSystemUiVisibility(uiOptions);
+
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
+ startActivity(intent);
+
+ finish();
+ }
+ }, 800);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/adaptor/HomeAdapter.java b/app/src/main/java/com/shuyue/snack/adaptor/HomeAdapter.java
new file mode 100644
index 0000000..3200957
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/adaptor/HomeAdapter.java
@@ -0,0 +1,22 @@
+package com.shuyue.snack.adaptor;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.shuyue.snack.R;
+import com.shuyue.snack.model.Snack;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+public class HomeAdapter extends BaseQuickAdapter {
+
+ public HomeAdapter(List snacks) {
+ super(R.layout.item_home_snack, snacks);
+ }
+
+ @Override
+ protected void convert(@NotNull BaseViewHolder baseViewHolder, Snack snack) {
+ baseViewHolder.setImageResource(R.id.homeSnackImage, snack.getImage());
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/adaptor/OrderAdapter.java b/app/src/main/java/com/shuyue/snack/adaptor/OrderAdapter.java
new file mode 100644
index 0000000..e2c2297
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/adaptor/OrderAdapter.java
@@ -0,0 +1,38 @@
+package com.shuyue.snack.adaptor;
+
+import android.annotation.SuppressLint;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.shuyue.snack.R;
+import com.shuyue.snack.model.Order;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+
+
+public class OrderAdapter extends BaseQuickAdapter {
+
+ public OrderAdapter(List orders) {
+
+ super(R.layout.item_order, orders);
+
+ /////
+
+ /////
+ }
+
+ @SuppressLint("SimpleDateFormat")
+ @Override
+ protected void convert(@NotNull BaseViewHolder baseViewHolder, Order order) {
+ baseViewHolder.setText(R.id.orderName, order.getName());
+ baseViewHolder.setImageResource(R.id.orderImage, order.getImage());
+ baseViewHolder.setText(R.id.orderTime, "下单时间: " + order.getTime());
+ baseViewHolder.setText(R.id.orderMoney, "总付款: ¥" + order.getMoney());
+ baseViewHolder.setText(R.id.button,"删除订单");
+ }
+
+
+}
diff --git a/app/src/main/java/com/shuyue/snack/adaptor/PlaceOrderAdapter.java b/app/src/main/java/com/shuyue/snack/adaptor/PlaceOrderAdapter.java
new file mode 100644
index 0000000..2fc4940
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/adaptor/PlaceOrderAdapter.java
@@ -0,0 +1,28 @@
+package com.shuyue.snack.adaptor;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.shuyue.snack.R;
+import com.shuyue.snack.model.Snack;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+/**
+ * 下单页面购物车列表适配器
+ */
+public class PlaceOrderAdapter extends BaseQuickAdapter {
+
+ public PlaceOrderAdapter(List snacks) {
+ super(R.layout.item_place_order, snacks);
+ }
+
+ @Override
+ protected void convert(@NotNull BaseViewHolder baseViewHolder, Snack snack) {
+ baseViewHolder.setImageResource(R.id.placeOrderImage, snack.getImage())
+ .setText(R.id.placeOrderName, snack.getName())
+ .setText(R.id.placeOrderPrice, "¥" + snack.getPrice())
+ .setText(R.id.orderCountBtn, String.valueOf(snack.getCount()));
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/adaptor/SnackLeftAdapter.java b/app/src/main/java/com/shuyue/snack/adaptor/SnackLeftAdapter.java
new file mode 100644
index 0000000..88a588d
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/adaptor/SnackLeftAdapter.java
@@ -0,0 +1,29 @@
+package com.shuyue.snack.adaptor;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.shuyue.snack.R;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+public class SnackLeftAdapter extends BaseQuickAdapter {
+
+ public SnackLeftAdapter(List types) {
+ super(R.layout.item_snack_left, types);
+ }
+
+ /**
+ * 设置item数据
+ */
+ @Override
+ protected void convert(@NotNull BaseViewHolder baseViewHolder, String s) {
+ // 第一个item默认选中状态
+ if (baseViewHolder.getLayoutPosition() == 0) {
+ baseViewHolder.setBackgroundResource(R.id.snackLeftType, R.color.colorBgWhite);
+ }
+ baseViewHolder.setText(R.id.snackLeftType, s);
+ }
+
+}
diff --git a/app/src/main/java/com/shuyue/snack/adaptor/SnackRightAdapter.java b/app/src/main/java/com/shuyue/snack/adaptor/SnackRightAdapter.java
new file mode 100644
index 0000000..4095217
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/adaptor/SnackRightAdapter.java
@@ -0,0 +1,24 @@
+package com.shuyue.snack.adaptor;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.shuyue.snack.R;
+import com.shuyue.snack.model.Snack;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+public class SnackRightAdapter extends BaseQuickAdapter {
+
+ public SnackRightAdapter(List snacks) {
+ super(R.layout.item_snack_right, snacks);
+ }
+
+ @Override
+ protected void convert(@NotNull BaseViewHolder baseViewHolder, Snack snack) {
+ baseViewHolder.setImageResource(R.id.snackRightImage, snack.getImage())
+ .setText(R.id.snackRightName, snack.getName())
+ .setText(R.id.snackRightPrice, "¥" + snack.getPrice());
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/animator/MyAnimation.java b/app/src/main/java/com/shuyue/snack/animator/MyAnimation.java
new file mode 100644
index 0000000..4d10acc
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/animator/MyAnimation.java
@@ -0,0 +1,29 @@
+package com.shuyue.snack.animator;
+
+import android.animation.Animator;
+import android.animation.ObjectAnimator;
+import android.view.View;
+import android.view.animation.DecelerateInterpolator;
+
+import com.chad.library.adapter.base.animation.BaseAnimation;
+
+import org.jetbrains.annotations.NotNull;
+
+public class MyAnimation implements BaseAnimation {
+ @NotNull
+ @Override
+ public Animator[] animators(@NotNull View view) {
+ Animator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1.3f, 1);
+ Animator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1.3f, 1);
+ Animator alpha = ObjectAnimator.ofFloat(view, "alpha", 0, 1f);
+
+ scaleY.setDuration(350);
+ scaleX.setDuration(350);
+ alpha.setDuration(350);
+
+ scaleY.setInterpolator(new DecelerateInterpolator());
+ scaleX.setInterpolator(new DecelerateInterpolator());
+
+ return new Animator[]{scaleY, scaleX, alpha};
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/animator/MyAnimation2.java b/app/src/main/java/com/shuyue/snack/animator/MyAnimation2.java
new file mode 100644
index 0000000..dd4dbaa
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/animator/MyAnimation2.java
@@ -0,0 +1,37 @@
+package com.shuyue.snack.animator;
+
+import android.animation.Animator;
+import android.animation.ObjectAnimator;
+import android.view.View;
+import android.view.animation.Interpolator;
+
+import com.chad.library.adapter.base.animation.BaseAnimation;
+
+import org.jetbrains.annotations.NotNull;
+
+import static java.lang.Math.PI;
+import static java.lang.Math.pow;
+import static java.lang.Math.sin;
+
+public class MyAnimation2 implements BaseAnimation {
+
+ static class MyInterpolator2 implements Interpolator {
+ @Override
+ public float getInterpolation(float input) {
+ float factor = 0.7f;
+ return (float) (pow(2.0, -10.0 * input) * sin((input - factor / 4) * (2 * PI) / factor) + 1);
+ }
+ }
+
+ @NotNull
+ @Override
+ public Animator[] animators(@NotNull View view) {
+ Animator translationX =
+ ObjectAnimator.ofFloat(view, "translationX", -view.getRootView().getWidth(), 0f);
+
+ translationX.setDuration(800);
+ translationX.setInterpolator(new MyInterpolator2());
+
+ return new Animator[]{translationX};
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/animator/MyAnimation3.java b/app/src/main/java/com/shuyue/snack/animator/MyAnimation3.java
new file mode 100644
index 0000000..a975232
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/animator/MyAnimation3.java
@@ -0,0 +1,27 @@
+package com.shuyue.snack.animator;
+
+import android.animation.Animator;
+import android.animation.ObjectAnimator;
+import android.view.View;
+import android.view.animation.DecelerateInterpolator;
+
+import com.chad.library.adapter.base.animation.BaseAnimation;
+
+import org.jetbrains.annotations.NotNull;
+
+public class MyAnimation3 implements BaseAnimation {
+
+ @NotNull
+ @Override
+ public Animator[] animators(@NotNull View view) {
+ Animator alpha = ObjectAnimator.ofFloat(view, "alpha", 0, 1f);
+ alpha.setDuration(450);
+
+ Animator translationY =
+ ObjectAnimator.ofFloat(view, "translationY", view.getRootView().getHeight(), 0f);
+ translationY.setDuration(450);
+ translationY.setInterpolator(new DecelerateInterpolator(1.2f));
+
+ return new Animator[]{alpha, translationY};
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/dao/DatabaseHelper.java b/app/src/main/java/com/shuyue/snack/dao/DatabaseHelper.java
new file mode 100644
index 0000000..559f923
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/dao/DatabaseHelper.java
@@ -0,0 +1,34 @@
+package com.shuyue.snack.dao;
+
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import androidx.annotation.Nullable;
+
+public class DatabaseHelper extends SQLiteOpenHelper {
+ public DatabaseHelper(@Nullable Context context, int version) {
+ super(context, "OrderStore.db", null, version);
+ }
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+ // 创建数据库表
+ // 创建orders表
+ String createOrders = "create table orders (" +
+ "id integer primary key autoincrement," +
+ "name text," +
+ "image integer," +
+ "money real," +
+ "time text," +
+ "username text)";
+ db.execSQL(createOrders);
+ // 创建address表
+ String createAddress = "create table address(id integer primary key autoincrement, username text, cosignee text,phone number,address text)";
+ db.execSQL(createAddress);
+ // 创建 user表
+ String createUsers = "create table IF NOT EXISTS user(username text,password text,password2 text,phone text)";
+ db.execSQL(createUsers);
+ }
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/dao/DbContect.java b/app/src/main/java/com/shuyue/snack/dao/DbContect.java
new file mode 100644
index 0000000..29defb0
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/dao/DbContect.java
@@ -0,0 +1,39 @@
+package com.shuyue.snack.dao;
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+
+public class DbContect extends SQLiteOpenHelper {
+ private static final int VERSION=1;
+ private static final String DBNAME="OrderStore.db"; // 创建数据库名叫 Users
+ private Context mContext;
+ public DbContect(Context context){super(context,DBNAME,null,VERSION);
+ mContext = context;
+ }
+ //创建数据库
+ public void onCreate(SQLiteDatabase db){
+ // 创建orders表
+ String createOrders = "create table orders (" +
+ "id integer primary key autoincrement," +
+ "name text," +
+ "image integer," +
+ "money real," +
+ "time text," +
+ "username text)";
+ db.execSQL(createOrders);
+ // 创建address表
+ String createAddress = "create table address(id integer primary key autoincrement, username text, cosignee text,phone number,address text)";
+ db.execSQL(createAddress);
+ // 创建 user表
+ String createUsers = "create table IF NOT EXISTS user(username text,password text,password2 text,phone text)";
+ db.execSQL(createUsers);
+ }
+ //数据库版本更新
+ public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion)
+ {
+ db.execSQL("drop table if exists user");
+ db.execSQL("drop table if exists orders");
+ db.execSQL("drop table if exists address");
+ onCreate(db);
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/dao/OrderDao.java b/app/src/main/java/com/shuyue/snack/dao/OrderDao.java
new file mode 100644
index 0000000..5fab29c
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/dao/OrderDao.java
@@ -0,0 +1,77 @@
+package com.shuyue.snack.dao;
+
+import android.content.ContentValues;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+
+import com.shuyue.snack.model.Order;
+import com.shuyue.snack.utils.Utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class OrderDao {
+
+ private static DatabaseHelper dbHelper = new DatabaseHelper(Utils.getContext(), 1);
+
+ static {
+ dbHelper.getWritableDatabase();
+ }
+ // * 保存订单数据
+ public static void saveOrder(List orders) {
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ for (Order order : orders) {
+ ContentValues values = new ContentValues();
+ values.put("name", order.getName());
+ values.put("image", order.getImage());
+ values.put("money", order.getMoney());
+ values.put("time", order.getTime());
+ values.put("username", order.getUsername());
+
+ db.insert("orders", null, values);
+ }
+ }
+ // * 通过用户名查询订单数据
+ public static List findAllByUsername(String username) {
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ List orders = new ArrayList<>();
+ // 查询指定用户名订单
+ Cursor cursor = db.query("orders", null, "username=?", new String[]{username}, null, null, "time desc");
+ if (cursor.moveToFirst()) {
+ do {
+ String name = cursor.getString(cursor.getColumnIndex("name"));
+ int image = cursor.getInt(cursor.getColumnIndex("image"));
+ double money = cursor.getDouble(cursor.getColumnIndex("money"));
+ String time = cursor.getString(cursor.getColumnIndex("time"));
+
+ Order order = new Order(name, image, money, time);
+ orders.add(order);
+ } while (cursor.moveToNext());
+ }
+ cursor.close();
+ return orders;
+ }
+
+ // * 通过商品名称查询订单
+ public static List findAllByName(String names) {
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ List orders1 = new ArrayList<>();
+
+ // 查询指定用户名订单
+ Cursor cursor = db.query("orders", null, "name=?", new String[]{names}, null, null, "time desc");
+ if (cursor.moveToFirst()) {
+ do {
+ String name = cursor.getString(cursor.getColumnIndex("name"));
+ int image = cursor.getInt(cursor.getColumnIndex("image"));
+ double money = cursor.getDouble(cursor.getColumnIndex("money"));
+ String time = cursor.getString(cursor.getColumnIndex("time"));
+
+ Order order = new Order(name, image, money, time);
+ orders1.add(order);
+ } while (cursor.moveToNext());
+ }
+ cursor.close();
+ return orders1;
+ }
+
+}
diff --git a/app/src/main/java/com/shuyue/snack/dao/UserDao.java b/app/src/main/java/com/shuyue/snack/dao/UserDao.java
new file mode 100644
index 0000000..15f3df5
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/dao/UserDao.java
@@ -0,0 +1,62 @@
+package com.shuyue.snack.dao;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+import com.google.gson.Gson;
+import com.shuyue.snack.model.User;
+import com.shuyue.snack.utils.Utils;
+
+public class UserDao {
+
+ // 实例化SharedPreferences对象
+ private static SharedPreferences data = Utils.getContext().getSharedPreferences("data", Context.MODE_PRIVATE);
+
+ // Gson对象
+ private static Gson gson = new Gson();
+
+ public static boolean isLogin() {
+ return data.getBoolean("isLogin", false);
+ }
+
+ public static void isLogin(boolean bool) {
+ SharedPreferences.Editor edit = data.edit();
+ edit.putBoolean("isLogin", bool);
+ edit.apply();
+ }
+// 获取已登录用户对象
+ public static User getUser() {
+ String userJson = data.getString("user", "");
+ return gson.fromJson(userJson, User.class);
+ }
+
+ public static void saveUser(User user) {
+ String userJson = gson.toJson(user);
+ SharedPreferences.Editor edit = data.edit();
+ edit.putString("user", userJson);
+ edit.apply();
+ }
+ //* 清除登录用户信息和登录状态
+ public static void removeUserAndLoginStatus() {
+ SharedPreferences.Editor edit = data.edit();
+ edit.remove("user");
+ edit.remove("isLogin");
+ edit.apply();
+ }
+
+ public static void removeAll() {
+ SharedPreferences.Editor edit = data.edit();
+ edit.clear();
+ edit.apply();
+ }
+ // * 保存账号
+ public static void saveUsername(String username) {
+ SharedPreferences.Editor editor = data.edit();
+ editor.putString("username", username);
+ editor.apply();
+ }
+
+ public static String getUsername() {
+ return data.getString("username", "");
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/data/DataServer.java b/app/src/main/java/com/shuyue/snack/data/DataServer.java
new file mode 100644
index 0000000..5ea463e
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/data/DataServer.java
@@ -0,0 +1,158 @@
+package com.shuyue.snack.data;
+
+import android.annotation.SuppressLint;
+
+import com.shuyue.snack.R;
+import com.shuyue.snack.model.Order;
+import com.shuyue.snack.model.Snack;
+import com.shuyue.snack.model.User;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class DataServer {
+
+ private static List snackOrderList;
+
+ private static List homeList;
+
+ private static List scdpList;
+
+ private static List sgxhList;
+
+ private static List xxlsList;
+
+ private static List rdscList;
+
+ private static List ssdpList;
+
+ private static List accountList;
+
+
+ // * 首页数据
+ public static List getHomeList() {
+ if (homeList == null) {
+ homeList = new ArrayList() {{
+
+ add(new Snack("农家自种小土豆", 9.99, R.mipmap.tudou, "土豆,是中国五大主食之一,其营养价值高、适应力强、产量大,是全球第三大重要的粮食作物,仅次于小麦和玉米。土豆是块茎繁殖,可入药,性平味甘,可以治胃痛、痄肋、痈肿等疾病。"));
+ add(new Snack("精品小米辣", 12.01, R.mipmap.liaomila, "小米辣是双子叶植物纲、菊亚纲、茄目、茄科、辣椒属植物,味辛,性热。具有开胃消食、温中散寒、美容养颜等功效。"));
+ add(new Snack("猪肉水饺", 23.10, R.mipmap.zhuroushuijiao, "猪肉水饺. 以猪肉为主料的饺子,饺子原名“娇耳”,相传是我国医圣张仲景首先发明的,已有一千八百多年的历史,饺子多用面皮包馅水煮或蒸制而成是深受中国汉族人民喜爱的传统特色食品。"));
+ add(new Snack("瑞士卷", 6.99, R.mipmap.ruishijuan, "瑞士卷是海绵蛋糕的一种,在烤炉中将材料烤成薄薄的蛋糕,加上了果酱、奶油和切碎了的果肉,卷成卷状。. 另外可以加上混和的可可粉和咖啡粉,形成松软的海绵质感的卷蛋糕。"));
+ add(new Snack("麻辣王子", 8.00, R.mipmap.malawangzi, "麻辣王子辣条的最大特点就是麻辣味。辣椒、花椒、姜等多种香料的混合使用,让它的味道独具特色,刺激味蕾,让人食欲大开。"));
+ add(new Snack("精选龙虾尾", 9.9, R.mipmap.longxiawei, "龙虾中镁的含量很高,食用龙虾有保护心血管系统的功效,不仅能降低血液中胆固醇的含量,预防动脉硬化的发生,而且能扩张冠状动脉,对预防高血压及心肌梗死也非常有效"));
+ add(new Snack("海南妃子笑荔枝", 16.9, R.mipmap.lizhi, "荔枝对大脑组织有补养作用,能明显改善失眠、忘记、神疲等症。能够增强免疫功能荔枝肉含丰富。作用的物质,对糖尿病患者十分适宜。"));
+ add(new Snack("新鲜甜脆桃", 13.1, R.mipmap.cuitao, "脆桃中的营养成分以及纤维元素更是水果中之最,它是含铁量最高的水果之一,人体中含量最多也是必不可少的微量元素“铁”,铁是人体主要造血功能中的必需物质,季节性适量食用脆桃能有效提高人体所需铁元素,从而达到清肠健胃、提高抵抗力等功效"));
+
+ }};
+ }
+ return homeList;
+ }
+ // * 点菜页面分类左边列表数据
+ public static List getSnackOrderList() {
+ if (snackOrderList == null) {
+ snackOrderList = new ArrayList() {{
+ add("蔬菜豆品");
+ add("水果鲜花");
+ add("休闲零食");
+ add("肉蛋水产");
+ add("速食冻品");
+ }};
+ }
+ return snackOrderList;
+ }
+
+ // * 蔬菜豆品数据
+ public static List getFujianList() {
+ if (scdpList == null) {
+ scdpList = new ArrayList() {{
+ add(new Snack("农家自种小土豆", 9.99, R.mipmap.tudou, "土豆,是中国五大主食之一,其营养价值高、适应力强、产量大,是全球第三大重要的粮食作物,仅次于小麦和玉米。土豆是块茎繁殖,可入药,性平味甘,可以治胃痛、痄肋、痈肿等疾病。"));
+ add(new Snack("精品大蒜", 7.25, R.mipmap.dasuan, "大蒜具有很强的抗氧化性能够增强人体生理机能、促进新陈代谢、延缓机体衰老、提高自身免疫力、预防消化系统疾病等。大蒜中的大蒜素能有效减缓血液中的脂肪上升趋势,抗血脂和动脉硬化、抗血小板聚集,对血液、心血管疾病具有一定的预防作用,并且大蒜素具有很强的杀菌能力和抗菌特性,因此大蒜素也被称为“植物性天然广谱抗生素”。大蒜中的有机硫化物能抑制致癌物质亚硝胺类在体内的合成,能够起到抗癌作用。所以,蒜是一种良好的药用植物。"));
+ add(new Snack("水果黄瓜", 8.63, R.mipmap.huanggua, "黄瓜,别名青瓜、胡瓜、吊瓜等,是日常生活中最常见的一种瓜类蔬菜。 黄瓜含水量极高,还富含多种维生素、膳食纤维、蛋白质及矿物质钙、磷、镁、钠等营养素,具有清热解毒、生津止渴、减肥消脂等功效,尤其适合夏天食用。"));
+ add(new Snack("精品小米辣", 12.01, R.mipmap.liaomila, "小米辣是双子叶植物纲、菊亚纲、茄目、茄科、辣椒属植物,味辛,性热。具有开胃消食、温中散寒、美容养颜等功效。"));
+ add(new Snack("贝贝南瓜", 9.51, R.mipmap.nangua, "贝贝南瓜内含有维生素和果胶,果胶有很好的吸附性,能粘结和消除体内细菌毒素和其他有害物质,如重金属中的铅、汞和放射性元素,起到解毒作用,贝贝南瓜含有丰富的钴,在各类蔬菜中含钻量居首位。"));
+ }};
+ }
+ return scdpList;
+ }
+
+
+ // * 水果鲜花数据
+ public static List getGuangxiList() {
+ if (sgxhList == null) {
+ sgxhList = new ArrayList() {{
+ add(new Snack("早春红玉西瓜", 12.1, R.mipmap.xigua, "夏日炎炎,清甜的西瓜极好的消暑水果。西瓜不仅水分多,营养也很丰富,具有清热解暑、生津止渴、利尿除烦的功效。西瓜其所含的氨基酸还可以滋润皮肤、增添光泽。"));
+ add(new Snack("海南妃子笑荔枝", 16.9, R.mipmap.lizhi, "荔枝对大脑组织有补养作用,能明显改善失眠、忘记、神疲等症。能够增强免疫功能荔枝肉含丰富。作用的物质,对糖尿病患者十分适宜。"));
+ add(new Snack("国产红心火龙果", 9.32, R.mipmap.huolg, "火龙果是一种低能量的水果,富含水溶性膳食纤维,具有减肥、降低胆固醇、预防便秘、大肠癌等功效,还有丰富的纤维,能够预防便秘。 火龙果中含有一般蔬果中较少有的植物性白蛋白,这种白蛋白会与人体内的重金属离子结合而起到解毒的作用。 它富含抗氧化剂维生素C,能美白皮肤防黑斑。"));
+ add(new Snack("新鲜甜脆桃", 13.1, R.mipmap.cuitao, "脆桃中的营养成分以及纤维元素更是水果中之最,它是含铁量最高的水果之一,人体中含量最多也是必不可少的微量元素“铁”,铁是人体主要造血功能中的必需物质,季节性适量食用脆桃能有效提高人体所需铁元素,从而达到清肠健胃、提高抵抗力等功效"));
+ }};
+ }
+ return sgxhList;
+ }
+
+
+ // * 休闲零食数据
+ public static List getGuangzhouList() {
+ if (xxlsList == null) {
+ xxlsList = new ArrayList() {{
+ add(new Snack("乐事原味薯片", 6.00, R.mipmap.leshi, "乐事原味薯片: 完美的把马铃薯的味道体现出来,淡淡的咸味在口中融化越嚼越香,不拿别的牌子做比较,就冲这个味道,就百吃不腻,原味是永远的经典!"));
+ add(new Snack("瑞士卷", 6.99, R.mipmap.ruishijuan, "瑞士卷是海绵蛋糕的一种,在烤炉中将材料烤成薄薄的蛋糕,加上了果酱、奶油和切碎了的果肉,卷成卷状。. 另外可以加上混和的可可粉和咖啡粉,形成松软的海绵质感的卷蛋糕。"));
+ add(new Snack("咪咪虾条", 9.99, R.mipmap.mimixt, "虾条,是一道油炸类美食,主要材料是小麦粉、虾粉、植物油,直接食用。"));
+ add(new Snack("麻辣王子", 8.00, R.mipmap.malawangzi, "麻辣王子辣条的最大特点就是麻辣味。辣椒、花椒、姜等多种香料的混合使用,让它的味道独具特色,刺激味蕾,让人食欲大开。"));
+ }};
+ }
+ return xxlsList;
+ }
+
+ // * 肉蛋水产数据
+
+ public static List getBeijingList() {
+ if (rdscList == null) {
+ rdscList = new ArrayList() {{
+ add(new Snack("精选龙虾尾", 9.9, R.mipmap.longxiawei, "龙虾中镁的含量很高,食用龙虾有保护心血管系统的功效,不仅能降低血液中胆固醇的含量,预防动脉硬化的发生,而且能扩张冠状动脉,对预防高血压及心肌梗死也非常有效"));
+ add(new Snack("去皮五花肉", 8.99, R.mipmap.wuhuar, "五花肉性平味甘,有润肠胃、生津液、补肾气、解热毒的功效,主治热病伤津、消渴羸瘦、肾虚体弱、产后血虚、燥咳、便秘、补虚、滋阴、润燥、滋肝阴、润肌肤、利小便和止消渴。"));
+ add(new Snack("松花皮蛋", 10.88, R.mipmap.pidan, "皮蛋比鸭蛋含更多矿物质,但是含有的脂肪和总热量却稍有下降,食用皮蛋还能刺激消化,增进食欲,有利于营养的消化吸收,具有润肺、养阴止血的作用。"));
+ add(new Snack("新鲜鸡蛋", 17.99, R.mipmap.jidan, "鸡蛋作为我们日常生活中经常食用的食品,含有较高的蛋白质及丰富的脂质,是很好的维生素及矿物质的供给源,同时又兼具易于吸收,价格低廉等特点"));
+ add(new Snack("农家老母鸡", 22.00, R.mipmap.laomj, "老母鸡具有温中益气、补虚劳、健脾益胃之功效,可用于治疗体虚食少、虚劳瘦弱、消渴、水肿等症。"));
+
+ }};
+ }
+ return rdscList;
+ }
+
+ // * 速食冻品数据
+ public static List getChongqingList() {
+ if (ssdpList == null) {
+ ssdpList = new ArrayList() {{
+ add(new Snack("正宗火鸡面", 18.32, R.mipmap.huojim, "火鸡面的辣是其灵魂属性。丰富配料,干拌素食,让你想不到的变态辣度,让你简直爽到爆炸。"));
+ add(new Snack("千层蛋糕", 9.99, R.mipmap.qcdg, "千层蛋糕由來,传说这种千层形狀最早源自匈牙利的Szeged城,这里的人们常吃一种上层鋪有焦糖 的千层蛋糕。"));
+ add(new Snack("黑芝麻汤圆", 10.00, R.mipmap.hzmty, "黑芝麻汤圆是一道色香味俱全的传统名点,黑芝麻的神奇功效,还在于它含有的维生素E居植物性食品之首。"));
+ add(new Snack("猪肉水饺", 23.10, R.mipmap.zhuroushuijiao, "猪肉水饺. 以猪肉为主料的饺子,饺子原名“娇耳”,相传是我国医圣张仲景首先发明的,已有一千八百多年的历史,饺子多用面皮包馅水煮或蒸制而成是深受中国汉族人民喜爱的传统特色食品。"));
+ add(new Snack("地道烤肠", 10.26, R.mipmap.kaochang, "台湾烤肠色泽诱人,肠体饱满而有弹性,经热加工后口感外酥内嫩、香气袭人、风味独特,深受消费者喜爱。"));
+ }};
+ }
+ return ssdpList;
+ }
+
+
+ // * 用户账号信息
+ public static List getAccountList() {
+ if (accountList == null) {
+ accountList = new ArrayList() {{
+ add(new User("fdzy", "123456", "ffff", R.mipmap.momo));
+ add(new User("gsdzy", "123456", "ffff", R.mipmap.momo));
+ }};
+ }
+ return accountList;
+ }
+
+ public static List getOrderTest() {
+ @SuppressLint("SimpleDateFormat") SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ return new ArrayList() {{
+ add(new Order("是我", R.mipmap.tudou, 10.9, simpleDateFormat.format(new Date())));
+ add(new Order("是我", R.mipmap.tudou, 10.9, simpleDateFormat.format(new Date())));
+ add(new Order("是我", R.mipmap.tudou, 10.9, simpleDateFormat.format(new Date())));
+ }};
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/model/Order.java b/app/src/main/java/com/shuyue/snack/model/Order.java
new file mode 100644
index 0000000..0ba07a9
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/model/Order.java
@@ -0,0 +1,99 @@
+package com.shuyue.snack.model;
+
+import android.annotation.SuppressLint;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class Order implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String name;
+
+ private int image;
+
+ private double money;
+
+ private String time;
+
+ private String username;
+
+ public Order() {
+ }
+
+ public Order(String name, int image, double money, String time) {
+ this.name = name;
+ this.image = image;
+ this.money = money;
+ this.time = time;
+ }
+
+
+ @SuppressLint("SimpleDateFormat")
+ public Order(Snack snack) {
+ this.name = snack.getName();
+ this.image = snack.getImage();
+ // 计算金额
+ BigDecimal money = BigDecimal.valueOf(snack.getPrice()).multiply(BigDecimal.valueOf(snack.getCount()));
+ this.money = money.doubleValue();
+ // 订单产生时间(格式化)
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
+ this.time = simpleDateFormat.format(new Date());
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getImage() {
+ return image;
+ }
+
+ public void setImage(int image) {
+ this.image = image;
+ }
+
+ public double getMoney() {
+ return money;
+ }
+
+ public void setMoney(double money) {
+ this.money = money;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ @NotNull
+ @Override
+ public String toString() {
+ return "Order{" +
+ "name='" + name + '\'' +
+ ", image='" + image + '\'' +
+ ", money=" + money +
+ ", time=" + time +
+ '}';
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/model/Snack.java b/app/src/main/java/com/shuyue/snack/model/Snack.java
new file mode 100644
index 0000000..d8a0064
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/model/Snack.java
@@ -0,0 +1,103 @@
+package com.shuyue.snack.model;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+
+public class Snack implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+
+ private String name;
+
+ private double price;
+
+
+ private int image;
+
+
+ private String detail;
+
+
+ private int count;
+
+ public Snack() {
+ }
+
+ public Snack(String name, double price, int image, String detail) {
+ this.name = name;
+ this.price = price;
+ this.image = image;
+ this.detail = detail;
+ this.count = 1;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public double getPrice() {
+ return price;
+ }
+
+ public void setPrice(double price) {
+ this.price = price;
+ }
+
+ public int getImage() {
+ return image;
+ }
+
+ public void setImage(int image) {
+ this.image = image;
+ }
+
+ public String getDetail() {
+ return detail;
+ }
+
+ public void setDetail(String detail) {
+ this.detail = detail;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Snack snack = (Snack) o;
+ return Objects.equals(name, snack.name);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name);
+ }
+
+ @NotNull
+ @Override
+ public String toString() {
+ return "Snack{" +
+ "name='" + name + '\'' +
+ ", price=" + price +
+ ", image=" + image +
+ ", detail='" + detail + '\'' +
+ ", count=" + count +
+ '}';
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/model/User.java b/app/src/main/java/com/shuyue/snack/model/User.java
new file mode 100644
index 0000000..77d8d13
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/model/User.java
@@ -0,0 +1,108 @@
+package com.shuyue.snack.model;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+public class User implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private int id;
+
+ private String username;
+
+ private String password;
+
+ private String nickname;
+
+ private int headImage;
+
+ public User() {
+ }
+
+ public User(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ public User(String username, String password, String nickname, int headImage) {
+ this.username = username;
+ this.password = password;
+ this.nickname = nickname;
+ this.headImage = headImage;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getNickname() {
+ return nickname;
+ }
+
+ public void setNickname(String nickname) {
+ this.nickname = nickname;
+ }
+
+ public int getHeadImage() {
+ return headImage;
+ }
+
+ public void setHeadImage(int headImage) {
+ this.headImage = headImage;
+ }
+
+ /**
+ * 用于登录比较用户账号密码
+ *
+ * @param o 待比较用户
+ * @return 比较结果
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ User user = (User) o;
+ return Objects.equals(username, user.username) &&
+ Objects.equals(password, user.password);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(username, password);
+ }
+
+ @NotNull
+ @Override
+ public String toString() {
+ return "User{" +
+ "id=" + id +
+ ", username='" + username + '\'' +
+ ", password='" + password + '\'' +
+ ", nickname='" + nickname + '\'' +
+ ", headImage='" + headImage + '\'' +
+ '}';
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/ui/home/HomeFragment.java b/app/src/main/java/com/shuyue/snack/ui/home/HomeFragment.java
new file mode 100644
index 0000000..59ee6ed
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/ui/home/HomeFragment.java
@@ -0,0 +1,86 @@
+package com.shuyue.snack.ui.home;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProviders;
+import androidx.recyclerview.widget.RecyclerView;
+import androidx.recyclerview.widget.StaggeredGridLayoutManager;
+
+import com.shuyue.snack.R;
+import com.shuyue.snack.activity.DetailActivity;
+import com.shuyue.snack.adaptor.HomeAdapter;
+import com.shuyue.snack.animator.MyAnimation3;
+import com.shuyue.snack.data.DataServer;
+import com.shuyue.snack.model.Snack;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class HomeFragment extends Fragment {
+
+ private HomeViewModel homeViewModel;
+
+ @BindView(R.id.homeRecyclerView)
+ RecyclerView homeRecyclerView;
+
+ public View onCreateView(@NonNull LayoutInflater inflater,
+ ViewGroup container, Bundle savedInstanceState) {
+ homeViewModel =
+ ViewModelProviders.of(this).get(HomeViewModel.class);
+ View root = inflater.inflate(R.layout.fragment_home, container, false);
+ // 绑定资源
+ ButterKnife.bind(this, root);
+ return root;
+ }
+
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ // 首页瀑布流列表
+ homeRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
+ initHomeAdapter();
+ }
+
+ private void initHomeAdapter() {
+ // 实例化购物车列表适配器对象
+ HomeAdapter adapter = new HomeAdapter(DataServer.getHomeList());
+ // 设置动画效果
+ adapter.setAnimationEnable(true);
+// adapter.setAnimationFirstOnly(false);
+// adapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInBottom);
+ adapter.setAdapterAnimation(new MyAnimation3());
+ // 设置头部
+ adapter.setHeaderView(getHeadView(), 1);
+ // 设置尾部
+ adapter.setFooterView(getFooterView(), 1);
+
+ // 点击事件监听器
+ adapter.setOnItemClickListener((adapter1, view, position) -> {
+ Snack snack = (Snack) adapter1.getItem(position);
+ DetailActivity.actionStart(getContext(), snack);
+ });
+
+ // 设置适配器
+ homeRecyclerView.setAdapter(adapter);
+ }
+
+ /**
+ * 首页RecyclerView头部View
+ */
+ private View getHeadView() {
+ return getLayoutInflater().inflate(R.layout.head_home_image, homeRecyclerView, false);
+ }
+
+ /**
+ * 首页RecyclerView尾部View
+ */
+ private View getFooterView() {
+ return getLayoutInflater().inflate(R.layout.footer_no_item, homeRecyclerView, false);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/ui/home/HomeViewModel.java b/app/src/main/java/com/shuyue/snack/ui/home/HomeViewModel.java
new file mode 100644
index 0000000..799b530
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/ui/home/HomeViewModel.java
@@ -0,0 +1,19 @@
+package com.shuyue.snack.ui.home;
+
+import androidx.lifecycle.LiveData;
+import androidx.lifecycle.MutableLiveData;
+import androidx.lifecycle.ViewModel;
+
+public class HomeViewModel extends ViewModel {
+
+ private MutableLiveData mText;
+
+ public HomeViewModel() {
+ mText = new MutableLiveData<>();
+ mText.setValue("首页页面");
+ }
+
+ public LiveData getText() {
+ return mText;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/ui/my/MyFragment.java b/app/src/main/java/com/shuyue/snack/ui/my/MyFragment.java
new file mode 100644
index 0000000..7b13757
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/ui/my/MyFragment.java
@@ -0,0 +1,152 @@
+package com.shuyue.snack.ui.my;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProviders;
+
+import com.shuyue.snack.MyApplication;
+import com.shuyue.snack.R;
+import com.shuyue.snack.activity.LoginActivity;
+import com.shuyue.snack.activity.OrderActivity;
+import com.shuyue.snack.adaptor.PlaceOrderAdapter;
+import com.shuyue.snack.dao.UserDao;
+import com.shuyue.snack.model.User;
+import com.shuyue.snack.utils.Tips;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+import de.hdodenhof.circleimageview.CircleImageView;
+
+import static android.database.sqlite.SQLiteDatabase.openOrCreateDatabase;
+
+public class MyFragment extends Fragment {
+
+ private MyViewModel myViewModel;
+ PlaceOrderAdapter orderAdapter;
+// 头像
+ @BindView(R.id.myUserHead)
+ CircleImageView image;
+// 用户名
+ @BindView(R.id.myUserNickName)
+ TextView nickname;
+// 账号
+ @BindView(R.id.myUserName)
+ TextView username;
+// 我的订单
+
+// 待付款
+ @BindView(R.id.Obligation)
+ LinearLayout Obligation;
+// 待评价
+ @BindView(R.id.Evaluate)
+ LinearLayout Evaluate;
+// 退款
+ @BindView(R.id.Refund)
+ LinearLayout Refund;
+
+
+// 设置部分
+
+ // 地址管理
+
+
+ public View onCreateView(@NonNull LayoutInflater inflater,
+ ViewGroup container, Bundle savedInstanceState) {
+ myViewModel =
+ ViewModelProviders.of(this).get(MyViewModel.class);
+ View root = inflater.inflate(R.layout.fragment_my, container, false);
+
+ // 绑定资源
+ ButterKnife.bind(this, root);
+ return root;
+ }
+
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ initView();
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ initView();
+ }
+
+
+// 获取当前用户名
+ @SuppressLint("SetTextI18n")
+ private void initView() {
+ if (MyApplication.isLogin()) {
+ User user = MyApplication.getUser();
+ //image.setImageResource(user.getHeadImage());
+ image.setImageResource(R.mipmap.momo);
+ nickname.setText("用户名: " +user.getUsername());
+
+ }
+ }
+
+ /**
+ * 点击头像
+ */
+ @OnClick(R.id.myUserHead)
+ void clickImage() {
+ if (MyApplication.isLogin()) {
+ Tips.show("已登录");
+ } else {
+ LoginActivity.actionStart(getActivity());
+ }
+ }
+
+
+
+ /**
+ * 点击我的订单
+ */
+ @OnClick(R.id.myOrderView)
+ void clickOrder() {
+ if (MyApplication.isLogin()) {
+ OrderActivity.actionStart(getContext());
+ } else {
+ Tips.show("请先登录");
+ }
+ }
+
+
+ /**
+ * 点击退出登录
+ */
+ @OnClick(R.id.logoutBtn)
+ void clickLogout() {
+ if (MyApplication.isLogin()) {
+ // 清除持久化数据
+ UserDao.removeUserAndLoginStatus();
+ // 清除全局数据
+ MyApplication.isLogin(false);
+ MyApplication.setUser(null);
+ nickname.setText("登录/注册");
+ username.setText("");
+ image.setImageResource(R.mipmap.momo);
+ } else {
+ Tips.show("还没有登录,请先登录");
+ }
+ }
+//
+ public static void actionStartP(Context context) {
+ Intent intent = new Intent(context, LoginActivity.class);
+ context.startActivity(intent);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/ui/my/MyViewModel.java b/app/src/main/java/com/shuyue/snack/ui/my/MyViewModel.java
new file mode 100644
index 0000000..c115afd
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/ui/my/MyViewModel.java
@@ -0,0 +1,19 @@
+package com.shuyue.snack.ui.my;
+
+import androidx.lifecycle.LiveData;
+import androidx.lifecycle.MutableLiveData;
+import androidx.lifecycle.ViewModel;
+
+public class MyViewModel extends ViewModel {
+
+ private MutableLiveData mText;
+
+ public MyViewModel() {
+ mText = new MutableLiveData<>();
+ mText.setValue("我的页面");
+ }
+
+ public LiveData getText() {
+ return mText;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/ui/place/PlaceFragment.java b/app/src/main/java/com/shuyue/snack/ui/place/PlaceFragment.java
new file mode 100644
index 0000000..99269e4
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/ui/place/PlaceFragment.java
@@ -0,0 +1,248 @@
+package com.shuyue.snack.ui.place;
+
+import android.annotation.SuppressLint;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageButton;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProviders;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.listener.OnItemClickListener;
+import com.shuyue.snack.MyApplication;
+import com.shuyue.snack.R;
+import com.shuyue.snack.activity.DetailActivity;
+import com.shuyue.snack.activity.OrderActivity;
+import com.shuyue.snack.adaptor.PlaceOrderAdapter;
+import com.shuyue.snack.dao.OrderDao;
+import com.shuyue.snack.model.Order;
+import com.shuyue.snack.model.Snack;
+import com.shuyue.snack.ui.my.MyFragment;
+import com.shuyue.snack.utils.Tips;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+
+public class PlaceFragment extends Fragment {
+
+ private PlaceViewModel placeViewModel;
+
+ @BindView(R.id.placeRecyclerView)
+ RecyclerView orderRecyclerView;
+
+ @BindView(R.id.placeBuyBtn)
+ Button buyButton;
+
+ @BindView(R.id.placeMoney)
+ TextView placeMoney;
+
+ PlaceOrderAdapter orderAdapter;
+
+ public View onCreateView(@NonNull LayoutInflater inflater,
+ ViewGroup container, Bundle savedInstanceState) {
+ placeViewModel =
+ ViewModelProviders.of(this).get(PlaceViewModel.class);
+ View root = inflater.inflate(R.layout.fragment_place, container, false);
+ // 绑定资源
+ ButterKnife.bind(this, root);
+// final TextView textView = root.findViewById(R.id.text_notifications);
+// notificationsViewModel.getText().observe(getViewLifecycleOwner(), new Observer() {
+// @Override
+// public void onChanged(@Nullable String s) {
+// textView.setText(s);
+// }
+// });
+ return root;
+ }
+
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ orderRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
+ initOrderAdapter();
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ // 每次页面显示都计算合计金额
+ calcTotalMoney();
+ }
+
+ /**
+ * 初始化购物车列表适配器
+ */
+ private void initOrderAdapter() {
+ // 实例化购物车列表适配器对象
+ orderAdapter = new PlaceOrderAdapter(MyApplication.getCartSnacks());
+
+ // 设置空布局
+ orderAdapter.setEmptyView(getEmptyView());
+
+ // 设置动画效果
+ orderAdapter.setAnimationEnable(true);
+// orderAdapter.setAnimationFirstOnly(false);
+ orderAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.ScaleIn);
+
+ // 点击item事件触发
+ orderAdapter.setOnItemClickListener(new OnItemClickListener() {
+ @Override
+ public void onItemClick(@NonNull BaseQuickAdapter, ?> adapter, @NonNull View view, int position) {
+ Snack snack = (Snack) adapter.getItem(position);
+ DetailActivity.actionStart(getContext(), snack);
+ }
+ });
+
+ // 注册item内子控件id
+ orderAdapter.addChildClickViewIds(R.id.orderLessLabel, R.id.orderAddLabel);
+ // 子控件点击监听
+ orderAdapter.setOnItemChildClickListener((adapter, view, position) -> {
+ Snack snack = (Snack) adapter.getItem(position);
+ switch (view.getId()) {
+ case R.id.orderLessLabel:
+ // 点击减少数量
+ if (snack.getCount() == 1) {
+ MyApplication.getCartSnacks().remove(position);
+ } else {
+ MyApplication.getCartSnacks().get(position).setCount(snack.getCount() - 1);
+ }
+
+ adapter.notifyDataSetChanged();
+ break;
+ case R.id.orderAddLabel:
+ // 点击添加数量
+ MyApplication.getCartSnacks().get(position).setCount(snack.getCount() + 1);
+ adapter.notifyDataSetChanged();
+ break;
+ default:
+ break;
+ }
+ calcTotalMoney();
+ });
+
+ // 设置适配器
+ orderRecyclerView.setAdapter(orderAdapter);
+ }
+ /**
+ * 点击下单按钮事件触发器
+ */
+ @OnClick(R.id.placeBuyBtn)
+ void initClick() {
+ if (MyApplication.getCartSnacks().isEmpty()) {
+ Tips.show("购物车是空的啦!!!");
+ } else {
+ if (MyApplication.isLogin()) {
+ // 显示Dialog
+ showDialog();
+ } else {
+ Tips.show("请先登录");
+ }
+ }
+ }
+ /**
+ * 显示下单备注提示框
+ */
+ @SuppressLint("InflateParams")
+ public void showDialog() {
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ LayoutInflater inflater = requireActivity().getLayoutInflater();
+
+ builder.setView(inflater.inflate(R.layout.dialog_view, null))
+
+ .setTitle("待支付")
+ .setPositiveButton("支付成功", (dialog, which) -> {
+ // 持久化订单数据
+ saveOrder();
+ // 清空购物车数据
+ MyApplication.getCartSnacks().removeAll(MyApplication.getCartSnacks());
+ // 通知适配器数据变化
+ orderAdapter.notifyDataSetChanged();
+ // 刷新总金额
+ calcTotalMoney();
+
+ Tips.show("支付成功");
+ })
+ .create()
+ .show();
+ }
+ /**
+ * 持久化订单数据
+ */
+ public void saveOrder() {
+ List orders = new ArrayList<>();
+ // 购物车数据产生订单
+ for (Snack snack : MyApplication.getCartSnacks()) {
+ Order order = new Order(snack);
+ order.setUsername(MyApplication.getUser().getUsername());
+ orders.add(order);
+ }
+
+ OrderDao.saveOrder(orders);
+ }
+ /**
+ * 点击垃圾桶事件触发器
+ */
+ @OnClick(R.id.deleteOrder)
+ void deleteOrder() {
+ if (MyApplication.getCartSnacks().isEmpty()) {
+ Tips.show("购物车是空的");
+ } else {
+ AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
+ builder.setTitle("提示")
+ .setMessage("是否清空购物车?")
+ .setPositiveButton("确定", (dialog, which) -> {
+ // 清空购物车数据
+ MyApplication.getCartSnacks().removeAll(MyApplication.getCartSnacks());
+ // 通知适配器数据变化
+ orderAdapter.notifyDataSetChanged();
+ // 刷新总金额
+ calcTotalMoney();
+
+ Tips.show("已清空购物车");
+ })
+ .create()
+ .show();
+ }
+ }
+ // 计算合计金额
+ @SuppressLint("SetTextI18n")
+ private void calcTotalMoney() {
+ BigDecimal totalMoney = BigDecimal.valueOf(0);
+ // 遍历计算总金额(解决舍入误差)
+ if (!MyApplication.getCartSnacks().isEmpty()) {
+ for (Snack snack : MyApplication.getCartSnacks()) {
+ // 小吃单价 × 小吃数量
+ BigDecimal tmp = BigDecimal.valueOf(snack.getPrice()).multiply(BigDecimal.valueOf(snack.getCount()));
+ totalMoney = totalMoney.add(tmp);
+ }
+ }
+ placeMoney.setText("¥" + totalMoney.doubleValue());
+ }
+ /**
+ * 下单页面购物车空布局
+ */
+
+ private View getEmptyView() {
+ return getLayoutInflater().inflate(R.layout.empty_cart_view, orderRecyclerView, false);
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/ui/place/PlaceViewModel.java b/app/src/main/java/com/shuyue/snack/ui/place/PlaceViewModel.java
new file mode 100644
index 0000000..ffec8a7
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/ui/place/PlaceViewModel.java
@@ -0,0 +1,19 @@
+package com.shuyue.snack.ui.place;
+
+import androidx.lifecycle.LiveData;
+import androidx.lifecycle.MutableLiveData;
+import androidx.lifecycle.ViewModel;
+
+public class PlaceViewModel extends ViewModel {
+
+ private MutableLiveData mText;
+
+ public PlaceViewModel() {
+ mText = new MutableLiveData<>();
+ mText.setValue("下单页面");
+ }
+
+ public LiveData getText() {
+ return mText;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/ui/snack/SnackFragment.java b/app/src/main/java/com/shuyue/snack/ui/snack/SnackFragment.java
new file mode 100644
index 0000000..a99f08f
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/ui/snack/SnackFragment.java
@@ -0,0 +1,171 @@
+package com.shuyue.snack.ui.snack;
+
+import android.annotation.SuppressLint;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.ViewModelProviders;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.listener.OnItemClickListener;
+import com.shuyue.snack.MyApplication;
+import com.shuyue.snack.R;
+import com.shuyue.snack.activity.DetailActivity;
+import com.shuyue.snack.adaptor.SnackLeftAdapter;
+import com.shuyue.snack.adaptor.SnackRightAdapter;
+import com.shuyue.snack.data.DataServer;
+import com.shuyue.snack.model.Snack;
+import com.shuyue.snack.utils.Tips;
+
+import java.util.Objects;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class SnackFragment extends Fragment {
+
+ private SnackViewModel snackViewModel;
+
+ // 小吃页面左边列表已选择的Position
+ private int leftSelectPosition = 0;
+
+ @BindView(R.id.snackLeftRecyclerView)
+ RecyclerView leftRecyclerview;
+
+ @BindView(R.id.snackRightRecyclerView)
+ RecyclerView rightRecyclerView;
+
+ // 右边适配器
+ private SnackRightAdapter rightAdapter;
+
+ public static SnackFragment newInstance() {
+ return new SnackFragment();
+ }
+
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
+ @Nullable Bundle savedInstanceState) {
+ snackViewModel = ViewModelProviders.of(this).get(SnackViewModel.class);
+ View root = inflater.inflate(R.layout.fragment_snack, container, false);
+ // 绑定资源
+ ButterKnife.bind(this, root);
+ return root;
+ }
+
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ leftRecyclerview.setLayoutManager(new LinearLayoutManager(getActivity()));
+ rightRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
+
+ initLeftAdapter();
+ initRightAdapter();
+ }
+
+ /**
+ * 初始化左边适配器
+ */
+ @SuppressLint("ResourceAsColor")
+ private void initLeftAdapter() {
+ // 实例化左边适配器对象
+ SnackLeftAdapter leftAdapter = new SnackLeftAdapter(DataServer.getSnackOrderList());
+ // 设置动画效果
+ leftAdapter.setAnimationEnable(true);
+ leftAdapter.setAnimationFirstOnly(false);
+ leftAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInLeft);
+
+ // 触发点击按钮
+ leftAdapter.setOnItemClickListener((adapter, view, position) -> {
+ if (position != leftSelectPosition) {
+ String item = (String) adapter.getItem(position);
+
+ // 原本选中的item变成未选中颜色
+ Objects.requireNonNull(adapter.getViewByPosition(leftSelectPosition, R.id.snackLeftType)).setBackgroundResource(R.color.colorContent);
+ // 当前item变成选中颜色
+ Objects.requireNonNull(adapter.getViewByPosition(position, R.id.snackLeftType)).setBackgroundResource(R.color.colorBgWhite);
+ leftSelectPosition = position;
+
+ // 刷新右边列表
+// rightAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInBottom);
+ rightAdapter.setAnimationEnable(false);
+ switch (position) {
+ case 1:
+ rightAdapter.setNewInstance(DataServer.getGuangxiList());
+ break;
+ case 2:
+ rightAdapter.setNewInstance(DataServer.getGuangzhouList());
+ break;
+ case 3:
+ rightAdapter.setNewInstance(DataServer.getBeijingList());
+ break;
+ case 4:
+ rightAdapter.setNewInstance(DataServer.getChongqingList());
+ break;
+ default:
+ rightAdapter.setNewInstance(DataServer.getFujianList());
+ break;
+ }
+ }
+ });
+
+ // 设置左边列表适配器
+ leftRecyclerview.setAdapter(leftAdapter);
+ }
+
+ /**
+ * 初始化右边适配器
+ */
+ public void initRightAdapter() {
+ // 实例化右边适配器对象
+ rightAdapter = new SnackRightAdapter(DataServer.getFujianList());
+ // 设置动画效果
+ rightAdapter.setAnimationEnable(true);
+// rightAdapter.setAnimationFirstOnly(false);
+ rightAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInRight);
+ // 设置尾部
+ rightAdapter.addFooterView(getFooterView());
+
+ // 点击item事件
+ rightAdapter.setOnItemClickListener(new OnItemClickListener() {
+ @Override
+ public void onItemClick(@NonNull BaseQuickAdapter, ?> adapter, @NonNull View view, int position) {
+ Snack snack = (Snack) adapter.getItem(position);
+ DetailActivity.actionStart(getContext(), snack);
+ }
+ });
+
+ // 左边列表加入购物车点击事件
+ rightAdapter.addChildClickViewIds(R.id.snackRightAddBtn);
+ rightAdapter.setOnItemChildClickListener((adapter, view, position) -> {
+ Snack snack = (Snack) adapter.getItem(position);
+ if (view.getId() == R.id.snackRightAddBtn) {
+ if (!MyApplication.getCartSnacks().contains(snack)) {
+ // 添加到购物车
+ snack.setCount(1);
+ MyApplication.getCartSnacks().add(snack);
+ Tips.show("已添加" + snack.getName() + "到购物车");
+ } else {
+ Tips.show("已在购物车中,不能重复添加");
+ }
+ }
+ });
+
+ // 设置右边列表适配器
+ rightRecyclerView.setAdapter(rightAdapter);
+ }
+
+ /**
+ * 小吃页面右边RecyclerView尾部View
+ */
+ private View getFooterView() {
+ return getLayoutInflater().inflate(R.layout.footer_no_item, rightRecyclerView, false);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/ui/snack/SnackViewModel.java b/app/src/main/java/com/shuyue/snack/ui/snack/SnackViewModel.java
new file mode 100644
index 0000000..3172181
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/ui/snack/SnackViewModel.java
@@ -0,0 +1,19 @@
+package com.shuyue.snack.ui.snack;
+
+import androidx.lifecycle.LiveData;
+import androidx.lifecycle.MediatorLiveData;
+import androidx.lifecycle.ViewModel;
+
+public class SnackViewModel extends ViewModel {
+
+ private MediatorLiveData mText;
+
+ public SnackViewModel() {
+ mText = new MediatorLiveData<>();
+ mText.setValue("点单页面");
+ }
+
+ public LiveData getText() {
+ return mText;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/shuyue/snack/utils/Tips.java b/app/src/main/java/com/shuyue/snack/utils/Tips.java
new file mode 100644
index 0000000..90b26f3
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/utils/Tips.java
@@ -0,0 +1,84 @@
+package com.shuyue.snack.utils;
+
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.drawable.ShapeDrawable;
+import android.graphics.drawable.shapes.RoundRectShape;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.FrameLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class Tips {
+
+ /**
+ * 显示Toast
+ *
+ * @param message 显示的文本消息
+ */
+ public static void show(String message) {
+ show(message, Toast.LENGTH_SHORT);
+ }
+
+ /**
+ * 显示Toast
+ *
+ * @param message 显示的文本消息
+ * @param duration 显示时间长度
+ */
+ public static void show(String message, int duration) {
+ Toast toast = new Toast(Utils.getContext());
+ toast.setDuration(duration);
+ toast.setGravity(Gravity.CENTER, 0, 0);
+ toast.setView(createToastView(message));
+ toast.show();
+ }
+
+ /**
+ * 创建Toast自定义View
+ *
+ * @param message 显示的文本消息
+ * @return 自定义View
+ */
+ private static View createToastView(String message) {
+ // 构建圆角矩形背景
+ float radius = dp2px(6);
+ RoundRectShape shape = new RoundRectShape(new float[]{radius, radius, radius, radius, radius, radius, radius, radius}, null, null);
+ ShapeDrawable drawable = new ShapeDrawable(shape);
+ drawable.getPaint().setColor(Color.argb(225, 240, 240, 240));
+ drawable.getPaint().setStyle(Paint.Style.FILL);
+ drawable.getPaint().setAntiAlias(true);
+ drawable.getPaint().setFlags(Paint.ANTI_ALIAS_FLAG);
+
+ // 创建View
+ FrameLayout layout = new FrameLayout(Utils.getContext());
+ ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+ layout.setLayoutParams(layoutParams);
+ layout.setPadding(dp2px(16), dp2px(12), dp2px(16), dp2px(12));
+ layout.setBackground(drawable);
+
+ TextView textView = new TextView(Utils.getContext());
+ textView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT));
+ textView.setTextSize(15);
+ textView.setText(message);
+ textView.setLineSpacing(dp2px(4), 1f);
+ textView.setTextColor(Color.BLACK);
+
+ layout.addView(textView);
+
+ return layout;
+ }
+
+ /**
+ * dp转px
+ *
+ * @param dp dp的值
+ * @return 转换后的px
+ */
+ private static int dp2px(float dp) {
+ final float scale = Utils.getContext().getResources().getDisplayMetrics().density;
+ return (int) (dp * scale + 0.5f);
+ }
+}
diff --git a/app/src/main/java/com/shuyue/snack/utils/Utils.java b/app/src/main/java/com/shuyue/snack/utils/Utils.java
new file mode 100644
index 0000000..d8a87e8
--- /dev/null
+++ b/app/src/main/java/com/shuyue/snack/utils/Utils.java
@@ -0,0 +1,35 @@
+package com.shuyue.snack.utils;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+
+public class Utils {
+
+ @SuppressLint("StaticFieldLeak")
+ private static Context context;
+
+ private Utils() {
+ throw new UnsupportedOperationException("我是需要实例化的啦!!!");
+ }
+
+ /**
+ * 初始化工具类
+ *
+ * @param context 上下文
+ */
+ public static void init(Context context) {
+ Utils.context = context.getApplicationContext();
+ }
+
+ /**
+ * 获取应用的ApplicationContext
+ *
+ * @return ApplicationContext
+ */
+ public static Context getContext() {
+ if (context != null) {
+ return context;
+ }
+ throw new NullPointerException("上下文为空啊!!!");
+ }
+}
diff --git a/app/src/main/res/anim/left_in.xml b/app/src/main/res/anim/left_in.xml
new file mode 100644
index 0000000..9a07cbf
--- /dev/null
+++ b/app/src/main/res/anim/left_in.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/anim/right_out.xml b/app/src/main/res/anim/right_out.xml
new file mode 100644
index 0000000..ff2c8ea
--- /dev/null
+++ b/app/src/main/res/anim/right_out.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
new file mode 100644
index 0000000..2b068d1
--- /dev/null
+++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/address.png b/app/src/main/res/drawable/address.png
new file mode 100644
index 0000000..7318be0
Binary files /dev/null and b/app/src/main/res/drawable/address.png differ
diff --git a/app/src/main/res/drawable/arrow_down.png b/app/src/main/res/drawable/arrow_down.png
new file mode 100644
index 0000000..6d95bb5
Binary files /dev/null and b/app/src/main/res/drawable/arrow_down.png differ
diff --git a/app/src/main/res/drawable/arrow_left.png b/app/src/main/res/drawable/arrow_left.png
new file mode 100644
index 0000000..365afe0
Binary files /dev/null and b/app/src/main/res/drawable/arrow_left.png differ
diff --git a/app/src/main/res/drawable/arrow_right.png b/app/src/main/res/drawable/arrow_right.png
new file mode 100644
index 0000000..84ded85
Binary files /dev/null and b/app/src/main/res/drawable/arrow_right.png differ
diff --git a/app/src/main/res/drawable/back.jpg b/app/src/main/res/drawable/back.jpg
new file mode 100644
index 0000000..d64620f
Binary files /dev/null and b/app/src/main/res/drawable/back.jpg differ
diff --git a/app/src/main/res/drawable/back_bg.xml b/app/src/main/res/drawable/back_bg.xml
new file mode 100644
index 0000000..81b48d5
--- /dev/null
+++ b/app/src/main/res/drawable/back_bg.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/button_shape.xml b/app/src/main/res/drawable/button_shape.xml
new file mode 100644
index 0000000..b53f13b
--- /dev/null
+++ b/app/src/main/res/drawable/button_shape.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/detail_info.xml b/app/src/main/res/drawable/detail_info.xml
new file mode 100644
index 0000000..60b91c3
--- /dev/null
+++ b/app/src/main/res/drawable/detail_info.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/editext_shape.xml b/app/src/main/res/drawable/editext_shape.xml
new file mode 100644
index 0000000..81915c1
--- /dev/null
+++ b/app/src/main/res/drawable/editext_shape.xml
@@ -0,0 +1,10 @@
+
+
+ android:shape="rectangle">
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/fl2.png b/app/src/main/res/drawable/fl2.png
new file mode 100644
index 0000000..298669e
Binary files /dev/null and b/app/src/main/res/drawable/fl2.png differ
diff --git a/app/src/main/res/drawable/gwc.png b/app/src/main/res/drawable/gwc.png
new file mode 100644
index 0000000..e98e37c
Binary files /dev/null and b/app/src/main/res/drawable/gwc.png differ
diff --git a/app/src/main/res/drawable/gwc1.png b/app/src/main/res/drawable/gwc1.png
new file mode 100644
index 0000000..b61140d
Binary files /dev/null and b/app/src/main/res/drawable/gwc1.png differ
diff --git a/app/src/main/res/drawable/huo.png b/app/src/main/res/drawable/huo.png
new file mode 100644
index 0000000..b3187c1
Binary files /dev/null and b/app/src/main/res/drawable/huo.png differ
diff --git a/app/src/main/res/drawable/ic_baseline_assignment_24dp.xml b/app/src/main/res/drawable/ic_baseline_assignment_24dp.xml
new file mode 100644
index 0000000..444ccdc
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_assignment_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_assignment_turned_in_24dp.xml b/app/src/main/res/drawable/ic_baseline_assignment_turned_in_24dp.xml
new file mode 100644
index 0000000..5d5680e
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_assignment_turned_in_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_delete_24dp.xml b/app/src/main/res/drawable/ic_baseline_delete_24dp.xml
new file mode 100644
index 0000000..3c4030b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_delete_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_favorite_24dp.xml b/app/src/main/res/drawable/ic_baseline_favorite_24dp.xml
new file mode 100644
index 0000000..fca0971
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_favorite_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_favorite_border_24dp.xml b/app/src/main/res/drawable/ic_baseline_favorite_border_24dp.xml
new file mode 100644
index 0000000..3edfe1d
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_favorite_border_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_navigate_before_24dp.xml b/app/src/main/res/drawable/ic_baseline_navigate_before_24dp.xml
new file mode 100644
index 0000000..f0d71e1
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_navigate_before_24dp.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_question_answer_24dp.xml b/app/src/main/res/drawable/ic_baseline_question_answer_24dp.xml
new file mode 100644
index 0000000..4bc2544
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_question_answer_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_report_24dp.xml b/app/src/main/res/drawable/ic_baseline_report_24dp.xml
new file mode 100644
index 0000000..811e67b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_baseline_report_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_cart_black_24dp.xml b/app/src/main/res/drawable/ic_cart_black_24dp.xml
new file mode 100644
index 0000000..cf0dcc8
--- /dev/null
+++ b/app/src/main/res/drawable/ic_cart_black_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_home_black_24dp.xml b/app/src/main/res/drawable/ic_home_black_24dp.xml
new file mode 100644
index 0000000..70fb291
--- /dev/null
+++ b/app/src/main/res/drawable/ic_home_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..07d5da9
--- /dev/null
+++ b/app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_search_black_24dp.xml b/app/src/main/res/drawable/ic_search_black_24dp.xml
new file mode 100644
index 0000000..affc7ba
--- /dev/null
+++ b/app/src/main/res/drawable/ic_search_black_24dp.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_sharp_monetization_on_24dp.xml b/app/src/main/res/drawable/ic_sharp_monetization_on_24dp.xml
new file mode 100644
index 0000000..4b5b299
--- /dev/null
+++ b/app/src/main/res/drawable/ic_sharp_monetization_on_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/ic_snack_black_24dp.xml b/app/src/main/res/drawable/ic_snack_black_24dp.xml
new file mode 100644
index 0000000..4797566
--- /dev/null
+++ b/app/src/main/res/drawable/ic_snack_black_24dp.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/drawable/img.png b/app/src/main/res/drawable/img.png
new file mode 100644
index 0000000..e71959e
Binary files /dev/null and b/app/src/main/res/drawable/img.png differ
diff --git a/app/src/main/res/drawable/img_1.png b/app/src/main/res/drawable/img_1.png
new file mode 100644
index 0000000..996a3a0
Binary files /dev/null and b/app/src/main/res/drawable/img_1.png differ
diff --git a/app/src/main/res/drawable/img_2.png b/app/src/main/res/drawable/img_2.png
new file mode 100644
index 0000000..510a819
Binary files /dev/null and b/app/src/main/res/drawable/img_2.png differ
diff --git a/app/src/main/res/drawable/img_3.png b/app/src/main/res/drawable/img_3.png
new file mode 100644
index 0000000..a59f2df
Binary files /dev/null and b/app/src/main/res/drawable/img_3.png differ
diff --git a/app/src/main/res/drawable/my_general_setting.xml b/app/src/main/res/drawable/my_general_setting.xml
new file mode 100644
index 0000000..20218d9
--- /dev/null
+++ b/app/src/main/res/drawable/my_general_setting.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/password.png b/app/src/main/res/drawable/password.png
new file mode 100644
index 0000000..1c6c4f5
Binary files /dev/null and b/app/src/main/res/drawable/password.png differ
diff --git a/app/src/main/res/drawable/phone.png b/app/src/main/res/drawable/phone.png
new file mode 100644
index 0000000..7ee1fb9
Binary files /dev/null and b/app/src/main/res/drawable/phone.png differ
diff --git a/app/src/main/res/drawable/place_buy_btn.xml b/app/src/main/res/drawable/place_buy_btn.xml
new file mode 100644
index 0000000..5be6557
--- /dev/null
+++ b/app/src/main/res/drawable/place_buy_btn.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/place_order_count_btn.xml b/app/src/main/res/drawable/place_order_count_btn.xml
new file mode 100644
index 0000000..047dcd1
--- /dev/null
+++ b/app/src/main/res/drawable/place_order_count_btn.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/place_order_item.xml b/app/src/main/res/drawable/place_order_item.xml
new file mode 100644
index 0000000..9b310da
--- /dev/null
+++ b/app/src/main/res/drawable/place_order_item.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/radius_content.xml b/app/src/main/res/drawable/radius_content.xml
new file mode 100644
index 0000000..0d44743
--- /dev/null
+++ b/app/src/main/res/drawable/radius_content.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/right.png b/app/src/main/res/drawable/right.png
new file mode 100644
index 0000000..8569198
Binary files /dev/null and b/app/src/main/res/drawable/right.png differ
diff --git a/app/src/main/res/drawable/sex.png b/app/src/main/res/drawable/sex.png
new file mode 100644
index 0000000..acb8197
Binary files /dev/null and b/app/src/main/res/drawable/sex.png differ
diff --git a/app/src/main/res/drawable/shopping.jpg b/app/src/main/res/drawable/shopping.jpg
new file mode 100644
index 0000000..4213ced
Binary files /dev/null and b/app/src/main/res/drawable/shopping.jpg differ
diff --git a/app/src/main/res/drawable/shouye.png b/app/src/main/res/drawable/shouye.png
new file mode 100644
index 0000000..4674237
Binary files /dev/null and b/app/src/main/res/drawable/shouye.png differ
diff --git a/app/src/main/res/drawable/snack_right_item.xml b/app/src/main/res/drawable/snack_right_item.xml
new file mode 100644
index 0000000..8ca2977
--- /dev/null
+++ b/app/src/main/res/drawable/snack_right_item.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/sure_apssword.png b/app/src/main/res/drawable/sure_apssword.png
new file mode 100644
index 0000000..0e7cee9
Binary files /dev/null and b/app/src/main/res/drawable/sure_apssword.png differ
diff --git a/app/src/main/res/drawable/username.png b/app/src/main/res/drawable/username.png
new file mode 100644
index 0000000..47d8362
Binary files /dev/null and b/app/src/main/res/drawable/username.png differ
diff --git a/app/src/main/res/drawable/zffs.jpg b/app/src/main/res/drawable/zffs.jpg
new file mode 100644
index 0000000..c13fa67
Binary files /dev/null and b/app/src/main/res/drawable/zffs.jpg differ
diff --git a/app/src/main/res/drawable/zhuye.png b/app/src/main/res/drawable/zhuye.png
new file mode 100644
index 0000000..fec63ce
Binary files /dev/null and b/app/src/main/res/drawable/zhuye.png differ
diff --git a/app/src/main/res/layout/activity_detail.xml b/app/src/main/res/layout/activity_detail.xml
new file mode 100644
index 0000000..3762e72
--- /dev/null
+++ b/app/src/main/res/layout/activity_detail.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
new file mode 100644
index 0000000..7497195
--- /dev/null
+++ b/app/src/main/res/layout/activity_login.xml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..8336e5f
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_order.xml b/app/src/main/res/layout/activity_order.xml
new file mode 100644
index 0000000..45c3137
--- /dev/null
+++ b/app/src/main/res/layout/activity_order.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_register.xml b/app/src/main/res/layout/activity_register.xml
new file mode 100644
index 0000000..c13fb1a
--- /dev/null
+++ b/app/src/main/res/layout/activity_register.xml
@@ -0,0 +1,240 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_welcome.xml b/app/src/main/res/layout/activity_welcome.xml
new file mode 100644
index 0000000..cdbddc0
--- /dev/null
+++ b/app/src/main/res/layout/activity_welcome.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_view.xml b/app/src/main/res/layout/dialog_view.xml
new file mode 100644
index 0000000..11484f0
--- /dev/null
+++ b/app/src/main/res/layout/dialog_view.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/empty_cart_view.xml b/app/src/main/res/layout/empty_cart_view.xml
new file mode 100644
index 0000000..6b533c3
--- /dev/null
+++ b/app/src/main/res/layout/empty_cart_view.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/empty_order_view.xml b/app/src/main/res/layout/empty_order_view.xml
new file mode 100644
index 0000000..abcb517
--- /dev/null
+++ b/app/src/main/res/layout/empty_order_view.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/footer_no_item.xml b/app/src/main/res/layout/footer_no_item.xml
new file mode 100644
index 0000000..4757cbd
--- /dev/null
+++ b/app/src/main/res/layout/footer_no_item.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml
new file mode 100644
index 0000000..7a75b85
--- /dev/null
+++ b/app/src/main/res/layout/fragment_home.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_my.xml b/app/src/main/res/layout/fragment_my.xml
new file mode 100644
index 0000000..46c2e91
--- /dev/null
+++ b/app/src/main/res/layout/fragment_my.xml
@@ -0,0 +1,259 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_place.xml b/app/src/main/res/layout/fragment_place.xml
new file mode 100644
index 0000000..b8193dc
--- /dev/null
+++ b/app/src/main/res/layout/fragment_place.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_snack.xml b/app/src/main/res/layout/fragment_snack.xml
new file mode 100644
index 0000000..b0b2bc2
--- /dev/null
+++ b/app/src/main/res/layout/fragment_snack.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/head_home_image.xml b/app/src/main/res/layout/head_home_image.xml
new file mode 100644
index 0000000..54bf7a1
--- /dev/null
+++ b/app/src/main/res/layout/head_home_image.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_address.xml b/app/src/main/res/layout/item_address.xml
new file mode 100644
index 0000000..912a5d0
--- /dev/null
+++ b/app/src/main/res/layout/item_address.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_home_snack.xml b/app/src/main/res/layout/item_home_snack.xml
new file mode 100644
index 0000000..4b117d0
--- /dev/null
+++ b/app/src/main/res/layout/item_home_snack.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_order.xml b/app/src/main/res/layout/item_order.xml
new file mode 100644
index 0000000..79f3238
--- /dev/null
+++ b/app/src/main/res/layout/item_order.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_place_order.xml b/app/src/main/res/layout/item_place_order.xml
new file mode 100644
index 0000000..77bb81b
--- /dev/null
+++ b/app/src/main/res/layout/item_place_order.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_snack_left.xml b/app/src/main/res/layout/item_snack_left.xml
new file mode 100644
index 0000000..5721328
--- /dev/null
+++ b/app/src/main/res/layout/item_snack_left.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_snack_right.xml b/app/src/main/res/layout/item_snack_right.xml
new file mode 100644
index 0000000..9e5b73e
--- /dev/null
+++ b/app/src/main/res/layout/item_snack_right.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/activity_list_view.xml b/app/src/main/res/menu/activity_list_view.xml
new file mode 100644
index 0000000..fe187c0
--- /dev/null
+++ b/app/src/main/res/menu/activity_list_view.xml
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/bottom_nav_menu.xml b/app/src/main/res/menu/bottom_nav_menu.xml
new file mode 100644
index 0000000..625cad7
--- /dev/null
+++ b/app/src/main/res/menu/bottom_nav_menu.xml
@@ -0,0 +1,24 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/left.xml b/app/src/main/res/menu/left.xml
new file mode 100644
index 0000000..2cdf1b9
--- /dev/null
+++ b/app/src/main/res/menu/left.xml
@@ -0,0 +1,24 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml
new file mode 100644
index 0000000..8a619d7
--- /dev/null
+++ b/app/src/main/res/menu/main.xml
@@ -0,0 +1,27 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/right.xml b/app/src/main/res/menu/right.xml
new file mode 100644
index 0000000..de09000
--- /dev/null
+++ b/app/src/main/res/menu/right.xml
@@ -0,0 +1,23 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..eca70cf
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a571e60
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..61da551
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-hdpi/img.png b/app/src/main/res/mipmap-hdpi/img.png
new file mode 100644
index 0000000..346103a
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/img.png differ
diff --git a/app/src/main/res/mipmap-hdpi/img_1.png b/app/src/main/res/mipmap-hdpi/img_1.png
new file mode 100644
index 0000000..346103a
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/img_1.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..c41dd28
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..db5080a
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/daifukuan.jpg b/app/src/main/res/mipmap-xhdpi/daifukuan.jpg
new file mode 100644
index 0000000..8a5d462
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/daifukuan.jpg differ
diff --git a/app/src/main/res/mipmap-xhdpi/daipingjia.jpg b/app/src/main/res/mipmap-xhdpi/daipingjia.jpg
new file mode 100644
index 0000000..49db006
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/daipingjia.jpg differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..6dba46d
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..da31a87
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/myorder.jpg b/app/src/main/res/mipmap-xhdpi/myorder.jpg
new file mode 100644
index 0000000..e0f535e
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/myorder.jpg differ
diff --git a/app/src/main/res/mipmap-xhdpi/tuikuan.jpg b/app/src/main/res/mipmap-xhdpi/tuikuan.jpg
new file mode 100644
index 0000000..6d700fc
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/tuikuan.jpg differ
diff --git a/app/src/main/res/mipmap-xxhdpi/cuitao.png b/app/src/main/res/mipmap-xxhdpi/cuitao.png
new file mode 100644
index 0000000..32a1daf
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/cuitao.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/dasuan.png b/app/src/main/res/mipmap-xxhdpi/dasuan.png
new file mode 100644
index 0000000..7a2b67a
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/dasuan.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/dd.png b/app/src/main/res/mipmap-xxhdpi/dd.png
new file mode 100644
index 0000000..5d349bf
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/dd.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/dpj.png b/app/src/main/res/mipmap-xxhdpi/dpj.png
new file mode 100644
index 0000000..88adad0
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/dpj.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/dzf.png b/app/src/main/res/mipmap-xxhdpi/dzf.png
new file mode 100644
index 0000000..c88a36a
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/dzf.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/dzf1.png b/app/src/main/res/mipmap-xxhdpi/dzf1.png
new file mode 100644
index 0000000..6a5fca6
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/dzf1.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/home_image.png b/app/src/main/res/mipmap-xxhdpi/home_image.png
new file mode 100644
index 0000000..dcee064
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/home_image.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/home_img1.jpg b/app/src/main/res/mipmap-xxhdpi/home_img1.jpg
new file mode 100644
index 0000000..674d8e0
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/home_img1.jpg differ
diff --git a/app/src/main/res/mipmap-xxhdpi/huanggua.png b/app/src/main/res/mipmap-xxhdpi/huanggua.png
new file mode 100644
index 0000000..03fa751
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/huanggua.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/huoguo.jpg b/app/src/main/res/mipmap-xxhdpi/huoguo.jpg
new file mode 100644
index 0000000..03a4324
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/huoguo.jpg differ
diff --git a/app/src/main/res/mipmap-xxhdpi/huojim.png b/app/src/main/res/mipmap-xxhdpi/huojim.png
new file mode 100644
index 0000000..216d217
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/huojim.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/huolg.png b/app/src/main/res/mipmap-xxhdpi/huolg.png
new file mode 100644
index 0000000..1ecf2b1
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/huolg.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/hzmty.png b/app/src/main/res/mipmap-xxhdpi/hzmty.png
new file mode 100644
index 0000000..2367bd4
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/hzmty.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..15ac681
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..b216f2d
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/jidan.png b/app/src/main/res/mipmap-xxhdpi/jidan.png
new file mode 100644
index 0000000..c924c0c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/jidan.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/kaochang.png b/app/src/main/res/mipmap-xxhdpi/kaochang.png
new file mode 100644
index 0000000..db28927
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/kaochang.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/laomj.png b/app/src/main/res/mipmap-xxhdpi/laomj.png
new file mode 100644
index 0000000..7c2de98
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/laomj.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/leshi.png b/app/src/main/res/mipmap-xxhdpi/leshi.png
new file mode 100644
index 0000000..0eb36c0
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/leshi.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/liaomila.png b/app/src/main/res/mipmap-xxhdpi/liaomila.png
new file mode 100644
index 0000000..e36b8ca
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/liaomila.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/lizhi.png b/app/src/main/res/mipmap-xxhdpi/lizhi.png
new file mode 100644
index 0000000..3ae55d4
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/lizhi.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/logo1.png b/app/src/main/res/mipmap-xxhdpi/logo1.png
new file mode 100644
index 0000000..51e7e88
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/logo1.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/logo2.png b/app/src/main/res/mipmap-xxhdpi/logo2.png
new file mode 100644
index 0000000..a0d25d9
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/logo2.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/longxiawei.png b/app/src/main/res/mipmap-xxhdpi/longxiawei.png
new file mode 100644
index 0000000..21e0597
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/longxiawei.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/malawangzi.png b/app/src/main/res/mipmap-xxhdpi/malawangzi.png
new file mode 100644
index 0000000..60bd5f9
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/malawangzi.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/mimixt.png b/app/src/main/res/mipmap-xxhdpi/mimixt.png
new file mode 100644
index 0000000..86fe18c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/mimixt.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/momo.jpg b/app/src/main/res/mipmap-xxhdpi/momo.jpg
new file mode 100644
index 0000000..cdeb14e
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/momo.jpg differ
diff --git a/app/src/main/res/mipmap-xxhdpi/nangua.png b/app/src/main/res/mipmap-xxhdpi/nangua.png
new file mode 100644
index 0000000..c93e9c8
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/nangua.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/pidan.png b/app/src/main/res/mipmap-xxhdpi/pidan.png
new file mode 100644
index 0000000..9b6a72d
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/pidan.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/qcdg.png b/app/src/main/res/mipmap-xxhdpi/qcdg.png
new file mode 100644
index 0000000..562104b
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/qcdg.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ruishijuan.png b/app/src/main/res/mipmap-xxhdpi/ruishijuan.png
new file mode 100644
index 0000000..a1f1162
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ruishijuan.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/tk.png b/app/src/main/res/mipmap-xxhdpi/tk.png
new file mode 100644
index 0000000..f5fd127
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/tk.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/tudou.png b/app/src/main/res/mipmap-xxhdpi/tudou.png
new file mode 100644
index 0000000..66cd55b
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/tudou.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/welcome1.jpg b/app/src/main/res/mipmap-xxhdpi/welcome1.jpg
new file mode 100644
index 0000000..b245c15
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/welcome1.jpg differ
diff --git a/app/src/main/res/mipmap-xxhdpi/welcome_image.png b/app/src/main/res/mipmap-xxhdpi/welcome_image.png
new file mode 100644
index 0000000..60bf0ac
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/welcome_image.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/wuhuar.png b/app/src/main/res/mipmap-xxhdpi/wuhuar.png
new file mode 100644
index 0000000..f69cffa
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/wuhuar.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/xigua.png b/app/src/main/res/mipmap-xxhdpi/xigua.png
new file mode 100644
index 0000000..9cb96ee
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/xigua.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/zhuroushuijiao.png b/app/src/main/res/mipmap-xxhdpi/zhuroushuijiao.png
new file mode 100644
index 0000000..62f9f7d
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/zhuroushuijiao.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/zy1.png b/app/src/main/res/mipmap-xxhdpi/zy1.png
new file mode 100644
index 0000000..39c3c77
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/zy1.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/zy2.png b/app/src/main/res/mipmap-xxhdpi/zy2.png
new file mode 100644
index 0000000..e66252a
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/zy2.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..f25a419
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..e96783c
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml
new file mode 100644
index 0000000..8b4ce9a
--- /dev/null
+++ b/app/src/main/res/navigation/mobile_navigation.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..f6d8546
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,10 @@
+
+
+ #ff3366
+ #ff3366
+ #000000
+
+
+ #fff
+ #CCEEEEEE
+
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..e00c2dd
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..2da74b3
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,100 @@
+
+ momo超市
+ 分类
+ 购物车
+ 我的
+ +
+ 合计:
+ 购物车
+ -
+ +
+ 1
+ — 没有更多啦~ —
+ 请输入账号
+ 请输入密码
+ 登录
+ 当前购物车空空如也,快去添加
+ 还没有下单哦
+
+
+
+
+ - 湖南省
+ - 云南省
+ - 山西省
+ - 福建省
+ - 广西壮族自治区
+ - 广东省
+ - 贵州省
+
+
+
+ - 长沙市
+ - 常德市
+ - 郴州市
+ - 娄底市
+ - 怀化市
+ - 永州市
+
+
+
+ - 昆明市
+ - 曲靖市
+ - 玉溪市
+ - 昭通市
+ - 保山市
+ - 丽江市
+
+
+
+
+
+ - 南宁市
+ - 桂林市
+ - 柳州市
+ - 北海市
+ - 钦州市
+ - 玉林市
+ - 百色市
+ - 河池市
+ - 防城港市
+
+
+
+ - 大同市
+ - 临汾市
+ - 太原市
+ - 阳泉市
+ - 长治市
+ - 晋城市
+ - 朔州市
+ - 晋中市
+ - 运城市
+
+
+ - 福州市
+ - 厦门市
+ - 泉州市
+ - 漳州市
+ - 福清市
+ - 莆田市
+ - 宁德市
+
+
+ - 广州市
+ - 深圳市
+ - 中山市
+ - 佛山市
+ - 惠州市
+ - 珠海市
+ - 汕头市
+
+
+ - 贵阳市
+ - 遵义市
+ - 安顺市
+ - 毕节市
+ - 铜仁市
+ - 六盘水市
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..269b7e2
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml
new file mode 100644
index 0000000..2c950a5
--- /dev/null
+++ b/app/src/main/res/xml/network_security_config.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/test/java/com/shuyue/snack/ExampleUnitTest.java b/app/src/test/java/com/shuyue/snack/ExampleUnitTest.java
new file mode 100644
index 0000000..16a6071
--- /dev/null
+++ b/app/src/test/java/com/shuyue/snack/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.shuyue.snack;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..fb7a972
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,25 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:4.0.1'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ maven { url 'https://jitpack.io' }
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..c52ac9b
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,19 @@
+# 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=-Xmx2048m
+# 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
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..f6b961f
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..07f8d9c
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Jul 13 23:06:51 CST 2020
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..cccdd3d
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,172 @@
+#!/usr/bin/env sh
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+ echo "$*"
+}
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+ NONSTOP* )
+ nonstop=true
+ ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
+}
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..f955316
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,84 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windows variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..7c5fcbc
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,2 @@
+include ':app'
+rootProject.name = "Snack App"
\ No newline at end of file