commit 0d7b507235da9dd7386d1bd55db72c9c18a7e116 Author: 86157 <2106710376@qq.com> Date: Wed May 3 20:18:34 2023 +0800 first commit 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..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..3e92eab --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +yemamacake \ 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..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml new file mode 100644 index 0000000..70f212e --- /dev/null +++ b/.idea/dbnavigator.xml @@ -0,0 +1,414 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..ae331be --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..909c0df --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..19757db --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,91 @@ + + +<<<<<<< HEAD + + + + + + + + + + + Android + + + ComplianceLintAndroid + + + CorrectnessLintAndroid + + + LintAndroid + + + PerformanceLintAndroid + + + UsabilityLintAndroid + + + + + + +======= + +>>>>>>> 8d271bc (end_code) + + + + +<<<<<<< HEAD + + + +======= +>>>>>>> 8d271bc (end_code) + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3b782d4 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# url + diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..469bef4 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,57 @@ +apply plugin: 'com.android.application' + +android { +<<<<<<< HEAD + compileSdkVersion 33 + buildToolsVersion "29.0.2" + defaultConfig { + applicationId "com.orangesale.cn" + minSdkVersion 26 + targetSdkVersion 33 +======= + compileSdkVersion 30 + buildToolsVersion "30.0.2" + defaultConfig { + applicationId "com.example.orangesale_end" + minSdkVersion 26 + targetSdkVersion 30 +>>>>>>> 8d271bc (end_code) + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +<<<<<<< HEAD +======= + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } +>>>>>>> 8d271bc (end_code) +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +<<<<<<< HEAD + implementation 'androidx.appcompat:appcompat:1.4.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + implementation 'liji.library.dev:citypickerview:1.1.0' +======= + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' + implementation 'liji.library.dev:citypickerview:1.1.0' + implementation "com.squareup.okhttp3:okhttp:4.2.2" + implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.12' +>>>>>>> 8d271bc (end_code) +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /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 diff --git a/app/src/androidTest/java/com/example/orangesale_end/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/orangesale_end/ExampleInstrumentedTest.java new file mode 100644 index 0000000..0ef57ae --- /dev/null +++ b/app/src/androidTest/java/com/example/orangesale_end/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package com.example.orangesale_end; + +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.example.orangesale_end", appContext.getPackageName()); + } +} diff --git a/app/src/androidTest/java/com/yemamacake/cn/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/yemamacake/cn/ExampleInstrumentedTest.java new file mode 100644 index 0000000..713d673 --- /dev/null +++ b/app/src/androidTest/java/com/yemamacake/cn/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package com.orangesale.cn; + +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.orangesale.cn", appContext.getPackageName()); + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..c040658 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,51 @@ + + + +======= + package="com.example.orangesale_end"> + +>>>>>>> 8d271bc (end_code) + + + + + + + + + + + +======= + android:usesCleartextTraffic="true" + android:supportsRtl="true" + android:theme="@style/AppTheme"> + + + + + + + + + + + + + +>>>>>>> 8d271bc (end_code) + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/orangesale_end/MainActivity.java b/app/src/main/java/com/example/orangesale_end/MainActivity.java new file mode 100644 index 0000000..5ad8815 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/MainActivity.java @@ -0,0 +1,92 @@ +package com.example.orangesale_end; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Looper; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import com.example.orangesale_end.activity.IndexActivity; +import com.example.orangesale_end.activity.RegisterActivity; +import com.example.orangesale_end.entity.OrangeUser; +import com.example.orangesale_end.netrequest.OkHttpUser; + +import java.io.IOException; + +public class MainActivity extends AppCompatActivity implements View.OnClickListener { + private Button registerButton, loginButton; + private EditText usernameText, paswdEdit; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.user_login); + init(); + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.register: + Intent intent = new Intent(MainActivity.this, RegisterActivity.class); + startActivity(intent); + break; + case R.id.login: + //注册时,我们引入了数据库,登录这里可以通过数据库进行验证,验证跳转到首页,不通过进行提示 + Thread thread = new Thread(runnable); + thread.start(); + break; + } + + } + + //界面组件初始化 + private void init() { + usernameText = findViewById(R.id.username); + paswdEdit = findViewById(R.id.password); + loginButton = findViewById(R.id.login); + loginButton.setOnClickListener(this); + registerButton = findViewById(R.id.register); + registerButton.setOnClickListener(this); + } + + /** + * 登录验证 + */ + Runnable runnable = new Runnable() { + @Override + public void run() { + String username = usernameText.getText().toString(); + String password = paswdEdit.getText().toString(); + OrangeUser orangeUser = new OrangeUser(); + orangeUser.setUsername(username); + orangeUser.setPassword(password); + OkHttpUser okHttpUser = new OkHttpUser(); + OrangeUser orangeUser1 = null; + try { + orangeUser1 = okHttpUser.userLogin(orangeUser); + if (orangeUser1 != null) { + Intent intent1 = new Intent(MainActivity.this, IndexActivity.class); + Bundle bundle = new Bundle(); + bundle.putString("username", usernameText.getText().toString()); + bundle.putString("password", orangeUser1.getPassword()); + bundle.putString("city", orangeUser1.getCity()); + bundle.putString("sex", orangeUser1.getSex()); + intent1.putExtras(bundle); + startActivity(intent1); + } else { + //解决在子线程中调用Toast的异常情况处理 + Looper.prepare(); + Toast.makeText(MainActivity.this, "账号或者密码错误", Toast.LENGTH_SHORT).show(); + Looper.loop(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + }; +} diff --git a/app/src/main/java/com/example/orangesale_end/activity/CategoryActivity.java b/app/src/main/java/com/example/orangesale_end/activity/CategoryActivity.java new file mode 100644 index 0000000..278743a --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/activity/CategoryActivity.java @@ -0,0 +1,90 @@ +package com.example.orangesale_end.activity; + +import android.app.Activity; +import android.app.FragmentManager; +import android.app.FragmentTransaction; +import android.os.Bundle; +import android.widget.ListView; + +import androidx.annotation.Nullable; + +import com.example.orangesale_end.R; +import com.example.orangesale_end.adapter.Adapter; +import com.example.orangesale_end.entity.Product; +import com.example.orangesale_end.fragment.SetDetailFragment; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + + +public class CategoryActivity extends Activity { + public OnChangeListener onchangedListener; + private List productList; + private List productCategory = new ArrayList<>(); + private ListView titleList; + private Adapter adapter; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.content_category); + initData(); + init(); + SetDetailFragment fragment = new SetDetailFragment(); + FragmentManager fragmentManager = getFragmentManager(); + FragmentTransaction transaction = fragmentManager.beginTransaction(); + transaction.replace(R.id.category_detail, fragment); + transaction.commit(); + titleList.setOnItemClickListener((parent, view, position, id) -> { + adapter.setSelectedPosition(position); + adapter.notifyDataSetInvalidated(); + if (onchangedListener != null) { + onchangedListener.changeText(productList.get(position)); + } + }); + + } + + public void setOnChangeListener(OnChangeListener onChangeListener) { + this.onchangedListener = onChangeListener; + } + + public interface OnChangeListener { + void changeText(Product product); + } + + /** + * 初始化数据 + */ + private void initData() { + productList = new ArrayList<>(); + productCategory.add("橘子"); + productCategory.add("橙子"); + productCategory.add("柚子"); + Product product = new Product(); + product.setImageUrlId(R.drawable.arrow_down); + product.setProductName("橘子"); + product.setProductPrice(new BigDecimal("9.9")); + Product product1 = new Product(); + product1.setImageUrlId(R.drawable.orange); + product1.setProductName("橙子"); + product1.setProductPrice(new BigDecimal("29.9")); + Product product2 = new Product(); + product2.setImageUrlId(R.drawable.arrow_left); + product2.setProductName("柚子"); + product2.setProductPrice(new BigDecimal("19.9")); + productList.add(product); + productList.add(product1); + productList.add(product2); + } + + /** + * 初始化组件 + */ + private void init() { + titleList = findViewById(R.id.category_title_list); + adapter = new Adapter(productCategory, CategoryActivity.this); + titleList.setAdapter(adapter); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/example/orangesale_end/activity/IndexActivity.java b/app/src/main/java/com/example/orangesale_end/activity/IndexActivity.java new file mode 100644 index 0000000..e399cfb --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/activity/IndexActivity.java @@ -0,0 +1,128 @@ +package com.example.orangesale_end.activity; + +import android.app.Activity; +import android.app.FragmentTransaction; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.LinearLayout; + +import androidx.annotation.Nullable; + +import com.example.orangesale_end.R; +import com.example.orangesale_end.fragment.IndexFragment; +import com.example.orangesale_end.fragment.PearsonFragment; +import com.example.orangesale_end.fragment.ProductFragment; +import com.example.orangesale_end.fragment.ShoppingCartFragment; +import com.example.orangesale_end.service.TimeService; + +public class IndexActivity extends Activity implements View.OnClickListener { + private IndexFragment indexFragment; + private ProductFragment productFragment; + private ShoppingCartFragment shoppingCartFragment; + private PearsonFragment pearsonFragment; + private LinearLayout indexLine, productLine, shoppingCartLine, pearsonLine; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + init(); + initIndexFragment(); + Thread thread = new Thread(runnable); + thread.start(); + } + + /** + * 组件初始化 + */ + private void init() { + indexLine = findViewById(R.id.content_index); + indexLine.setOnClickListener(this); + productLine = findViewById(R.id.content_product); + productLine.setOnClickListener(this); + shoppingCartLine = findViewById(R.id.content_cart); + shoppingCartLine.setOnClickListener(this); + pearsonLine = findViewById(R.id.content_pearson); + pearsonLine.setOnClickListener(this); + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.content_index: + initIndexFragment(); + break; + case R.id.content_product: + initproductFragment(); + break; + case R.id.content_cart: + initshoppingCartFragment(); + break; + case R.id.content_pearson: + initpearsonFragment(); + break; + } + } + + /** + * 初始化首页Fragment + */ + private void initIndexFragment() { + //开启事务,fragment的控制是由事务来实现的 + FragmentTransaction transaction = getFragmentManager().beginTransaction(); + if (indexFragment == null) { + indexFragment = new IndexFragment(); + } + transaction.replace(R.id.main_content0, indexFragment); + transaction.commit(); + } + + /** + * 初始化产品Fragment + */ + private void initproductFragment() { + //开启事务,fragment的控制是由事务来实现的 + FragmentTransaction transaction = getFragmentManager().beginTransaction(); + if (productFragment == null) { + productFragment = new ProductFragment(); + } + transaction.replace(R.id.main_content0, productFragment); + transaction.commit(); + } + + /** + * 初始化购物车Fragment + */ + private void initshoppingCartFragment() { + //开启事务,fragment的控制是由事务来实现的 + FragmentTransaction transaction = getFragmentManager().beginTransaction(); + if (shoppingCartFragment == null) { + shoppingCartFragment = new ShoppingCartFragment(); + } + transaction.replace(R.id.main_content0, shoppingCartFragment); + transaction.commit(); + } + + /** + * 初始化个人Fragment + */ + private void initpearsonFragment() { + //开启事务,fragment的控制是由事务来实现的 + FragmentTransaction transaction = getFragmentManager().beginTransaction(); + if (pearsonFragment == null) { + Intent intent = IndexActivity.this.getIntent(); + Bundle bundle = intent.getExtras(); + pearsonFragment = new PearsonFragment(); + pearsonFragment.setArguments(bundle); + } + transaction.replace(R.id.main_content0, pearsonFragment); + transaction.commit(); + } + + Runnable runnable = () -> { + Intent intent = new Intent(IndexActivity.this, TimeService.class); + startService(intent); + }; + +} diff --git a/app/src/main/java/com/example/orangesale_end/activity/RegisterActivity.java b/app/src/main/java/com/example/orangesale_end/activity/RegisterActivity.java new file mode 100644 index 0000000..6601d99 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/activity/RegisterActivity.java @@ -0,0 +1,176 @@ +package com.example.orangesale_end.activity; + +import android.content.Intent; +import android.graphics.Color; +import android.os.Bundle; +import android.os.Looper; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.RadioGroup; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; + +import com.lljjcoder.citypickerview.widget.CityPicker; +import com.example.orangesale_end.R; +import com.example.orangesale_end.entity.OrangeUser; +import com.example.orangesale_end.netrequest.OkHttpUser; + +import java.io.IOException; + +public class RegisterActivity extends AppCompatActivity implements View.OnClickListener, RadioGroup.OnCheckedChangeListener { + private EditText usernameEdit, passwordEdit, surePasswordEdit; + private TextView cityText; + private CityPicker cityPicker; + private Button regButton; + private RadioGroup sexGroup; + private String sexStr = "男"; + + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.user_register); + init(); + } + + /** + * 界面组件初始化 + */ + private void init() { + cityText = findViewById(R.id.reg_province); + cityText.setOnClickListener(this); + usernameEdit = findViewById(R.id.reg_username); + passwordEdit = findViewById(R.id.reg_password); + surePasswordEdit = findViewById(R.id.reg_sure_password); + regButton = findViewById(R.id.reg_register); + regButton.setOnClickListener(this); + sexGroup = findViewById(R.id.sex); + sexGroup.setOnCheckedChangeListener(this); + + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.reg_province: + initCityPicker(); + cityPicker.show(); + break; + case R.id.reg_register: + //注册验证方法 + //validateRegister(); + Thread thread = new Thread(runnable); + thread.start(); + break; + + } + } + + /** + * 初始化城市选择器 + */ + public void initCityPicker() { + cityPicker = new CityPicker.Builder(RegisterActivity.this) + .textSize(16) + .title("地址选择") + .backgroundPop(0xa0000000) + .titleBackgroundColor("#EFB81C") + .titleTextColor("#000000") + .backgroundPop(0xa0000000) + .confirTextColor("#000000") + .cancelTextColor("#000000") + .province("江西省") + .city("赣州市") + .district("章贡区") + .textColor(Color.parseColor("#000000")) + .provinceCyclic(true) + .cityCyclic(false) + .districtCyclic(false) + .visibleItemsCount(7) + .itemPadding(10) + .onlyShowProvinceAndCity(false) + .build(); + cityPicker.setOnCityItemClickListener(new CityPicker.OnCityItemClickListener() { + @Override + public void onSelected(String... strings) { + String province = strings[0]; + String city = strings[1]; + String district = strings[2]; + cityText.setText(String.format("%s %s %s", province, city, district)); + } + + @Override + public void onCancel() { + } + }); + + } + + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + //根据用户选择来改变sex的值 + sexStr = checkedId == R.id.reg_man ? "男" : "女"; + } + + /** + * 注册验证 + */ + Runnable runnable = new Runnable() { + @Override + public void run() { + String username = usernameEdit.getText().toString(); + String password = passwordEdit.getText().toString(); + String surePassword = surePasswordEdit.getText().toString(); + String city = cityText.getText().toString(); + //判断两次密码是否输入一致 + if (password.equals(surePassword)) { + //这里也可以再进行其它的验证,如是否符合要求等,符合就进行插入数据库操作 + if (!username.equals("") || !password.equals("")) { + if (!city.equals("")) { + Bundle bundle = new Bundle(); + bundle.putString("username", username); + bundle.putString("password", password); + bundle.putString("sex", sexStr); + bundle.putString("city", city); + OrangeUser orangeUser = new OrangeUser(); + orangeUser.setUsername(username); + orangeUser.setPassword(password); + orangeUser.setCity(city); + orangeUser.setSex(sexStr); + //将使用安卓自身带的SQLite数据库换成调用okhttp的方式 + OkHttpUser okHttpUser = new OkHttpUser(); + try { + if (okHttpUser.userRegister(orangeUser)) { + Intent intent = new Intent(RegisterActivity.this, IndexActivity.class); + intent.putExtras(bundle); + startActivity(intent); + } else { + Looper.prepare(); + Toast.makeText(RegisterActivity.this, "注册失败!", Toast.LENGTH_SHORT).show(); + Looper.loop(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } else { + Looper.prepare(); + Toast.makeText(RegisterActivity.this, "请选择地址", Toast.LENGTH_SHORT).show(); + Looper.loop(); + } + } else { + Looper.prepare(); + Toast.makeText(RegisterActivity.this, "账号或密码未填写", Toast.LENGTH_SHORT).show(); + Looper.loop(); + } + } else { + Looper.prepare(); + Toast.makeText(RegisterActivity.this, "两次密码输入不一致", Toast.LENGTH_SHORT).show(); + Looper.loop(); + } + } + }; +} diff --git a/app/src/main/java/com/example/orangesale_end/activity/UserActivity.java b/app/src/main/java/com/example/orangesale_end/activity/UserActivity.java new file mode 100644 index 0000000..f9ef766 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/activity/UserActivity.java @@ -0,0 +1,66 @@ +package com.example.orangesale_end.activity; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.Nullable; + +import com.example.orangesale_end.R; + +public class UserActivity extends Activity implements View.OnClickListener { + private ImageView userIconImage; + private TextView usernameText, userSexText, userCityText; + private LinearLayout usernameLine, userSexline, userCityLine, userPayLine, userSettingLine, userGeneralLine, userSearchProductLine; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.content_user); + init(); + } + + /** + * 组件初始化 + */ + private void init() { + userIconImage = findViewById(R.id.user_icon); + usernameText = findViewById(R.id.user_username); + userSexText = findViewById(R.id.user_sex); + userCityText = findViewById(R.id.user_city); + usernameLine = findViewById(R.id.user_username_line); + userSexline = findViewById(R.id.user_sex_line); + userCityLine = findViewById(R.id.user_city_line); + userPayLine = findViewById(R.id.user_pay); + userSettingLine = findViewById(R.id.user_setting); + userGeneralLine = findViewById(R.id.user_general); +// userSearchProductLine = findViewById(R.id.user_searchProduct); + userSearchProductLine.setOnClickListener(this); + setData(); + } + + /** + * 组件赋值 + */ + private void setData() { + Intent intent = UserActivity.this.getIntent(); + Bundle bundle = intent.getExtras(); + usernameText.setText(String.format("用户名:%s", bundle.getString("username"))); + userSexText.setText(String.format("性别:%s", bundle.getString("sex"))); + userCityText.setText(String.format("城市:%s", bundle.getString("city"))); + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + /*case R.id.user_searchProduct: + Intent intent1 = new Intent(UserActivity.this, CategoryActivity.class); + startActivity(intent1); + break;*/ + } + } +} diff --git a/app/src/main/java/com/example/orangesale_end/adapter/Adapter.java b/app/src/main/java/com/example/orangesale_end/adapter/Adapter.java new file mode 100644 index 0000000..7b5b02e --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/adapter/Adapter.java @@ -0,0 +1,69 @@ +package com.example.orangesale_end.adapter; + +import android.content.Context; +import android.graphics.Color; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.TextView; + +import com.example.orangesale_end.R; + +import java.util.List; + +public class Adapter extends BaseAdapter { + private List productCategory; + private LayoutInflater layoutInflater; + private int selectionPosition = -1; + + public Adapter(List productCategory, Context context) { + this.productCategory = productCategory; + this.layoutInflater = LayoutInflater.from(context); + } + + @Override + public int getCount() { + return productCategory.size(); + } + + @Override + public Object getItem(int position) { + return productCategory.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + ViewHolder viewHolder = null; + if (convertView == null) { + viewHolder = new ViewHolder(); + convertView = layoutInflater.inflate(R.layout.category_list_item, null); + Log.i("adapts", "getView: " + convertView); + viewHolder.tv = convertView.findViewById(R.id.categor_titles); + convertView.setTag(viewHolder); + } else { + viewHolder = (ViewHolder) convertView.getTag(); + } + viewHolder.tv.setText(productCategory.get(position)); + if (selectionPosition == position) { + viewHolder.tv.setBackgroundColor(Color.YELLOW); + } else { + viewHolder.tv.setBackgroundColor(Color.WHITE); + } + return convertView; + } + + public void setSelectedPosition(int position) { + this.selectionPosition = position; + } + + class ViewHolder { + TextView tv; + } +} diff --git a/app/src/main/java/com/example/orangesale_end/adapter/ListViewAdapter.java b/app/src/main/java/com/example/orangesale_end/adapter/ListViewAdapter.java new file mode 100644 index 0000000..39c0e88 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/adapter/ListViewAdapter.java @@ -0,0 +1,78 @@ +package com.example.orangesale_end.adapter; + +import android.content.Context; +import android.graphics.Color; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.example.orangesale_end.R; +import com.example.orangesale_end.entity.Condition; + +import java.util.List; + +public class ListViewAdapter extends BaseAdapter { + private List conditionList; + private LayoutInflater layoutInflater; + private int selectedPosition = -1; + private int selectColor = Color.GRAY; + + public ListViewAdapter(Context context, List conditionList) { + this.conditionList = conditionList; + this.layoutInflater = LayoutInflater.from(context); + } + + @Override + public int getCount() { + return conditionList.size(); + } + + @Override + public Object getItem(int position) { + return conditionList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + ViewHolder viewHolder; + if (convertView == null) { + convertView = layoutInflater.inflate(R.layout.product_condition_item, null); + viewHolder = new ViewHolder(); + viewHolder.imageView = convertView.findViewById(R.id.condition_icon); + viewHolder.jiange = convertView.findViewById(R.id.image_jiange); + viewHolder.textView = convertView.findViewById(R.id.condition_name); + viewHolder.linearLayout = convertView.findViewById(R.id.item_bg); + convertView.setTag(viewHolder); + } else { + viewHolder = (ViewHolder) convertView.getTag(); + } + Condition condition = conditionList.get(position); + if (condition != null) { + viewHolder.imageView.setBackgroundResource(condition.getConditionIcon()); + viewHolder.textView.setText(condition.getConditionName()); + viewHolder.jiange.setBackgroundColor(Color.rgb(207, 207, 207)); + if (selectedPosition == position) { + viewHolder.linearLayout.setBackgroundColor(selectColor); + } + + } + return convertView; + } + + class ViewHolder { + ImageView imageView, jiange; + TextView textView; + LinearLayout linearLayout; + } + + +} diff --git a/app/src/main/java/com/example/orangesale_end/adapter/ProductAdapter.java b/app/src/main/java/com/example/orangesale_end/adapter/ProductAdapter.java new file mode 100644 index 0000000..72c6f20 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/adapter/ProductAdapter.java @@ -0,0 +1,68 @@ +package com.example.orangesale_end.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.TextView; + +import com.example.orangesale_end.R; +import com.example.orangesale_end.entity.OrangeProductPack; + +import java.util.List; + +public class ProductAdapter extends BaseAdapter { + //private List productList; + private List orangeProductList; + private LayoutInflater layoutInflater; + + public ProductAdapter(Context context, List orangeProductList) { + this.orangeProductList = orangeProductList; + this.layoutInflater = LayoutInflater.from(context); + } + + @Override + public int getCount() { + return orangeProductList.size(); + } + + @Override + public Object getItem(int position) { + return orangeProductList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + ViewHolder viewHolder; + if (convertView == null) { + convertView = layoutInflater.inflate(R.layout.categoty_detail_content, null); + viewHolder = new ViewHolder(); + viewHolder.productImage = convertView.findViewById(R.id.category_product_image); + viewHolder.productName = convertView.findViewById(R.id.category_product_name); + viewHolder.productPrice = convertView.findViewById(R.id.category_product_price); + convertView.setTag(viewHolder); + } else { + viewHolder = (ViewHolder) convertView.getTag(); + } + OrangeProductPack product = orangeProductList.get(position); + if (product != null) { + viewHolder.productImage.setImageBitmap(product.getImgBitmap()); + viewHolder.productName.setText(product.getName()); + viewHolder.productPrice.setText(String.format("%s元", String.valueOf(product.getPrice()))); + } + return convertView; + } + + class ViewHolder { + ImageView productImage; + TextView productName, productPrice; + } + +} diff --git a/app/src/main/java/com/example/orangesale_end/entity/Condition.java b/app/src/main/java/com/example/orangesale_end/entity/Condition.java new file mode 100644 index 0000000..960bf61 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/entity/Condition.java @@ -0,0 +1,30 @@ +package com.example.orangesale_end.entity; + +public class Condition { + private Integer conditionIcon; + private String conditionName; + + public Integer getConditionIcon() { + return conditionIcon; + } + + public void setConditionIcon(Integer conditionIcon) { + this.conditionIcon = conditionIcon; + } + + public String getConditionName() { + return conditionName; + } + + public void setConditionName(String conditionName) { + this.conditionName = conditionName; + } + + @Override + public String toString() { + return "Condition{" + + "conditionIcon=" + conditionIcon + + ", conditionName='" + conditionName + '\'' + + '}'; + } +} diff --git a/app/src/main/java/com/example/orangesale_end/entity/OrangeMessage.java b/app/src/main/java/com/example/orangesale_end/entity/OrangeMessage.java new file mode 100644 index 0000000..eb7a058 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/entity/OrangeMessage.java @@ -0,0 +1,52 @@ +package com.example.orangesale_end.entity; + +import java.sql.Timestamp; + +public class OrangeMessage { + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Timestamp getSendTime() { + return sendTime; + } + + public void setSendTime(Timestamp sendTime) { + this.sendTime = sendTime; + } + + public String getUsed() { + return used; + } + + public void setUsed(String used) { + this.used = used; + } + + private Integer id; + private String content; + private Timestamp sendTime; + private String used; + + @Override + public String toString() { + return "OrangeMessage{" + + "id=" + id + + ", content='" + content + '\'' + + ", sendTime=" + sendTime + + ", used='" + used + '\'' + + '}'; + } +} diff --git a/app/src/main/java/com/example/orangesale_end/entity/OrangeProduct.java b/app/src/main/java/com/example/orangesale_end/entity/OrangeProduct.java new file mode 100644 index 0000000..6ce06d9 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/entity/OrangeProduct.java @@ -0,0 +1,64 @@ +package com.example.orangesale_end.entity; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +public class OrangeProduct { + private Integer id; + private String name; + private BigDecimal price; + private String imgUrl; + + @Override + public String toString() { + return "OrangeProduct{" + + "id=" + id + + ", name='" + name + '\'' + + ", price=" + price + + ", imgUrl='" + imgUrl + '\'' + + ", addTime=" + addTime + + '}'; + } + + public Timestamp getAddTime() { + return addTime; + } + + public void setAddTime(Timestamp addTime) { + this.addTime = addTime; + } + + private Timestamp addTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } +} diff --git a/app/src/main/java/com/example/orangesale_end/entity/OrangeProductPack.java b/app/src/main/java/com/example/orangesale_end/entity/OrangeProductPack.java new file mode 100644 index 0000000..0acf008 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/entity/OrangeProductPack.java @@ -0,0 +1,66 @@ +package com.example.orangesale_end.entity; + +import android.graphics.Bitmap; + +import java.math.BigDecimal; +import java.sql.Timestamp; + +public class OrangeProductPack { + private Integer id; + private String name; + private Timestamp addTime; + private Bitmap imgBitmap; + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + private BigDecimal price; + + @Override + public String toString() { + return "OrangeProductPack{" + + "id=" + id + + ", name='" + name + '\'' + + ", addTime=" + addTime + + ", imgBitmap=" + imgBitmap + + ", price=" + price + + '}'; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Timestamp getAddTime() { + return addTime; + } + + public void setAddTime(Timestamp addTime) { + this.addTime = addTime; + } + + public Bitmap getImgBitmap() { + return imgBitmap; + } + + public void setImgBitmap(Bitmap imgBitmap) { + this.imgBitmap = imgBitmap; + } +} diff --git a/app/src/main/java/com/example/orangesale_end/entity/OrangeUser.java b/app/src/main/java/com/example/orangesale_end/entity/OrangeUser.java new file mode 100644 index 0000000..91c6ffc --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/entity/OrangeUser.java @@ -0,0 +1,59 @@ +package com.example.orangesale_end.entity; + +public class OrangeUser { + private Integer id; + private String username; + private String password; + private String sex; + private String city; + + public Integer getId() { + return id; + } + + public void setId(Integer 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 getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + @Override + public String toString() { + return "OrangeUser{" + + "username='" + username + '\'' + + ", password='" + password + '\'' + + ", sex='" + sex + '\'' + + ", city='" + city + '\'' + + '}'; + } +} diff --git a/app/src/main/java/com/example/orangesale_end/entity/Product.java b/app/src/main/java/com/example/orangesale_end/entity/Product.java new file mode 100644 index 0000000..f762103 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/entity/Product.java @@ -0,0 +1,43 @@ +package com.example.orangesale_end.entity; + +import java.math.BigDecimal; + +public class Product { + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public BigDecimal getProductPrice() { + return productPrice; + } + + public void setProductPrice(BigDecimal productPrice) { + this.productPrice = productPrice; + } + + public Integer getImageUrlId() { + return imageUrlId; + } + + public void setImageUrlId(Integer imageUrlId) { + this.imageUrlId = imageUrlId; + } + + private Integer imageUrlId; + private String productName; + private BigDecimal productPrice; + + @Override + public String toString() { + return "Product{" + + "imageUrlId=" + imageUrlId + + ", productName='" + productName + '\'' + + ", productPrice=" + productPrice + + '}'; + } +} diff --git a/app/src/main/java/com/example/orangesale_end/entity/ShoppingCart.java b/app/src/main/java/com/example/orangesale_end/entity/ShoppingCart.java new file mode 100644 index 0000000..fe38c7c --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/entity/ShoppingCart.java @@ -0,0 +1,44 @@ +package com.example.orangesale_end.entity; + +public class ShoppingCart { + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public Integer getProductId() { + return ProductId; + } + + public void setProductId(Integer productId) { + ProductId = productId; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + private Integer id; + private Integer userId; + private Integer ProductId; + /** + * 购买数量 + */ + private Integer number; +} diff --git a/app/src/main/java/com/example/orangesale_end/fragment/IndexFragment.java b/app/src/main/java/com/example/orangesale_end/fragment/IndexFragment.java new file mode 100644 index 0000000..195bf55 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/fragment/IndexFragment.java @@ -0,0 +1,136 @@ +package com.example.orangesale_end.fragment; + +import android.app.Fragment; +import android.os.AsyncTask; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.GridView; +import android.widget.LinearLayout; +import android.widget.SearchView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.example.orangesale_end.R; +import com.example.orangesale_end.adapter.ProductAdapter; +import com.example.orangesale_end.entity.OrangeProductPack; +import com.example.orangesale_end.entity.Product; +import com.example.orangesale_end.netrequest.OkHttpClientProduct; + +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + + +public class IndexFragment extends Fragment implements View.OnClickListener { + private SearchView searchView; + private LinearLayout orangeLine, youziLine, juziLine, xiguaLine, liLine, appleLine, lemonLine, mangguoLine; + private GridView gridView; + private ProductAdapter productAdapter; + private List productList; + private List list = new ArrayList<>(); + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_index, container, false); + init(view); + return view; + } + + /** + * 初始化组件 + */ + private void init(View view) { + searchView = view.findViewById(R.id.searchView); + searchView.setOnClickListener(this); + orangeLine = view.findViewById(R.id.breakfast); + orangeLine.setOnClickListener(this); + youziLine = view.findViewById(R.id.下午茶点); + youziLine.setOnClickListener(this); + juziLine = view.findViewById(R.id.western_cake); + juziLine.setOnClickListener(this); + xiguaLine = view.findViewById(R.id.chinese_tradional_cake); + xiguaLine.setOnClickListener(this); + liLine = view.findViewById(R.id.chinese_newcake); + liLine.setOnClickListener(this); + lemonLine = view.findViewById(R.id.breakbread); + lemonLine.setOnClickListener(this); + mangguoLine = view.findViewById(R.id.fruit_tea); + mangguoLine.setOnClickListener(this); + appleLine = view.findViewById(R.id.birthcake); + appleLine.setOnClickListener(this); + gridView = view.findViewById(R.id.index_famous_gridview); + //initData(); + new SearchProductTask().execute(); + } + + + @Override + public void onClick(View v) { + + } + + /** + * 初始化商品数据 + */ + private void initData() { + productList = new ArrayList<>(); + Product product = new Product(); + product.setImageUrlId(R.drawable.strawberrybread); + product.setProductName("草莓蛋糕"); + product.setProductPrice(new BigDecimal("29.9")); + Product product1 = new Product(); + product1.setImageUrlId(R.drawable.sweet); + product1.setProductName("马卡龙"); + product1.setProductPrice(new BigDecimal("39.9")); + Product product2 = new Product(); + product2.setImageUrlId(R.drawable.hongdoubread); + product2.setProductName("红的吐司"); + product2.setProductPrice(new BigDecimal("9.9")); + Product product3 = new Product(); + product3.setImageUrlId(R.drawable.mochabread); + product3.setProductName("抹茶吐司"); + product3.setProductPrice(new BigDecimal("12.9")); + Product product4 = new Product(); + product4.setImageUrlId(R.drawable.rousongbread); + product4.setProductName("肉松小贝"); + product4.setProductPrice(new BigDecimal("49.9")); + Product product5 = new Product(); + product5.setImageUrlId(R.drawable.user_cake); + product5.setProductName("慕斯卷"); + product5.setProductPrice(new BigDecimal("9.9")); + productList.add(product); + productList.add(product1); + productList.add(product2); + productList.add(product3); + productList.add(product4); + productList.add(product5); + } + + /** + * 发送网络请求获取数据 + */ + class SearchProductTask extends AsyncTask> { + + @Override + protected List doInBackground(Void... voids) { + OkHttpClientProduct clientProduct = new OkHttpClientProduct(); + try { + list = clientProduct.getProductPack(); + } catch (IOException e) { + e.printStackTrace(); + } + return list; + } + + @Override + protected void onPostExecute(List orangeProducts) { + productAdapter = new ProductAdapter(getActivity(), list); + gridView.setAdapter(productAdapter); + } + } +} diff --git a/app/src/main/java/com/example/orangesale_end/fragment/PearsonFragment.java b/app/src/main/java/com/example/orangesale_end/fragment/PearsonFragment.java new file mode 100644 index 0000000..0f3e8de --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/fragment/PearsonFragment.java @@ -0,0 +1,64 @@ +package com.example.orangesale_end.fragment; + +import android.app.Fragment; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.example.orangesale_end.R; + +public class PearsonFragment extends Fragment implements View.OnClickListener { + private ImageView userIconImage; + private TextView usernameText, userSexText, userCityText; + private LinearLayout usernameLine, userSexline, userCityLine, userPayLine, userSettingLine, userGeneralLine; + + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_user, container, false); + init(view); + return view; + } + + /** + * 组件初始化 + */ + private void init(View view) { + userIconImage = view.findViewById(R.id.user_icon); + usernameText = view.findViewById(R.id.user_username); + userSexText = view.findViewById(R.id.user_sex); + userCityText = view.findViewById(R.id.user_city); + usernameLine = view.findViewById(R.id.user_username_line); + userSexline = view.findViewById(R.id.user_sex_line); + userCityLine = view.findViewById(R.id.user_city_line); + userPayLine = view.findViewById(R.id.user_pay); + userSettingLine = view.findViewById(R.id.user_setting); + userGeneralLine = view.findViewById(R.id.user_general); + setData(); + } + + /** + * 组件赋值 + */ + private void setData() { + Bundle bundle = getArguments(); + usernameText.setText(String.format("用户名:%s", bundle.getString("username"))); + userSexText.setText(String.format("性别:%s", bundle.getString("sex"))); + userCityText.setText(String.format("城市:%s", bundle.getString("city"))); + } + + @Override + public void onClick(View v) { + + } + + +} diff --git a/app/src/main/java/com/example/orangesale_end/fragment/ProductFragment.java b/app/src/main/java/com/example/orangesale_end/fragment/ProductFragment.java new file mode 100644 index 0000000..5d6fc86 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/fragment/ProductFragment.java @@ -0,0 +1,102 @@ +package com.example.orangesale_end.fragment; + +import android.app.Fragment; +import android.os.AsyncTask; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.GridView; +import android.widget.Spinner; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.example.orangesale_end.R; +import com.example.orangesale_end.adapter.ListViewAdapter; +import com.example.orangesale_end.adapter.ProductAdapter; +import com.example.orangesale_end.entity.Condition; +import com.example.orangesale_end.entity.OrangeProductPack; +import com.example.orangesale_end.netrequest.OkHttpClientProduct; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class ProductFragment extends Fragment { + private Spinner conditonListSpinner; + private ListViewAdapter listViewAdapter; + private List conditionList; + private GridView productGridView; + private List orangeProductList = new ArrayList<>(); + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_product, container, false); + init(view); + return view; + } + + /** + * 组件初始化方法 + * + * @param view + */ + private void init(View view) { + conditonListSpinner = view.findViewById(R.id.product_select_condition); + initCondList(); + listViewAdapter = new ListViewAdapter(getActivity(), conditionList); + conditonListSpinner.setAdapter(listViewAdapter); + productGridView = view.findViewById(R.id.product_list); + new SearchProductTask().execute(); + } + + /** + * 初始化conditionList + */ + private void initCondList() { + conditionList = new ArrayList<>(); + Condition allCondition = new Condition(); + allCondition.setConditionIcon(R.drawable.all); + allCondition.setConditionName("全部"); + Condition saleCondition = new Condition(); + saleCondition.setConditionIcon(R.drawable.salenum); + saleCondition.setConditionName("按销量高低排序"); + Condition timeCondition = new Condition(); + timeCondition.setConditionIcon(R.drawable.time); + timeCondition.setConditionName("按上市时间排序"); + Condition priceCondition = new Condition(); + priceCondition.setConditionIcon(R.drawable.price); + priceCondition.setConditionName("按商品价格排序"); + conditionList.add(allCondition); + conditionList.add(saleCondition); + conditionList.add(timeCondition); + conditionList.add(priceCondition); + } + + /** + * 发送网络请求获取数据 + */ + class SearchProductTask extends AsyncTask> { + + @Override + protected List doInBackground(Void... voids) { + OkHttpClientProduct clientProduct = new OkHttpClientProduct(); + try { + orangeProductList = clientProduct.getProductPack(); + } catch (IOException e) { + e.printStackTrace(); + } + return orangeProductList; + } + + @Override + protected void onPostExecute(List orangeProducts) { + ProductAdapter productAdapter = new ProductAdapter(getActivity(), orangeProductList); + productGridView.setAdapter(productAdapter); + } + } + + +} diff --git a/app/src/main/java/com/example/orangesale_end/fragment/SetDetailFragment.java b/app/src/main/java/com/example/orangesale_end/fragment/SetDetailFragment.java new file mode 100644 index 0000000..211082d --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/fragment/SetDetailFragment.java @@ -0,0 +1,53 @@ +package com.example.orangesale_end.fragment; + +import android.annotation.SuppressLint; +import android.app.Fragment; +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.example.orangesale_end.R; +import com.example.orangesale_end.activity.CategoryActivity; + +import java.util.Objects; + +public class SetDetailFragment extends Fragment { + private View view; + private ImageView imageView; + private TextView nameText, priceText; + + @SuppressLint("SetTextI18n") + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + view = inflater.inflate(R.layout.categoty_detail_content, container, false); + if (view != null) { + init(); + } + CategoryActivity categoryActivity = (CategoryActivity) getActivity(); + Objects.requireNonNull(categoryActivity).setOnChangeListener(product -> { + Log.i("sss", "onCreateView: " + product.getProductName()); + imageView.setBackgroundResource(product.getImageUrlId()); + nameText.setText(product.getProductName()); + priceText.setText(product.getProductPrice().toString()); + }); + return view; + } + + /** + * 内容组件初始化 + */ + private void init() { + imageView = view.findViewById(R.id.category_product_image); + nameText = view.findViewById(R.id.category_product_name); + priceText = view.findViewById(R.id.category_product_price); + } + +} diff --git a/app/src/main/java/com/example/orangesale_end/fragment/ShoppingCartFragment.java b/app/src/main/java/com/example/orangesale_end/fragment/ShoppingCartFragment.java new file mode 100644 index 0000000..f37faae --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/fragment/ShoppingCartFragment.java @@ -0,0 +1,61 @@ +package com.example.orangesale_end.fragment; + +import android.app.Fragment; +import android.app.FragmentTransaction; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.example.orangesale_end.R; +import com.example.orangesale_end.entity.ShoppingCart; + +import java.util.ArrayList; +import java.util.List; + +public class ShoppingCartFragment extends Fragment implements View.OnClickListener { + private Button walkButton; + private List cartList = new ArrayList<>(); + private ProductFragment productFragment; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + View view; + if (cartList.size() > 0) { + //有商品 + view = LayoutInflater.from(getActivity()).inflate(R.layout.cart_have_product, container, false); + } else { + view = LayoutInflater.from(getActivity()).inflate(R.layout.cart_no_product, container, false); + } + init(view); + return view; + } + + /** + * 组件初始化 + */ + private void init(View view) { + walkButton = view.findViewById(R.id.random_search); + walkButton.setOnClickListener(this); + } + + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.random_search: + //开启事务,fragment的控制是由事务来实现的 + FragmentTransaction transaction = getFragmentManager().beginTransaction(); + if (productFragment == null) { + productFragment = new ProductFragment(); + } + transaction.replace(R.id.main_content0, productFragment); + transaction.commit(); + break; + } + } +} diff --git a/app/src/main/java/com/example/orangesale_end/netrequest/OkHttpClientProduct.java b/app/src/main/java/com/example/orangesale_end/netrequest/OkHttpClientProduct.java new file mode 100644 index 0000000..e7e460b --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/netrequest/OkHttpClientProduct.java @@ -0,0 +1,80 @@ +package com.example.orangesale_end.netrequest; + +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.example.orangesale_end.entity.OrangeProduct; +import com.example.orangesale_end.entity.OrangeProductPack; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +public class OkHttpClientProduct { + + /** + * 查询商品信息 + * + * @return + */ + public List getProduct() throws IOException { + OkHttpClient okHttpClient = new OkHttpClient(); + Request request = new Request.Builder() + .url("http://106.55.41.135:8081/orange/product/search") + .build(); + Response response = okHttpClient.newCall(request).execute(); + JSONObject jsonObject = JSON.parseObject(Objects.requireNonNull(response.body()).string()); + List list = JSON.parseObject(jsonObject.getString("data"), new TypeReference>() { + }); + return list; + } + + /** + * 获取图片 + * + * @param imgUrl + * @return + * @throws IOException + */ + public Bitmap getImageBitMap(String imgUrl) throws IOException { + Bitmap bitmap; + OkHttpClient okHttpClient = new OkHttpClient(); + Request request = new Request.Builder() + .url(imgUrl) + .build(); + Response response = okHttpClient.newCall(request).execute(); + byte[] bytes = Objects.requireNonNull(response.body()).bytes(); + bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); + return bitmap; + + } + + /** + * 封装信息 + * + * @return + * @throws IOException + */ + + public List getProductPack() throws IOException { + List packList = new ArrayList<>(); + List list = getProduct(); + for (OrangeProduct orangeProduct : list) { + OrangeProductPack orangeProductPack = new OrangeProductPack(); + orangeProductPack.setId(orangeProduct.getId()); + orangeProductPack.setImgBitmap(getImageBitMap(orangeProduct.getImgUrl())); + orangeProductPack.setAddTime(orangeProduct.getAddTime()); + orangeProductPack.setPrice(orangeProduct.getPrice()); + packList.add(orangeProductPack); + } + return packList; + } +} diff --git a/app/src/main/java/com/example/orangesale_end/netrequest/OkHttpMessage.java b/app/src/main/java/com/example/orangesale_end/netrequest/OkHttpMessage.java new file mode 100644 index 0000000..e8787ab --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/netrequest/OkHttpMessage.java @@ -0,0 +1,39 @@ +package com.example.orangesale_end.netrequest; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.example.orangesale_end.entity.OrangeMessage; + +import java.io.IOException; +import java.util.Objects; + +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +public class OkHttpMessage { + + /** + * 消费消息 + * + * @return + */ + public OrangeMessage consumeMessage() throws IOException { + OkHttpClient okHttpClient = new OkHttpClient(); + Request request = new Request.Builder() + .url("http://106.55.41.135:8081/orange/message/consumeMessage") + .build(); + Response response = okHttpClient.newCall(request).execute(); + JSONObject jsonObject = JSON.parseObject(Objects.requireNonNull(response.body()).string()); + OrangeMessage orangeMessage = JSON.toJavaObject(jsonObject.getJSONObject("data"), OrangeMessage.class); + /** + * 消费完消息以后,设置消息为已读 + */ + Request request1 = new Request.Builder() + .url("http://106.55.41.135:8081/orange/message/updateMessage") + .build(); + okHttpClient.newCall(request1).execute(); + return orangeMessage; + } + +} diff --git a/app/src/main/java/com/example/orangesale_end/netrequest/OkHttpUser.java b/app/src/main/java/com/example/orangesale_end/netrequest/OkHttpUser.java new file mode 100644 index 0000000..d84253e --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/netrequest/OkHttpUser.java @@ -0,0 +1,71 @@ +package com.example.orangesale_end.netrequest; + +import android.util.Log; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.example.orangesale_end.entity.OrangeUser; + +import java.io.IOException; + +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +public class OkHttpUser { + /** + * 用户登录验证 + * + * @param orangeUser + */ + public OrangeUser userLogin(OrangeUser orangeUser) throws IOException { + OkHttpClient okHttpClient= new OkHttpClient(); + //数据类型为json格式 + MediaType mediaType = MediaType.parse("application/json; charset=utf-8"); + //将对象转为JSON字符串 + String jsonStr = JSONObject.toJSONString(orangeUser); + + RequestBody requestBody = RequestBody.create(jsonStr, mediaType); + Request request = new Request.Builder() + .url("http://106.55.41.135:8081/orange/user/login") + .post(requestBody) + .build(); + + Response response = okHttpClient.newCall(request).execute(); + + String responseStr = response.body().string(); + System.out.println("responseStr = " + responseStr); + JSONObject jsonObject = JSON.parseObject(responseStr); + JSONObject jsonObject1 = jsonObject.getJSONObject("data"); + OrangeUser orangeUser1 = JSON.toJavaObject(jsonObject1, OrangeUser.class); + return orangeUser1; + } + + /** + * 用户注册 + * + * @param orangeUser + * @return + * @throws IOException + */ + public boolean userRegister(OrangeUser orangeUser) throws IOException { + OkHttpClient okHttpClient = new OkHttpClient(); + //数据类型为json格式 + MediaType mediaType = MediaType.parse("application/json; charset=utf-8"); + //将对象转为JSON字符串 + String jsonStr = JSONObject.toJSONString(orangeUser); + RequestBody requestBody = RequestBody.create(jsonStr, mediaType); + Request request = new Request.Builder() + .url("http://106.55.41.135:8081/orange/user/register") + .post(requestBody) + .build(); + Response response = okHttpClient.newCall(request).execute(); + JSONObject jsonObject = JSON.parseObject(response.body().string()); + Log.i("register", "userRegister: "+jsonObject); + return jsonObject.getBoolean("flag"); + } + + +} diff --git a/app/src/main/java/com/example/orangesale_end/service/TimeService.java b/app/src/main/java/com/example/orangesale_end/service/TimeService.java new file mode 100644 index 0000000..ceecacc --- /dev/null +++ b/app/src/main/java/com/example/orangesale_end/service/TimeService.java @@ -0,0 +1,105 @@ +package com.example.orangesale_end.service; + +import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.Service; +import android.content.Context; +import android.content.Intent; +import android.os.AsyncTask; +import android.os.IBinder; +import android.util.Log; + +import androidx.annotation.Nullable; +import androidx.core.app.NotificationCompat; + +import com.example.orangesale_end.R; +import com.example.orangesale_end.entity.OrangeMessage; +import com.example.orangesale_end.netrequest.OkHttpMessage; + +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Objects; +import java.util.Timer; +import java.util.TimerTask; + +public class TimeService extends Service { + private static Timer timer = null; + private NotificationManager manager; + private NotificationCompat.Builder builder; + + @Nullable + @Override + public IBinder onBind(Intent intent) { + return null; + } + + /** + * 清除通知 + */ + private void cleanAllNotification() { + manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + manager.cancelAll(); + if (timer != null) { + timer.cancel(); + timer = null; + } + + } + + /** + * 添加通知 + */ + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + long period = 60 * 1000; //1分钟一个周期 + if (timer == null) { + timer = new Timer(); + } + timer.schedule(new TimerTask() { + @Override + public void run() { + new ConsumeMessageTask().execute(); + } + }, 0, period); + + return super.onStartCommand(intent, flags, startId); + } + + class ConsumeMessageTask extends AsyncTask { + @Override + protected Void doInBackground(Void... voids) { + /** + * NotificationChannel是android8.0新增的特性,如果App的targetSDKVersion>=26, + * 没有设置channel通知渠道的话,就会导致通知无法展示。 + * 报错内容:Failed to post notification on channel “null” + */ + OkHttpMessage okHttpMessage = new OkHttpMessage(); + OrangeMessage orangeMessage; + try { + orangeMessage = okHttpMessage.consumeMessage(); + if (!Objects.isNull(orangeMessage)) { + Log.i("orangeMessage", "run: " + orangeMessage.toString()); + NotificationChannel channel = new NotificationChannel("channel", "通知", NotificationManager.IMPORTANCE_DEFAULT); + manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + manager.createNotificationChannel(channel); + builder = new NotificationCompat.Builder(TimeService.this); + Date date = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + builder.setContentTitle("来自橙一色的系统通知消息" + " " + formatter.format(date)); + builder.setSmallIcon(R.drawable.chengzi); + builder.setChannelId("channel"); + builder.setContentText(orangeMessage.getContent()); + builder.setAutoCancel(true); + builder.setDefaults(Notification.DEFAULT_ALL); + Notification notification = builder.build(); + manager.notify(1, notification); + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + } +} diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..1f6bb29 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/app/src/main/res/drawable-v24/xiawu.png b/app/src/main/res/drawable-v24/xiawu.png new file mode 100644 index 0000000..a197f63 Binary files /dev/null and b/app/src/main/res/drawable-v24/xiawu.png differ 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/all.png b/app/src/main/res/drawable/all.png new file mode 100644 index 0000000..131c4fd Binary files /dev/null and b/app/src/main/res/drawable/all.png differ diff --git a/app/src/main/res/drawable/apple.png b/app/src/main/res/drawable/apple.png new file mode 100644 index 0000000..0810381 Binary files /dev/null and b/app/src/main/res/drawable/apple.png differ diff --git a/app/src/main/res/drawable/applep.png b/app/src/main/res/drawable/applep.png new file mode 100644 index 0000000..e26da47 Binary files /dev/null and b/app/src/main/res/drawable/applep.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/birthcake.png b/app/src/main/res/drawable/birthcake.png new file mode 100644 index 0000000..da26c22 Binary files /dev/null and b/app/src/main/res/drawable/birthcake.png differ diff --git a/app/src/main/res/drawable/breakfast.png b/app/src/main/res/drawable/breakfast.png new file mode 100644 index 0000000..10da0dd Binary files /dev/null and b/app/src/main/res/drawable/breakfast.png differ diff --git a/app/src/main/res/drawable/button_login.xml b/app/src/main/res/drawable/button_login.xml new file mode 100644 index 0000000..1439ecb --- /dev/null +++ b/app/src/main/res/drawable/button_login.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/button_register.xml b/app/src/main/res/drawable/button_register.xml new file mode 100644 index 0000000..3eb0673 --- /dev/null +++ b/app/src/main/res/drawable/button_register.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/cake.png b/app/src/main/res/drawable/cake.png new file mode 100644 index 0000000..7da6a2d Binary files /dev/null and b/app/src/main/res/drawable/cake.png differ diff --git a/app/src/main/res/drawable/cart.png b/app/src/main/res/drawable/cart.png new file mode 100644 index 0000000..f2e1190 Binary files /dev/null and b/app/src/main/res/drawable/cart.png differ diff --git a/app/src/main/res/drawable/chengzi.png b/app/src/main/res/drawable/chengzi.png new file mode 100644 index 0000000..fff0306 Binary files /dev/null and b/app/src/main/res/drawable/chengzi.png differ diff --git a/app/src/main/res/drawable/city.png b/app/src/main/res/drawable/city.png new file mode 100644 index 0000000..790fb2b Binary files /dev/null and b/app/src/main/res/drawable/city.png differ diff --git a/app/src/main/res/drawable/famous_cake.jpeg b/app/src/main/res/drawable/famous_cake.jpeg new file mode 100644 index 0000000..72b7a32 Binary files /dev/null and b/app/src/main/res/drawable/famous_cake.jpeg differ diff --git a/app/src/main/res/drawable/hongdoubread.png b/app/src/main/res/drawable/hongdoubread.png new file mode 100644 index 0000000..ff1a448 Binary files /dev/null and b/app/src/main/res/drawable/hongdoubread.png differ 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..0d025f9 --- /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_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..1f6bb29 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + 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..06e6145 Binary files /dev/null and b/app/src/main/res/drawable/img_1.png differ diff --git a/app/src/main/res/drawable/img_11.png b/app/src/main/res/drawable/img_11.png new file mode 100644 index 0000000..10da0dd Binary files /dev/null and b/app/src/main/res/drawable/img_11.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..3f5ab06 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..3f5ab06 Binary files /dev/null and b/app/src/main/res/drawable/img_3.png differ diff --git a/app/src/main/res/drawable/img_4.png b/app/src/main/res/drawable/img_4.png new file mode 100644 index 0000000..e1d697f Binary files /dev/null and b/app/src/main/res/drawable/img_4.png differ diff --git a/app/src/main/res/drawable/img_5.png b/app/src/main/res/drawable/img_5.png new file mode 100644 index 0000000..b281beb Binary files /dev/null and b/app/src/main/res/drawable/img_5.png differ diff --git a/app/src/main/res/drawable/img_6.png b/app/src/main/res/drawable/img_6.png new file mode 100644 index 0000000..65fdbfe Binary files /dev/null and b/app/src/main/res/drawable/img_6.png differ diff --git a/app/src/main/res/drawable/img_7.png b/app/src/main/res/drawable/img_7.png new file mode 100644 index 0000000..65fdbfe Binary files /dev/null and b/app/src/main/res/drawable/img_7.png differ diff --git a/app/src/main/res/drawable/img_8.png b/app/src/main/res/drawable/img_8.png new file mode 100644 index 0000000..d78d260 Binary files /dev/null and b/app/src/main/res/drawable/img_8.png differ diff --git a/app/src/main/res/drawable/img_9.png b/app/src/main/res/drawable/img_9.png new file mode 100644 index 0000000..10da0dd Binary files /dev/null and b/app/src/main/res/drawable/img_9.png differ diff --git a/app/src/main/res/drawable/index.jpg b/app/src/main/res/drawable/index.jpg new file mode 100644 index 0000000..3003c79 Binary files /dev/null and b/app/src/main/res/drawable/index.jpg differ diff --git a/app/src/main/res/drawable/index_menu.xml b/app/src/main/res/drawable/index_menu.xml new file mode 100644 index 0000000..14636dd --- /dev/null +++ b/app/src/main/res/drawable/index_menu.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/juzi.jpg b/app/src/main/res/drawable/juzi.jpg new file mode 100644 index 0000000..1489296 Binary files /dev/null and b/app/src/main/res/drawable/juzi.jpg differ diff --git a/app/src/main/res/drawable/juzip.png b/app/src/main/res/drawable/juzip.png new file mode 100644 index 0000000..4f10b72 Binary files /dev/null and b/app/src/main/res/drawable/juzip.png differ diff --git a/app/src/main/res/drawable/lemon.png b/app/src/main/res/drawable/lemon.png new file mode 100644 index 0000000..39f12cc Binary files /dev/null and b/app/src/main/res/drawable/lemon.png differ diff --git a/app/src/main/res/drawable/lemonp.png b/app/src/main/res/drawable/lemonp.png new file mode 100644 index 0000000..ca5eca8 Binary files /dev/null and b/app/src/main/res/drawable/lemonp.png differ diff --git a/app/src/main/res/drawable/li.png b/app/src/main/res/drawable/li.png new file mode 100644 index 0000000..0834592 Binary files /dev/null and b/app/src/main/res/drawable/li.png differ diff --git a/app/src/main/res/drawable/lvdou.jpg b/app/src/main/res/drawable/lvdou.jpg new file mode 100644 index 0000000..da33605 Binary files /dev/null and b/app/src/main/res/drawable/lvdou.jpg differ diff --git a/app/src/main/res/drawable/mangguo.png b/app/src/main/res/drawable/mangguo.png new file mode 100644 index 0000000..2e9825c Binary files /dev/null and b/app/src/main/res/drawable/mangguo.png differ diff --git a/app/src/main/res/drawable/mochabread.jpg b/app/src/main/res/drawable/mochabread.jpg new file mode 100644 index 0000000..f710f2a Binary files /dev/null and b/app/src/main/res/drawable/mochabread.jpg differ diff --git a/app/src/main/res/drawable/naiyoubread.png b/app/src/main/res/drawable/naiyoubread.png new file mode 100644 index 0000000..2e57ace Binary files /dev/null and b/app/src/main/res/drawable/naiyoubread.png differ diff --git a/app/src/main/res/drawable/orange.png b/app/src/main/res/drawable/orange.png new file mode 100644 index 0000000..70e8db8 Binary files /dev/null and b/app/src/main/res/drawable/orange.png differ diff --git a/app/src/main/res/drawable/paofu.jpg b/app/src/main/res/drawable/paofu.jpg new file mode 100644 index 0000000..5b6fb19 Binary files /dev/null and b/app/src/main/res/drawable/paofu.jpg differ 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/peachtea.jpg b/app/src/main/res/drawable/peachtea.jpg new file mode 100644 index 0000000..df901f1 Binary files /dev/null and b/app/src/main/res/drawable/peachtea.jpg differ diff --git a/app/src/main/res/drawable/pearson.png b/app/src/main/res/drawable/pearson.png new file mode 100644 index 0000000..90cf0eb Binary files /dev/null and b/app/src/main/res/drawable/pearson.png differ diff --git a/app/src/main/res/drawable/price.png b/app/src/main/res/drawable/price.png new file mode 100644 index 0000000..c7a125c Binary files /dev/null and b/app/src/main/res/drawable/price.png differ diff --git a/app/src/main/res/drawable/product.png b/app/src/main/res/drawable/product.png new file mode 100644 index 0000000..8f5cb21 Binary files /dev/null and b/app/src/main/res/drawable/product.png differ diff --git a/app/src/main/res/drawable/red.png b/app/src/main/res/drawable/red.png new file mode 100644 index 0000000..f6ffc7b Binary files /dev/null and b/app/src/main/res/drawable/red.png differ diff --git a/app/src/main/res/drawable/rousongbread.png b/app/src/main/res/drawable/rousongbread.png new file mode 100644 index 0000000..3b2bc62 Binary files /dev/null and b/app/src/main/res/drawable/rousongbread.png differ diff --git a/app/src/main/res/drawable/salenum.png b/app/src/main/res/drawable/salenum.png new file mode 100644 index 0000000..87ed2c9 Binary files /dev/null and b/app/src/main/res/drawable/salenum.png differ diff --git a/app/src/main/res/drawable/search.png b/app/src/main/res/drawable/search.png new file mode 100644 index 0000000..a8b5ac0 Binary files /dev/null and b/app/src/main/res/drawable/search.png differ diff --git a/app/src/main/res/drawable/setting.png b/app/src/main/res/drawable/setting.png new file mode 100644 index 0000000..34c2f2f Binary files /dev/null and b/app/src/main/res/drawable/setting.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..d6a6056 Binary files /dev/null and b/app/src/main/res/drawable/shopping.jpg differ diff --git a/app/src/main/res/drawable/shoppingcart.png b/app/src/main/res/drawable/shoppingcart.png new file mode 100644 index 0000000..76c06de Binary files /dev/null and b/app/src/main/res/drawable/shoppingcart.png differ diff --git a/app/src/main/res/drawable/shuiguo.png b/app/src/main/res/drawable/shuiguo.png new file mode 100644 index 0000000..d316137 Binary files /dev/null and b/app/src/main/res/drawable/shuiguo.png differ diff --git a/app/src/main/res/drawable/spinner_drop_down_shape.xml b/app/src/main/res/drawable/spinner_drop_down_shape.xml new file mode 100644 index 0000000..64306b1 --- /dev/null +++ b/app/src/main/res/drawable/spinner_drop_down_shape.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/strawberrybread.png b/app/src/main/res/drawable/strawberrybread.png new file mode 100644 index 0000000..4c10eae Binary files /dev/null and b/app/src/main/res/drawable/strawberrybread.png differ 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/sweet.png b/app/src/main/res/drawable/sweet.png new file mode 100644 index 0000000..268e14a Binary files /dev/null and b/app/src/main/res/drawable/sweet.png differ diff --git a/app/src/main/res/drawable/tab_menu_text.xml b/app/src/main/res/drawable/tab_menu_text.xml new file mode 100644 index 0000000..fb06945 --- /dev/null +++ b/app/src/main/res/drawable/tab_menu_text.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/taosu.jpg b/app/src/main/res/drawable/taosu.jpg new file mode 100644 index 0000000..c7d9fb3 Binary files /dev/null and b/app/src/main/res/drawable/taosu.jpg differ diff --git a/app/src/main/res/drawable/time.png b/app/src/main/res/drawable/time.png new file mode 100644 index 0000000..8a672eb Binary files /dev/null and b/app/src/main/res/drawable/time.png differ diff --git a/app/src/main/res/drawable/user.png b/app/src/main/res/drawable/user.png new file mode 100644 index 0000000..47d8362 Binary files /dev/null and b/app/src/main/res/drawable/user.png differ diff --git a/app/src/main/res/drawable/user_account.png b/app/src/main/res/drawable/user_account.png new file mode 100644 index 0000000..e70142a Binary files /dev/null and b/app/src/main/res/drawable/user_account.png differ diff --git a/app/src/main/res/drawable/user_cake.jpg b/app/src/main/res/drawable/user_cake.jpg new file mode 100644 index 0000000..bd0dfaf Binary files /dev/null and b/app/src/main/res/drawable/user_cake.jpg differ diff --git a/app/src/main/res/drawable/user_general.png b/app/src/main/res/drawable/user_general.png new file mode 100644 index 0000000..cf57947 Binary files /dev/null and b/app/src/main/res/drawable/user_general.png differ diff --git a/app/src/main/res/drawable/user_icon.png b/app/src/main/res/drawable/user_icon.png new file mode 100644 index 0000000..d5309b1 Binary files /dev/null and b/app/src/main/res/drawable/user_icon.png differ diff --git a/app/src/main/res/drawable/user_pay.png b/app/src/main/res/drawable/user_pay.png new file mode 100644 index 0000000..3fd6f50 Binary files /dev/null and b/app/src/main/res/drawable/user_pay.png differ diff --git a/app/src/main/res/drawable/user_ps.jpg b/app/src/main/res/drawable/user_ps.jpg new file mode 100644 index 0000000..4fa4925 Binary files /dev/null and b/app/src/main/res/drawable/user_ps.jpg differ diff --git a/app/src/main/res/drawable/user_sex.png b/app/src/main/res/drawable/user_sex.png new file mode 100644 index 0000000..da0e318 Binary files /dev/null and b/app/src/main/res/drawable/user_sex.png differ diff --git a/app/src/main/res/drawable/xiawu.png b/app/src/main/res/drawable/xiawu.png new file mode 100644 index 0000000..a197f63 Binary files /dev/null and b/app/src/main/res/drawable/xiawu.png differ diff --git a/app/src/main/res/drawable/xiawucha.png b/app/src/main/res/drawable/xiawucha.png new file mode 100644 index 0000000..98505e5 Binary files /dev/null and b/app/src/main/res/drawable/xiawucha.png differ diff --git a/app/src/main/res/drawable/xiawucha2.png b/app/src/main/res/drawable/xiawucha2.png new file mode 100644 index 0000000..d729df4 Binary files /dev/null and b/app/src/main/res/drawable/xiawucha2.png differ diff --git a/app/src/main/res/drawable/xigua.png b/app/src/main/res/drawable/xigua.png new file mode 100644 index 0000000..20275c1 Binary files /dev/null and b/app/src/main/res/drawable/xigua.png differ diff --git a/app/src/main/res/drawable/xiguap.png b/app/src/main/res/drawable/xiguap.png new file mode 100644 index 0000000..b760712 Binary files /dev/null and b/app/src/main/res/drawable/xiguap.png differ diff --git a/app/src/main/res/drawable/youzi.png b/app/src/main/res/drawable/youzi.png new file mode 100644 index 0000000..dc1a0ed Binary files /dev/null and b/app/src/main/res/drawable/youzi.png differ diff --git a/app/src/main/res/drawable/youzip.png b/app/src/main/res/drawable/youzip.png new file mode 100644 index 0000000..5a7d966 Binary files /dev/null and b/app/src/main/res/drawable/youzip.png differ 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..049f970 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,41 @@ + + + +<<<<<<< HEAD + + + + + --> + >>>>>> 8d271bc (end_code) + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1" /> + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/cart_have_product.xml b/app/src/main/res/layout/cart_have_product.xml new file mode 100644 index 0000000..b7362e4 --- /dev/null +++ b/app/src/main/res/layout/cart_have_product.xml @@ -0,0 +1,15 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/cart_no_product.xml b/app/src/main/res/layout/cart_no_product.xml new file mode 100644 index 0000000..8781e18 --- /dev/null +++ b/app/src/main/res/layout/cart_no_product.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + +