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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/register/dateoperation/Database.java b/app/src/main/java/com/example/register/dateoperation/Database.java
index 1f96404..917a4c5 100644
--- a/app/src/main/java/com/example/register/dateoperation/Database.java
+++ b/app/src/main/java/com/example/register/dateoperation/Database.java
@@ -11,13 +11,13 @@ import androidx.annotation.Nullable;
public class Database extends SQLiteOpenHelper {
public Database(@Nullable Context context) {
- super(context, "orange", null, 1);
+ super(context, "meituan", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
//创建用户表
- String sql = "create table orange_user(id integer primary key autoincrement, username varchar(50), password varchar(50),sex varchar(10),city carchar(50))";
+ String sql = "create table meituan_user(id integer primary key autoincrement, username varchar(50), password varchar(50),sex varchar(10),city carchar(50))";
db.execSQL(sql);
}
@@ -41,7 +41,7 @@ public class Database extends SQLiteOpenHelper {
contentValues.put("password", password);
contentValues.put("sex", sex);
contentValues.put("city", city);
- sqLiteDatabase.insert("orange_user", null, contentValues);
+ sqLiteDatabase.insert("meituan_user", null, contentValues);
sqLiteDatabase.close();
}
diff --git a/app/src/main/java/com/example/register/entity/Product.java b/app/src/main/java/com/example/register/entity/Product.java
index a45a9a7..d3504b7 100644
--- a/app/src/main/java/com/example/register/entity/Product.java
+++ b/app/src/main/java/com/example/register/entity/Product.java
@@ -37,4 +37,14 @@ public class Product {
private String productName;
private BigDecimal productPrice;
// private String characterStory;
+
+
+ @Override
+ public String toString() {
+ return "Product{" +
+ "imageUrlId=" + imageUrlId +
+ ", productName='" + productName + '\'' +
+ ", productPrice=" + productPrice +
+ '}';
+ }
}
diff --git a/app/src/main/java/com/example/register/fragment/IndexFragment.java b/app/src/main/java/com/example/register/fragment/IndexFragment.java
index 1115ace..2f5bf39 100644
--- a/app/src/main/java/com/example/register/fragment/IndexFragment.java
+++ b/app/src/main/java/com/example/register/fragment/IndexFragment.java
@@ -22,7 +22,7 @@ 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 LinearLayout meishiLine, houseLine, footLine, dyLine, lyLine, fruitLine, planeLine, ktvLine;
private GridView gridView;
private List productList;
private ProductAdapter productAdapter;
@@ -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.setOnClickListener(this);
- youziLine = view.findViewById(R.id.youzi);
- youziLine.setOnClickListener(this);
- juziLine = view.findViewById(R.id.juzi);
- juziLine.setOnClickListener(this);
- xiguaLine = view.findViewById(R.id.xigua);
- xiguaLine.setOnClickListener(this);
- liLine = view.findViewById(R.id.li);
- liLine.setOnClickListener(this);
- lemonLine = view.findViewById(R.id.lemon);
- lemonLine.setOnClickListener(this);
- mangguoLine = view.findViewById(R.id.mangguo);
- mangguoLine.setOnClickListener(this);
- appleLine = view.findViewById(R.id.apple);
- appleLine.setOnClickListener(this);
+ meishiLine = view.findViewById(R.id.meishi);
+ meishiLine.setOnClickListener(this);
+ houseLine = view.findViewById(R.id.house);
+ houseLine.setOnClickListener(this);
+ footLine = view.findViewById(R.id.foot);
+ footLine.setOnClickListener(this);
+ dyLine = view.findViewById(R.id.dy);
+ dyLine.setOnClickListener(this);
+ lyLine = view.findViewById(R.id.ly);
+ lyLine.setOnClickListener(this);
+ fruitLine = view.findViewById(R.id.fruit);
+ fruitLine.setOnClickListener(this);
+ planeLine = view.findViewById(R.id.plane);
+ planeLine.setOnClickListener(this);
+ ktvLine = view.findViewById(R.id.sing);
+ ktvLine.setOnClickListener(this);
gridView = view.findViewById(R.id.index_famous_gridview);
initData();
productAdapter = new ProductAdapter(getActivity(), productList);
@@ -75,25 +75,25 @@ public class IndexFragment extends Fragment implements View.OnClickListener {
private void initData() {
productList = new ArrayList<>();
Product product = new Product();
- product.setImageUrlId(R.drawable.juzip);
- product.setProductName("橘子");
- product.setProductPrice(new BigDecimal("9.9"));
+ product.setImageUrlId(R.drawable.haoroup);
+ product.setProductName("照烧鸡");
+ product.setProductPrice(new BigDecimal("19.9"));
Product product1 = new Product();
- product1.setImageUrlId(R.drawable.orange);
- product1.setProductName("橙子");
- product1.setProductPrice(new BigDecimal("29.9"));
+ product1.setImageUrlId(R.drawable.juzip);
+ product1.setProductName("橘子");
+ product1.setProductPrice(new BigDecimal("9.9"));
Product product2 = new Product();
- product2.setImageUrlId(R.drawable.youzip);
- product2.setProductName("柚子");
+ product2.setImageUrlId(R.drawable.singp);
+ product2.setProductName("KTV");
product2.setProductPrice(new BigDecimal("19.9"));
Product product3 = new Product();
- product3.setImageUrlId(R.drawable.xiguap);
- product3.setProductName("西瓜");
- product3.setProductPrice(new BigDecimal("19.9"));
+ product3.setImageUrlId(R.drawable.housep);
+ product3.setProductName("酒店");
+ product3.setProductPrice(new BigDecimal("199.9"));
Product product4 = new Product();
- product4.setImageUrlId(R.drawable.applep);
- product4.setProductName("苹果");
- product4.setProductPrice(new BigDecimal("49.9"));
+ product4.setImageUrlId(R.drawable.footp);
+ product4.setProductName("足疗");
+ product4.setProductPrice(new BigDecimal("29.9"));
Product product5 = new Product();
product5.setImageUrlId(R.drawable.lemonp);
product5.setProductName("柠檬");
diff --git a/app/src/main/java/com/example/register/fragment/SetDetailFragment.java b/app/src/main/java/com/example/register/fragment/SetDetailFragment.java
index 9935299..1cc4158 100644
--- a/app/src/main/java/com/example/register/fragment/SetDetailFragment.java
+++ b/app/src/main/java/com/example/register/fragment/SetDetailFragment.java
@@ -33,15 +33,21 @@ 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 -> {
+ Log.i("sss", "onCreateView: " + product.getProductName());
+ imageView.setBackgroundResource(product.getImageUrlId());
+ nameText.setText(product.getProductName());
+ priceText.setText(product.getProductPrice().toString());
});
+// categoryActivity.setOnChangeListener(new CategoryActivity.OnChangeListener() {
+// @Override
+// public void changeText(Product product) {
+// imageView.setBackgroundResource(product.getImageUrlId());
+// nameText.setText(product.getProductName());
+// priceText.setText(product.getProductPrice().toString());
+//
+// }
+// });
return view;
}
diff --git a/app/src/main/java/com/example/register/registerActivity.java b/app/src/main/java/com/example/register/registerActivity.java
index e7acb7d..2338fe0 100644
--- a/app/src/main/java/com/example/register/registerActivity.java
+++ b/app/src/main/java/com/example/register/registerActivity.java
@@ -123,7 +123,7 @@ public class registerActivity extends AppCompatActivity implements View.OnClickL
* 注册验证
*/
public void validateRegister() {
- Intent intent = new Intent(registerActivity.this, userActivity.class);
+ //Intent intent = new Intent(registerActivity.this, userActivity.class);
String username = usernameEdit.getText().toString();
String password = passwordEdit.getText().toString();
String surePassword = surePasswordEdit.getText().toString();
@@ -146,6 +146,11 @@ public class registerActivity extends AppCompatActivity implements View.OnClickL
bundle.putString("password", password);
bundle.putString("sex", sex);
bundle.putString("city", city);
+
+ Database database = new Database(registerActivity.this);
+ SQLiteDatabase sqLiteDatabase = database.getWritableDatabase();
+ insertData(sqLiteDatabase, bundle);
+ Intent intent = new Intent(registerActivity.this, IndexActivity.class);
intent.putExtras(bundle);
startActivity(intent);
} else {
@@ -173,7 +178,7 @@ public class registerActivity extends AppCompatActivity implements View.OnClickL
contentValues.put("password", bundle.getString("passwordT"));
contentValues.put("sex", bundle.getString("sex"));
contentValues.put("city", bundle.getString("city"));
- sqLiteDatabase.insert("orange_user", null, contentValues);
+ sqLiteDatabase.insert("meituan_user", null, contentValues);
sqLiteDatabase.close();
}
}
diff --git a/app/src/main/res/drawable/dy.png b/app/src/main/res/drawable/dy.png
new file mode 100644
index 0000000..ac29ef1
Binary files /dev/null and b/app/src/main/res/drawable/dy.png differ
diff --git a/app/src/main/res/drawable/foot.png b/app/src/main/res/drawable/foot.png
new file mode 100644
index 0000000..c1f3cd0
Binary files /dev/null and b/app/src/main/res/drawable/foot.png differ
diff --git a/app/src/main/res/drawable/footp.png b/app/src/main/res/drawable/footp.png
new file mode 100644
index 0000000..a2769ba
Binary files /dev/null and b/app/src/main/res/drawable/footp.png differ
diff --git a/app/src/main/res/drawable/haorou.jpg b/app/src/main/res/drawable/haorou.jpg
deleted file mode 100644
index 2a2921a..0000000
Binary files a/app/src/main/res/drawable/haorou.jpg and /dev/null differ
diff --git a/app/src/main/res/drawable/haorou.png b/app/src/main/res/drawable/haorou.png
new file mode 100644
index 0000000..472ea12
Binary files /dev/null and b/app/src/main/res/drawable/haorou.png differ
diff --git a/app/src/main/res/drawable/haoroup.png b/app/src/main/res/drawable/haoroup.png
new file mode 100644
index 0000000..9e05874
Binary files /dev/null and b/app/src/main/res/drawable/haoroup.png differ
diff --git a/app/src/main/res/drawable/house.png b/app/src/main/res/drawable/house.png
new file mode 100644
index 0000000..d46ce5c
Binary files /dev/null and b/app/src/main/res/drawable/house.png differ
diff --git a/app/src/main/res/drawable/housep.png b/app/src/main/res/drawable/housep.png
new file mode 100644
index 0000000..847293b
Binary files /dev/null and b/app/src/main/res/drawable/housep.png differ
diff --git a/app/src/main/res/drawable/ly.png b/app/src/main/res/drawable/ly.png
new file mode 100644
index 0000000..83b9865
Binary files /dev/null and b/app/src/main/res/drawable/ly.png differ
diff --git a/app/src/main/res/drawable/plane.png b/app/src/main/res/drawable/plane.png
new file mode 100644
index 0000000..9bf3654
Binary files /dev/null and b/app/src/main/res/drawable/plane.png differ
diff --git a/app/src/main/res/drawable/sing.png b/app/src/main/res/drawable/sing.png
new file mode 100644
index 0000000..d6cb377
Binary files /dev/null and b/app/src/main/res/drawable/sing.png differ
diff --git a/app/src/main/res/drawable/singp.png b/app/src/main/res/drawable/singp.png
new file mode 100644
index 0000000..1362b5b
Binary files /dev/null and b/app/src/main/res/drawable/singp.png differ
diff --git a/app/src/main/res/haorou.jpg b/app/src/main/res/haorou.jpg
new file mode 100644
index 0000000..ae8da7b
Binary files /dev/null and b/app/src/main/res/haorou.jpg differ
diff --git a/app/src/main/res/layout/content_index.xml b/app/src/main/res/layout/content_index.xml
index 7fa926d..dc55a9c 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:src="@drawable/haorou" />
+ android:src="@drawable/house" />
+ android:src="@drawable/foot" />
+ android:src="@drawable/dy" />
@@ -126,7 +126,7 @@
android:orientation="horizontal">
+ android:src="@drawable/ly" />
+ android:src="@drawable/juzi" />
+ android:src="@drawable/plane" />
+ android:src="@drawable/sing" />