commit 49f18bba60243d736ccf04ec8951a9d150c027fa Author: 邢璞 <1798084327> Date: Wed Jun 18 18:13:33 2025 +0800 v1 diff --git a/doc/购物商场系统维护.pptx b/doc/购物商场系统维护.pptx new file mode 100644 index 0000000..a715d5a Binary files /dev/null and b/doc/购物商场系统维护.pptx differ diff --git a/doc/购物商城系统维护.docx b/doc/购物商城系统维护.docx new file mode 100644 index 0000000..7808f5b Binary files /dev/null and b/doc/购物商城系统维护.docx differ diff --git a/src/ShoppingMallSystem/.gitignore b/src/ShoppingMallSystem/.gitignore new file mode 100644 index 0000000..603b140 --- /dev/null +++ b/src/ShoppingMallSystem/.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/src/ShoppingMallSystem/.idea/.gitignore b/src/ShoppingMallSystem/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/src/ShoppingMallSystem/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/src/ShoppingMallSystem/.idea/AndroidProjectSystem.xml b/src/ShoppingMallSystem/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/src/ShoppingMallSystem/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/.idea/androidTestResultsUserPreferences.xml b/src/ShoppingMallSystem/.idea/androidTestResultsUserPreferences.xml new file mode 100644 index 0000000..23adfe4 --- /dev/null +++ b/src/ShoppingMallSystem/.idea/androidTestResultsUserPreferences.xml @@ -0,0 +1,22 @@ + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/.idea/codeStyles/Project.xml b/src/ShoppingMallSystem/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..681f41a --- /dev/null +++ b/src/ShoppingMallSystem/.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/src/ShoppingMallSystem/.idea/compiler.xml b/src/ShoppingMallSystem/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/src/ShoppingMallSystem/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/.idea/deploymentTargetSelector.xml b/src/ShoppingMallSystem/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..c6c2ddc --- /dev/null +++ b/src/ShoppingMallSystem/.idea/deploymentTargetSelector.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/.idea/gradle.xml b/src/ShoppingMallSystem/.idea/gradle.xml new file mode 100644 index 0000000..f82f99e --- /dev/null +++ b/src/ShoppingMallSystem/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/.idea/jarRepositories.xml b/src/ShoppingMallSystem/.idea/jarRepositories.xml new file mode 100644 index 0000000..1d883ac --- /dev/null +++ b/src/ShoppingMallSystem/.idea/jarRepositories.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/.idea/migrations.xml b/src/ShoppingMallSystem/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/src/ShoppingMallSystem/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/.idea/misc.xml b/src/ShoppingMallSystem/.idea/misc.xml new file mode 100644 index 0000000..1776bbc --- /dev/null +++ b/src/ShoppingMallSystem/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/.idea/runConfigurations.xml b/src/ShoppingMallSystem/.idea/runConfigurations.xml new file mode 100644 index 0000000..16660f1 --- /dev/null +++ b/src/ShoppingMallSystem/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/.gitignore b/src/ShoppingMallSystem/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/src/ShoppingMallSystem/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/build.gradle b/src/ShoppingMallSystem/app/build.gradle new file mode 100644 index 0000000..886b7f4 --- /dev/null +++ b/src/ShoppingMallSystem/app/build.gradle @@ -0,0 +1,47 @@ +apply plugin: 'com.android.application' + +android { + + lintOptions { + checkReleaseBuilds false + abortOnError false + } + + compileSdkVersion 30 + buildToolsVersion "30.0.2" + + defaultConfig { + applicationId "com.example.shoppingmallsystem" + minSdkVersion 14 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + + + implementation 'androidx.navigation:navigation-fragment:2.3.2' + implementation 'androidx.navigation:navigation-ui:2.3.2' + implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6' + compile 'com.android.support:cardview-v7:21.+' + implementation 'androidx.recyclerview:recyclerview:1.0.0' + + compile 'com.jungly:gridPasswordView:0.3' +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/proguard-rules.pro b/src/ShoppingMallSystem/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/src/ShoppingMallSystem/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/release/app-release.apk b/src/ShoppingMallSystem/app/release/app-release.apk new file mode 100644 index 0000000..f565c85 Binary files /dev/null and b/src/ShoppingMallSystem/app/release/app-release.apk differ diff --git a/src/ShoppingMallSystem/app/release/output-metadata.json b/src/ShoppingMallSystem/app/release/output-metadata.json new file mode 100644 index 0000000..bc60897 --- /dev/null +++ b/src/ShoppingMallSystem/app/release/output-metadata.json @@ -0,0 +1,20 @@ +{ + "version": 1, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.example.shoppingmallsystem", + "variantName": "release", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "properties": [], + "versionCode": 1, + "versionName": "1.0", + "enabled": true, + "outputFile": "app-release.apk" + } + ] +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/androidTest/java/com/example/shoppingmallsystem/ExampleInstrumentedTest.java b/src/ShoppingMallSystem/app/src/androidTest/java/com/example/shoppingmallsystem/ExampleInstrumentedTest.java new file mode 100644 index 0000000..c9e87c8 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/androidTest/java/com/example/shoppingmallsystem/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.shoppingmallsystem; + +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.shoppingmallsystem", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/AndroidManifest.xml b/src/ShoppingMallSystem/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..c3377c3 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/AndroidManifest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/MainActivity.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/MainActivity.java new file mode 100644 index 0000000..642082c --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/MainActivity.java @@ -0,0 +1,148 @@ +package com.example.shoppingmallsystem; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.View; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.EditText; +import android.widget.Toast; + +import com.example.shoppingmallsystem.activity.HomeAllStoresActivity; +import com.example.shoppingmallsystem.activity.RegisterActivity; +import com.example.shoppingmallsystem.bean.Userinfo; +import com.example.shoppingmallsystem.util.MySQLiteHelper; +import com.example.shoppingmallsystem.util.ShareUtils; + +import java.util.List; + +public class MainActivity extends AppCompatActivity implements View.OnClickListener { + + private EditText et_password; + private EditText et_username; + private Button btn_login; + private Button btn_register; + public static String username; + private String password; + private CheckBox rember; + private CheckBox autologin; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + initView(); + } + + private void initView() { + et_password = (EditText) findViewById(R.id.et_password); + et_username = (EditText) findViewById(R.id.et_username); + btn_login = (Button)findViewById(R.id.M_login); + btn_register = (Button)findViewById(R.id.M_register); + rember = (CheckBox) findViewById(R.id.remenberpw); + autologin = (CheckBox)findViewById(R.id.autologin); + + btn_login.setOnClickListener(this); + btn_register.setOnClickListener(this); + + //清除表中所有数据 + // MySQLiteHelper.getInstance(this).deleateAllUserInfo(); + + //打印所有用户名和密码记录信息 + List userinfoList = MySQLiteHelper.getInstance(this).queryAlluserInfo(); + //Log.e("userinfoList", userinfoList.toString()); + + + if (ShareUtils.getRember().equals("1")) { + rember.setChecked(true); + et_username.setText(ShareUtils.getUserName()); + et_password.setText(ShareUtils.getPassword()); + }else { + rember.setChecked(false); + } + + + if (ShareUtils.getAuto_Login().equals("1")) { + autologin.setChecked(true); + if (TextUtils.isEmpty(et_username.getText()) || TextUtils.isEmpty(et_password.getText())) { + Toast.makeText(this, "用户名密码为空", Toast.LENGTH_SHORT).show(); + } else { + //登陆成功进入的页面 + startActivity(new Intent(this, HomeAllStoresActivity.class)); + username = ShareUtils.getUserName(); + this.finish(); + } + }else { + autologin.setChecked(false); + } + + + + rember.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener(){ + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean b) { + if (rember.isChecked()){ + //System.out.println("记住密码已被选中"); + ShareUtils.putRember("1"); + }else { + //System.out.println("记住密码没有被选中"); + ShareUtils.putRember("0"); + } + } + + }); + + + autologin.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean b) { + if (autologin.isChecked()){ + //System.out.println("自动登录被选中"); + ShareUtils.putAuto_Login("1"); + }else { + //System.out.println("自动登录没有被选中"); + ShareUtils.putAuto_Login("0"); + } + } + }); + } + + @Override + public void onClick(View view) { + switch (view.getId()){ + case R.id.M_login: + username = et_username.getText().toString(); + password = et_password.getText().toString(); + // Log.e("password " ,password); + // Log.e("username " ,username); + if (TextUtils.isEmpty(username) || TextUtils.isEmpty(password)) { + Toast.makeText(MainActivity.this, "用户名或密码不能为空", Toast.LENGTH_SHORT).show(); + return; + + } + if (MySQLiteHelper.getInstance(this).queryUseristrue(username,password)){ + if (rember.isChecked()){ + ShareUtils.putUserName(username); + ShareUtils.putPassword(password); + } + Toast.makeText(MainActivity.this, "登陆成功", Toast.LENGTH_SHORT).show(); + startActivity(new Intent(this, HomeAllStoresActivity.class)); + MainActivity.this.finish(); + }else { + Toast.makeText(MainActivity.this, "登录失败,用户名或密码错误", Toast.LENGTH_SHORT).show(); + return; + } + break; + case R.id.M_register: + Intent intent = new Intent(this, RegisterActivity.class); + startActivity(intent); + break; + } + + } + +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/HomeAllStoresActivity.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/HomeAllStoresActivity.java new file mode 100644 index 0000000..9edc4ab --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/HomeAllStoresActivity.java @@ -0,0 +1,215 @@ +package com.example.shoppingmallsystem.activity; + +import android.content.Intent; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.view.KeyEvent; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.ActionBarDrawerToggle; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.core.view.GravityCompat; +import androidx.drawerlayout.widget.DrawerLayout; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import com.example.shoppingmallsystem.MainActivity; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.adapter.AllStoresAdapter; +import com.example.shoppingmallsystem.bean.StoreBean; +import com.example.shoppingmallsystem.util.MySQLiteHelper; +import com.example.shoppingmallsystem.util.ShareUtils; +import com.example.shoppingmallsystem.util.ToastUtil; +import com.google.android.material.navigation.NavigationView; +import java.util.ArrayList; +import java.util.List; + + +/** + * 主页所有商店的activity + * + */ +public class HomeAllStoresActivity extends AppCompatActivity implements View.OnClickListener { + + + /*创建一个Drawerlayout和Toolbar联动的开关*/ + private ActionBarDrawerToggle toggle ; + private DrawerLayout drawerLayout; + private NavigationView navigationView; + private Toolbar toolbar; + private TextView tv_bar_title; + private TextView tv_main_userName; + private ImageView iv_head; + + private AllStoresAdapter allStoresAdapter; + //private SearchView mySearchView; + private RecyclerView rv_stores; + private List storeBeans; + private LinearLayout headerView; + private int UserID ; + + //初始化数据 + private void initData(){ + storeBeans = new ArrayList<>(); + storeBeans = MySQLiteHelper.getInstance(getApplicationContext()).queryAllStores(); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_home_all_stores); + //加载数据 + initData(); + //初始化View + ininView(); + //隐藏滑动条 + hideScrollBar(); + //设置ActionBar + setActionBar(); + /*设置Drawerlayout开关*/ + setDrawerToggle(); + /*设置监听器*/ + setListener(); + } + + /*初始化View*/ + private void ininView() { + drawerLayout = findViewById(R.id.drawer_layout); + navigationView = findViewById(R.id.navigation_view); + toolbar = findViewById(R.id.toolbar); + tv_bar_title = findViewById(R.id.tv_bar_title); + tv_bar_title.setText("商家列表"); + + //获取头布局 + headerView = (LinearLayout) navigationView.getHeaderView(0); + tv_main_userName = headerView.findViewById(R.id.tv_header_userName); + iv_head = headerView.findViewById(R.id.iv_head); + tv_main_userName.setText(MainActivity.username); + UserID = MySQLiteHelper.getInstance(getApplicationContext()).GetUserId(MainActivity.username); + switch (UserID){ + case 1: + iv_head.setImageResource(R.drawable.tx_1_48); + break; + case 2: + iv_head.setImageResource(R.drawable.tx_2_48); + break; + case 3: + iv_head.setImageResource(R.drawable.tx_3_48); + break; + case 4: + iv_head.setImageResource(R.drawable.tx_4_48); + break; + case 5: + iv_head.setImageResource(R.drawable.tx_5_48); + break; + case 6: + iv_head.setImageResource(R.drawable.tx_6_48); + break; + } + + + rv_stores = findViewById(R.id.rv_stores); + allStoresAdapter = new AllStoresAdapter(storeBeans); + //初始化recyclerView + rv_stores.setItemAnimator(new DefaultItemAnimator()); + rv_stores.setLayoutManager(new LinearLayoutManager(this)); + rv_stores.setAdapter(allStoresAdapter); + + //设置item点击事件 + allStoresAdapter.setOnItemClickListener(new AllStoresAdapter.OnItemClickListener() { + @Override + public void onClick(View v, int position, StoreBean storeBean) { + //ToastUtil.showShort("您点击的下标"+position+"商家:"+storeBean.getStoreName()); + startActivity(new Intent(HomeAllStoresActivity.this,StoreGoodsActivity.class).putExtra("storeID",storeBean.getID())); + } + }); + + } + + /*去掉navigation中的滑动条*/ + private void hideScrollBar() { + navigationView.getChildAt(0).setVerticalScrollBarEnabled(false); + } + + /*设置ActionBar*/ + private void setActionBar() { + setSupportActionBar(toolbar); + /*显示Home图标*/ + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + //设置不显示项目名称 + getSupportActionBar().setDisplayShowTitleEnabled(false); + } + /*设置Drawerlayout的开关,并且和Home图标联动*/ + private void setDrawerToggle() { + toggle = new ActionBarDrawerToggle(this,drawerLayout,toolbar,0,0); + drawerLayout.addDrawerListener(toggle); + /*同步drawerlayout的状态*/ + toggle.syncState(); + } + + /*设置监听器*/ + private void setListener() { + navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { + @Override + public boolean onNavigationItemSelected(@NonNull MenuItem item) { + switch (item.getItemId()){ + case R.id.single_1: + startActivity(new Intent(HomeAllStoresActivity.this,OrderActivity.class)); + break; + case R.id.single_2: + startActivity(new Intent(HomeAllStoresActivity.this, MyAccountActivity.class)); + break; + case R.id.single_3: + startActivity(new Intent(HomeAllStoresActivity.this,PersonalCenterActivity.class)); + break; + case R.id.single_4: + startActivity(new Intent(HomeAllStoresActivity.this, MainActivity.class)); + ShareUtils.putAuto_Login("0"); + HomeAllStoresActivity.this.finish(); + break; + + } + drawerLayout.closeDrawer(GravityCompat.START); + + return true; + } + }); + } + + + @Override + public void onClick(View view) { + switch (view.getId()){ + } + } + + + /** + * 设置返回两次退出程序的方法 + */ + protected long exitTime ; //记录第一次点击的时间 + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN){ + if ((System.currentTimeMillis() - exitTime) > 2000 ){ + Toast.makeText(HomeAllStoresActivity.this,"再按一次退出商城", + Toast.LENGTH_SHORT).show(); + exitTime = System.currentTimeMillis(); + }else { + HomeAllStoresActivity.this.finish(); + System.exit(0); + } + return true; + } + return super.onKeyDown(keyCode,event); + } + +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/MyAccountActivity.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/MyAccountActivity.java new file mode 100644 index 0000000..be392cc --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/MyAccountActivity.java @@ -0,0 +1,157 @@ +package com.example.shoppingmallsystem.activity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import com.example.shoppingmallsystem.MainActivity; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.bean.Userinfo; +import com.example.shoppingmallsystem.util.MySQLiteHelper; +import java.text.DecimalFormat; + +/** + * 我的钱包activity + */ +public class MyAccountActivity extends AppCompatActivity { + + private TextView tv_bar_title; + private Toolbar toolbar; + private TextView tv_recharge; + private TextView tv_userName; + private TextView tv_money; + private TextView tv_phoneNumb; + private TextView tv_schoolName; + private TextView tv_apartmentNumb; + private ImageView iv_personal_pic; + private Userinfo userinfo; + private double newMoney; + private int myUserID; + private DecimalFormat df; + private String result; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_my_account); + initData(); + initView(); + setActionBar(); + } + + + /**设置ActionBar**/ + private void setActionBar() { + setSupportActionBar(toolbar); + /*显示Home图标*/ + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + //设置不显示项目名称 + getSupportActionBar().setDisplayShowTitleEnabled(false); + } + @Override + //为toolbar设置返回按钮 + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if(item.getItemId() == android.R.id.home) + { + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + + private void initData() { + //从数据库获取userId和user信息 + userinfo = MySQLiteHelper.getInstance(getApplicationContext()).getUserInfoFromUserName(MainActivity.username); + myUserID = MySQLiteHelper.getInstance(getApplicationContext()).GetUserId(MainActivity.username); + } + + + private void initView() { + //初始化控件 + toolbar = findViewById(R.id.toolbar); + tv_bar_title = findViewById(R.id.tv_bar_title); + tv_bar_title.setText("我的钱包"); + tv_recharge = findViewById(R.id.tv_bar_function); + tv_recharge.setVisibility(View.VISIBLE); + tv_userName = findViewById(R.id.tv_username_acc); + tv_money = findViewById(R.id.tv_money); + tv_phoneNumb = findViewById(R.id.tv_phoneNumb_acc); + tv_schoolName = findViewById(R.id.tv_schoolName_acc); + tv_apartmentNumb = findViewById(R.id.tv_apartmentNumb_acc); + iv_personal_pic = findViewById(R.id.iv_personal_pic); + + tv_userName.setText(userinfo.getUserName()); + //不使用科学计数法显示double类型数据,解决显示错误问题 + df = new DecimalFormat("0.00"); + result = df.format(userinfo.getMoney()); + tv_money.setText(result+"元"); + tv_phoneNumb.setText(userinfo.getPhoneNumb()); + tv_schoolName.setText(userinfo.getSchoolName()); + tv_apartmentNumb.setText(userinfo.getApartmentNumb()); + + switch (myUserID){ + case 1: + iv_personal_pic.setImageResource(R.drawable.tx_1_48); + break; + case 2: + iv_personal_pic.setImageResource(R.drawable.tx_2_48); + break; + case 3: + iv_personal_pic.setImageResource(R.drawable.tx_3_48); + break; + case 4: + iv_personal_pic.setImageResource(R.drawable.tx_4_48); + break; + case 5: + iv_personal_pic.setImageResource(R.drawable.tx_5_48); + break; + case 6: + iv_personal_pic.setImageResource(R.drawable.tx_6_48); + break; + } + + /**充值的点击事件 */ + tv_recharge.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + startActivityForResult(new Intent(MyAccountActivity.this,RechargeActivity.class),0); + } + }); + + + } + + /** + *充值完成后,回到我的钱包界面时刷新金额数据 + */ + private void refreshMoney(){ + newMoney = MySQLiteHelper.getInstance(getApplicationContext()).getUserMoneyFromUserName(MainActivity.username); + //不使用科学计数法显示double类型数据,解决显示错误问题 + df = new DecimalFormat("0.00"); + result = df.format(newMoney); + tv_money.setText(result +"元"); + } + + /** + * 接受跳转的返回值并进行操作 + * @param requestCode + * @param resultCode + * @param data + */ + @Override + protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (resultCode == 1){ + refreshMoney(); + }else { + return; + } + } +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/OrderActivity.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/OrderActivity.java new file mode 100644 index 0000000..ba29978 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/OrderActivity.java @@ -0,0 +1,84 @@ +package com.example.shoppingmallsystem.activity; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.os.Bundle; +import android.view.MenuItem; +import android.widget.TextView; + +import com.example.shoppingmallsystem.MainActivity; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.adapter.AllStoresAdapter; +import com.example.shoppingmallsystem.adapter.OrderAdapter; +import com.example.shoppingmallsystem.bean.OrderBean; +import com.example.shoppingmallsystem.util.MySQLiteHelper; + +import java.util.List; + +/** + * 订单界面 + */ +public class OrderActivity extends AppCompatActivity { + + + private TextView tv_bar_title; + private Toolbar toolbar; + private RecyclerView tv_order; + private OrderAdapter orderAdapter ; + private List orderBeans; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_order); + initData(); + initView(); + setActionBar(); + } + + /*设置ActionBar*/ + private void setActionBar() { + setSupportActionBar(toolbar); + /*显示Home图标*/ + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + //设置不显示项目名称 + getSupportActionBar().setDisplayShowTitleEnabled(false); + } + + @Override + //为toolbar设置返回按钮 + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if(item.getItemId() == android.R.id.home) + { + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + + /** + * 初始化数据 + */ + private void initData() { + orderBeans = MySQLiteHelper.getInstance(OrderActivity.this).queryOrderBeanFromUserName(MainActivity.username); + } + + + + private void initView() { + toolbar = findViewById(R.id.toolbar); + tv_bar_title = findViewById(R.id.tv_bar_title); + tv_bar_title.setText("订单信息"); + + tv_order = findViewById(R.id.rv_order); + orderAdapter = new OrderAdapter(orderBeans); + tv_order.setItemAnimator(new DefaultItemAnimator()); + tv_order.setLayoutManager(new LinearLayoutManager(this)); + tv_order.setAdapter(orderAdapter); + } +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/OrderDetailsActivity.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/OrderDetailsActivity.java new file mode 100644 index 0000000..d6e2327 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/OrderDetailsActivity.java @@ -0,0 +1,120 @@ +package com.example.shoppingmallsystem.activity; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.os.Bundle; +import android.view.MenuItem; +import android.widget.TextView; + +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.adapter.OrderAdapter; +import com.example.shoppingmallsystem.adapter.PayRVAdapter; +import com.example.shoppingmallsystem.bean.GoodsArrayBean; +import com.example.shoppingmallsystem.bean.OrderBean; +import com.example.shoppingmallsystem.util.AppContext; +import com.example.shoppingmallsystem.util.MySQLiteHelper; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.util.List; + + +/** + * 订单详情界面activity + */ +public class OrderDetailsActivity extends AppCompatActivity { + + private OrderBean orderBean ; + private Gson gson; + private List goodsData ; + private TextView tv_bar_title; + private Toolbar toolbar; + private RecyclerView rv_orderDetails; + private PayRVAdapter payRVAdapter ; + private TextView tv_total; + private double total = 0; + private BigDecimal b1 ; + private BigDecimal b2 ; + private BigDecimal b3 ; + private BigDecimal result ; + private BigDecimal one ; + private double a ; + private TextView tv_orderDetails_time; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_order_details); + initData(); + initView(); + setActionBar(); + } + + /*设置ActionBar*/ + private void setActionBar() { + setSupportActionBar(toolbar); + /*显示Home图标*/ + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + //设置不显示项目名称 + getSupportActionBar().setDisplayShowTitleEnabled(false); + } + + @Override + //为toolbar设置返回按钮 + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if(item.getItemId() == android.R.id.home) + { + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + + + + private void initData() { + orderBean = (OrderBean) getIntent().getSerializableExtra("orderDetails"); + gson = new Gson(); + Type type = new TypeToken>() {}.getType(); + goodsData = gson.fromJson(orderBean.getGoodsJson(), type); + } + + private void initView() { + toolbar = findViewById(R.id.toolbar); + tv_bar_title = findViewById(R.id.tv_bar_title); + tv_bar_title.setText("订单详情"); + tv_total = findViewById(R.id.tv_order_total); + tv_orderDetails_time = findViewById(R.id.tv_orderDetails_time); + tv_orderDetails_time.setText(orderBean.getTime()); + rv_orderDetails = findViewById(R.id.rv_orderDetails); + //初始化recyclerView + payRVAdapter = new PayRVAdapter(goodsData); + rv_orderDetails.setLayoutManager(new LinearLayoutManager(AppContext.getInstance())); + rv_orderDetails.setAdapter(payRVAdapter); + + + /** + * 循环数据集,获取价格总数 + */ + for (int i= 0;i data =new ArrayList<>(); + private RecyclerView rv_pay; + private TextView tv_pay_total; + private TextView tv_submitOrder; + private PayRVAdapter payRVAdapter; + private double total = 0; + private BigDecimal b1 ; + private BigDecimal b2 ; + private BigDecimal b3 ; + private BigDecimal result ; + private BigDecimal one ; + private double a ; + private Dialog dialog; + private double accountMoney; + private OrderBean orderBean; + private Gson gson; + private String goodsJson; + + private BigDecimal a1 ; + private BigDecimal a2 ; + private BigDecimal result1 ; + private double resultMoney ; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_pay); + data = (ArrayList) getIntent().getSerializableExtra("PayList"); + initView(); + setActionBar(); + } + + /*设置ActionBar*/ + private void setActionBar() { + setSupportActionBar(toolbar); + /*显示Home图标*/ + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + //设置不显示项目名称 + getSupportActionBar().setDisplayShowTitleEnabled(false); + } + + @Override + //为toolbar设置返回按钮 + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if(item.getItemId() == android.R.id.home) + { + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + + private void initView() { + rv_pay = findViewById(R.id.rv_pay); + tv_pay_total = findViewById(R.id.tv_pay_total); + tv_submitOrder = findViewById(R.id.tv_submitOrder); + toolbar = findViewById(R.id.toolbar); + tv_bar_title = findViewById(R.id.tv_bar_title); + tv_bar_title.setText("提交订单"); + + //初始化recyclerView + rv_pay.setItemAnimator(null); + payRVAdapter = new PayRVAdapter(data); + rv_pay.setLayoutManager(new LinearLayoutManager(AppContext.getInstance())); + rv_pay.setAdapter(payRVAdapter); + + + /** + * 循环获得总价格 + */ + for (int i= 0;i accountMoney){ + ToastUtil.showShort("账户余额不足,请先充值"); + dialog.dismiss(); + }else { + //解决double精度丢失问题 + a1 = new BigDecimal(accountMoney); + a2 = new BigDecimal(total); + result1 = a1.subtract(a2); + one = new BigDecimal("1"); + resultMoney = result1.divide(one,2,BigDecimal.ROUND_HALF_UP).doubleValue();//保留2位数 + + MySQLiteHelper.getInstance(PayActivity.this).RechargeMoney(MainActivity.username,resultMoney); + gson = new Gson(); + goodsJson = gson.toJson(data); + //Log.e("inputString=" , inputString); + orderBean = new OrderBean(MainActivity.username, DateUtill.getCurrentTime(),goodsJson); + //Log.e("order",orderBean.toString()); + //Log.e("时间",DateUtill.getCurrentTime()); + MySQLiteHelper.getInstance(PayActivity.this).insertOrderInfo(orderBean); + ToastUtil.showShort("下单成功!"); + //通过handler通知刷新购物车界面 + MyDialog.handler.sendEmptyMessage(2); + PayActivity.this.finish(); + } + + } +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/PersonalCenterActivity.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/PersonalCenterActivity.java new file mode 100644 index 0000000..e835d93 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/PersonalCenterActivity.java @@ -0,0 +1,144 @@ +package com.example.shoppingmallsystem.activity; + +import android.os.Bundle; +import android.text.TextUtils; +import android.view.MenuItem; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.example.shoppingmallsystem.MainActivity; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.bean.Userinfo; +import com.example.shoppingmallsystem.util.MySQLiteHelper; +import com.example.shoppingmallsystem.util.ToastUtil; + + +/** + * 个人中心界面activity + */ +public class PersonalCenterActivity extends AppCompatActivity { + + private TextView tv_userName; + private EditText et_nickName; + private EditText et_phonNumb; + private EditText et_schoolName; + private EditText et_apartmentNumb; + private Button btn_alter; + private Button btn_cancle; + + private String nickName; + private String phoneNumb; + private String schoolName; + private String apartmentNumb; + + private TextView tv_bar_title; + private Toolbar toolbar; + + private Userinfo userinfo; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_personal_center); + initView(); + setActionBar(); + } + + /*设置ActionBar*/ + private void setActionBar() { + setSupportActionBar(toolbar); + /*显示Home图标*/ + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + //设置不显示项目名称 + getSupportActionBar().setDisplayShowTitleEnabled(false); + } + + @Override + //为toolbar设置返回按钮 + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if(item.getItemId() == android.R.id.home) + { + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + + private void initView() { + tv_userName = findViewById(R.id.tv_username); + et_nickName = findViewById(R.id.et_nickName_per); + et_phonNumb = findViewById(R.id.et_phoneNumb_per); + et_schoolName = findViewById(R.id.et_schoolName_per); + et_apartmentNumb = findViewById(R.id.et_apartmentNumb_per); + btn_alter = findViewById(R.id.btn_alter); + btn_cancle = findViewById(R.id.btn_cancle_per); + + toolbar = findViewById(R.id.toolbar); + tv_bar_title = findViewById(R.id.tv_bar_title); + tv_bar_title.setText("个人信息"); + + + //获取用户信息数据 + userinfo = MySQLiteHelper.getInstance(getApplicationContext()).getUserInfoFromUserName(MainActivity.username); + + tv_userName.setText(userinfo.getUserName()); + et_nickName.setText(userinfo.getNickName()); + et_phonNumb.setText(userinfo.getPhoneNumb()); + et_schoolName.setText(userinfo.getSchoolName()); + et_apartmentNumb.setText(userinfo.getApartmentNumb()); + + btn_alter.setOnClickListener(new View.OnClickListener() { + + private Userinfo userinfo1; + + @Override + public void onClick(View view) { + nickName = et_nickName.getText().toString(); + phoneNumb = et_phonNumb.getText().toString(); + schoolName = et_schoolName.getText().toString(); + apartmentNumb = et_apartmentNumb.getText().toString(); + + if (TextUtils.isEmpty(nickName)) { + ToastUtil.showShort("昵称不能为空!"); + return; + } + if (TextUtils.isEmpty(phoneNumb)) { + ToastUtil.showShort("手机号码不能为空!"); + return; + } + if (TextUtils.isEmpty(schoolName)) { + ToastUtil.showShort("学校名称不能为空"); + return; + } + if (TextUtils.isEmpty(apartmentNumb)) { + ToastUtil.showShort("公寓楼号不能为空"); + return; + } + + userinfo1 = new Userinfo(); + userinfo1.setUserName(MainActivity.username); + userinfo1.setNickName(nickName); + userinfo1.setPassword(userinfo.getPassword()); + userinfo1.setPhoneNumb(phoneNumb); + userinfo1.setSchoolName(schoolName); + userinfo1.setApartmentNumb(apartmentNumb); + //Log.e("修改后的信息",userinfo1.toString()); + //在数据库中修改相关信息 + MySQLiteHelper.getInstance(getBaseContext()).updateUserInfo(userinfo1); + ToastUtil.showShort("信息更新成功"); + } + }); + + btn_cancle.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + PersonalCenterActivity.this.finish(); + } + }); + } +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/RechargeActivity.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/RechargeActivity.java new file mode 100644 index 0000000..5dea78f --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/RechargeActivity.java @@ -0,0 +1,104 @@ +package com.example.shoppingmallsystem.activity; + +import android.content.DialogInterface; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.MenuItem; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.example.shoppingmallsystem.MainActivity; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.util.MySQLiteHelper; +import com.example.shoppingmallsystem.util.ToastUtil; + + +/** + * 充值界面的activity + */ +public class RechargeActivity extends AppCompatActivity { + + private TextView tv_bar_title; + private Toolbar toolbar; + private EditText et_rechargeMoney; + private Button btn_doRecharge; + private String money1; + private double currentAccountMoney; + private AlertDialog dialog1; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_recharge); + initView(); + setActionBar(); + } + + /*设置ActionBar*/ + private void setActionBar() { + setSupportActionBar(toolbar); + /*显示Home图标*/ + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + //设置不显示项目名称 + getSupportActionBar().setDisplayShowTitleEnabled(false); + } + @Override + //为toolbar设置返回按钮 + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if(item.getItemId() == android.R.id.home) + { + setResult(1); + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + + private void initView() { + //获取当前账户的金额 + currentAccountMoney = MySQLiteHelper.getInstance(getApplicationContext()).getUserMoneyFromUserName(MainActivity.username); + + toolbar = findViewById(R.id.toolbar); + tv_bar_title = findViewById(R.id.tv_bar_title); + tv_bar_title.setText("充值"); + et_rechargeMoney= findViewById(R.id.et_rechargeMoney); + btn_doRecharge = findViewById(R.id.btn_doRecharge); + //充值到账户的点击事件 + btn_doRecharge.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + money1 =et_rechargeMoney.getText().toString(); + if (money1.equals("0")){ + ToastUtil.showShort("金额不能为0"); + }else if (TextUtils.isEmpty(money1)) { + ToastUtil.showShort("金额不能为空"); + }else { + double m1 = Double.parseDouble(money1); + currentAccountMoney = currentAccountMoney + m1; + dialog1 = new AlertDialog.Builder(RechargeActivity.this).setTitle("是否确认充值") + .setMessage("充值账户:" + MainActivity.username + '\n' + "金 额:" + money1 +"元") + .setIcon(R.mipmap.ic_launcher) + .setPositiveButton("确定", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + MySQLiteHelper.getInstance(getBaseContext()).RechargeMoney(MainActivity.username, currentAccountMoney); + ToastUtil.showShort("充值成功"); + et_rechargeMoney.setText(""); + } + }) + .setNegativeButton("取消", null) + .create(); + dialog1.show(); + } + } + }); + + } +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/RegisterActivity.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/RegisterActivity.java new file mode 100644 index 0000000..8b2c327 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/RegisterActivity.java @@ -0,0 +1,161 @@ +package com.example.shoppingmallsystem.activity; + +import android.content.DialogInterface; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.MenuItem; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.bean.Userinfo; +import com.example.shoppingmallsystem.util.MySQLiteHelper; +import com.example.shoppingmallsystem.util.ToastUtil; + +public class RegisterActivity extends AppCompatActivity implements View.OnClickListener { + + private AlertDialog dialog; + private EditText et_userName; + private EditText et_password; + private EditText et_nickName; + private EditText et_phonNumb; + private EditText et_schoolName; + private EditText et_apartmentNumb; + private Button btn_register; + private Button btn_cancle; + + private String userName; + private String password; + private String nickName; + private String phoneNumb; + private String schoolName; + private String apartmentNumb; + + private TextView tv_bar_title; + private Toolbar toolbar; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_register); + initView(); + setActionBar(); + } + + /*设置ActionBar*/ + private void setActionBar() { + setSupportActionBar(toolbar); + /*显示Home图标*/ + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + //设置不显示项目名称 + getSupportActionBar().setDisplayShowTitleEnabled(false); + } + + private void initView() { + et_userName = findViewById(R.id.et_username); + et_password = findViewById(R.id.et_password); + et_nickName = findViewById(R.id.et_nickName); + et_phonNumb = findViewById(R.id.et_phoneNumb); + et_schoolName = findViewById(R.id.et_schoolName); + et_apartmentNumb = findViewById(R.id.et_apartmentNumb); + btn_register = findViewById(R.id.btn_register); + btn_cancle = findViewById(R.id.btn_cancle); + + toolbar = findViewById(R.id.toolbar); + tv_bar_title = findViewById(R.id.tv_bar_title); + tv_bar_title.setText("用户注册"); + + btn_register.setOnClickListener(this); + btn_cancle.setOnClickListener(this); + + } + + @Override + //为toolbar设置返回按钮 + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if(item.getItemId() == android.R.id.home) + { + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + + @Override + public void onClick(View view) { + switch (view.getId()) { + case R.id.btn_register: + userName = et_userName.getText().toString(); + password = et_password.getText().toString(); + nickName = et_nickName.getText().toString(); + phoneNumb = et_phonNumb.getText().toString(); + schoolName = et_schoolName.getText().toString(); + apartmentNumb = et_apartmentNumb.getText().toString(); + + if (MySQLiteHelper.getInstance(this).queryNameisExist(userName)) { + ToastUtil.showShort("用户名已存在"); + return; + } + if (TextUtils.isEmpty(userName) || TextUtils.isEmpty(password)) { + ToastUtil.showShort("用户名或密码不能为空!"); + return; + } + if (TextUtils.isEmpty(nickName)) { + ToastUtil.showShort("昵称不能为空!"); + return; + } + if (TextUtils.isEmpty(phoneNumb)) { + ToastUtil.showShort("手机号码不能为空!"); + return; + } + if (TextUtils.isEmpty(schoolName)) { + ToastUtil.showShort("学校名称不能为空"); + return; + } + if (TextUtils.isEmpty(apartmentNumb)) { + ToastUtil.showShort("公寓楼号不能为空"); + return; + } + + final Userinfo userinfo = new Userinfo(); + userinfo.setUserName(userName); + userinfo.setPassword(password); + userinfo.setNickName(nickName); + userinfo.setPhoneNumb(phoneNumb); + userinfo.setSchoolName(schoolName); + userinfo.setApartmentNumb(apartmentNumb); + dialog = new AlertDialog.Builder(this).setTitle("是否确认注册?") + .setMessage("用户名:" + userName + '\n' + "密 码:" + password + '\n' + "昵 称:" + nickName + '\n' + "手机号:" + phoneNumb + '\n' + "学校名称:" + schoolName + '\n' + "公寓楼号:" + apartmentNumb) + .setIcon(R.mipmap.ic_launcher) + .setPositiveButton("确定", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + DoInsert(userinfo); + } + }) + .setNegativeButton("取消", null) + .create(); + dialog.show(); + break; + case R.id.btn_cancle: + RegisterActivity.this.finish(); + break; + } + } + + //注册成功执行方法,将对象存入sqllite + public void DoInsert(Userinfo userinfo){ + MySQLiteHelper.getInstance(this).insertUserinfo(userinfo); + ToastUtil.showShort("注册成功"); + RegisterActivity.this.finish(); + } + +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/StoreGoodsActivity.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/StoreGoodsActivity.java new file mode 100644 index 0000000..92eaa09 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/activity/StoreGoodsActivity.java @@ -0,0 +1,150 @@ +package com.example.shoppingmallsystem.activity; + +import android.os.Bundle; +import android.view.MenuItem; +import android.widget.ImageView; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.fragment.app.Fragment; +import androidx.viewpager.widget.ViewPager; + +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.adapter.MyTabAdapter; +import com.example.shoppingmallsystem.bean.StoreBean; +import com.example.shoppingmallsystem.fragment.StoreCommentFragment; +import com.example.shoppingmallsystem.fragment.StoreGoodsFragment; +import com.example.shoppingmallsystem.fragment.StoreIntroFragment; +import com.example.shoppingmallsystem.util.MySQLiteHelper; +import com.google.android.material.tabs.TabLayout; +import java.util.ArrayList; +import java.util.List; + + +/** + * 点击商家后进入的商家商品界面 + */ +public class StoreGoodsActivity extends AppCompatActivity { + + private TabLayout tabLayout = null; + private MyTabAdapter myTabAdapter; + private ViewPager home_news_viewPager; + private StoreGoodsFragment storeGoodsFragment; + private StoreCommentFragment storeCommentFragment; + private StoreIntroFragment storeIntroFragment; + private List fragments = new ArrayList<>(); + + private TextView tv_bar_title; + private Toolbar toolbar; + private String storeID; + private StoreBean storeBean; + private ImageView iv_pic; + private TextView tv_storeName; + private TextView tv_storeScore; + private TextView tv_storeSell; + private TextView tv_storeSign; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_store_goods); + storeID = getIntent().getStringExtra("storeID"); + initData(); + initView(); + setActionBar(); + } + + /*设置ActionBar*/ + private void setActionBar() { + setSupportActionBar(toolbar); + /*显示Home图标*/ + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + //设置不显示项目名称 + getSupportActionBar().setDisplayShowTitleEnabled(false); + } + + @Override + //为toolbar设置返回按钮 + public boolean onOptionsItemSelected(@NonNull MenuItem item) { + if(item.getItemId() == android.R.id.home){ + finish(); + return true; + } + return super.onOptionsItemSelected(item); + } + + + private void initData() { + storeBean = new StoreBean(); + storeBean = MySQLiteHelper.getInstance(getApplicationContext()).queryStoreBeanFromStoreID(storeID); + storeGoodsFragment = new StoreGoodsFragment(storeID); + storeCommentFragment = new StoreCommentFragment(); + storeIntroFragment = new StoreIntroFragment(storeBean); + fragments.add(storeGoodsFragment); + fragments.add(storeCommentFragment); + fragments.add(storeIntroFragment); + } + + + private void initView() { + toolbar = findViewById(R.id.toolbar); + tv_bar_title = findViewById(R.id.tv_bar_title); + tv_bar_title.setText("商店详情"); + tabLayout = findViewById(R.id.home_newsTab); + home_news_viewPager = findViewById(R.id.home_news_vp); + iv_pic = findViewById(R.id.iv_store_act); + tv_storeName = findViewById(R.id.tv_storeName_act); + tv_storeScore = findViewById(R.id.tv_store_score_act); + tv_storeSell = findViewById(R.id.tv_store_sell_act); + tv_storeSign = findViewById(R.id.tv_store_sign_act); + + switch (storeBean.getIv_store_pic()){ + case "0": + iv_pic.setImageResource(R.mipmap.store_1); + break; + case "1": + iv_pic.setImageResource(R.mipmap.store_2); + break; + case "2": + iv_pic.setImageResource(R.mipmap.store_3); + break; + case "3": + iv_pic.setImageResource(R.mipmap.store_4); + break; + case "4": + iv_pic.setImageResource(R.mipmap.store_5); + break; + case "5": + iv_pic.setImageResource(R.mipmap.store_6); + break; + case "6": + iv_pic.setImageResource(R.mipmap.store_7); + break; + case "7": + iv_pic.setImageResource(R.mipmap.store_8); + break; + case "8": + iv_pic.setImageResource(R.mipmap.store_9); + break; + case "9": + iv_pic.setImageResource(R.mipmap.store_10); + break; + } + + tv_storeName.setText(storeBean.getStoreName()); + tv_storeScore.setText(storeBean.getStoreScore()+"分"); + tv_storeSell.setText("月销量:"+storeBean.getStoreSell()); + tv_storeSign.setText(storeBean.getStoreSign()); + + //初始化tab的Adapter + myTabAdapter = new MyTabAdapter(getSupportFragmentManager(),fragments); + home_news_viewPager.setAdapter(myTabAdapter); + tabLayout.setupWithViewPager(home_news_viewPager); + + } + + + +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/AllStoresAdapter.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/AllStoresAdapter.java new file mode 100644 index 0000000..e8a5fb9 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/AllStoresAdapter.java @@ -0,0 +1,136 @@ +package com.example.shoppingmallsystem.adapter; + +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.recyclerview.widget.RecyclerView; + +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.bean.StoreBean; + +import java.util.List; + + +/** + * 首页所有商家的Adapter + */ +public class AllStoresAdapter extends RecyclerView.Adapter{ + + //设置数据源 + private LayoutInflater inflater ; + private List storeBeans; + + + private OnItemClickListener onItemClickListener; + public void setOnItemClickListener(OnItemClickListener listener){ + this.onItemClickListener = listener; + } + + + //适配器的构造方法 + public AllStoresAdapter(List storeBeans){ + this.storeBeans = storeBeans; + } + + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + inflater = LayoutInflater.from(parent.getContext()); + View view = inflater.inflate(R.layout.store_item,parent,false); + final ViewHolder viewHolder = new ViewHolder(view); + return viewHolder; + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + switch (storeBeans.get(position).getIv_store_pic()){ + case "0": + holder.iv_store_pic.setImageResource(R.mipmap.store_1); + break; + case "1": + holder.iv_store_pic.setImageResource(R.mipmap.store_2); + break; + case "2": + holder.iv_store_pic.setImageResource(R.mipmap.store_3); + break; + case "3": + holder.iv_store_pic.setImageResource(R.mipmap.store_4); + break; + case "4": + holder.iv_store_pic.setImageResource(R.mipmap.store_5); + break; + case "5": + holder.iv_store_pic.setImageResource(R.mipmap.store_6); + break; + case "6": + holder.iv_store_pic.setImageResource(R.mipmap.store_7); + break; + case "7": + holder.iv_store_pic.setImageResource(R.mipmap.store_8); + break; + case "8": + holder.iv_store_pic.setImageResource(R.mipmap.store_9); + break; + case "9": + holder.iv_store_pic.setImageResource(R.mipmap.store_10); + break; + } + holder.tv_storeName.setText(storeBeans.get(position).getStoreName()); + holder.tv_storeScore.setText(storeBeans.get(position).getStoreScore()+"分"); + holder.tv_storeSell.setText(storeBeans.get(position).getStoreSell()+"份"); + holder.tv_storeSign.setText(storeBeans.get(position).getStoreSign()); + + } + + @Override + public long getItemId(int position) { + return position; + } + @Override + public int getItemCount() { + return storeBeans.size(); + } + + class ViewHolder extends RecyclerView.ViewHolder{ + + private ImageView iv_store_pic ; + private TextView tv_storeName ; + private TextView tv_storeScore ; + private TextView tv_storeSell ; + private TextView tv_storeSign; + + public ViewHolder(@NonNull View itemView) { + super(itemView); + + //绑定控件 + iv_store_pic = itemView.findViewById(R.id.iv_store_pic); + tv_storeName = itemView.findViewById(R.id.tv_storeName); + tv_storeScore = itemView.findViewById(R.id.tv_store_score); + tv_storeSell = itemView.findViewById(R.id.tv_store_sell); + tv_storeSign = itemView.findViewById(R.id.tv_store_sign); + + //实现item点击事件 + itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (onItemClickListener != null){ + onItemClickListener.onClick(view,getLayoutPosition(),storeBeans.get(getLayoutPosition())); + } + } + }); + } + } + + + /** + * RecycleView 的 点击事件 的 接口 + */ + //item点击事件接口 + public interface OnItemClickListener { + void onClick(View v, int position, StoreBean storeBean); + } + +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/BaseRecyclerHolder.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/BaseRecyclerHolder.java new file mode 100644 index 0000000..a22b86f --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/BaseRecyclerHolder.java @@ -0,0 +1,26 @@ +package com.example.shoppingmallsystem.adapter; + +import android.view.View; + +import androidx.annotation.IdRes; +import androidx.annotation.NonNull; +import androidx.collection.SparseArrayCompat; +import androidx.recyclerview.widget.RecyclerView; + +public class BaseRecyclerHolder extends RecyclerView.ViewHolder { + + private SparseArrayCompat mViews; + public BaseRecyclerHolder(@NonNull View itemView) { + super(itemView); + mViews = new SparseArrayCompat<>(); + } + + public V getView(@IdRes int ids){ + View v = mViews.get(ids); + if (v == null){ + v = itemView.findViewById(ids); + mViews.put(ids,v); + } + return (V) v; + } +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/BaseRecyclerViewAdater.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/BaseRecyclerViewAdater.java new file mode 100644 index 0000000..8826f57 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/BaseRecyclerViewAdater.java @@ -0,0 +1,131 @@ +package com.example.shoppingmallsystem.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.IntRange; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.ArrayList; +import java.util.List; + +public abstract class BaseRecyclerViewAdater extends RecyclerView.Adapter { + + private List mData; + public Context context; + private List resLayout; + + public BaseRecyclerViewAdater(Context context , int resLayout){ + this.resLayout = new ArrayList<>(); + this.context = context; + this.resLayout.add(resLayout); + mData = new ArrayList<>(); + } + + public BaseRecyclerViewAdater(Context context , int resLayout,List data){ + this.resLayout = new ArrayList<>(); + this.context = context; + this.resLayout.add(resLayout); + mData = data; + } + + //需要重写getItemViewType方法自行给布局分类 + public BaseRecyclerViewAdater(Context context , List resLayouts){ + this.context = context; + this.resLayout = resLayouts; + mData = new ArrayList<>(); + } + + @Override + public int getItemViewType(int position) { + return super.getItemViewType(position); + } + + public List getmData() { + return mData; + } + + @NonNull + @Override + public BaseRecyclerHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + final BaseRecyclerHolder holder = new BaseRecyclerHolder(LayoutInflater.from(context).inflate(resLayout.get(viewType), parent, false)); + if (null != mOnItemClickListener) { + holder.itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mOnItemClickListener.onItemClick(v, holder.getAdapterPosition()); + } + }); + } + return holder; + } + + @Override + public void onBindViewHolder(@NonNull BaseRecyclerHolder holder, int position) { + convert(holder,position); + } + + @Override + public int getItemCount() { + return mData.size(); + } + + /** + * 需要重写的方法 + * @param holder + * @param position + */ + public abstract void convert(BaseRecyclerHolder holder, int position); + + + public void setData(List items) { + this.mData = items == null ? new ArrayList() : items; + notifyDataSetChanged(); + } + + public void addData(@IntRange(from = 0) int position, @NonNull T data) { + mData.add(position, data); + notifyItemInserted(position); + compatibilityDataSizeChanged(1); + } + public void addData( @NonNull T data) { + mData.add(data); + notifyItemInserted(mData.size()); + } + + + public void remove(int position) { + mData.remove(position); + int internalPosition = position; + notifyItemRemoved(internalPosition); + notifyItemRangeChanged(internalPosition, mData.size() - internalPosition); + } + + private void compatibilityDataSizeChanged(int size) { + final int dataSize = mData == null ? 0 : mData.size(); + if (dataSize == size) { + notifyDataSetChanged(); + } + } + + private OnItemClickListener mOnItemClickListener; + public BaseRecyclerViewAdater setOnItemClickListener(OnItemClickListener listener) { + this.mOnItemClickListener = listener; + return this; + } + public interface OnItemClickListener { + void onItemClick(View view, int position); + } + + private RecyclerView recyclerView; + public void bindToRecyclerView(RecyclerView recyclerView){ + this.recyclerView = recyclerView; + } + + public RecyclerView getRecyclerView() { + return recyclerView; + } +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/ChatMessageAdapter.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/ChatMessageAdapter.java new file mode 100644 index 0000000..f5c00fa --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/ChatMessageAdapter.java @@ -0,0 +1,184 @@ +package com.example.shoppingmallsystem.adapter; + +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.recyclerview.widget.RecyclerView; + +import com.example.shoppingmallsystem.MainActivity; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.bean.ChatMessageBean; +import com.example.shoppingmallsystem.util.AppContext; +import com.example.shoppingmallsystem.util.MySQLiteHelper; + +import java.util.List; + +/** + * 评论信息的适配器 + */ +public class ChatMessageAdapter extends RecyclerView.Adapter { + + private LayoutInflater inflater; + private List messageBeans; + private int MyUserID = MySQLiteHelper.getInstance(AppContext.getInstance()).GetUserId(MainActivity.username); + + //构造方法 + public ChatMessageAdapter(List chatMessageBeans){ + this.messageBeans = chatMessageBeans; + } + + //设置枚举,判断类型 + public enum ItemType { + MY, OTHERS + } + + + @NonNull + @Override + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + inflater = LayoutInflater.from(parent.getContext()); + // 给ViewHolder设置布局文件 + RecyclerView.ViewHolder holder = null; + //根据类型,加载不同布局 + if (ItemType.MY.ordinal() == viewType) { + View v = inflater.inflate(R.layout.chat_item_right, parent, false); + holder = new ViewHolderMy(v); + } else if (ItemType.OTHERS.ordinal() == viewType) { + View v = inflater.inflate(R.layout.chat_item_left, parent, false); + holder = new ViewHolderOther(v); + } + return holder; + } + + @Override + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { + //根据holder的类型不同,显示不同的数据 + if (holder instanceof ViewHolderMy) { + switch (messageBeans.get(position).getImg_id()){ + case "1": + ((ViewHolderMy) holder).iv_chat.setImageResource(R.drawable.tx_1_48); + break; + case "2" : + ((ViewHolderMy) holder).iv_chat.setImageResource(R.drawable.tx_2_48); + break; + case "3": + ((ViewHolderMy) holder).iv_chat.setImageResource(R.drawable.tx_3_48); + break; + case "4": + ((ViewHolderMy) holder).iv_chat.setImageResource(R.drawable.tx_4_48); + break; + case "5": + ((ViewHolderMy) holder).iv_chat.setImageResource(R.drawable.tx_5_48); + break; + case "6": + ((ViewHolderMy) holder).iv_chat.setImageResource(R.drawable.tx_6_48); + break; + } + // ((ViewHolderMy) holder).iv_chat.setImageResource(R.drawable.my_tx_48); + ((ViewHolderMy) holder).tv_message.setText(messageBeans.get(position).getMessage()); + ((ViewHolderMy) holder).tv_rightUserName.setText(messageBeans.get(position).getUserName()); + ((ViewHolderMy) holder).tv_right_time.setText(messageBeans.get(position).getTime()); + } else if (holder instanceof ViewHolderOther) { + switch (messageBeans.get(position).getImg_id()){ + case "1": + ((ViewHolderOther) holder).iv_chat.setImageResource(R.drawable.tx_1_48); + break; + case "2" : + ((ViewHolderOther) holder).iv_chat.setImageResource(R.drawable.tx_2_48); + break; + case "3": + ((ViewHolderOther) holder).iv_chat.setImageResource(R.drawable.tx_3_48); + break; + case "4": + ((ViewHolderOther) holder).iv_chat.setImageResource(R.drawable.tx_4_48); + break; + case "5": + ((ViewHolderOther) holder).iv_chat.setImageResource(R.drawable.tx_5_48); + break; + case "6": + ((ViewHolderOther) holder).iv_chat.setImageResource(R.drawable.tx_6_48); + break; + } + ((ViewHolderOther) holder).tv_message.setText(messageBeans.get(position).getMessage()); + ((ViewHolderOther) holder).tv_leftUserName.setText(messageBeans.get(position).getUserName()); + ((ViewHolderOther) holder).tv_left_time.setText(messageBeans.get(position).getTime()); + } + } + + @Override + public int getItemCount() { + return messageBeans.size(); + } + + /** + * 拿到此位置条目的类型 + * @param position + * @return + */ + @Override + public int getItemViewType(int position) { + if (messageBeans.get(position).getId() == MyUserID) { + return ItemType.MY.ordinal(); + } else { + return ItemType.OTHERS.ordinal(); + } + + } + + /** + * 本人的view Holder + */ + class ViewHolderMy extends RecyclerView.ViewHolder { + + private ImageView iv_chat; + private TextView tv_message; + private TextView tv_rightUserName; + private TextView tv_right_time; + + public ViewHolderMy(@NonNull View itemView) { + super(itemView); + iv_chat = itemView.findViewById(R.id.iv_chat_imagr_right); + tv_message = itemView.findViewById(R.id.tv_chat_me_message); + tv_rightUserName = itemView.findViewById(R.id.tv_right_userName); + tv_right_time = itemView.findViewById(R.id.tv_right_time); + } + } + + + /** + * 其他用户的viewHolder + */ + class ViewHolderOther extends RecyclerView.ViewHolder { + + private ImageView iv_chat; + private TextView tv_message; + private TextView tv_leftUserName; + private TextView tv_left_time; + + public ViewHolderOther(@NonNull View itemView) { + super(itemView); + iv_chat = itemView.findViewById(R.id.iv_icon); + tv_message = itemView.findViewById(R.id.tv_message_left); + tv_leftUserName = itemView.findViewById(R.id.tv_left_userName); + tv_left_time = itemView.findViewById(R.id.tv_left_time); + } + } + + + + //刷新信息 + public void refreshMessages(){ + initData(); + notifyDataSetChanged(); + } + + //刷新数据源 + private void initData(){ + messageBeans = MySQLiteHelper.getInstance(AppContext.getInstance()).queryAllMessages(); + } + +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/MyTabAdapter.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/MyTabAdapter.java new file mode 100644 index 0000000..c86f5c8 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/MyTabAdapter.java @@ -0,0 +1,47 @@ +package com.example.shoppingmallsystem.adapter; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; + +import java.util.ArrayList; +import java.util.List; + + +/** + * tab的适配器 + */ +public class MyTabAdapter extends FragmentPagerAdapter { + + private List fragments; + String[] Title = new String[]{"点餐","讨论","商家"}; + + public MyTabAdapter(@NonNull FragmentManager fm, List fragments) { + super(fm); + this.fragments = fragments; + } + + @NonNull + @Override + public Fragment getItem(int position) { + return fragments.get(position); + } + + @Override + public int getCount() { + return 3; + } + + /** + * //此方法用来显示tab上的名字 + * @param position + * @return + */ + @Override + public CharSequence getPageTitle(int position) { + return Title[position]; + } + + +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/OrderAdapter.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/OrderAdapter.java new file mode 100644 index 0000000..233327a --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/OrderAdapter.java @@ -0,0 +1,66 @@ +package com.example.shoppingmallsystem.adapter; + +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.activity.OrderDetailsActivity; +import com.example.shoppingmallsystem.bean.OrderBean; +import com.example.shoppingmallsystem.util.AppContext; +import java.util.List; + + +/** + * 订单界面的适配器 + */ +public class OrderAdapter extends RecyclerView.Adapter{ + + private LayoutInflater inflater ; + private List data ; + + public OrderAdapter (List data){ + this.data = data ; + } + + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + inflater = LayoutInflater.from(parent.getContext()); + View view = inflater.inflate(R.layout.order_item,parent,false); + final ViewHolder viewHolder = new ViewHolder(view); + return viewHolder; + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + holder.tv_time.setText(data.get(position).getTime()); + } + + @Override + public int getItemCount() { + return data.size(); + } + + class ViewHolder extends RecyclerView.ViewHolder{ + + private TextView tv_time ; + public ViewHolder(@NonNull View itemView) { + super(itemView); + tv_time = itemView.findViewById(R.id.tv_orderTime); + + //设置点击事件点击后跳转订单详情界面 + tv_time.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + AppContext.getInstance().startActivity(new Intent(AppContext.getInstance(), OrderDetailsActivity.class) + .putExtra("orderDetails",data.get(getLayoutPosition())) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK )); + } + }); + } + } +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/PayRVAdapter.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/PayRVAdapter.java new file mode 100644 index 0000000..fe7cd8c --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/PayRVAdapter.java @@ -0,0 +1,97 @@ +package com.example.shoppingmallsystem.adapter; + +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.recyclerview.widget.RecyclerView; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.bean.GoodsArrayBean; +import java.util.List; + +/** + * 付款界面recyclerView的适配器 + */ +public class PayRVAdapter extends RecyclerView.Adapter { + + //设置数据源 + private LayoutInflater inflater ; + private List data; + + //适配器的构造方法 + public PayRVAdapter(List data){ + this.data = data; + } + + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + inflater = LayoutInflater.from(parent.getContext()); + View view = inflater.inflate(R.layout.pay_order_goods_item,parent,false); + final ViewHolder viewHolder = new ViewHolder(view); + return viewHolder; + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + switch (data.get(position).getPicNumb()){ + case "0": + holder.iv_pic.setImageResource(R.drawable.goods_1); + break; + case "1": + holder.iv_pic.setImageResource(R.drawable.goods_2); + break; + case "2": + holder.iv_pic.setImageResource(R.drawable.goods_3); + break; + case "3": + holder.iv_pic.setImageResource(R.drawable.goods_4); + break; + case "4": + holder.iv_pic.setImageResource(R.drawable.goods_5); + break; + case "5": + holder.iv_pic.setImageResource(R.drawable.goods_6); + break; + case "6": + holder.iv_pic.setImageResource(R.drawable.goods_7); + break; + case "7": + holder.iv_pic.setImageResource(R.drawable.goods_8); + break; + case "8": + holder.iv_pic.setImageResource(R.drawable.goods_9); + break; + case "9": + holder.iv_pic.setImageResource(R.drawable.goods_10); + break; + } + holder.tv_name.setText(data.get(position).getName()); + holder.tv_price.setText(data.get(position).getPrice()); + holder.tv_number.setText("X "+data.get(position).getNumber()); + } + + @Override + public int getItemCount() { + return data.size(); + } + + + class ViewHolder extends RecyclerView.ViewHolder{ + + + private ImageView iv_pic; + private TextView tv_name ; + private TextView tv_price ; + private TextView tv_number ; + public ViewHolder(@NonNull View itemView) { + super(itemView); + iv_pic = itemView.findViewById(R.id.iv_pay_goods); + tv_name = itemView.findViewById(R.id.tv_pay_Name); + tv_price = itemView.findViewById(R.id.tv_pay_Price); + tv_number = itemView.findViewById(R.id.tv_pay_number); + } + } +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/ShoppongCarGoodsAdapter.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/ShoppongCarGoodsAdapter.java new file mode 100644 index 0000000..15b8606 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/adapter/ShoppongCarGoodsAdapter.java @@ -0,0 +1,175 @@ +package com.example.shoppingmallsystem.adapter; + +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.recyclerview.widget.RecyclerView; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.bean.GoodsArrayBean; +import com.example.shoppingmallsystem.fragment.StoreGoodsFragment; +import com.example.shoppingmallsystem.util.MyDialog; +import com.example.shoppingmallsystem.util.ToastUtil; +import java.math.BigDecimal; +import java.util.List; + + +/** + * 购物车dialog的recyclerView的适配器 + */ +public class ShoppongCarGoodsAdapter extends RecyclerView.Adapter{ + + //设置数据源 + private LayoutInflater inflater ; + private List data; + public static double total; + private static BigDecimal b1 ; + private static BigDecimal b2 ; + private static BigDecimal b3 ; + private static BigDecimal result ; + private static BigDecimal one ; + private static double a ; + + //适配器的构造方法 + public ShoppongCarGoodsAdapter(List data){ + this.data = data; + } + @NonNull + @Override + public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + inflater = LayoutInflater.from(parent.getContext()); + View view = inflater.inflate(R.layout.shopping_car_goods_item,parent,false); + final ViewHolder viewHolder = new ViewHolder(view); + return viewHolder; + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + switch (data.get(position).getPicNumb()){ + case "0": + holder.iv_pic.setImageResource(R.drawable.goods_1); + break; + case "1": + holder.iv_pic.setImageResource(R.drawable.goods_2); + break; + case "2": + holder.iv_pic.setImageResource(R.drawable.goods_3); + break; + case "3": + holder.iv_pic.setImageResource(R.drawable.goods_4); + break; + case "4": + holder.iv_pic.setImageResource(R.drawable.goods_5); + break; + case "5": + holder.iv_pic.setImageResource(R.drawable.goods_6); + break; + case "6": + holder.iv_pic.setImageResource(R.drawable.goods_7); + break; + case "7": + holder.iv_pic.setImageResource(R.drawable.goods_8); + break; + case "8": + holder.iv_pic.setImageResource(R.drawable.goods_9); + break; + case "9": + holder.iv_pic.setImageResource(R.drawable.goods_10); + break; + } + holder.tv_name.setText(data.get(position).getName()); + holder.tv_price.setText(data.get(position).getPrice()); + holder.tv_number.setText(data.get(position).getNumber()+""); + + } + + @Override + public int getItemCount() { + return data.size(); + } + + class ViewHolder extends RecyclerView.ViewHolder{ + private ImageView iv_pic ; + private ImageView iv_add ; + private ImageView iv_minus ; + private TextView tv_price ; + private TextView tv_number ; + private TextView tv_name ; + + public ViewHolder(@NonNull View itemView) { + super(itemView); + iv_pic = itemView.findViewById(R.id.iv_car_goods); + iv_add = itemView.findViewById(R.id.iv_car_add); + iv_minus = itemView.findViewById(R.id.iv_car_minus); + tv_price = itemView.findViewById(R.id.tv_car_Price); + tv_number = itemView.findViewById(R.id.tv_car_number); + tv_name = itemView.findViewById(R.id.tv_car_Name); + + iv_add.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + data.get(getAdapterPosition()).setNumber(data.get(getAdapterPosition()).getNumber()+1); + //int p = StoreGoodsFragment.goodsArrayBean.itemsRight.indexOf(data.get(getAdapterPosition())); + //Log.e("获取的位置",p+""); + //StoreGoodsFragment.goodsArrayBean.itemsRight.get(p).setNumber(StoreGoodsFragment.goodsArrayBean.itemsRight.get(p).getNumber()+1); + StoreGoodsFragment.handler.sendEmptyMessage(1); + notifyItemChanged(getAdapterPosition()); + refreshTotal(); + } + }); + + iv_minus.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + data.get(getAdapterPosition()).setNumber(data.get(getAdapterPosition()).getNumber()-1); + //发送信息,通知商品列表刷新 + StoreGoodsFragment.handler.sendEmptyMessage(1); + refreshTotal(); + /** + * 判断是否已经减到了0 + */ + if (data.get(getAdapterPosition()).getNumber() == 0){ + data.remove(getAdapterPosition()); + notifyItemRemoved(getAdapterPosition()); + notifyDataSetChanged(); + refreshTotal(); + }else { + notifyItemChanged(getAdapterPosition()); + refreshTotal(); + } + //如果数据已为空,通知handler刷新 + if (data.size() == 0){ + ToastUtil.showShort("购物车已空"); + MyDialog.handler.sendEmptyMessage(1); + } + } + }); + } + } + + //刷新购物车底部总价格 + private void refreshTotal(){ + total = 0; + for (int i= 0;i itemsLeft; + public List itemsRight; + + @Override + public String toString() { + return "GoodsArrayBean{" + + "itemsLeft=" + itemsLeft + + ", itemsRight=" + itemsRight + + '}'; + } + + public static class ItemL{ + private String title; + + public ItemL(String title) { + this.title = title; + } + + public ItemL() { + + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + @Override + public String toString() { + return "ItemL{" + + "title='" + title + '\'' + + '}'; + } + } + + + public static class ItemR implements Serializable{ + private String title; + private String picNumb; + private String name; + private String price; + private String content; + private int number = 0; + + public ItemR() { + + } + + public ItemR(String title, String picNumb, String name, String price, String content, int number) { + this.title = title; + this.picNumb = picNumb; + this.name = name; + this.price = price; + this.content = content; + this.number = number; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getPicNumb() { + return picNumb; + } + + public void setPicNumb(String picNumb) { + this.picNumb = picNumb; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public int getNumber() { + return number; + } + + public void setNumber(int number) { + this.number = number; + } + + @Override + public String toString() { + return "ItemR{" + + "title='" + title + '\'' + + ", picNumb='" + picNumb + '\'' + + ", name='" + name + '\'' + + ", price='" + price + '\'' + + ", content='" + content + '\'' + + ", number=" + number + + '}'; + } + } + +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/bean/OrderBean.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/bean/OrderBean.java new file mode 100644 index 0000000..624009d --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/bean/OrderBean.java @@ -0,0 +1,57 @@ +package com.example.shoppingmallsystem.bean; + +import java.io.Serializable; + + +/** + * 订单信息bean + */ +public class OrderBean implements Serializable { + + private String userName ; + private String time ; + private String goodsJson ; + + public OrderBean(String userName, String time, String goodsJson) { + this.userName = userName; + this.time = time; + this.goodsJson = goodsJson; + } + + public OrderBean() { + + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getGoodsJson() { + return goodsJson; + } + + public void setGoodsJson(String goodsJson) { + this.goodsJson = goodsJson; + } + + @Override + public String toString() { + return "OrderBean{" + + "userName='" + userName + '\'' + + ", time='" + time + '\'' + + ", goodsJson='" + goodsJson + '\'' + + '}'; + } +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/bean/StoreBean.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/bean/StoreBean.java new file mode 100644 index 0000000..a46d2d2 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/bean/StoreBean.java @@ -0,0 +1,101 @@ +package com.example.shoppingmallsystem.bean; + +import java.io.Serializable; + + +/** + * 商家信息bean + */ +public class StoreBean implements Serializable { + + private String ID; + private String iv_store_pic; + private String storeName; + private String storeScore; + private String storeSell; + private String storeSign; + private String storeIntro; + + public StoreBean(String ID, String iv_store_pic, String storeName, String storeScore, String storeSell, String storeSign, String storeIntro) { + this.ID = ID; + this.iv_store_pic = iv_store_pic; + this.storeName = storeName; + this.storeScore = storeScore; + this.storeSell = storeSell; + this.storeSign = storeSign; + this.storeIntro = storeIntro; + } + + public StoreBean() { + + } + + public String getID() { + return ID; + } + + public void setID(String ID) { + this.ID = ID; + } + + public String getIv_store_pic() { + return iv_store_pic; + } + + public void setIv_store_pic(String iv_store_pic) { + this.iv_store_pic = iv_store_pic; + } + + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public String getStoreScore() { + return storeScore; + } + + public void setStoreScore(String storeScore) { + this.storeScore = storeScore; + } + + public String getStoreSell() { + return storeSell; + } + + public void setStoreSell(String storeSell) { + this.storeSell = storeSell; + } + + public String getStoreSign() { + return storeSign; + } + + public void setStoreSign(String storeSign) { + this.storeSign = storeSign; + } + + public String getStoreIntro() { + return storeIntro; + } + + public void setStoreIntro(String storeIntro) { + this.storeIntro = storeIntro; + } + + @Override + public String toString() { + return "StoreBean{" + + "ID='" + ID + '\'' + + ", iv_store_pic='" + iv_store_pic + '\'' + + ", storeName='" + storeName + '\'' + + ", storeScore='" + storeScore + '\'' + + ", storeSell='" + storeSell + '\'' + + ", storeSign='" + storeSign + '\'' + + ", storeIntro='" + storeIntro + '\'' + + '}'; + } +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/bean/Userinfo.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/bean/Userinfo.java new file mode 100644 index 0000000..b4ad17f --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/bean/Userinfo.java @@ -0,0 +1,109 @@ +package com.example.shoppingmallsystem.bean; + +/** + * 用户信息的bean + */ +public class Userinfo { + private int id ; + private String userName; + private String password; + private String nickName; + private String phoneNumb; + private String schoolName; + private String apartmentNumb; + private double money; + + + public Userinfo(){ + + } + + public Userinfo(int id, String userName, String password, String nickName, String phoneNumb, String schoolName, String apartmentNumb, double money) { + this.id = id; + this.userName = userName; + this.password = password; + this.nickName = nickName; + this.phoneNumb = phoneNumb; + this.schoolName = schoolName; + this.apartmentNumb = apartmentNumb; + this.money = money; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getPhoneNumb() { + return phoneNumb; + } + + public void setPhoneNumb(String phoneNumb) { + this.phoneNumb = phoneNumb; + } + + public String getSchoolName() { + return schoolName; + } + + public void setSchoolName(String schoolName) { + this.schoolName = schoolName; + } + + public String getApartmentNumb() { + return apartmentNumb; + } + + public void setApartmentNumb(String apartmentNumb) { + this.apartmentNumb = apartmentNumb; + } + + public double getMoney() { + return money; + } + + public void setMoney(double money) { + this.money = money; + } + + @Override + public String toString() { + return "Userinfo{" + + "id=" + id + + ", userName='" + userName + '\'' + + ", password='" + password + '\'' + + ", nickName='" + nickName + '\'' + + ", phoneNumb='" + phoneNumb + '\'' + + ", schoolName='" + schoolName + '\'' + + ", apartmentNumb='" + apartmentNumb + '\'' + + ", money=" + money + + '}'; + } +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/fragment/StoreCommentFragment.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/fragment/StoreCommentFragment.java new file mode 100644 index 0000000..cc1afc4 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/fragment/StoreCommentFragment.java @@ -0,0 +1,147 @@ +package com.example.shoppingmallsystem.fragment; + +import android.os.Bundle; +import android.text.TextUtils; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.shoppingmallsystem.MainActivity; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.adapter.ChatMessageAdapter; +import com.example.shoppingmallsystem.bean.ChatMessageBean; +import com.example.shoppingmallsystem.bean.GoodsArrayBean; +import com.example.shoppingmallsystem.util.AppContext; +import com.example.shoppingmallsystem.util.DateUtill; +import com.example.shoppingmallsystem.util.MySQLiteHelper; +import com.example.shoppingmallsystem.util.ToastUtil; +import com.google.gson.Gson; + +import java.util.ArrayList; +import java.util.List; + + +/** + * 评论界面的fragment + */ +public class StoreCommentFragment extends Fragment { + + private List chatMessageBeans = new ArrayList<>(); + private RecyclerView rv_Chat; + private ChatMessageAdapter adapter; + private EditText et_chat_message; + private Button btn_message_send; + private String messages; + private ChatMessageBean chatMessageBean; + + private int MyUserID = MySQLiteHelper.getInstance(AppContext.getInstance()).GetUserId(MainActivity.username); + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_store_comment,container,false); + } + + @Override + public void onStart() { + super.onStart(); + initData(); + initView(); + } + + private void initData() { + + chatMessageBeans = MySQLiteHelper.getInstance(getContext()).queryAllMessages(); + + /** + * 通过此方法,将json数据存入数据库,将数据转化为json格式存储 + */ +// GoodsArrayBean goodsArrayBean = new GoodsArrayBean(); +// goodsArrayBean.itemsLeft = new ArrayList<>(); +// goodsArrayBean.itemsRight = new ArrayList<>(); +// +// goodsArrayBean.itemsLeft.add(new GoodsArrayBean.ItemL("吉他")); +// goodsArrayBean.itemsLeft.add(new GoodsArrayBean.ItemL("尤克里里")); +// goodsArrayBean.itemsLeft.add(new GoodsArrayBean.ItemL("钢琴")); +// goodsArrayBean.itemsLeft.add(new GoodsArrayBean.ItemL("长笛")); +// goodsArrayBean.itemsLeft.add(new GoodsArrayBean.ItemL("架子鼓")); +// +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("吉他","1","吉他1","1600.50","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("吉他","2","吉他2","950.85","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("吉他","8","吉他3","1900.00","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("吉他","9","吉他4","1200.00","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("吉他","8","吉他5","2300.00","我是商品标题展示数据。。。",0)); +// +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("尤克里里","6","尤克里里1","350.80","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("尤克里里","5","尤克里里2","950.88","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("尤克里里","9","尤克里里3","690.88","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("尤克里里","1","尤克里里4","950.88","我是商品标题展示数据。。。",0)); +// +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("钢琴","6","钢琴1","11000.99","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("钢琴","5","钢琴2","85000.99","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("钢琴","1","钢琴3","16000.00","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("钢琴","2","钢琴4","60000.90","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("钢琴","5","钢琴5","35000.50","我是商品标题展示数据。。。",0)); +// +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("长笛","9","长笛1","110.99","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("长笛","1","长笛2","150.99","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("长笛","2","长笛3","90.99","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("长笛","3","长笛4","190.99","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("长笛","9","长笛5","52.99","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("长笛","5","长笛6","150.99","我是商品标题展示数据。。。",0)); +// +// +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("架子鼓","2","架子鼓1","1500.99","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("架子鼓","9","架子鼓2","1500.99","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("架子鼓","5","架子鼓3","1500.99","我是商品标题展示数据。。。",0)); +// goodsArrayBean.itemsRight.add(new GoodsArrayBean.ItemR("架子鼓","1","架子鼓4","1500.99","我是商品标题展示数据。。。",0)); +// +// +// Gson gson = new Gson(); +// String inputString = gson.toJson(goodsArrayBean); +// Log.e("inputString=" , inputString); + + } + + private void initView() { + rv_Chat = getActivity().findViewById(R.id.rv_chat); + et_chat_message = getActivity().findViewById(R.id.et_chat_message); + btn_message_send = getActivity().findViewById(R.id.btn_message_send); + messages = et_chat_message.getText().toString(); + + + adapter = new ChatMessageAdapter(chatMessageBeans); + rv_Chat.setItemAnimator(new DefaultItemAnimator()); + rv_Chat.setLayoutManager(new LinearLayoutManager(getActivity())); + rv_Chat.setAdapter(adapter); + rv_Chat.scrollToPosition(adapter.getItemCount()-1); + + //发送信息的判断和操作 + btn_message_send.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + messages = et_chat_message.getText().toString(); + if (TextUtils.isEmpty(messages)){ + ToastUtil.showShort("内容为空!"); + }else { + chatMessageBean = new ChatMessageBean(MyUserID,MyUserID+"",messages,MainActivity.username, DateUtill.getCurrentTime()); + MySQLiteHelper.getInstance(getActivity()).insertMessages(chatMessageBean); + adapter.refreshMessages(); + rv_Chat.scrollToPosition(adapter.getItemCount()-1); + ToastUtil.showShort("发送成功"); + et_chat_message.setText(""); + } + } + }); + } +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/fragment/StoreGoodsFragment.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/fragment/StoreGoodsFragment.java new file mode 100644 index 0000000..6669258 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/fragment/StoreGoodsFragment.java @@ -0,0 +1,420 @@ +package com.example.shoppingmallsystem.fragment; + +import android.content.Context; +import android.os.Bundle; +import android.os.Handler; +import android.os.Message; +import android.text.TextUtils; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.adapter.BaseRecyclerHolder; +import com.example.shoppingmallsystem.adapter.BaseRecyclerViewAdater; +import com.example.shoppingmallsystem.bean.GoodsArrayBean; +import com.example.shoppingmallsystem.util.AppContext; +import com.example.shoppingmallsystem.util.MyDialog; +import com.example.shoppingmallsystem.util.MySQLiteHelper; +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + + +/** + * 商家商品信息的fragment + */ +public class StoreGoodsFragment extends Fragment { + + public static GoodsArrayBean goodsArrayBean; + private LAdapter lAdapter; + public static RAdapter rAdapter; + private final Gson gson; + private final String json; + private RelativeLayout re_shoppingCar ; + private List dialogData = new ArrayList<>(); + private static ImageView iv_car ; + private static TextView tv_car ; + public static TextView tv_total ; + public static double total; + private static BigDecimal b1 ; + private static BigDecimal b2 ; + private static BigDecimal b3 ; + private static BigDecimal result ; + private static BigDecimal one ; + private static double a ; + private MyDialog dialog; + + + //通过handler刷新数据 + public static Handler handler = new Handler(){ + @Override + public void handleMessage(@NonNull Message msg) { + switch (msg.what){ + case 1: + rAdapter.notifyDataSetChanged(); + if (rAdapter.getCurrentData().size() == 0){ + setShoppingCarNotHaveGoods(); + } + refreshTotal(); + break; + } + } + }; + + + public StoreGoodsFragment(String storeID) { + gson = new Gson(); + json = MySQLiteHelper.getInstance(AppContext.getInstance()).queryGoodsFromStoreID(storeID); + Type type = new TypeToken() {}.getType(); + this.goodsArrayBean = gson.fromJson(json, type); + } + + + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_store_goods,container,false); + } + + @Override + public void onStart() { + super.onStart(); + //initData(); + initView(); + initListener(); + } + + + private RecyclerView rvL, rvR; + private TextView tv_head; + + private void initView() { + tv_head = getActivity().findViewById(R.id.tv_header); + tv_head.setText(goodsArrayBean.itemsLeft.get(0).getTitle()); + re_shoppingCar = getActivity().findViewById(R.id.re_shoppingCar); + iv_car = getActivity().findViewById(R.id.iv_shoppingCar); + tv_car = getActivity().findViewById(R.id.tv_shoppingCar); + tv_total = getActivity().findViewById(R.id.tv_total_frag); + + + rvL = getActivity().findViewById(R.id.rv1); + rvR = getActivity().findViewById(R.id.rv2); + rvR.setItemAnimator(null); + rvL.setLayoutManager(new LinearLayoutManager(getContext())); + rvR.setLayoutManager(new LinearLayoutManager(getContext())); + lAdapter = new LAdapter(getContext(),R.layout.goods_left_item, goodsArrayBean.itemsLeft); + lAdapter.bindToRecyclerView(rvL); + rvL.setAdapter(lAdapter); + rAdapter = new RAdapter(getContext(),R.layout.goods_right_item, goodsArrayBean.itemsRight); + rvR.setAdapter(rAdapter); + + + re_shoppingCar.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dialogData = rAdapter.getCurrentData(); + if (dialogData.size() != 0){ + dialog = new MyDialog(getActivity(),dialogData); + dialog.show(); + } + } + }); + } + + private boolean moveToTop = false; + private int index; + private void initListener() { + lAdapter.setOnItemClickListener(new BaseRecyclerViewAdater.OnItemClickListener() { + @Override + public void onItemClick(View view, int position) { + if (rvR.getScrollState() != RecyclerView.SCROLL_STATE_IDLE)return; + lAdapter.fromClick = true; + lAdapter.setChecked(position); + String tag = lAdapter.getmData().get(position).getTitle(); + for (int i = 0; i < rAdapter.getmData().size(); i++) { + //根据左边选中的条目获取到右面此条目Title相同的位置索引; + if (TextUtils.equals(tag,rAdapter.getmData().get(i).getTitle())){ + index = i; + moveToPosition_R(index); + return; + } + } + } + }); + + rvR.addOnScrollListener(new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + super.onScrolled(recyclerView, dx, dy); + LinearLayoutManager layoutManager = (LinearLayoutManager) rvR.getLayoutManager(); + if (moveToTop){ //向下滑动时,只会把改条目显示出来;我们还需要让该条目滑动到顶部; + moveToTop = false; + int m = index - layoutManager.findFirstVisibleItemPosition(); + if (m >= 0 && m <= layoutManager.getChildCount()){ + int top = layoutManager.getChildAt(m).getTop(); + rvR.smoothScrollBy(0,top); + } + }else { + int index = layoutManager.findFirstVisibleItemPosition(); + tv_head.setText(rAdapter.getmData().get(index).getTitle()); + lAdapter.setToPosition(rAdapter.getmData().get(index).getTitle()); + } + } + }); + + rvR.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View view, MotionEvent motionEvent) { + lAdapter.fromClick = false; + return false; + } + }); + } + + + private void moveToPosition_R(int index) { + LinearLayoutManager layoutManager = (LinearLayoutManager) rvR.getLayoutManager(); + int f = layoutManager.findFirstVisibleItemPosition(); + int l = layoutManager.findLastVisibleItemPosition(); + if (index <= f){ //向上移动时 + layoutManager.scrollToPosition(index); + }else if (index <= l){ //已经再屏幕上面显示时 + int m = index - f; + if (0 <= m && m <= layoutManager.getChildCount()) { + int top = layoutManager.getChildAt(m).getTop(); + rvR.smoothScrollBy(0, top); + } + }else { //向下移动时 + moveToTop = true; + layoutManager.scrollToPosition(index); + } + } + + class LAdapter extends BaseRecyclerViewAdater { + + + public LAdapter(Context context, int resLayout, List data) { + super(context, resLayout, data); + } + + @Override + public void convert(BaseRecyclerHolder holder, final int position) { + TextView tv = ((TextView)holder.getView(R.id.tv)); + tv.setText(getmData().get(position).getTitle()); + if (checked == position){ + tv.setTextColor(ContextCompat.getColor(context,R.color.colorPrimary)); + tv.setBackgroundResource(R.color.colorfff); + }else { + tv.setTextColor(ContextCompat.getColor(context,R.color.black)); + tv.setBackgroundResource(R.color.orange); + } + + } + + private int checked; //当前选中项 + public boolean fromClick; //是否是自己点击的 + + public void setChecked(int checked) { + this.checked = checked; + notifyDataSetChanged(); + } + + //让左边的额条目选中 + public void setToPosition(String title){ + if (fromClick)return; + if (TextUtils.equals(title,getmData().get(checked).getTitle()))return; + if (TextUtils.isEmpty(title))return; + for (int i = 0; i < getmData().size(); i++) { + if (TextUtils.equals(getmData().get(i).getTitle(),title)){ + setChecked(i); + moveToPosition(i); + return; + } + } + + } + + private void moveToPosition(int index){ + //如果选中的条目不在显示范围内,要滑动条目让该条目显示出来 + LinearLayoutManager linearLayoutManager = (LinearLayoutManager) getRecyclerView().getLayoutManager(); + int f = linearLayoutManager.findFirstVisibleItemPosition(); + int l = linearLayoutManager.findLastVisibleItemPosition(); + if (index<=f || index >= l){ + linearLayoutManager.scrollToPosition(index); + } + + } + + } + + class RAdapter extends BaseRecyclerViewAdater{ + + + public RAdapter(Context context, int resLayout, List data) { + super(context, resLayout, data); + } + + + @Override + public void convert(BaseRecyclerHolder holder, final int position) { + switch (getmData().get(position).getPicNumb()){ + case "0": + ((ImageView)holder.getView(R.id.iv_goods)).setImageResource(R.drawable.goods_1); + break; + case "1": + ((ImageView)holder.getView(R.id.iv_goods)).setImageResource(R.drawable.goods_2); + break; + case "2": + ((ImageView)holder.getView(R.id.iv_goods)).setImageResource(R.drawable.goods_3); + break; + case "3": + ((ImageView)holder.getView(R.id.iv_goods)).setImageResource(R.drawable.goods_4); + break; + case "4": + ((ImageView)holder.getView(R.id.iv_goods)).setImageResource(R.drawable.goods_5); + break; + case "5": + ((ImageView)holder.getView(R.id.iv_goods)).setImageResource(R.drawable.goods_6); + break; + case "6": + ((ImageView)holder.getView(R.id.iv_goods)).setImageResource(R.drawable.goods_7); + break; + case "7": + ((ImageView)holder.getView(R.id.iv_goods)).setImageResource(R.drawable.goods_8); + break; + case "8": + ((ImageView)holder.getView(R.id.iv_goods)).setImageResource(R.drawable.goods_9); + break; + case "9": + ((ImageView)holder.getView(R.id.iv_goods)).setImageResource(R.drawable.goods_10); + break; + } + ((TextView)holder.getView(R.id.tvName)).setText(getmData().get(position).getName()); + ((TextView)holder.getView(R.id.tvContant)).setText(getmData().get(position).getContent()); + ((TextView)holder.getView(R.id.tvPrice)).setText("¥:"+getmData().get(position).getPrice()); + if ( !(getmData().get(position).getNumber() == 0)){ + ((ImageView)holder.getView(R.id.iv_minus)).setVisibility(View.VISIBLE); + ((TextView)holder.getView(R.id.tv_number)).setVisibility(View.VISIBLE); + ((TextView)holder.getView(R.id.tv_number)).setText(getmData().get(position).getNumber()+""); + }else { + ((ImageView)holder.getView(R.id.iv_minus)).setVisibility(View.INVISIBLE); + ((TextView)holder.getView(R.id.tv_number)).setVisibility(View.INVISIBLE); + } + + + //悬停的标题头 + FrameLayout headLayout = holder.getView(R.id.stick_header); + TextView tvHead = holder.getView(R.id.tv_header); + if (position == 0){ + headLayout.setVisibility(View.VISIBLE); + tvHead.setText(getmData().get(position).getTitle()); + }else { + if (TextUtils.equals(getmData().get(position).getTitle(),getmData().get(position-1).getTitle())){ + headLayout.setVisibility(View.GONE); + }else { + headLayout.setVisibility(View.VISIBLE); + tvHead.setText(getmData().get(position).getTitle()); + } + } + + holder.itemView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Toast.makeText(getActivity(),getmData().get(position).getTitle()+getmData().get(position).getName(),Toast.LENGTH_SHORT).show(); + } + }); + + holder.getView(R.id.iv_add).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + getmData().get(position).setNumber(getmData().get(position).getNumber()+1); + notifyItemChanged(position); + refreshTotal(); + // tv_total.setText("¥ "+ total); + setShoppingCarHaveGoods(); + } + }); + holder.getView(R.id.iv_minus).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if (getmData().get(position).getNumber() == 0){ + notifyItemChanged(position); + refreshTotal(); + // tv_total.setText("¥ "+ total); + }else { + getmData().get(position).setNumber(getmData().get(position).getNumber()-1); + notifyItemChanged(position); + refreshTotal(); + // tv_total.setText("¥ "+ total); + } + if (getCurrentData().size() == 0){ + setShoppingCarNotHaveGoods(); + } + } + }); + + + } + + public List getCurrentData(){ + List data = new ArrayList<>(); + //data = getmData(); + for (int i = 0 ; i dialogData) { + this.context = context; + dialog = new CustomDialog(context, R.style.myDialog); + // dialog的样式 + view = LayoutInflater.from(context).inflate(R.layout.shoppcar_dialog, null); + //拿到dialog里的控件 + animView = view.findViewById(R.id.v_anim); + re_bottow = view.findViewById(R.id.rl); + tv_clean = view.findViewById(R.id.tv_car_clean); + recyclerView_carGoods = view.findViewById(R.id.re_shoppingGoods); + tv_DoShopping = view.findViewById(R.id.tv_DoShopping); + iv_shoppingCar = view.findViewById(R.id.iv_shoppingCar); + tv_total =view.findViewById(R.id.tv_total_dialog); + + total = StoreGoodsFragment.total; + tv_total.setText("¥ "+StoreGoodsFragment.total); + iv_shoppingCar.setImageResource(R.drawable.shoppingcar_full_64); + tv_DoShopping.setText("去结算"); + //初始化recyclerView + recyclerView_carGoods.setItemAnimator(null); + shoppongCarGoodsAdapter = new ShoppongCarGoodsAdapter(dialogData); + recyclerView_carGoods.setLayoutManager(new LinearLayoutManager(AppContext.getInstance())); + recyclerView_carGoods.setAdapter(shoppongCarGoodsAdapter); + + + dialog.setContentView(view); + + dismissView = view.findViewById(R.id.v_dimiss); + dismissView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + dialog.dismiss(); + } + }); + + re_bottow.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dialog.dismiss(); + } + }); + + + tv_DoShopping.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + intent = new Intent(); + intent.setClass(context, PayActivity.class); + intent.putExtra("PayList",(Serializable) dialogData); + context.startActivity(intent); + } + }); + + tv_clean.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + dialogData.clear(); + shoppongCarGoodsAdapter.notifyDataSetChanged(); + for (int i = 0;i< StoreGoodsFragment.goodsArrayBean.itemsRight.size() ;i++){ + StoreGoodsFragment.goodsArrayBean.itemsRight.get(i).setNumber(0); + } + StoreGoodsFragment.handler.sendEmptyMessage(1); + dialog.dismiss(); + ToastUtil.showShort("购物车已清空"); + } + }); + + dialog.setBeforeDismiss(new CustomDialog.IBeforeDismiss() { + @Override + public void onBeforeDismiss() { + dismissAnim(); + } + }); + + + // 设置dialog的位置 + Window dialogWindow = dialog.getWindow(); + dialogWindow.getDecorView().setPadding(0, 0, 0, 0); + dialogWindow.setBackgroundDrawableResource(android.R.color.transparent);//背景透明,不然会有个白色的东东 +// dialogWindow.setWindowAnimations(R.style.dialogWindowAnim); //不使用窗口弹出动画 + WindowManager.LayoutParams lp = dialogWindow.getAttributes(); + + lp.width = WindowManager.LayoutParams.MATCH_PARENT; // 宽度 + lp.height = WindowManager.LayoutParams.MATCH_PARENT; // 高度 + dialogWindow.setAttributes(lp); + // 设置dialog为底部 + dialogWindow.setGravity(Gravity.BOTTOM); + } + + + + + public void show() { + dialog.show(); + showAnim(); + } + + // 出现动画 + private void showAnim() { + TranslateAnimation animation = new TranslateAnimation(0, 0, DensityUtil.dp2px(context, 300), 0); + animation.setDuration(300); + animView.startAnimation(animation); + } + + // 消失动画 + private void dismissAnim() { + TranslateAnimation animation = new TranslateAnimation(0, 0, 0, DensityUtil.dp2px(context, 300)); + animation.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + dialog.myDismiss(); + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + animation.setDuration(300); + animView.startAnimation(animation); + } + +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/MySQLhelper.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/MySQLhelper.java new file mode 100644 index 0000000..1d2240c --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/MySQLhelper.java @@ -0,0 +1,70 @@ +package com.example.shoppingmallsystem.util; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +import androidx.annotation.Nullable; + +/** + * 创建SQLite数据库的工具类 + */ +public class MySQLhelper extends SQLiteOpenHelper { + + public static final String DB_NAME = "ShoppingMallInfo"; + public static final int VERSION = 1; + + public MySQLhelper(@Nullable Context context, @Nullable String DB_NAME, @Nullable SQLiteDatabase.CursorFactory factory, int VERSION) { + super(context, DB_NAME, factory, VERSION); + } + + @Override + public void onCreate(SQLiteDatabase db) { + db.execSQL("CREATE TABLE userInfo(_id INTEGER PRIMARY KEY AUTOINCREMENT ,userName VERVHAR(20),password VERVHAR(20),nickName VERVHAR(20),phoneNumb VERVHAR(20),schoolName VERVHAR(20),apartmentNumb VERVHAR(20) , money REAL)"); + db.execSQL("CREATE TABLE storeInfo(_id INTEGER PRIMARY KEY autoincrement ,ID VERVHAR(20),picNumb VERVHAR(20),storeName VERVHAR(20),storeScore VERVHAR(20),storeSell VERVHAR(20) ,storeSign VERVHAR(20) ,storeIntro text )"); + db.execSQL("CREATE TABLE goodsInfo(_id INTEGER PRIMARY KEY autoincrement ,ID VERVHAR(20),goodsJson text)"); + db.execSQL("CREATE TABLE messagesInfo(_id INTEGER PRIMARY KEY autoincrement ,ID INTEGER,img_id VERVHAR(20),message text,userName VERVHAR(20),time VERVHAR(20))"); + db.execSQL("CREATE TABLE orderInfo(_id INTEGER PRIMARY KEY autoincrement ,userName VERVHAR(20),time VERVHAR(20),goodsJson text)"); + + + db.execSQL("INSERT INTO userInfo(userName,password,nickName,phoneNumb,schoolName,apartmentNumb,money) VALUES ('aaa','111','张三','15632586254','三里屯大学','N9号楼',0)"); + db.execSQL("INSERT INTO messagesInfo(ID,img_id,message,userName,time) VALUES (1,'1','我觉得店家1的商品就很不绰','aaa','2021.12.15 12:08')"); + + + db.execSQL("INSERT INTO storeInfo (ID,picNumb,storeName,storeScore,storeSell,storeSign,storeIntro)values ('0','0','米阳家具专营店','5.0','125','享折上折 屯居家好物','1.家用器具。《晋书·王述传》:“初, 述家贫,求试宛陵令,颇受赠遗,而修家具,为州司所检,有一千三百条。” 北魏 贾思勰 《齐民要术·槐柳楸梓梧柞》:“凡为家具者,前件木皆所宜种。” 宋 梅尧臣 《江邻几迁居》诗:“闻君迁新居,应比旧居好。复此假布囊,家具何草草。”《恨海》第六回:“﹝ 棣华 ﹞觅了一处房子,置备了一切动用家具。” 巴金 《灭亡》第二章:“这小小的房间底墙壁,以及房中的家具都不见了。”')"); + db.execSQL("INSERT INTO storeInfo (ID,picNumb,storeName,storeScore,storeSell,storeSign,storeIntro)values ('1','1','艺世界旗舰店','4.9','698','快来这里挑选家具日用吧','柳青《铜墙铁壁》第十八章:“一个背盒子枪和卡宾枪两件子家具的警卫员上来了。” 家用的器具,指木器,也包括炊事用具等。是人类日常生活和社会活动中使用的具有坐卧、凭倚、贮藏、间隔等功能的器具。通常由若干个零、部件按一定接合方式装配而成,已成为室内外装饰的重要组成部分。北魏贾思勰《齐民要术》五种槐柳楸梓梧柞:“凡为家具者,前件木皆所宜种。”可见,自古以来,中国家具一直以木材为主要用材,主要是木家具。\n" + + "家具既是物质产品,又是艺术创作,这便是人们常说的家具二重特点。')"); + db.execSQL("INSERT INTO storeInfo (ID,picNumb,storeName,storeScore,storeSell,storeSign,storeIntro)values ('2','2','海尔官方旗舰店','4.7','253','来海尔,挑选智能家居','海尔集团 [8-9] 始终以用户体验为中心,踏准时代节拍,从资不抵债、濒临倒闭的集体小厂发展成引领物联网时代的生态型企业 [6] ,连续两年作为全球唯一物联网生态品牌蝉联BrandZ最具价值全球品牌100强 [10-11] 。海尔拥有上市公司3家 [12-13] ,在全球设立10+N开发式创新体系 [14] 、28个工业园、122个制造中心 [15] ,108个营销中心和24万+销售网络 [13] [16] ,拥有海尔、卡萨帝、Leader、GE Appliances、Fisher&Paykel、AQUA、Candy等七大高端品牌和全球首个场景品牌“三翼鸟” [165] ,构建了全球引领的工业互联网平台卡奥斯COSMOPlat [15] 、孵化了日日顺、盈康一生、海尔生物医疗 [17] 、海纳云 [18] 、海创汇 [15] [19] 、海尔兄弟等众多生态品牌和新物种 [167] 。')"); + db.execSQL("INSERT INTO storeInfo (ID,picNumb,storeName,storeScore,storeSell,storeSign,storeIntro)values ('3','3','奥克斯康兴专卖店','4.6','544','奥克斯,享智能生活','奥克斯集团是中国500强企业、中国大企业集团竞争力前25强、中国信息化标杆企业、国家重点火炬高新技术企业,并为国家工程技术中心和国家级博士后工作站的常设单位,在宁波、上海、深圳、南昌建立了四大研究院;拥有“三星”和“奥克斯”两项跨行业的中国驰名商标和2个中国名牌产品。奥克斯空调位居行业第三,销售遍布中东、欧洲、亚太、非洲、美洲等100多个国家和地区 [25] ,奥克斯集团设立“国家博士后工作站” [26] 。')"); + db.execSQL("INSERT INTO storeInfo (ID,picNumb,storeName,storeScore,storeSell,storeSign,storeIntro)values ('4','4','阿里健康大药房','4.9','123','阿里健康,保驾护航','借助阿里巴巴集团在电子商务、大数据和云计算领域的优势,为医药健康行业提供全面的互联网解决方案。2016年8月,阿里健康全资收购广州五千年医药连锁,并更名为阿里健康大药房。阿里健康大药房持有国家食品药品监督管理局颁发的《互联网药品交易许可证》,提供互联网药品交易服务。')"); + db.execSQL("INSERT INTO storeInfo (ID,picNumb,storeName,storeScore,storeSell,storeSign,storeIntro)values ('5','5','冰蓝国际数码','4.3','635','数码产品大卖场','我们通常说的“数码”指的是含有“数码技术”的数码产品,如数码相机、数码摄像机、数码学习机、数码随身听等等。随着科技的发展,计算机的出现、发展带动了一批以数字为记载标识的产品,取代了传统的胶片、录影带、录音带等,我们把这种产品统称为数码产品。 例如电视/通讯器材/移动或者便携的电子工具等, 在相当程度上都采用了数字化。')"); + db.execSQL("INSERT INTO storeInfo (ID,picNumb,storeName,storeScore,storeSell,storeSign,storeIntro)values ('6','6','南极人旗舰店','4.8','418','国货之光南极人','南极人,成立于1997年, 是中国最早成立的内衣企业之一,首创保暖内衣产品,开创了中国内衣行业发展的新道路。\n" + + "历经22年的成长蜕变,南极人已经在内衣、母婴、服装、床品&布艺、厨品、鞋品、服饰配件、户外、家电等9大品类的55大类目产品线中取得突出的成绩,签约国民好媳妇海清,共同为国人带来 “全品类消费品王国”,努力打造让用户尖叫的产品,创造极致的用户体验。')"); + db.execSQL("INSERT INTO storeInfo (ID,picNumb,storeName,storeScore,storeSell,storeSign,storeIntro)values ('7','7','MAC魅可官方旗舰店','4.9','95','MAC魅可官方旗舰店','M∙A∙C彩妆创立于1984年,原创加拿大,现为美国雅诗兰黛旗下所有。第一支M∙A∙C彩妆的摄影需要,在镁光灯下诞生的。从第一批产品开始,M∙A∙C化妆品就以其丰富的色彩和独特的配方取得了成功,奠定了专业彩妆品牌的地位。M∙A∙C始终追求将时尚、快乐与幻想融合在一起,尊重不同种族、不同性别、不同年龄的人追求梦想和美丽的权利和自由,而M∙A∙C化妆品公司在艾滋病、反虐待及环保等社会事业的努力更显得难能可贵。Nicki Minaj、Lady Gaga等众多明星曾为其代言VIVA GLAM艾滋病爱心事业。')"); + db.execSQL("INSERT INTO storeInfo (ID,picNumb,storeName,storeScore,storeSell,storeSign,storeIntro)values ('8','8','李宁官方旗舰店','4.5','241','李宁官方旗舰店','李宁公司由著名体操运动员李宁先生创立。李宁公司成立于1990年,经过三十年的探索,已逐步成为代表中国的、国际领先的运动品牌公司。李宁公司采取多品牌业务发展策略,除自有核心李宁品牌(LI-NING),还拥有乐途品牌(LOTTO)、艾高品牌(AIGLE)、心动品牌(Z-DO)。此外,李宁公司控股上海红双喜、全资收购凯胜体育。')"); + db.execSQL("INSERT INTO storeInfo (ID,picNumb,storeName,storeScore,storeSell,storeSign,storeIntro)values ('9','9','广州木木夕乐器店','5.0','2365','多种乐器直营','乐器,英文:musical instruments,泛指可以用各种方法奏出音色音律的器物。一般分为民族乐器与西洋乐器。\n" + + "能够发出乐音,并能进行音乐艺术再创造的器具。人类通过演奏乐器,借以表达、交流思想感情。对乐器的界定,音乐界和乐器学界有不同看法。\n" + + "音乐界认为,用于音乐的发声器具才是乐器;乐器学界则通常将许多非音乐领域中的发声器具,如古代战争中的鸣金击鼓、宗教祈祷诵经中敲打的法器、婚丧中的礼仪信号、商贩招揽的信号器等,也视为乐器,甚至将一些生产劳动用具和日常生活器皿,如:弓、锯、杵、缶、杯、碟、盅、碗等等,在进行演奏时,都冠以乐字,称其为乐弓、乐锯、乐杯、乐杵等。')"); + + + db.execSQL("INSERT INTO goodsInfo (ID,goodsJson)values(0,'{\"itemsLeft\":[{\"title\":\"衣柜\"},{\"title\":\"床\"},{\"title\":\"被子\"},{\"title\":\"桌子\"}],\"itemsRight\":[{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"衣柜1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"1666.50\",\"title\":\"衣柜\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"衣柜2\",\"number\":0,\"picNumb\":\"2\",\"price\":\"950.85\",\"title\":\"衣柜\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"衣柜3\",\"number\":0,\"picNumb\":\"8\",\"price\":\"2520.00\",\"title\":\"衣柜\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"衣柜4\",\"number\":0,\"picNumb\":\"8\",\"price\":\"1650.00\",\"title\":\"衣柜\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"衣柜5\",\"number\":0,\"picNumb\":\"8\",\"price\":\"2950.00\",\"title\":\"衣柜\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"床1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"356.80\",\"title\":\"床\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"床2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"956.88\",\"title\":\"床\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"床3\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1850.88\",\"title\":\"床\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"被子1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"110.99\",\"title\":\"被子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"被子2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"850.99\",\"title\":\"被子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"被子3\",\"number\":0,\"picNumb\":\"1\",\"price\":\"160.00\",\"title\":\"被子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"被子4\",\"number\":0,\"picNumb\":\"2\",\"price\":\"60.90\",\"title\":\"被子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"被子5\",\"number\":0,\"picNumb\":\"5\",\"price\":\"350.50\",\"title\":\"被子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子1\",\"number\":0,\"picNumb\":\"1\",\"price\":\"110.99\",\"title\":\"桌子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子2\",\"number\":0,\"picNumb\":\"3\",\"price\":\"150.99\",\"title\":\"桌子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子3\",\"number\":0,\"picNumb\":\"5\",\"price\":\"900.99\",\"title\":\"桌子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1900.99\",\"title\":\"桌子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子5\",\"number\":0,\"picNumb\":\"2\",\"price\":\"5230.99\",\"title\":\"桌子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子6\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1520.99\",\"title\":\"桌子\"}]}\n')"); + + + db.execSQL("INSERT INTO goodsInfo (ID,goodsJson)values(1,'{\"itemsLeft\":[{\"title\":\"镜子\"},{\"title\":\"衣架\"},{\"title\":\"被子\"},{\"title\":\"桌子\"}],\"itemsRight\":[{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"镜子1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"16.50\",\"title\":\"镜子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"镜子2\",\"number\":0,\"picNumb\":\"2\",\"price\":\"95.85\",\"title\":\"镜子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"镜子3\",\"number\":0,\"picNumb\":\"8\",\"price\":\"25.00\",\"title\":\"镜子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"镜子4\",\"number\":0,\"picNumb\":\"8\",\"price\":\"16.00\",\"title\":\"镜子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"镜子5\",\"number\":0,\"picNumb\":\"8\",\"price\":\"29.00\",\"title\":\"镜子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"衣架1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"35.80\",\"title\":\"衣架\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"衣架2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"95.88\",\"title\":\"衣架\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"衣架3\",\"number\":0,\"picNumb\":\"9\",\"price\":\"18.88\",\"title\":\"衣架\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"被子1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"110.99\",\"title\":\"被子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"被子2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"850.99\",\"title\":\"被子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"被子3\",\"number\":0,\"picNumb\":\"1\",\"price\":\"160.00\",\"title\":\"被子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"被子4\",\"number\":0,\"picNumb\":\"2\",\"price\":\"60.90\",\"title\":\"被子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"被子5\",\"number\":0,\"picNumb\":\"5\",\"price\":\"350.50\",\"title\":\"被子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子1\",\"number\":0,\"picNumb\":\"1\",\"price\":\"110.99\",\"title\":\"桌子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子2\",\"number\":0,\"picNumb\":\"3\",\"price\":\"150.99\",\"title\":\"桌子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子3\",\"number\":0,\"picNumb\":\"5\",\"price\":\"900.99\",\"title\":\"桌子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1900.99\",\"title\":\"桌子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子5\",\"number\":0,\"picNumb\":\"2\",\"price\":\"5230.99\",\"title\":\"桌子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"桌子6\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1520.99\",\"title\":\"桌子\"}]}\n')"); + db.execSQL("INSERT INTO goodsInfo (ID,goodsJson)values(2,'{\"itemsLeft\":[{\"title\":\"冰箱\"},{\"title\":\"空调\"},{\"title\":\"洗衣机\"},{\"title\":\"太阳能\"}],\"itemsRight\":[{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冰箱1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"1600.50\",\"title\":\"冰箱\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冰箱2\",\"number\":0,\"picNumb\":\"2\",\"price\":\"9500.85\",\"title\":\"冰箱\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冰箱3\",\"number\":0,\"picNumb\":\"8\",\"price\":\"2500.00\",\"title\":\"冰箱\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冰箱4\",\"number\":0,\"picNumb\":\"8\",\"price\":\"1600.00\",\"title\":\"冰箱\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冰箱5\",\"number\":0,\"picNumb\":\"8\",\"price\":\"2900.00\",\"title\":\"冰箱\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"空调1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"3500.80\",\"title\":\"空调\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"空调2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"9500.88\",\"title\":\"空调\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"空调3\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1800.88\",\"title\":\"空调\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"洗衣机1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"1100.99\",\"title\":\"洗衣机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"洗衣机2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"850.99\",\"title\":\"洗衣机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"洗衣机3\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1600.00\",\"title\":\"洗衣机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"洗衣机4\",\"number\":0,\"picNumb\":\"2\",\"price\":\"6000.90\",\"title\":\"洗衣机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"洗衣机5\",\"number\":0,\"picNumb\":\"5\",\"price\":\"3500.50\",\"title\":\"洗衣机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能1\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1100.99\",\"title\":\"太阳能\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能2\",\"number\":0,\"picNumb\":\"3\",\"price\":\"1500.99\",\"title\":\"太阳能\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能3\",\"number\":0,\"picNumb\":\"5\",\"price\":\"9000.99\",\"title\":\"太阳能\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1900.99\",\"title\":\"太阳能\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能5\",\"number\":0,\"picNumb\":\"2\",\"price\":\"5230.99\",\"title\":\"太阳能\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能6\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1520.99\",\"title\":\"太阳能\"}]}\n')"); + db.execSQL("INSERT INTO goodsInfo (ID,goodsJson)values(3,'{\"itemsLeft\":[{\"title\":\"冰箱\"},{\"title\":\"空调\"},{\"title\":\"洗衣机\"},{\"title\":\"太阳能\"}],\"itemsRight\":[{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冰箱1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"1600.50\",\"title\":\"冰箱\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冰箱2\",\"number\":0,\"picNumb\":\"2\",\"price\":\"9500.85\",\"title\":\"冰箱\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冰箱3\",\"number\":0,\"picNumb\":\"8\",\"price\":\"2500.00\",\"title\":\"冰箱\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冰箱4\",\"number\":0,\"picNumb\":\"8\",\"price\":\"1600.00\",\"title\":\"冰箱\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冰箱5\",\"number\":0,\"picNumb\":\"8\",\"price\":\"2900.00\",\"title\":\"冰箱\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"空调1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"3500.80\",\"title\":\"空调\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"空调2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"9500.88\",\"title\":\"空调\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"空调3\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1800.88\",\"title\":\"空调\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"洗衣机1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"1100.99\",\"title\":\"洗衣机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"洗衣机2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"850.99\",\"title\":\"洗衣机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"洗衣机3\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1600.00\",\"title\":\"洗衣机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"洗衣机4\",\"number\":0,\"picNumb\":\"2\",\"price\":\"6000.90\",\"title\":\"洗衣机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"洗衣机5\",\"number\":0,\"picNumb\":\"5\",\"price\":\"3500.50\",\"title\":\"洗衣机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能1\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1100.99\",\"title\":\"太阳能\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能2\",\"number\":0,\"picNumb\":\"3\",\"price\":\"1500.99\",\"title\":\"太阳能\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能3\",\"number\":0,\"picNumb\":\"5\",\"price\":\"9000.99\",\"title\":\"太阳能\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1900.99\",\"title\":\"太阳能\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能5\",\"number\":0,\"picNumb\":\"2\",\"price\":\"5230.99\",\"title\":\"太阳能\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"太阳能6\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1520.99\",\"title\":\"太阳能\"}]}\n')"); + db.execSQL("INSERT INTO goodsInfo (ID,goodsJson)values(4,'{\"itemsLeft\":[{\"title\":\"日常药品\"},{\"title\":\"心血管药品\"},{\"title\":\"肠胃药\"},{\"title\":\"皮肤药\"}],\"itemsRight\":[{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"日常药品1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"16.50\",\"title\":\"日常药品\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"日常药品2\",\"number\":0,\"picNumb\":\"2\",\"price\":\"95.85\",\"title\":\"日常药品\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"日常药品3\",\"number\":0,\"picNumb\":\"8\",\"price\":\"25.00\",\"title\":\"日常药品\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"日常药品4\",\"number\":0,\"picNumb\":\"8\",\"price\":\"16.00\",\"title\":\"日常药品\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"日常药品5\",\"number\":0,\"picNumb\":\"8\",\"price\":\"29.00\",\"title\":\"日常药品\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"心血管药品1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"35.80\",\"title\":\"心血管药品\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"心血管药品2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"95.88\",\"title\":\"心血管药品\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"心血管药品3\",\"number\":0,\"picNumb\":\"9\",\"price\":\"69.88\",\"title\":\"心血管药品\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"心血管药品4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"18.88\",\"title\":\"心血管药品\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"肠胃药1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"110.99\",\"title\":\"肠胃药\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"肠胃药2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"85.99\",\"title\":\"肠胃药\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"肠胃药3\",\"number\":0,\"picNumb\":\"1\",\"price\":\"16.00\",\"title\":\"肠胃药\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"肠胃药4\",\"number\":0,\"picNumb\":\"2\",\"price\":\"60.90\",\"title\":\"肠胃药\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"肠胃药5\",\"number\":0,\"picNumb\":\"5\",\"price\":\"35.50\",\"title\":\"肠胃药\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"皮肤药1\",\"number\":0,\"picNumb\":\"1\",\"price\":\"11.99\",\"title\":\"皮肤药\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"皮肤药2\",\"number\":0,\"picNumb\":\"3\",\"price\":\"15.99\",\"title\":\"皮肤药\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"皮肤药3\",\"number\":0,\"picNumb\":\"5\",\"price\":\"90.99\",\"title\":\"皮肤药\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"皮肤药4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"19.99\",\"title\":\"皮肤药\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"皮肤药5\",\"number\":0,\"picNumb\":\"2\",\"price\":\"52.99\",\"title\":\"皮肤药\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"皮肤药6\",\"number\":0,\"picNumb\":\"9\",\"price\":\"15.99\",\"title\":\"皮肤药\"}]}\n')"); + db.execSQL("INSERT INTO goodsInfo (ID,goodsJson)values(5,'{\"itemsLeft\":[{\"title\":\"照相机\"},{\"title\":\"耳机\"},{\"title\":\"电视\"},{\"title\":\"无人机\"}],\"itemsRight\":[{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"照相机1\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1600.50\",\"title\":\"照相机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"照相机2\",\"number\":0,\"picNumb\":\"2\",\"price\":\"9500.85\",\"title\":\"照相机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"照相机3\",\"number\":0,\"picNumb\":\"8\",\"price\":\"2500.00\",\"title\":\"照相机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"照相机4\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1600.00\",\"title\":\"照相机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"照相机5\",\"number\":0,\"picNumb\":\"8\",\"price\":\"2900.00\",\"title\":\"照相机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"耳机1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"350.80\",\"title\":\"耳机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"耳机2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"950.88\",\"title\":\"耳机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"耳机3\",\"number\":0,\"picNumb\":\"9\",\"price\":\"690.88\",\"title\":\"耳机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"耳机4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"180.88\",\"title\":\"耳机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"电视1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"1100.99\",\"title\":\"电视\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"电视2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"8500.99\",\"title\":\"电视\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"电视3\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1600.00\",\"title\":\"电视\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"电视4\",\"number\":0,\"picNumb\":\"2\",\"price\":\"6000.90\",\"title\":\"电视\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"电视5\",\"number\":0,\"picNumb\":\"5\",\"price\":\"3500.50\",\"title\":\"电视\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"无人机1\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1100.99\",\"title\":\"无人机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"无人机2\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1500.99\",\"title\":\"无人机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"无人机3\",\"number\":0,\"picNumb\":\"2\",\"price\":\"9000.99\",\"title\":\"无人机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"无人机4\",\"number\":0,\"picNumb\":\"3\",\"price\":\"1900.99\",\"title\":\"无人机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"无人机5\",\"number\":0,\"picNumb\":\"9\",\"price\":\"5200.99\",\"title\":\"无人机\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"无人机6\",\"number\":0,\"picNumb\":\"5\",\"price\":\"1500.99\",\"title\":\"无人机\"}]}\n')"); + db.execSQL("INSERT INTO goodsInfo (ID,goodsJson)values(6,'{\"itemsLeft\":[{\"title\":\"内衣\"},{\"title\":\"保暖衣\"},{\"title\":\"冲锋衣\"},{\"title\":\"登山靴\"},{\"title\":\"袜子\"}],\"itemsRight\":[{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"内衣1\",\"number\":0,\"picNumb\":\"1\",\"price\":\"16.50\",\"title\":\"内衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"内衣2\",\"number\":0,\"picNumb\":\"2\",\"price\":\"95.85\",\"title\":\"内衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"内衣3\",\"number\":0,\"picNumb\":\"8\",\"price\":\"25.00\",\"title\":\"内衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"内衣4\",\"number\":0,\"picNumb\":\"9\",\"price\":\"16.00\",\"title\":\"内衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"内衣5\",\"number\":0,\"picNumb\":\"8\",\"price\":\"29.00\",\"title\":\"内衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"保暖衣1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"35.80\",\"title\":\"保暖衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"保暖衣2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"95.88\",\"title\":\"保暖衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"保暖衣3\",\"number\":0,\"picNumb\":\"9\",\"price\":\"69.88\",\"title\":\"保暖衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"保暖衣4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"95.88\",\"title\":\"保暖衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冲锋衣1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"110.99\",\"title\":\"冲锋衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冲锋衣2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"850.99\",\"title\":\"冲锋衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冲锋衣3\",\"number\":0,\"picNumb\":\"1\",\"price\":\"160.00\",\"title\":\"冲锋衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冲锋衣4\",\"number\":0,\"picNumb\":\"2\",\"price\":\"600.90\",\"title\":\"冲锋衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"冲锋衣5\",\"number\":0,\"picNumb\":\"5\",\"price\":\"350.50\",\"title\":\"冲锋衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"登山靴1\",\"number\":0,\"picNumb\":\"9\",\"price\":\"110.99\",\"title\":\"登山靴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"登山靴2\",\"number\":0,\"picNumb\":\"1\",\"price\":\"150.99\",\"title\":\"登山靴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"登山靴3\",\"number\":0,\"picNumb\":\"2\",\"price\":\"900.99\",\"title\":\"登山靴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"登山靴4\",\"number\":0,\"picNumb\":\"3\",\"price\":\"190.99\",\"title\":\"登山靴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"登山靴5\",\"number\":0,\"picNumb\":\"9\",\"price\":\"520.99\",\"title\":\"登山靴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"登山靴6\",\"number\":0,\"picNumb\":\"5\",\"price\":\"150.99\",\"title\":\"登山靴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"袜子1\",\"number\":0,\"picNumb\":\"2\",\"price\":\"15.99\",\"title\":\"袜子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"袜子2\",\"number\":0,\"picNumb\":\"9\",\"price\":\"15.99\",\"title\":\"袜子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"袜子3\",\"number\":0,\"picNumb\":\"5\",\"price\":\"15.99\",\"title\":\"袜子\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"袜子4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"15.99\",\"title\":\"袜子\"}]}\n')"); + db.execSQL("INSERT INTO goodsInfo (ID,goodsJson)values(7,'{\"itemsLeft\":[{\"title\":\"口红\"},{\"title\":\"粉底\"},{\"title\":\"香水\"},{\"title\":\"遮瑕\"}],\"itemsRight\":[{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"口红1\",\"number\":0,\"picNumb\":\"1\",\"price\":\"160.50\",\"title\":\"口红\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"口红2\",\"number\":0,\"picNumb\":\"2\",\"price\":\"950.85\",\"title\":\"口红\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"口红3\",\"number\":0,\"picNumb\":\"8\",\"price\":\"250.00\",\"title\":\"口红\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"口红4\",\"number\":0,\"picNumb\":\"9\",\"price\":\"160.00\",\"title\":\"口红\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"口红5\",\"number\":0,\"picNumb\":\"8\",\"price\":\"290.00\",\"title\":\"口红\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"粉底1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"35.80\",\"title\":\"粉底\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"粉底2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"95.88\",\"title\":\"粉底\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"粉底3\",\"number\":0,\"picNumb\":\"9\",\"price\":\"69.88\",\"title\":\"粉底\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"粉底4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"95.88\",\"title\":\"粉底\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"香水1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"110.99\",\"title\":\"香水\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"香水2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"850.99\",\"title\":\"香水\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"香水3\",\"number\":0,\"picNumb\":\"1\",\"price\":\"160.00\",\"title\":\"香水\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"香水4\",\"number\":0,\"picNumb\":\"2\",\"price\":\"600.90\",\"title\":\"香水\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"香水5\",\"number\":0,\"picNumb\":\"5\",\"price\":\"350.50\",\"title\":\"香水\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"遮瑕1\",\"number\":0,\"picNumb\":\"9\",\"price\":\"110.99\",\"title\":\"遮瑕\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"遮瑕2\",\"number\":0,\"picNumb\":\"1\",\"price\":\"150.99\",\"title\":\"遮瑕\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"遮瑕3\",\"number\":0,\"picNumb\":\"2\",\"price\":\"90.99\",\"title\":\"遮瑕\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"遮瑕4\",\"number\":0,\"picNumb\":\"3\",\"price\":\"190.99\",\"title\":\"遮瑕\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"遮瑕5\",\"number\":0,\"picNumb\":\"9\",\"price\":\"52.99\",\"title\":\"遮瑕\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"遮瑕6\",\"number\":0,\"picNumb\":\"5\",\"price\":\"150.99\",\"title\":\"遮瑕\"}]}\n')"); + db.execSQL("INSERT INTO goodsInfo (ID,goodsJson)values(8,'{\"itemsLeft\":[{\"title\":\"速干衣\"},{\"title\":\"跑步鞋\"},{\"title\":\"篮球鞋\"},{\"title\":\"半袖\"},{\"title\":\"长裤\"}],\"itemsRight\":[{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"速干衣1\",\"number\":0,\"picNumb\":\"1\",\"price\":\"160.50\",\"title\":\"速干衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"速干衣2\",\"number\":0,\"picNumb\":\"2\",\"price\":\"95.85\",\"title\":\"速干衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"速干衣3\",\"number\":0,\"picNumb\":\"8\",\"price\":\"190.00\",\"title\":\"速干衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"速干衣4\",\"number\":0,\"picNumb\":\"9\",\"price\":\"120.00\",\"title\":\"速干衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"速干衣5\",\"number\":0,\"picNumb\":\"8\",\"price\":\"230.00\",\"title\":\"速干衣\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"跑步鞋1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"350.80\",\"title\":\"跑步鞋\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"跑步鞋2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"950.88\",\"title\":\"跑步鞋\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"跑步鞋3\",\"number\":0,\"picNumb\":\"9\",\"price\":\"690.88\",\"title\":\"跑步鞋\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"跑步鞋4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"950.88\",\"title\":\"跑步鞋\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"篮球鞋1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"110.99\",\"title\":\"篮球鞋\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"篮球鞋2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"850.99\",\"title\":\"篮球鞋\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"篮球鞋3\",\"number\":0,\"picNumb\":\"1\",\"price\":\"160.00\",\"title\":\"篮球鞋\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"篮球鞋4\",\"number\":0,\"picNumb\":\"2\",\"price\":\"600.90\",\"title\":\"篮球鞋\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"篮球鞋5\",\"number\":0,\"picNumb\":\"5\",\"price\":\"350.50\",\"title\":\"篮球鞋\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"半袖1\",\"number\":0,\"picNumb\":\"9\",\"price\":\"110.99\",\"title\":\"半袖\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"半袖2\",\"number\":0,\"picNumb\":\"1\",\"price\":\"150.99\",\"title\":\"半袖\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"半袖3\",\"number\":0,\"picNumb\":\"2\",\"price\":\"90.99\",\"title\":\"半袖\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"半袖4\",\"number\":0,\"picNumb\":\"3\",\"price\":\"190.99\",\"title\":\"半袖\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"半袖5\",\"number\":0,\"picNumb\":\"9\",\"price\":\"52.99\",\"title\":\"半袖\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"半袖6\",\"number\":0,\"picNumb\":\"5\",\"price\":\"150.99\",\"title\":\"半袖\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"长裤1\",\"number\":0,\"picNumb\":\"2\",\"price\":\"150.99\",\"title\":\"长裤\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"长裤2\",\"number\":0,\"picNumb\":\"9\",\"price\":\"150.99\",\"title\":\"长裤\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"长裤3\",\"number\":0,\"picNumb\":\"5\",\"price\":\"150.99\",\"title\":\"长裤\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"长裤4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"150.99\",\"title\":\"长裤\"}]}\n')"); + db.execSQL("INSERT INTO goodsInfo (ID,goodsJson)values(9,'{\"itemsLeft\":[{\"title\":\"吉他\"},{\"title\":\"尤克里里\"},{\"title\":\"钢琴\"},{\"title\":\"长笛\"},{\"title\":\"架子鼓\"}],\"itemsRight\":[{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"吉他1\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1600.50\",\"title\":\"吉他\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"吉他2\",\"number\":0,\"picNumb\":\"2\",\"price\":\"950.85\",\"title\":\"吉他\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"吉他3\",\"number\":0,\"picNumb\":\"8\",\"price\":\"1900.00\",\"title\":\"吉他\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"吉他4\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1200.00\",\"title\":\"吉他\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"吉他5\",\"number\":0,\"picNumb\":\"8\",\"price\":\"2300.00\",\"title\":\"吉他\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"尤克里里1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"350.80\",\"title\":\"尤克里里\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"尤克里里2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"950.88\",\"title\":\"尤克里里\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"尤克里里3\",\"number\":0,\"picNumb\":\"9\",\"price\":\"690.88\",\"title\":\"尤克里里\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"尤克里里4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"950.88\",\"title\":\"尤克里里\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"钢琴1\",\"number\":0,\"picNumb\":\"6\",\"price\":\"11000.99\",\"title\":\"钢琴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"钢琴2\",\"number\":0,\"picNumb\":\"5\",\"price\":\"85000.99\",\"title\":\"钢琴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"钢琴3\",\"number\":0,\"picNumb\":\"1\",\"price\":\"16000.00\",\"title\":\"钢琴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"钢琴4\",\"number\":0,\"picNumb\":\"2\",\"price\":\"60000.90\",\"title\":\"钢琴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"钢琴5\",\"number\":0,\"picNumb\":\"5\",\"price\":\"35000.50\",\"title\":\"钢琴\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"长笛1\",\"number\":0,\"picNumb\":\"9\",\"price\":\"110.99\",\"title\":\"长笛\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"长笛2\",\"number\":0,\"picNumb\":\"1\",\"price\":\"150.99\",\"title\":\"长笛\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"长笛3\",\"number\":0,\"picNumb\":\"2\",\"price\":\"90.99\",\"title\":\"长笛\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"长笛4\",\"number\":0,\"picNumb\":\"3\",\"price\":\"190.99\",\"title\":\"长笛\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"长笛5\",\"number\":0,\"picNumb\":\"9\",\"price\":\"52.99\",\"title\":\"长笛\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"长笛6\",\"number\":0,\"picNumb\":\"5\",\"price\":\"150.99\",\"title\":\"长笛\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"架子鼓1\",\"number\":0,\"picNumb\":\"2\",\"price\":\"1500.99\",\"title\":\"架子鼓\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"架子鼓2\",\"number\":0,\"picNumb\":\"9\",\"price\":\"1500.99\",\"title\":\"架子鼓\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"架子鼓3\",\"number\":0,\"picNumb\":\"5\",\"price\":\"1500.99\",\"title\":\"架子鼓\"},{\"content\":\"我是商品标题展示数据。。。\",\"name\":\"架子鼓4\",\"number\":0,\"picNumb\":\"1\",\"price\":\"1500.99\",\"title\":\"架子鼓\"}]}\n')"); + + + } + + @Override + public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) { + + } +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/MySQLiteHelper.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/MySQLiteHelper.java new file mode 100644 index 0000000..792cc13 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/MySQLiteHelper.java @@ -0,0 +1,285 @@ +package com.example.shoppingmallsystem.util; + +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; + +import com.example.shoppingmallsystem.bean.ChatMessageBean; +import com.example.shoppingmallsystem.bean.OrderBean; +import com.example.shoppingmallsystem.bean.StoreBean; +import com.example.shoppingmallsystem.bean.Userinfo; + +import java.util.ArrayList; +import java.util.List; + +/** + *SQlite执行操作的封装工具类 + */ +public class MySQLiteHelper { + + private static MySQLiteHelper mySQLiteHelper; + private SQLiteDatabase db; + + private MySQLiteHelper(Context context) { + MySQLhelper mySQLhelper = new MySQLhelper(context, MySQLhelper.DB_NAME, null, MySQLhelper.VERSION); + db = mySQLhelper.getWritableDatabase(); + } + + public synchronized static MySQLiteHelper getInstance(Context context) { + if (mySQLiteHelper == null) { + mySQLiteHelper = new MySQLiteHelper(context); + } + return mySQLiteHelper; + } + + + //将注册的用户名密码插入到表中 + public void insertUserinfo(Userinfo userinfo) { + db.execSQL("insert into userInfo(userName,password,nickName,phoneNumb,schoolName,apartmentNumb,money) values(?,?,?,?,?,?,?)", new Object[]{userinfo.getUserName(), userinfo.getPassword(),userinfo.getNickName(),userinfo.getPhoneNumb(),userinfo.getSchoolName(),userinfo.getApartmentNumb(),0}); + //Log.e("插入语句:", "插入已执行,插入成功"); + } + + + //查询用户名密码是否正确 + public boolean queryUseristrue(String userName, String password) { + Cursor cursor = db.rawQuery("select * from userInfo where username = ? and password = ?", new String[]{userName, password}); + if (cursor.moveToFirst() == true) { + cursor.close(); + return true; + } + return false; + } + + //查询用户名是否存在 存在返回true 不存在false + public boolean queryNameisExist(String username) { + Cursor cursor = db.rawQuery("select * from userInfo where username = ? ", new String[]{username}); + if (cursor.moveToFirst() == true) { + cursor.close(); + return true; + } + return false; + } + + //查询所有的用户名和密码信息并返回 + public List queryAlluserInfo() { + List userinfos = new ArrayList<>(); + Cursor cursor = db.rawQuery("select * from userInfo ", null); + if (cursor != null && cursor.getCount() > 0) { + while (cursor.moveToNext()) { + Userinfo userinfo = new Userinfo(); + userinfo.setId(cursor.getInt(0)); + userinfo.setUserName(cursor.getString(1)); + userinfo.setPassword(cursor.getString(2)); + userinfo.setNickName(cursor.getString(3)); + userinfo.setPhoneNumb(cursor.getString(4)); + userinfo.setSchoolName(cursor.getString(5)); + userinfo.setApartmentNumb(cursor.getString(6)); + userinfo.setMoney(cursor.getDouble(7)); + userinfos.add(userinfo); + } + } + return userinfos; + } + + //删除用户名密码表中的所有数据 + public void deleateAllUserInfo() { + db.execSQL("DELETE from userInfo"); + } + + //查询用户个人信息 + public Userinfo getUserInfoFromUserName(String userName){ + Userinfo userinfo = new Userinfo(); + Cursor cursor = db.rawQuery("SELECT * FROM userInfo WHERE userName LIKE ? ", + new String[] {userName}); + if (cursor != null && cursor.getCount() > 0) { + while (cursor.moveToNext()) { + userinfo.setUserName(cursor.getString(1)); + userinfo.setPassword(cursor.getString(2)); + userinfo.setNickName(cursor.getString(3)); + userinfo.setPhoneNumb(cursor.getString(4)); + userinfo.setSchoolName(cursor.getString(5)); + userinfo.setApartmentNumb(cursor.getString(6)); + userinfo.setMoney(cursor.getDouble(7)); + } + } + + return userinfo; + } + + + + //修改相关用户信息 + public void updateUserInfo(Userinfo userinfo){ + db.execSQL("update userInfo set nickName = ?,phoneNumb = ?,schoolName = ?,apartmentNumb = ? where userName like ?",new String[]{userinfo.getNickName(), + userinfo.getPhoneNumb(),userinfo.getSchoolName(),userinfo.getApartmentNumb(),userinfo.getUserName()}); + + } + + + //拿到当前用户ID + public int GetUserId(String userName){ + Userinfo userinfo = new Userinfo(); + Cursor cursor = db.rawQuery("SELECT * FROM userInfo WHERE userName LIKE ? ", + new String[] {userName}); + if (cursor != null && cursor.getCount() > 0) { + while (cursor.moveToNext()) { + userinfo.setId(cursor.getInt(0)); + } + } + return userinfo.getId(); + } + + + //根据输入的商店ID搜索数据库并返回一个该商店的商品集合 + public String queryGoodsFromStoreID(String goodsID){ + String resultJson = null; + Cursor cursor = db.rawQuery("SELECT * FROM goodsInfo WHERE ID LIKE ? ", + new String[] {goodsID}); + if (cursor != null && cursor.getCount() > 0) { + while (cursor.moveToNext()) { + resultJson = cursor.getString(2); + } + } + return resultJson; + } + + + //根据输入的商店ID搜索数据库并返回一个该商店的信息集合 + public StoreBean queryStoreBeanFromStoreID(String goodsID){ + StoreBean storeBean = new StoreBean(); + Cursor cursor = db.rawQuery("SELECT * FROM storeInfo WHERE ID LIKE ? ", + new String[] {goodsID}); + if (cursor != null && cursor.getCount() > 0) { + while (cursor.moveToNext()) { + storeBean.setID(cursor.getString(1)); + storeBean.setIv_store_pic(cursor.getString(2)); + storeBean.setStoreName(cursor.getString(3)); + storeBean.setStoreScore(cursor.getString(4)); + storeBean.setStoreSell(cursor.getString(5)); + storeBean.setStoreSign(cursor.getString(6)); + storeBean.setStoreIntro(cursor.getString(7)); + } + } + return storeBean; + } + + + //删除指定的用户信息 + public void deleteUserInfo(String username){ + db.execSQL("DELETE from userInfo WHERE userName LIKE ? ", + new String[] { username}); + } + + + + //查询所有商家信息的方法 + public List queryAllStores(){ + List storeBeans = new ArrayList<>(); + Cursor cursor = db.rawQuery("select * from storeInfo ", null); + if (cursor != null && cursor.getCount() > 0) { + while (cursor.moveToNext()) { + StoreBean storeBean = new StoreBean(); + storeBean.setID(cursor.getString(1)); + storeBean.setIv_store_pic(cursor.getString(2)); + storeBean.setStoreName(cursor.getString(3)); + storeBean.setStoreScore(cursor.getString(4)); + storeBean.setStoreSell(cursor.getString(5)); + storeBean.setStoreSign(cursor.getString(6)); + storeBeans.add(storeBean); + } + } + return storeBeans; + } + + + //查询所有信息的方法 + public List queryAllMessages(){ + List chatMessageBeans = new ArrayList<>(); + Cursor cursor = db.rawQuery("select * from messagesInfo ", null); + if (cursor != null && cursor.getCount() > 0) { + while (cursor.moveToNext()) { + ChatMessageBean chatMessageBean = new ChatMessageBean(); + chatMessageBean.setId(cursor.getInt(1)); + chatMessageBean.setImg_id(cursor.getString(2)); + chatMessageBean.setMessage(cursor.getString(3)); + chatMessageBean.setUserName(cursor.getString(4)); + chatMessageBean.setTime(cursor.getString(5)); + chatMessageBeans.add(chatMessageBean); + } + } + return chatMessageBeans; + } + + + //插入聊天信息的方法 + public void insertMessages(ChatMessageBean chatMessageBean){ + ContentValues cv =new ContentValues(); + cv.put("ID",chatMessageBean.getId()); + cv.put("img_id",chatMessageBean.getImg_id()); + cv.put("message",chatMessageBean.getMessage()); + cv.put("userName",chatMessageBean.getUserName()); + cv.put("time",chatMessageBean.getTime()); + //插入数据,参数为表名,当列为空时的填充值,封装数据的ContentValue + db.insert("messagesInfo",null,cv); + } + + + //获取当前用户的账户余额 + public double getUserMoneyFromUserName(String userName){ + double money = 0; + Cursor cursor = db.rawQuery("SELECT * FROM userInfo WHERE userName LIKE ? ", + new String[] {userName}); + if (cursor != null && cursor.getCount() > 0) { + while (cursor.moveToNext()) { + money = cursor.getDouble(7); + } + } + return money; + } + + //充值的方法 + public void RechargeMoney(String userName,double newMoney){ + db.execSQL("update userInfo set money = ? where userName like ?",new Object[]{newMoney,userName}); + } + + + //查询全部商家的名称 + public List getAllStoreName(){ + List storeNames = new ArrayList<>(); + Cursor cursor = db.rawQuery("SELECT * FROM storeInfo",null); + if (cursor != null && cursor.getCount() > 0) { + while (cursor.moveToNext()) { + storeNames.add(cursor.getString(3)); + } + } + return storeNames; + } + + + + //将订单信息插入到订单表中 + public void insertOrderInfo(OrderBean orderBean) { + db.execSQL("insert into orderInfo(userName,time,goodsJson) values(?,?,?)", new Object[]{orderBean.getUserName(),orderBean.getTime(),orderBean.getGoodsJson()}); + //Log.e("插入语句:", "插入已执行,插入成功"); + } + + + //根据输入用户名返回一个该用户的订单集合 + public List queryOrderBeanFromUserName(String userName){ + OrderBean orderBean ; + List result = new ArrayList<>(); + Cursor cursor = db.rawQuery("SELECT * FROM orderInfo WHERE userName LIKE ? ", + new String[] {userName}); + if (cursor != null && cursor.getCount() > 0) { + while (cursor.moveToNext()) { + orderBean = new OrderBean(); + orderBean.setUserName(cursor.getString(1)); + orderBean.setTime(cursor.getString(2)); + orderBean.setGoodsJson(cursor.getString(3)); + result.add(orderBean); + } + } + return result; + } +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/PayDialog.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/PayDialog.java new file mode 100644 index 0000000..bd45a91 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/PayDialog.java @@ -0,0 +1,118 @@ +package com.example.shoppingmallsystem.util; + +import android.app.Dialog; +import android.content.Context; +import android.util.Log; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.view.animation.Animation; +import android.view.animation.TranslateAnimation; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.RecyclerView; + +import com.example.shoppingmallsystem.R; +import com.example.shoppingmallsystem.adapter.ShoppongCarGoodsAdapter; +import com.jungly.gridpasswordview.GridPasswordView; + +public class PayDialog { + + private static CustomDialog dialog; + private View view; // dialog布局 + private GridPasswordView gridPasswordView ; + private RelativeLayout re_bottow ; + private RecyclerView recyclerView_carGoods; + private TextView tv_clean ; + private TextView tv_DoShopping; + private ImageView iv_shoppingCar ; + private Context context; + private ShoppongCarGoodsAdapter shoppongCarGoodsAdapter; + public static TextView tv_total; + public static double total = 0; + + public PayDialog(Context context) { + this.context = context; + dialog = new CustomDialog(context, R.style.PayDialog); + // dialog的样式 + view = LayoutInflater.from(context).inflate(R.layout.pay_dialog, null); + //拿到dialog里的控件 + gridPasswordView = view.findViewById(R.id.my_passwordView); + + //设置输入密码监听 + gridPasswordView.setOnPasswordChangedListener(new GridPasswordView.OnPasswordChangedListener() { + //正在输入密码时执行此方法 + public void onTextChanged(String psw) { + //tv.setText("正在输入密码..."); + } + //输入密码完成时执行此方法 + public void onInputFinish(String psw) { + Log.e("你输入的密码为",psw); + } + }); + + dialog.setBeforeDismiss(new CustomDialog.IBeforeDismiss() { + @Override + public void onBeforeDismiss() { + dismissAnim(); + } + }); + + + // 设置dialog的位置 + Window dialogWindow = dialog.getWindow(); + dialogWindow.getDecorView().setPadding(0, 0, 0, 0); + dialogWindow.setBackgroundDrawableResource(android.R.color.transparent);//背景透明,不然会有个白色的东东 +// dialogWindow.setWindowAnimations(R.style.dialogWindowAnim); //不使用窗口弹出动画 + WindowManager.LayoutParams lp = dialogWindow.getAttributes(); + + lp.width = WindowManager.LayoutParams.MATCH_PARENT; // 宽度 + lp.height = WindowManager.LayoutParams.MATCH_PARENT; // 高度 + dialogWindow.setAttributes(lp); + // 设置dialog为底部 + dialogWindow.setGravity(Gravity.BOTTOM); + } + + + + + public void show() { + dialog.show(); + showAnim(); + } + + // 出现动画 + private void showAnim() { + TranslateAnimation animation = new TranslateAnimation(0, 0, DensityUtil.dp2px(context, 300), 0); + animation.setDuration(300); + } + + // 消失动画 + private void dismissAnim() { + TranslateAnimation animation = new TranslateAnimation(0, 0, 0, DensityUtil.dp2px(context, 300)); + animation.setAnimationListener(new Animation.AnimationListener() { + @Override + public void onAnimationStart(Animation animation) { + + } + + @Override + public void onAnimationEnd(Animation animation) { + dialog.myDismiss(); + } + + @Override + public void onAnimationRepeat(Animation animation) { + + } + }); + animation.setDuration(300); + } + +} \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/ShareUtils.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/ShareUtils.java new file mode 100644 index 0000000..f44aa21 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/ShareUtils.java @@ -0,0 +1,69 @@ +package com.example.shoppingmallsystem.util; + +import android.content.Context; +import android.content.SharedPreferences; + +public class ShareUtils { + static SharedPreferences preferences = AppContext.getInstance().getSharedPreferences("data", Context.MODE_PRIVATE); + static SharedPreferences.Editor editor = preferences.edit(); + + /** + * 从SharedPreferences保存的文件中获取是否自动登录 + */ + public static String getAuto_Login() { + return preferences.getString("AUTO_LOGIN", ""); + } + + /** + * 从SharedPreferences保存的文件中获取是否自动登录 + */ + public static void putAuto_Login( String tag) { + editor.putString("AUTO_LOGIN", tag); + editor.commit(); + } + + /** + * 从SharedPreferences保存的文件中获取是否记住密码 + */ + public static String getRember() { + return preferences.getString("Rember", ""); + } + + /** + * 从SharedPreferences保存的文件中获取否记住密码 + */ + public static void putRember( String isRember) { + editor.putString("Rember", isRember); + editor.commit(); + } + + /** + * 向SharedPreferences存储用户名 + */ + public static void putUserName(String username) { + editor.putString("UserName", username); + editor.commit(); + } + /** + * 从SharedPreferences取出用户名 + */ + public static String getUserName() { + return preferences.getString("UserName", ""); + } + + + /** + * 向SharedPreferences存储密码 + */ + public static void putPassword(String password) { + editor.putString("Password", password); + editor.commit(); + } + /** + * 从SharedPreferences取出密码 + */ + public static String getPassword() { + return preferences.getString("Password", ""); + } + +} diff --git a/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/ToastUtil.java b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/ToastUtil.java new file mode 100644 index 0000000..a361c4f --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/java/com/example/shoppingmallsystem/util/ToastUtil.java @@ -0,0 +1,31 @@ +package com.example.shoppingmallsystem.util; + +import android.widget.Toast; + +public class ToastUtil { + private ToastUtil() { + /* cannot be instantiated */ + throw new UnsupportedOperationException("cannot be instantiated"); + } + + /** + * 短时间显示Toast + * + * @param message + */ + public static void showShort( String message) + { + Toast.makeText(AppContext.getInstance(), message, Toast.LENGTH_SHORT).show(); + } + + /** + * 长时间显示Toast + * + * @param message + */ + public static void showLong( String message) + { + Toast.makeText(AppContext.getInstance(), message, Toast.LENGTH_LONG).show(); + } + +} diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/src/ShoppingMallSystem/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/add_32.png b/src/ShoppingMallSystem/app/src/main/res/drawable/add_32.png new file mode 100644 index 0000000..424e685 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/add_32.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/car_clean.png b/src/ShoppingMallSystem/app/src/main/res/drawable/car_clean.png new file mode 100644 index 0000000..7f05715 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/car_clean.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/goods_1.png b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_1.png new file mode 100644 index 0000000..62fdca4 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_1.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/goods_10.png b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_10.png new file mode 100644 index 0000000..fb7ba56 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_10.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/goods_2.png b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_2.png new file mode 100644 index 0000000..024008b Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_2.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/goods_3.png b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_3.png new file mode 100644 index 0000000..9fc37f5 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_3.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/goods_4.png b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_4.png new file mode 100644 index 0000000..f8bea24 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_4.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/goods_5.png b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_5.png new file mode 100644 index 0000000..b05e303 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_5.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/goods_6.png b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_6.png new file mode 100644 index 0000000..0884c72 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_6.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/goods_7.png b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_7.png new file mode 100644 index 0000000..dd7ff42 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_7.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/goods_8.png b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_8.png new file mode 100644 index 0000000..4834de6 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_8.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/goods_9.png b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_9.png new file mode 100644 index 0000000..8eee183 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/goods_9.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/ic_launcher_background.xml b/src/ShoppingMallSystem/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/login_bg.jpeg b/src/ShoppingMallSystem/app/src/main/res/drawable/login_bg.jpeg new file mode 100644 index 0000000..bdd3f14 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/login_bg.jpeg differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/minus_32.png b/src/ShoppingMallSystem/app/src/main/res/drawable/minus_32.png new file mode 100644 index 0000000..da2d08d Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/minus_32.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/recharge_et_shape.xml b/src/ShoppingMallSystem/app/src/main/res/drawable/recharge_et_shape.xml new file mode 100644 index 0000000..85e0b86 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/res/drawable/recharge_et_shape.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/shoppingcar_full_64.png b/src/ShoppingMallSystem/app/src/main/res/drawable/shoppingcar_full_64.png new file mode 100644 index 0000000..e411f4b Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/shoppingcar_full_64.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/shoppingcar_null_64.png b/src/ShoppingMallSystem/app/src/main/res/drawable/shoppingcar_null_64.png new file mode 100644 index 0000000..c90cd84 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/shoppingcar_null_64.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/store_intro_shape.xml b/src/ShoppingMallSystem/app/src/main/res/drawable/store_intro_shape.xml new file mode 100644 index 0000000..c33ddc5 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/res/drawable/store_intro_shape.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/textview_shape.xml b/src/ShoppingMallSystem/app/src/main/res/drawable/textview_shape.xml new file mode 100644 index 0000000..6958ae3 --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/res/drawable/textview_shape.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/tx_1_48.png b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_1_48.png new file mode 100644 index 0000000..2b44379 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_1_48.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/tx_2_48.png b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_2_48.png new file mode 100644 index 0000000..7983cb0 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_2_48.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/tx_3_48.png b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_3_48.png new file mode 100644 index 0000000..3194c71 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_3_48.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/tx_4_48.png b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_4_48.png new file mode 100644 index 0000000..d9a96f8 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_4_48.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/tx_5_48.png b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_5_48.png new file mode 100644 index 0000000..8e5c5c9 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_5_48.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/drawable/tx_6_48.png b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_6_48.png new file mode 100644 index 0000000..39f1477 Binary files /dev/null and b/src/ShoppingMallSystem/app/src/main/res/drawable/tx_6_48.png differ diff --git a/src/ShoppingMallSystem/app/src/main/res/layout/activity_home_all_stores.xml b/src/ShoppingMallSystem/app/src/main/res/layout/activity_home_all_stores.xml new file mode 100644 index 0000000..d3230ab --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/res/layout/activity_home_all_stores.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ShoppingMallSystem/app/src/main/res/layout/activity_main.xml b/src/ShoppingMallSystem/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..5a6795a --- /dev/null +++ b/src/ShoppingMallSystem/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +