diff --git a/.idea/vcs.xml b/.idea/vcs.xml index c8397c9..d670056 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 62787e8..181e1ab 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,7 +4,7 @@ android { compileSdkVersion 30 buildToolsVersion "30.0.2" defaultConfig { - applicationId "com.example.orangesale_04" + applicationId "com.example.orangesale_05" minSdkVersion 23 targetSdkVersion 30 versionCode 1 @@ -21,6 +21,7 @@ android { sourceCompatibility = 1.8 targetCompatibility = 1.8 } + } dependencies { diff --git a/app/src/androidTest/java/com/example/orangesale_04/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/orangesale_05/ExampleInstrumentedTest.java similarity index 84% rename from app/src/androidTest/java/com/example/orangesale_04/ExampleInstrumentedTest.java rename to app/src/androidTest/java/com/example/orangesale_05/ExampleInstrumentedTest.java index aa597d9..e315c38 100644 --- a/app/src/androidTest/java/com/example/orangesale_04/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/com/example/orangesale_05/ExampleInstrumentedTest.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04; +package com.example.orangesale_05; import android.content.Context; @@ -22,6 +22,6 @@ public class ExampleInstrumentedTest { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - assertEquals("com.example.orangesale_04", appContext.getPackageName()); + assertEquals("com.example.orangesale_05", appContext.getPackageName()); } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index eeca0b4..e797e03 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="com.example.orangesale_05"> 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)); - } - }); - /* 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("工艺品"); - productCategory.add("零食"); - productCategory.add("服装"); - productCategory.add("生活用品"); - productCategory.add("文具"); - productCategory.add("生鲜"); - productCategory.add("医药"); - Product product = new Product(); - product.setImageUrlId(R.drawable.juzi1); - product.setProductName("橘子"); - product.setProductPrice(new BigDecimal("9.9")); - Product product1 = new Product(); - product1.setImageUrlId(R.drawable.chengzi); - product1.setProductName("橙子"); - product1.setProductPrice(new BigDecimal("29.9")); - Product product2 = new Product(); - product2.setImageUrlId(R.drawable.youzi); - product2.setProductName("柚子"); - product2.setProductPrice(new BigDecimal("19.9")); - Product product3 = new Product(); - product3.setImageUrlId(R.drawable.xigua); - product3.setProductName("西瓜"); - product3.setProductPrice(new BigDecimal("39.9")); - Product product4 = new Product(); - product4.setImageUrlId(R.drawable.fuzhuang); - product4.setProductName("衬衫"); - product4.setProductPrice(new BigDecimal("30.9")); - Product product5 = new Product(); - product5.setImageUrlId(R.drawable.shenghuo); - product5.setProductName("常用品"); - product5.setProductPrice(new BigDecimal("50")); - Product product6 = new Product(); - product6.setImageUrlId(R.drawable.wenju); - product6.setProductName("文具礼盒"); - product6.setProductPrice(new BigDecimal("49.9")); - Product product7 = new Product(); - product7.setImageUrlId(R.drawable.shengxian); - product7.setProductName("果蔬拼盘"); - product7.setProductPrice(new BigDecimal("25.7")); - Product product8 = new Product(); - product8.setImageUrlId(R.drawable.shengxian); - product8.setProductName("常用医药"); - product8.setProductPrice(new BigDecimal("19.9")); - productList.add(product); - productList.add(product1); - productList.add(product2); - productList.add(product3); - productList.add(product4); - productList.add(product5); - productList.add(product6); - productList.add(product7); - productList.add(product8); - } - - /** - * 初始化组件 - */ - 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_04/MainActivity.java b/app/src/main/java/com/example/orangesale_05/MainActivity.java similarity index 90% rename from app/src/main/java/com/example/orangesale_04/MainActivity.java rename to app/src/main/java/com/example/orangesale_05/MainActivity.java index 8ba3b94..5e567d3 100644 --- a/app/src/main/java/com/example/orangesale_04/MainActivity.java +++ b/app/src/main/java/com/example/orangesale_05/MainActivity.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04; +package com.example.orangesale_05; import android.content.Intent; import android.database.Cursor; @@ -11,9 +11,9 @@ import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; -import com.example.orangesale_04.activity.IndexActivity; -import com.example.orangesale_04.activity.RegisterActivity; -import com.example.orangesale_04.dataoperation.OrangeDatabase; +import com.example.orangesale_05.activity.IndexActivity; +import com.example.orangesale_05.activity.RegisterActivity; +import com.example.orangesale_05.dataoperation.OrangeDatabase; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button registerButton, loginButton; diff --git a/app/src/main/java/com/example/orangesale_05/activity/CategoryActivity.java b/app/src/main/java/com/example/orangesale_05/activity/CategoryActivity.java new file mode 100644 index 0000000..9b82d77 --- /dev/null +++ b/app/src/main/java/com/example/orangesale_05/activity/CategoryActivity.java @@ -0,0 +1,90 @@ +package com.example.orangesale_05.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_05.R; +import com.example.orangesale_05.adapter.Adapter; +import com.example.orangesale_05.entity.Product; +import com.example.orangesale_05.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_04/activity/IndexActivity.java b/app/src/main/java/com/example/orangesale_05/activity/IndexActivity.java similarity index 89% rename from app/src/main/java/com/example/orangesale_04/activity/IndexActivity.java rename to app/src/main/java/com/example/orangesale_05/activity/IndexActivity.java index 9d5c5ce..987ab18 100644 --- a/app/src/main/java/com/example/orangesale_04/activity/IndexActivity.java +++ b/app/src/main/java/com/example/orangesale_05/activity/IndexActivity.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.activity; +package com.example.orangesale_05.activity; import android.app.Activity; import android.app.FragmentTransaction; @@ -9,11 +9,11 @@ import android.widget.LinearLayout; import androidx.annotation.Nullable; -import com.example.orangesale_04.R; -import com.example.orangesale_04.fragment.IndexFragment; -import com.example.orangesale_04.fragment.PearsonFragment; -import com.example.orangesale_04.fragment.ProductFragment; -import com.example.orangesale_04.fragment.ShoppingCartFragment; +import com.example.orangesale_05.R; +import com.example.orangesale_05.fragment.IndexFragment; +import com.example.orangesale_05.fragment.PearsonFragment; +import com.example.orangesale_05.fragment.ProductFragment; +import com.example.orangesale_05.fragment.ShoppingCartFragment; public class IndexActivity extends Activity implements View.OnClickListener { private IndexFragment indexFragment; diff --git a/app/src/main/java/com/example/orangesale_04/activity/RegisterActivity.java b/app/src/main/java/com/example/orangesale_05/activity/RegisterActivity.java similarity index 95% rename from app/src/main/java/com/example/orangesale_04/activity/RegisterActivity.java rename to app/src/main/java/com/example/orangesale_05/activity/RegisterActivity.java index 7d66c4e..9be3092 100644 --- a/app/src/main/java/com/example/orangesale_04/activity/RegisterActivity.java +++ b/app/src/main/java/com/example/orangesale_05/activity/RegisterActivity.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.activity; +package com.example.orangesale_05.activity; import android.content.ContentValues; import android.content.Intent; @@ -16,8 +16,8 @@ import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import com.lljjcoder.citypickerview.widget.CityPicker; -import com.example.orangesale_04.R; -import com.example.orangesale_04.dataoperation.OrangeDatabase; +import com.example.orangesale_05.R; +import com.example.orangesale_05.dataoperation.OrangeDatabase; public class RegisterActivity extends AppCompatActivity implements View.OnClickListener, RadioGroup.OnCheckedChangeListener { private EditText usernameEdit, passwordEdit, surePasswordEdit; diff --git a/app/src/main/java/com/example/orangesale_04/activity/UserActivity.java b/app/src/main/java/com/example/orangesale_05/activity/UserActivity.java similarity index 92% rename from app/src/main/java/com/example/orangesale_04/activity/UserActivity.java rename to app/src/main/java/com/example/orangesale_05/activity/UserActivity.java index 88b4dce..836ae96 100644 --- a/app/src/main/java/com/example/orangesale_04/activity/UserActivity.java +++ b/app/src/main/java/com/example/orangesale_05/activity/UserActivity.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.activity; +package com.example.orangesale_05.activity; import android.app.Activity; import android.content.Intent; @@ -10,8 +10,7 @@ import android.widget.TextView; import androidx.annotation.Nullable; -import com.example.orangesale_04.MainActivity; -import com.example.orangesale_04.R; +import com.example.orangesale_05.R; public class UserActivity extends Activity implements View.OnClickListener { private ImageView userIconImage; diff --git a/app/src/main/java/com/example/orangesale_04/adapter/Adapter.java b/app/src/main/java/com/example/orangesale_05/adapter/Adapter.java similarity index 92% rename from app/src/main/java/com/example/orangesale_04/adapter/Adapter.java rename to app/src/main/java/com/example/orangesale_05/adapter/Adapter.java index 927c7c0..9b9fc45 100644 --- a/app/src/main/java/com/example/orangesale_04/adapter/Adapter.java +++ b/app/src/main/java/com/example/orangesale_05/adapter/Adapter.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.adapter; +package com.example.orangesale_05.adapter; import android.content.Context; import android.graphics.Color; @@ -9,7 +9,7 @@ import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; -import com.example.orangesale_04.R; +import com.example.orangesale_05.R; import java.util.List; diff --git a/app/src/main/java/com/example/orangesale_04/adapter/ProductAdapter.java b/app/src/main/java/com/example/orangesale_05/adapter/ProductAdapter.java similarity index 91% rename from app/src/main/java/com/example/orangesale_04/adapter/ProductAdapter.java rename to app/src/main/java/com/example/orangesale_05/adapter/ProductAdapter.java index 3d64411..dec9822 100644 --- a/app/src/main/java/com/example/orangesale_04/adapter/ProductAdapter.java +++ b/app/src/main/java/com/example/orangesale_05/adapter/ProductAdapter.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.adapter; +package com.example.orangesale_05.adapter; import android.content.Context; import android.util.Log; @@ -9,8 +9,8 @@ import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; -import com.example.orangesale_04.R; -import com.example.orangesale_04.entity.Product; +import com.example.orangesale_05.R; +import com.example.orangesale_05.entity.Product; import java.util.List; diff --git a/app/src/main/java/com/example/orangesale_04/dataoperation/OrangeDatabase.java b/app/src/main/java/com/example/orangesale_05/dataoperation/OrangeDatabase.java similarity index 94% rename from app/src/main/java/com/example/orangesale_04/dataoperation/OrangeDatabase.java rename to app/src/main/java/com/example/orangesale_05/dataoperation/OrangeDatabase.java index e2e5119..7989a62 100644 --- a/app/src/main/java/com/example/orangesale_04/dataoperation/OrangeDatabase.java +++ b/app/src/main/java/com/example/orangesale_05/dataoperation/OrangeDatabase.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.dataoperation; +package com.example.orangesale_05.dataoperation; import android.content.ContentValues; import android.content.Context; diff --git a/app/src/main/java/com/example/orangesale_04/entity/OrangeUser.java b/app/src/main/java/com/example/orangesale_05/entity/OrangeUser.java similarity index 91% rename from app/src/main/java/com/example/orangesale_04/entity/OrangeUser.java rename to app/src/main/java/com/example/orangesale_05/entity/OrangeUser.java index 6aec026..48a19e8 100644 --- a/app/src/main/java/com/example/orangesale_04/entity/OrangeUser.java +++ b/app/src/main/java/com/example/orangesale_05/entity/OrangeUser.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.entity; +package com.example.orangesale_05.entity; public class OrangeUser { private Integer id; diff --git a/app/src/main/java/com/example/orangesale_04/entity/Product.java b/app/src/main/java/com/example/orangesale_05/entity/Product.java similarity index 91% rename from app/src/main/java/com/example/orangesale_04/entity/Product.java rename to app/src/main/java/com/example/orangesale_05/entity/Product.java index a92f79b..411aac3 100644 --- a/app/src/main/java/com/example/orangesale_04/entity/Product.java +++ b/app/src/main/java/com/example/orangesale_05/entity/Product.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.entity; +package com.example.orangesale_05.entity; import java.math.BigDecimal; @@ -31,6 +31,7 @@ public class Product { private Integer imageUrlId; private String productName; private BigDecimal productPrice; + @Override public String toString() { return "Product{" + diff --git a/app/src/main/java/com/example/orangesale_04/fragment/IndexFragment.java b/app/src/main/java/com/example/orangesale_05/fragment/IndexFragment.java similarity index 51% rename from app/src/main/java/com/example/orangesale_04/fragment/IndexFragment.java rename to app/src/main/java/com/example/orangesale_05/fragment/IndexFragment.java index 08da0b4..1c3c327 100644 --- a/app/src/main/java/com/example/orangesale_04/fragment/IndexFragment.java +++ b/app/src/main/java/com/example/orangesale_05/fragment/IndexFragment.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.fragment; +package com.example.orangesale_05.fragment; import android.app.Fragment; import android.os.Bundle; @@ -12,9 +12,9 @@ import android.widget.SearchView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.example.orangesale_04.R; -import com.example.orangesale_04.adapter.ProductAdapter; -import com.example.orangesale_04.entity.Product; +import com.example.orangesale_05.R; +import com.example.orangesale_05.adapter.ProductAdapter; +import com.example.orangesale_05.entity.Product; import java.math.BigDecimal; import java.util.ArrayList; @@ -41,22 +41,22 @@ public class IndexFragment extends Fragment implements View.OnClickListener { private void init(View view) { searchView = view.findViewById(R.id.searchView); searchView.setOnClickListener(this); - orangeLine = view.findViewById(R.id.chengzi); + orangeLine = view.findViewById(R.id.baocui); orangeLine.setOnClickListener(this); - youziLine = view.findViewById(R.id.youzi); + youziLine = view.findViewById(R.id.sanmingzhi); youziLine.setOnClickListener(this); - juziLine = view.findViewById(R.id.juzi); + juziLine = view.findViewById(R.id.tusi); juziLine.setOnClickListener(this); - xiguaLine = view.findViewById(R.id.xigua); + xiguaLine = view.findViewById(R.id.xiaomantou); xiguaLine.setOnClickListener(this); - liLine = view.findViewById(R.id.li); + liLine = view.findViewById(R.id.paofu); liLine.setOnClickListener(this); - lemonLine = view.findViewById(R.id.lemon); + lemonLine = view.findViewById(R.id.dangao); lemonLine.setOnClickListener(this); - mangguoLine = view.findViewById(R.id.mangguo); + mangguoLine = view.findViewById(R.id.shousimianbao); + mangguoLine.setOnClickListener(this); + mangguoLine = view.findViewById(R.id.taosu); mangguoLine.setOnClickListener(this); - appleLine = view.findViewById(R.id.apple); - appleLine.setOnClickListener(this); gridView = view.findViewById(R.id.index_famous_gridview); initData(); productAdapter = new ProductAdapter(getActivity(), productList); @@ -75,35 +75,44 @@ public class IndexFragment extends Fragment implements View.OnClickListener { private void initData() { productList = new ArrayList<>(); Product product = new Product(); - product.setImageUrlId(R.drawable.juzi); - product.setProductName("橘子"); - product.setProductPrice(new BigDecimal("9.9")); + product.setImageUrlId(R.drawable.caomeidangao); + product.setProductName("草莓蛋糕"); + product.setProductPrice(new BigDecimal("59.9")); Product product1 = new Product(); - product1.setImageUrlId(R.drawable.orange); - product1.setProductName("橙子"); - product1.setProductPrice(new BigDecimal("29.9")); + product1.setImageUrlId(R.drawable.qiepianmianbao); + product1.setProductName("切片面包"); + product1.setProductPrice(new BigDecimal("9.9")); Product product2 = new Product(); - product2.setImageUrlId(R.drawable.youzi); - product2.setProductName("柚子"); - product2.setProductPrice(new BigDecimal("19.9")); + product2.setImageUrlId(R.drawable.rousongxiaobei); + product2.setProductName("肉松小贝"); + product2.setProductPrice(new BigDecimal("25.0")); Product product3 = new Product(); - product3.setImageUrlId(R.drawable.xigua); - product3.setProductName("西瓜"); - product3.setProductPrice(new BigDecimal("19.9")); + product3.setImageUrlId(R.drawable.suannaipaofu); + product3.setProductName("酸奶泡芙"); + product3.setProductPrice(new BigDecimal("10.0")); Product product4 = new Product(); - product4.setImageUrlId(R.drawable.apple); - product4.setProductName("苹果"); - product4.setProductPrice(new BigDecimal("49.9")); + product4.setImageUrlId(R.drawable.ttq); + product4.setProductName("甜甜圈"); + product4.setProductPrice(new BigDecimal("6.99")); Product product5 = new Product(); - product5.setImageUrlId(R.drawable.lemon); - product5.setProductName("柠檬"); - product5.setProductPrice(new BigDecimal("9.9")); + product5.setImageUrlId(R.drawable.shousimianbao); + product5.setProductName("手撕面包"); + product5.setProductPrice(new BigDecimal("12.0")); + Product product6 = new Product(); + product6.setImageUrlId(R.drawable.fenghuangjuan); + product6.setProductName("凤凰卷"); + product6.setProductPrice(new BigDecimal("7.99")); + Product product7 = new Product(); + product7.setImageUrlId(R.drawable.quqibing); + product7.setProductName("曲奇饼"); + product7.setProductPrice(new BigDecimal("20.0")); productList.add(product); productList.add(product1); productList.add(product2); productList.add(product3); productList.add(product4); productList.add(product5); - + productList.add(product6); + productList.add(product7); } } diff --git a/app/src/main/java/com/example/orangesale_04/fragment/PearsonFragment.java b/app/src/main/java/com/example/orangesale_05/fragment/PearsonFragment.java similarity index 93% rename from app/src/main/java/com/example/orangesale_04/fragment/PearsonFragment.java rename to app/src/main/java/com/example/orangesale_05/fragment/PearsonFragment.java index 6cafb87..8f997bf 100644 --- a/app/src/main/java/com/example/orangesale_04/fragment/PearsonFragment.java +++ b/app/src/main/java/com/example/orangesale_05/fragment/PearsonFragment.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.fragment; +package com.example.orangesale_05.fragment; import android.app.Fragment; import android.os.Bundle; @@ -12,7 +12,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.example.orangesale_04.R; +import com.example.orangesale_05.R; public class PearsonFragment extends Fragment implements View.OnClickListener { private ImageView userIconImage; diff --git a/app/src/main/java/com/example/orangesale_04/fragment/ProductFragment.java b/app/src/main/java/com/example/orangesale_05/fragment/ProductFragment.java similarity index 84% rename from app/src/main/java/com/example/orangesale_04/fragment/ProductFragment.java rename to app/src/main/java/com/example/orangesale_05/fragment/ProductFragment.java index 98ede7d..e95c4e4 100644 --- a/app/src/main/java/com/example/orangesale_04/fragment/ProductFragment.java +++ b/app/src/main/java/com/example/orangesale_05/fragment/ProductFragment.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.fragment; +package com.example.orangesale_05.fragment; import android.app.Fragment; import android.os.Bundle; @@ -9,7 +9,7 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.example.orangesale_04.R; +import com.example.orangesale_05.R; public class ProductFragment extends Fragment { @Nullable diff --git a/app/src/main/java/com/example/orangesale_04/fragment/SetDetailFragment.java b/app/src/main/java/com/example/orangesale_05/fragment/SetDetailFragment.java similarity index 67% rename from app/src/main/java/com/example/orangesale_04/fragment/SetDetailFragment.java rename to app/src/main/java/com/example/orangesale_05/fragment/SetDetailFragment.java index 06e1ec6..7b9e60f 100644 --- a/app/src/main/java/com/example/orangesale_04/fragment/SetDetailFragment.java +++ b/app/src/main/java/com/example/orangesale_05/fragment/SetDetailFragment.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.fragment; +package com.example.orangesale_05.fragment; import android.annotation.SuppressLint; import android.app.Fragment; @@ -13,9 +13,8 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.example.orangesale_04.R; -import com.example.orangesale_04.activity.CategoryActivity; -import com.example.orangesale_04.entity.Product; +import com.example.orangesale_05.R; +import com.example.orangesale_05.activity.CategoryActivity; import java.util.Objects; @@ -33,22 +32,12 @@ public class SetDetailFragment extends Fragment { init(); } CategoryActivity categoryActivity = (CategoryActivity) getActivity(); - categoryActivity.setOnChangeListener(new CategoryActivity.OnChangeListener() { - @Override - public void changeText(Product product) { - imageView.setBackgroundResource(product.getImageUrlId()); - nameText.setText(product.getProductName()); - priceText.setText(product.getProductPrice().toString()); - } - }); - /* Objects.requireNonNull(categoryActivity).setOnChangeListener(product -> { + 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; } diff --git a/app/src/main/java/com/example/orangesale_04/fragment/ShoppingCartFragment.java b/app/src/main/java/com/example/orangesale_05/fragment/ShoppingCartFragment.java similarity index 85% rename from app/src/main/java/com/example/orangesale_04/fragment/ShoppingCartFragment.java rename to app/src/main/java/com/example/orangesale_05/fragment/ShoppingCartFragment.java index ad1ec24..b0fd574 100644 --- a/app/src/main/java/com/example/orangesale_04/fragment/ShoppingCartFragment.java +++ b/app/src/main/java/com/example/orangesale_05/fragment/ShoppingCartFragment.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04.fragment; +package com.example.orangesale_05.fragment; import android.app.Fragment; import android.os.Bundle; @@ -9,7 +9,7 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.example.orangesale_04.R; +import com.example.orangesale_05.R; public class ShoppingCartFragment extends Fragment { @Nullable diff --git a/app/src/main/res/drawable-v24/a.xml b/app/src/main/res/drawable-v24/a.xml deleted file mode 100644 index 4c5e86a..0000000 --- a/app/src/main/res/drawable-v24/a.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/apple.png b/app/src/main/res/drawable-v24/apple.png similarity index 100% rename from app/src/main/res/drawable/apple.png rename to app/src/main/res/drawable-v24/apple.png diff --git a/app/src/main/res/drawable-v24/applep.png b/app/src/main/res/drawable-v24/applep.png new file mode 100644 index 0000000..e26da47 Binary files /dev/null and b/app/src/main/res/drawable-v24/applep.png differ diff --git a/app/src/main/res/drawable-v24/fuzhuang.jpg b/app/src/main/res/drawable-v24/fuzhuang.jpg deleted file mode 100644 index afeabbb..0000000 Binary files a/app/src/main/res/drawable-v24/fuzhuang.jpg and /dev/null differ diff --git a/app/src/main/res/drawable-v24/hamigua.png b/app/src/main/res/drawable-v24/hamigua.png deleted file mode 100644 index 87c8975..0000000 Binary files a/app/src/main/res/drawable-v24/hamigua.png and /dev/null differ diff --git a/app/src/main/res/drawable/index.png b/app/src/main/res/drawable-v24/index.png similarity index 100% rename from app/src/main/res/drawable/index.png rename to app/src/main/res/drawable-v24/index.png diff --git a/app/src/main/res/drawable/index_menu.xml b/app/src/main/res/drawable-v24/index_menu.xml similarity index 100% rename from app/src/main/res/drawable/index_menu.xml rename to app/src/main/res/drawable-v24/index_menu.xml diff --git a/app/src/main/res/drawable-v24/juzi1.jpg b/app/src/main/res/drawable-v24/juzi1.jpg deleted file mode 100644 index 280be9e..0000000 Binary files a/app/src/main/res/drawable-v24/juzi1.jpg and /dev/null differ diff --git a/app/src/main/res/drawable-v24/juzip.png b/app/src/main/res/drawable-v24/juzip.png new file mode 100644 index 0000000..4f10b72 Binary files /dev/null and b/app/src/main/res/drawable-v24/juzip.png differ diff --git a/app/src/main/res/drawable/lemon.png b/app/src/main/res/drawable-v24/lemon.png similarity index 100% rename from app/src/main/res/drawable/lemon.png rename to app/src/main/res/drawable-v24/lemon.png diff --git a/app/src/main/res/drawable-v24/lemonp.png b/app/src/main/res/drawable-v24/lemonp.png new file mode 100644 index 0000000..ca5eca8 Binary files /dev/null and b/app/src/main/res/drawable-v24/lemonp.png differ diff --git a/app/src/main/res/drawable/li.png b/app/src/main/res/drawable-v24/li.png similarity index 100% rename from app/src/main/res/drawable/li.png rename to app/src/main/res/drawable-v24/li.png diff --git a/app/src/main/res/drawable/mangguo.png b/app/src/main/res/drawable-v24/mangguo.png similarity index 100% rename from app/src/main/res/drawable/mangguo.png rename to app/src/main/res/drawable-v24/mangguo.png diff --git a/app/src/main/res/drawable/pearson.png b/app/src/main/res/drawable-v24/pearson.png similarity index 100% rename from app/src/main/res/drawable/pearson.png rename to app/src/main/res/drawable-v24/pearson.png diff --git a/app/src/main/res/drawable-v24/pinpan.jpg b/app/src/main/res/drawable-v24/pinpan.jpg deleted file mode 100644 index 1fb14e3..0000000 Binary files a/app/src/main/res/drawable-v24/pinpan.jpg and /dev/null differ diff --git a/app/src/main/res/drawable/product.png b/app/src/main/res/drawable-v24/product.png similarity index 100% rename from app/src/main/res/drawable/product.png rename to app/src/main/res/drawable-v24/product.png diff --git a/app/src/main/res/drawable-v24/shenghuo.jpg b/app/src/main/res/drawable-v24/shenghuo.jpg deleted file mode 100644 index e977b89..0000000 Binary files a/app/src/main/res/drawable-v24/shenghuo.jpg and /dev/null differ diff --git a/app/src/main/res/drawable-v24/shengxian.jpg b/app/src/main/res/drawable-v24/shengxian.jpg deleted file mode 100644 index c2dfe25..0000000 Binary files a/app/src/main/res/drawable-v24/shengxian.jpg and /dev/null differ diff --git a/app/src/main/res/drawable/shoppingcart.png b/app/src/main/res/drawable-v24/shoppingcart.png similarity index 100% rename from app/src/main/res/drawable/shoppingcart.png rename to app/src/main/res/drawable-v24/shoppingcart.png diff --git a/app/src/main/res/drawable-v24/shuiguo.jpg b/app/src/main/res/drawable-v24/shuiguo.jpg deleted file mode 100644 index 3bc5241..0000000 Binary files a/app/src/main/res/drawable-v24/shuiguo.jpg and /dev/null differ diff --git a/app/src/main/res/drawable-v24/shuiguo.png b/app/src/main/res/drawable-v24/shuiguo.png new file mode 100644 index 0000000..d316137 Binary files /dev/null and b/app/src/main/res/drawable-v24/shuiguo.png differ diff --git a/app/src/main/res/drawable-v24/tab_menu_text.xml b/app/src/main/res/drawable-v24/tab_menu_text.xml new file mode 100644 index 0000000..ff3a059 --- /dev/null +++ b/app/src/main/res/drawable-v24/tab_menu_text.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/taozi.png b/app/src/main/res/drawable-v24/taozi.png deleted file mode 100644 index 5c65ce2..0000000 Binary files a/app/src/main/res/drawable-v24/taozi.png and /dev/null differ diff --git a/app/src/main/res/drawable-v24/wenju.jpg b/app/src/main/res/drawable-v24/wenju.jpg deleted file mode 100644 index 9b37891..0000000 Binary files a/app/src/main/res/drawable-v24/wenju.jpg and /dev/null differ diff --git a/app/src/main/res/drawable-v24/xigua.png b/app/src/main/res/drawable-v24/xigua.png index 3671f2c..20275c1 100644 Binary files a/app/src/main/res/drawable-v24/xigua.png and b/app/src/main/res/drawable-v24/xigua.png differ diff --git a/app/src/main/res/drawable-v24/xiguap.png b/app/src/main/res/drawable-v24/xiguap.png new file mode 100644 index 0000000..b760712 Binary files /dev/null and b/app/src/main/res/drawable-v24/xiguap.png differ diff --git a/app/src/main/res/drawable-v24/youzip.png b/app/src/main/res/drawable-v24/youzip.png new file mode 100644 index 0000000..5a7d966 Binary files /dev/null and b/app/src/main/res/drawable-v24/youzip.png differ diff --git a/app/src/main/res/drawable/baocui.JPG b/app/src/main/res/drawable/baocui.JPG new file mode 100644 index 0000000..a43bd05 Binary files /dev/null and b/app/src/main/res/drawable/baocui.JPG differ diff --git a/app/src/main/res/drawable/caomeidangao.png b/app/src/main/res/drawable/caomeidangao.png new file mode 100644 index 0000000..a5502f7 Binary files /dev/null and b/app/src/main/res/drawable/caomeidangao.png differ diff --git a/app/src/main/res/drawable/dangao.JPG b/app/src/main/res/drawable/dangao.JPG new file mode 100644 index 0000000..c088901 Binary files /dev/null and b/app/src/main/res/drawable/dangao.JPG differ diff --git a/app/src/main/res/drawable/fenghuangjuan.png b/app/src/main/res/drawable/fenghuangjuan.png new file mode 100644 index 0000000..e4d824c Binary files /dev/null and b/app/src/main/res/drawable/fenghuangjuan.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..9add9f5 Binary files /dev/null and b/app/src/main/res/drawable/paofu.JPG differ diff --git a/app/src/main/res/drawable/qiepianmianbao.png b/app/src/main/res/drawable/qiepianmianbao.png new file mode 100644 index 0000000..2be3b2a Binary files /dev/null and b/app/src/main/res/drawable/qiepianmianbao.png differ diff --git a/app/src/main/res/drawable/quqibing.png b/app/src/main/res/drawable/quqibing.png new file mode 100644 index 0000000..38e9da6 Binary files /dev/null and b/app/src/main/res/drawable/quqibing.png differ diff --git a/app/src/main/res/drawable/rousongxiaobei.png b/app/src/main/res/drawable/rousongxiaobei.png new file mode 100644 index 0000000..c1509bb Binary files /dev/null and b/app/src/main/res/drawable/rousongxiaobei.png differ diff --git a/app/src/main/res/drawable/sanmingzhi.JPG b/app/src/main/res/drawable/sanmingzhi.JPG new file mode 100644 index 0000000..fdfd9cc Binary files /dev/null and b/app/src/main/res/drawable/sanmingzhi.JPG differ diff --git a/app/src/main/res/drawable/shousibao.JPG b/app/src/main/res/drawable/shousibao.JPG new file mode 100644 index 0000000..3ddec86 Binary files /dev/null and b/app/src/main/res/drawable/shousibao.JPG differ diff --git a/app/src/main/res/drawable/shousimianbao.png b/app/src/main/res/drawable/shousimianbao.png new file mode 100644 index 0000000..4edee2d Binary files /dev/null and b/app/src/main/res/drawable/shousimianbao.png differ diff --git a/app/src/main/res/drawable/suannaipaofu.png b/app/src/main/res/drawable/suannaipaofu.png new file mode 100644 index 0000000..7c56496 Binary files /dev/null and b/app/src/main/res/drawable/suannaipaofu.png differ diff --git a/app/src/main/res/drawable/taosu.JPG b/app/src/main/res/drawable/taosu.JPG new file mode 100644 index 0000000..71b8d89 Binary files /dev/null and b/app/src/main/res/drawable/taosu.JPG differ diff --git a/app/src/main/res/drawable/tb.png b/app/src/main/res/drawable/tb.png new file mode 100644 index 0000000..e238b77 Binary files /dev/null and b/app/src/main/res/drawable/tb.png differ diff --git a/app/src/main/res/drawable/tiantianquan.JPG b/app/src/main/res/drawable/tiantianquan.JPG new file mode 100644 index 0000000..c1c4f25 Binary files /dev/null and b/app/src/main/res/drawable/tiantianquan.JPG differ diff --git a/app/src/main/res/drawable/ttq.png b/app/src/main/res/drawable/ttq.png new file mode 100644 index 0000000..a581615 Binary files /dev/null and b/app/src/main/res/drawable/ttq.png differ diff --git a/app/src/main/res/drawable/tusi.JPG b/app/src/main/res/drawable/tusi.JPG new file mode 100644 index 0000000..bee600b Binary files /dev/null and b/app/src/main/res/drawable/tusi.JPG differ diff --git a/app/src/main/res/drawable/xiaomantou.JPG b/app/src/main/res/drawable/xiaomantou.JPG new file mode 100644 index 0000000..7c48406 Binary files /dev/null and b/app/src/main/res/drawable/xiaomantou.JPG differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 480ba16..8efbc79 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -7,13 +7,13 @@ android:orientation="vertical" tools:context=".activity.IndexActivity"> - + + --> + android:layout_height="wrap_content" + android:textSize="18sp" + android:text="标题" /> \ No newline at end of file diff --git a/app/src/main/res/layout/categoty_detail_content.xml b/app/src/main/res/layout/categoty_detail_content.xml index d602ed9..b3972c2 100644 --- a/app/src/main/res/layout/categoty_detail_content.xml +++ b/app/src/main/res/layout/categoty_detail_content.xml @@ -2,95 +2,14 @@ - - - - - - - - - - - - - - - - - - - + android:layout_marginTop="5dp" + android:layout_height="wrap_content" + android:layout_gravity="center" /> @@ -110,6 +28,5 @@ android:layout_marginTop="2dp" android:gravity="center" android:textColor="#050505" - android:text="99.0" android:textSize="16sp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/content_category.xml b/app/src/main/res/layout/content_category.xml index 7a8ac65..7c73e75 100644 --- a/app/src/main/res/layout/content_category.xml +++ b/app/src/main/res/layout/content_category.xml @@ -25,7 +25,7 @@ android:layout_marginTop="12dp" android:layout_weight="1" android:gravity="center" - android:text="百货超市" + android:text="商品种类" android:textColor="#FFF" android:textSize="20sp" /> diff --git a/app/src/main/res/layout/content_index.xml b/app/src/main/res/layout/content_index.xml index 9662f77..781e3a1 100644 --- a/app/src/main/res/layout/content_index.xml +++ b/app/src/main/res/layout/content_index.xml @@ -30,7 +30,7 @@ android:orientation="horizontal"> + android:layout_width="53dp" + android:layout_height="50dp" + android:src="@drawable/baocui" /> + android:layout_width="53dp" + android:layout_height="50dp" + android:src="@drawable/sanmingzhi" /> + android:layout_width="53dp" + android:layout_height="50dp" + android:src="@drawable/tusi" /> + android:src="@drawable/xiaomantou" /> @@ -126,7 +126,7 @@ android:orientation="horizontal"> + android:layout_width="53dp" + android:layout_height="50dp" + android:src="@drawable/paofu" /> + android:layout_width="53dp" + android:layout_height="50dp" + android:src="@drawable/dangao" /> + android:layout_width="53dp" + android:layout_height="50dp" + android:src="@drawable/shousibao" /> - + android:layout_width="53dp" + android:layout_height="50dp" + android:src="@drawable/taosu" /> diff --git a/app/src/main/res/layout/content_user.xml b/app/src/main/res/layout/content_user.xml index bc7336b..43636c2 100644 --- a/app/src/main/res/layout/content_user.xml +++ b/app/src/main/res/layout/content_user.xml @@ -87,7 +87,7 @@ android:layout_marginLeft="5dp" android:drawableLeft="@drawable/user_sex" android:textColor="#000" - android:text="城市:" + android:text="性别:" android:gravity="center_vertical" android:drawablePadding="8dp" android:textSize="14sp" @@ -224,7 +224,7 @@ android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:textSize="18sp" - android:layout_marginTop="150dp" + android:layout_marginTop="90dp" android:text="退出登录" android:textColor="#FFFFFF" android:layout_gravity="center" diff --git a/app/src/main/res/layout/index_famous.xml b/app/src/main/res/layout/index_famous.xml index e0ab56b..a1b4209 100644 --- a/app/src/main/res/layout/index_famous.xml +++ b/app/src/main/res/layout/index_famous.xml @@ -19,10 +19,10 @@ android:layout_height="50dp" android:layout_marginLeft="5dp" android:layout_weight="1" - android:drawableLeft="@drawable/shuiguo" + android:drawableLeft="@drawable/tb" android:drawablePadding="8dp" android:gravity="center_vertical" - android:text="热门商品" + android:text="热门糕点" android:textColor="#000" android:textSize="18sp" /> diff --git a/app/src/main/res/layout/user_register.xml b/app/src/main/res/layout/user_register.xml index 91cceab..3715629 100644 --- a/app/src/main/res/layout/user_register.xml +++ b/app/src/main/res/layout/user_register.xml @@ -47,7 +47,7 @@ android:textAlignment="center" android:maxLength="10" android:maxLines="1" - android:hint="用户名 10位" /> + android:hint="用户名 10位" /> @@ -70,7 +70,7 @@ android:textAlignment="center" android:maxLength="16" android:maxLines="1" - android:hint="密码 6-16位" /> + android:hint="密码 6-16位" /> @@ -163,6 +163,6 @@ android:layout_gravity="center_horizontal" android:background="@drawable/button_login" android:textColor="#FFFFFF" - android:text="注 册" /> + android:text="注 册" /> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5a3bf7a..02daafe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ 橙一色 用户名: - 密 码: - \ No newline at end of file + 密    码: + diff --git a/app/src/test/java/com/example/orangesale_04/ExampleUnitTest.java b/app/src/test/java/com/example/orangesale_05/ExampleUnitTest.java similarity index 87% rename from app/src/test/java/com/example/orangesale_04/ExampleUnitTest.java rename to app/src/test/java/com/example/orangesale_05/ExampleUnitTest.java index 5522777..a6f37e1 100644 --- a/app/src/test/java/com/example/orangesale_04/ExampleUnitTest.java +++ b/app/src/test/java/com/example/orangesale_05/ExampleUnitTest.java @@ -1,4 +1,4 @@ -package com.example.orangesale_04; +package com.example.orangesale_05; import org.junit.Test;