2024年5月26日上传

main
杨松林 9 months ago
parent 4829541cdf
commit b7293d2300

@ -0,0 +1,15 @@
*.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
local.properties

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>

@ -0,0 +1,409 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DBNavigator.Project.DatabaseBrowserManager">
<autoscroll-to-editor value="false" />
<autoscroll-from-editor value="true" />
<show-object-properties value="true" />
<loaded-nodes />
</component>
<component name="DBNavigator.Project.DatabaseFileManager">
<open-files />
</component>
<component name="DBNavigator.Project.Settings">
<connections />
<browser-settings>
<general>
<display-mode value="TABBED" />
<navigation-history-size value="100" />
<show-object-details value="false" />
</general>
<filters>
<object-type-filter>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="true" />
<object-type name="ROLE" enabled="true" />
<object-type name="PRIVILEGE" enabled="true" />
<object-type name="CHARSET" enabled="true" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED_VIEW" enabled="true" />
<object-type name="NESTED_TABLE" enabled="true" />
<object-type name="COLUMN" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET_TRIGGER" enabled="true" />
<object-type name="DATABASE_TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="true" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="TYPE_ATTRIBUTE" enabled="true" />
<object-type name="ARGUMENT" enabled="true" />
<object-type name="DIMENSION" enabled="true" />
<object-type name="CLUSTER" enabled="true" />
<object-type name="DBLINK" enabled="true" />
</object-type-filter>
</filters>
<sorting>
<object-type name="COLUMN" sorting-type="NAME" />
<object-type name="FUNCTION" sorting-type="NAME" />
<object-type name="PROCEDURE" sorting-type="NAME" />
<object-type name="ARGUMENT" sorting-type="POSITION" />
<object-type name="TYPE ATTRIBUTE" sorting-type="POSITION" />
</sorting>
<default-editors>
<object-type name="VIEW" editor-type="SELECTION" />
<object-type name="PACKAGE" editor-type="SELECTION" />
<object-type name="TYPE" editor-type="SELECTION" />
</default-editors>
</browser-settings>
<navigation-settings>
<lookup-filters>
<lookup-objects>
<object-type name="SCHEMA" enabled="true" />
<object-type name="USER" enabled="false" />
<object-type name="ROLE" enabled="false" />
<object-type name="PRIVILEGE" enabled="false" />
<object-type name="CHARSET" enabled="false" />
<object-type name="TABLE" enabled="true" />
<object-type name="VIEW" enabled="true" />
<object-type name="MATERIALIZED VIEW" enabled="true" />
<object-type name="INDEX" enabled="true" />
<object-type name="CONSTRAINT" enabled="true" />
<object-type name="DATASET TRIGGER" enabled="true" />
<object-type name="DATABASE TRIGGER" enabled="true" />
<object-type name="SYNONYM" enabled="false" />
<object-type name="SEQUENCE" enabled="true" />
<object-type name="PROCEDURE" enabled="true" />
<object-type name="FUNCTION" enabled="true" />
<object-type name="PACKAGE" enabled="true" />
<object-type name="TYPE" enabled="true" />
<object-type name="DIMENSION" enabled="false" />
<object-type name="CLUSTER" enabled="false" />
<object-type name="DBLINK" enabled="true" />
</lookup-objects>
<force-database-load value="false" />
<prompt-connection-selection value="true" />
<prompt-schema-selection value="true" />
</lookup-filters>
</navigation-settings>
<dataset-grid-settings>
<general>
<enable-zooming value="true" />
<enable-column-tooltip value="true" />
</general>
<sorting>
<nulls-first value="true" />
<max-sorting-columns value="4" />
</sorting>
<audit-columns>
<column-names value="" />
<visible value="true" />
<editable value="false" />
</audit-columns>
</dataset-grid-settings>
<dataset-editor-settings>
<text-editor-popup>
<active value="false" />
<active-if-empty value="false" />
<data-length-threshold value="100" />
<popup-delay value="1000" />
</text-editor-popup>
<values-actions-popup>
<show-popup-button value="true" />
<element-count-threshold value="1000" />
<data-length-threshold value="250" />
</values-actions-popup>
<general>
<fetch-block-size value="100" />
<fetch-timeout value="30" />
<trim-whitespaces value="true" />
<convert-empty-strings-to-null value="true" />
<select-content-on-cell-edit value="true" />
<large-value-preview-active value="true" />
</general>
<filters>
<prompt-filter-dialog value="true" />
<default-filter-type value="BASIC" />
</filters>
<qualified-text-editor text-length-threshold="300">
<content-types>
<content-type name="Text" enabled="true" />
<content-type name="Properties" enabled="true" />
<content-type name="XML" enabled="true" />
<content-type name="DTD" enabled="true" />
<content-type name="HTML" enabled="true" />
<content-type name="XHTML" enabled="true" />
<content-type name="Java" enabled="true" />
<content-type name="SQL" enabled="true" />
<content-type name="PL/SQL" enabled="true" />
<content-type name="JSON" enabled="true" />
<content-type name="JSON5" enabled="true" />
<content-type name="Groovy" enabled="true" />
<content-type name="AIDL" enabled="true" />
<content-type name="YAML" enabled="true" />
<content-type name="Manifest" enabled="true" />
</content-types>
</qualified-text-editor>
<record-navigation>
<navigation-target value="VIEWER" />
</record-navigation>
</dataset-editor-settings>
<code-editor-settings>
<general>
<show-object-navigation-gutter value="false" />
<show-spec-declaration-navigation-gutter value="true" />
<enable-spellchecking value="true" />
<enable-reference-spellchecking value="false" />
</general>
<confirmations>
<save-changes value="false" />
<revert-changes value="true" />
<exit-on-changes value="ASK" />
</confirmations>
</code-editor-settings>
<code-completion-settings>
<filters>
<basic-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="false" />
<filter-element type="OBJECT" id="view" selected="false" />
<filter-element type="OBJECT" id="materialized view" selected="false" />
<filter-element type="OBJECT" id="index" selected="false" />
<filter-element type="OBJECT" id="constraint" selected="false" />
<filter-element type="OBJECT" id="trigger" selected="false" />
<filter-element type="OBJECT" id="synonym" selected="false" />
<filter-element type="OBJECT" id="sequence" selected="false" />
<filter-element type="OBJECT" id="procedure" selected="false" />
<filter-element type="OBJECT" id="function" selected="false" />
<filter-element type="OBJECT" id="package" selected="false" />
<filter-element type="OBJECT" id="type" selected="false" />
<filter-element type="OBJECT" id="dimension" selected="false" />
<filter-element type="OBJECT" id="cluster" selected="false" />
<filter-element type="OBJECT" id="dblink" selected="false" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</basic-filter>
<extended-filter>
<filter-element type="RESERVED_WORD" id="keyword" selected="true" />
<filter-element type="RESERVED_WORD" id="function" selected="true" />
<filter-element type="RESERVED_WORD" id="parameter" selected="true" />
<filter-element type="RESERVED_WORD" id="datatype" selected="true" />
<filter-element type="RESERVED_WORD" id="exception" selected="true" />
<filter-element type="OBJECT" id="schema" selected="true" />
<filter-element type="OBJECT" id="user" selected="true" />
<filter-element type="OBJECT" id="role" selected="true" />
<filter-element type="OBJECT" id="privilege" selected="true" />
<user-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</user-schema>
<public-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</public-schema>
<any-schema>
<filter-element type="OBJECT" id="table" selected="true" />
<filter-element type="OBJECT" id="view" selected="true" />
<filter-element type="OBJECT" id="materialized view" selected="true" />
<filter-element type="OBJECT" id="index" selected="true" />
<filter-element type="OBJECT" id="constraint" selected="true" />
<filter-element type="OBJECT" id="trigger" selected="true" />
<filter-element type="OBJECT" id="synonym" selected="true" />
<filter-element type="OBJECT" id="sequence" selected="true" />
<filter-element type="OBJECT" id="procedure" selected="true" />
<filter-element type="OBJECT" id="function" selected="true" />
<filter-element type="OBJECT" id="package" selected="true" />
<filter-element type="OBJECT" id="type" selected="true" />
<filter-element type="OBJECT" id="dimension" selected="true" />
<filter-element type="OBJECT" id="cluster" selected="true" />
<filter-element type="OBJECT" id="dblink" selected="true" />
</any-schema>
</extended-filter>
</filters>
<sorting enabled="true">
<sorting-element type="RESERVED_WORD" id="keyword" />
<sorting-element type="RESERVED_WORD" id="datatype" />
<sorting-element type="OBJECT" id="column" />
<sorting-element type="OBJECT" id="table" />
<sorting-element type="OBJECT" id="view" />
<sorting-element type="OBJECT" id="materialized view" />
<sorting-element type="OBJECT" id="index" />
<sorting-element type="OBJECT" id="constraint" />
<sorting-element type="OBJECT" id="trigger" />
<sorting-element type="OBJECT" id="synonym" />
<sorting-element type="OBJECT" id="sequence" />
<sorting-element type="OBJECT" id="procedure" />
<sorting-element type="OBJECT" id="function" />
<sorting-element type="OBJECT" id="package" />
<sorting-element type="OBJECT" id="type" />
<sorting-element type="OBJECT" id="dimension" />
<sorting-element type="OBJECT" id="cluster" />
<sorting-element type="OBJECT" id="dblink" />
<sorting-element type="OBJECT" id="schema" />
<sorting-element type="OBJECT" id="role" />
<sorting-element type="OBJECT" id="user" />
<sorting-element type="RESERVED_WORD" id="function" />
<sorting-element type="RESERVED_WORD" id="parameter" />
</sorting>
<format>
<enforce-code-style-case value="true" />
</format>
</code-completion-settings>
<execution-engine-settings>
<statement-execution>
<fetch-block-size value="100" />
<execution-timeout value="20" />
<debug-execution-timeout value="600" />
<focus-result value="false" />
<prompt-execution value="false" />
</statement-execution>
<script-execution>
<command-line-interfaces />
<execution-timeout value="300" />
</script-execution>
<method-execution>
<execution-timeout value="30" />
<debug-execution-timeout value="600" />
<parameter-history-size value="10" />
</method-execution>
</execution-engine-settings>
<operation-settings>
<transactions>
<uncommitted-changes>
<on-project-close value="ASK" />
<on-disconnect value="ASK" />
<on-autocommit-toggle value="ASK" />
</uncommitted-changes>
<multiple-uncommitted-changes>
<on-commit value="ASK" />
<on-rollback value="ASK" />
</multiple-uncommitted-changes>
</transactions>
<session-browser>
<disconnect-session value="ASK" />
<kill-session value="ASK" />
<reload-on-filter-change value="false" />
</session-browser>
<compiler>
<compile-type value="KEEP" />
<compile-dependencies value="ASK" />
<always-show-controls value="false" />
</compiler>
</operation-settings>
<ddl-file-settings>
<extensions>
<mapping file-type-id="VIEW" extensions="vw" />
<mapping file-type-id="TRIGGER" extensions="trg" />
<mapping file-type-id="PROCEDURE" extensions="prc" />
<mapping file-type-id="FUNCTION" extensions="fnc" />
<mapping file-type-id="PACKAGE" extensions="pkg" />
<mapping file-type-id="PACKAGE_SPEC" extensions="pks" />
<mapping file-type-id="PACKAGE_BODY" extensions="pkb" />
<mapping file-type-id="TYPE" extensions="tpe" />
<mapping file-type-id="TYPE_SPEC" extensions="tps" />
<mapping file-type-id="TYPE_BODY" extensions="tpb" />
</extensions>
<general>
<lookup-ddl-files value="true" />
<create-ddl-files value="false" />
<synchronize-ddl-files value="true" />
<use-qualified-names value="false" />
<make-scripts-rerunnable value="true" />
</general>
</ddl-file-settings>
<general-settings>
<regional-settings>
<date-format value="MEDIUM" />
<number-format value="UNGROUPED" />
<locale value="SYSTEM_DEFAULT" />
<use-custom-formats value="false" />
</regional-settings>
<environment>
<environment-types>
<environment-type id="development" name="Development" description="Development environment" color="-2430209/-12296320" readonly-code="false" readonly-data="false" />
<environment-type id="integration" name="Integration" description="Integration environment" color="-2621494/-12163514" readonly-code="true" readonly-data="false" />
<environment-type id="production" name="Production" description="Productive environment" color="-11574/-10271420" readonly-code="true" readonly-data="true" />
<environment-type id="other" name="Other" description="" color="-1576/-10724543" readonly-code="false" readonly-data="false" />
</environment-types>
<visibility-settings>
<connection-tabs value="true" />
<dialog-headers value="true" />
<object-editor-tabs value="true" />
<script-editor-tabs value="false" />
<execution-result-tabs value="true" />
</visibility-settings>
</environment>
</general-settings>
</component>
</project>

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<value>
<entry key="app">
<State>
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\songl\.android\avd\Pixel_3a_API_34_extension_level_7_x86_64.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2024-05-23T04:33:51.360675700Z" />
</State>
</entry>
</value>
</component>
</project>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="VisualizationToolProject">
<option name="state">
<ProjectState>
<option name="scale" value="0.7260503968935927" />
</ProjectState>
</option>
</component>
</project>

@ -0,0 +1,47 @@
plugins {
alias(libs.plugins.androidApplication)
}
android {
namespace = "com.example.deliciousfoodapp"
compileSdk = 34
defaultConfig {
applicationId = "com.example.deliciousfoodapp"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation(libs.appcompat)
implementation(libs.material)
implementation(libs.activity)
implementation(libs.constraintlayout)
implementation(libs.legacy.support.v4)
implementation(libs.recyclerview)
implementation(libs.navigation.fragment)
implementation(libs.navigation.ui)
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)
}

@ -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

@ -0,0 +1,26 @@
package com.example.deliciousfoodapp;
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.deliciousfoodapp", appContext.getPackageName());
}
}

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.DeliciousFoodApp"
tools:targetApi="31">
<activity
android:name=".ProductDetailsActivity"
android:exported="false" />
<activity
android:name=".AlarmClockActivity"
android:exported="false" />
<activity
android:name=".UserinformationActivity"
android:exported="true"
android:theme="@style/Theme.DeliciousFoodApp" />
<activity
android:name=".IndexActivity"
android:exported="true" />
<activity
android:name=".RegisterinformationActivity"
android:exported="false" />
<activity
android:name=".RegisterActivity"
android:exported="false" />
<activity
android:name=".LoginActivity"
android:exported="true" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

@ -0,0 +1,168 @@
package com.example.deliciousfoodapp;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
public class AlarmClockActivity extends AppCompatActivity implements View.OnClickListener, ServiceConnection {
private TextView timeTextView, dateTextView, dayOfWeekTextView;
private Handler handler2;
EditText etInput;
TextView tvOut;
Button btnStartService,btnStopService,btnBindService,btnUnbindService,btnSync;
Intent serviceIntent;
MyService.MyBinder binder=null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alarm_clock);
timeTextView = findViewById(R.id.timeTextView);
dateTextView = findViewById(R.id.dateTextView);
dayOfWeekTextView = findViewById(R.id.dayOfWeekTextView);
handler2 = new Handler(Looper.getMainLooper());
updateTimeAndDate();
serviceIntent=new Intent(AlarmClockActivity.this,MyService.class);
initCompent(); //初始化组件
btnClickListener(); //给5个按钮添加事件监听
}
@Override
protected void onResume() {
super.onResume();
startUpdateTask();
}
@Override
protected void onPause() {
super.onPause();
stopUpdateTask();
}
private void startUpdateTask() {
updateTask.run();
}
private void stopUpdateTask() {
handler2.removeCallbacks(updateTask);
}
private Runnable updateTask = new Runnable() {
@Override
public void run() {
updateTimeAndDate();
handler2.postDelayed(this, 1000); // 每秒更新一次
}
};
private void updateTimeAndDate() {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
SimpleDateFormat dayOfWeekFormat = new SimpleDateFormat("EEEE", Locale.getDefault());
String time = timeFormat.format(calendar.getTime());
String date = dateFormat.format(calendar.getTime());
String dayOfWeek = dayOfWeekFormat.format(calendar.getTime());
timeTextView.setText("Time: " + time);
dateTextView.setText("Date: " + date);
dayOfWeekTextView.setText("Day of Week: " + dayOfWeek);
}
public void back2(View view) {
Intent intent = new Intent(AlarmClockActivity.this, IndexActivity.class);
intent.putExtra("id",1);
startActivity(intent);
}
private void initCompent() {
etInput=findViewById(R.id.etInput);
tvOut=findViewById(R.id.tvOut);
btnStartService=findViewById(R.id.btnStartService);
btnStopService=findViewById(R.id.btnStopService);
btnBindService=findViewById(R.id.btnBindService);
btnUnbindService=findViewById(R.id.btnUnBindService);
btnSync=findViewById(R.id.btnSync);
}
private void btnClickListener() {
btnStartService.setOnClickListener(this);
btnStopService.setOnClickListener(this);
btnBindService.setOnClickListener(this);
btnUnbindService.setOnClickListener(this);
btnSync.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.btnStartService) {
serviceIntent.putExtra("data", etInput.getText().toString());
startService(serviceIntent); // 启动服务传递参数
} else if (view.getId() == R.id.btnStopService) {
stopService(serviceIntent);
} else if (view.getId() == R.id.btnBindService) {
bindService(serviceIntent, this, Context.BIND_AUTO_CREATE);
} else if (view.getId() == R.id.btnUnBindService) {
unbindService(this);
} else if (view.getId() == R.id.btnSync) {
if (binder != null) { // 绑定服务后,同步服务数据
binder.setData(etInput.getText().toString());
}
}
}
@Override
public void onServiceConnected(ComponentName name, IBinder iBinder) {
binder= (MyService.MyBinder) iBinder;
binder.getService().setCallback(new MyService.CallBack() {
@Override
public void dataChanged(String data) {
Message msg = new Message();
Bundle b = new Bundle();
b.putString("data", data);
msg.setData(b);
handler.sendMessage(msg);
}
});
}
@Override
public void onServiceDisconnected(ComponentName name) {
}
Handler handler=new Handler(){
public void handleMessage(Message msg) {
Log.v("Timer","handleMessage()..");
super.handleMessage(msg);
String str=(String)msg.obj;
tvOut.setText(msg.getData().getString("data"));
}
};
}

@ -0,0 +1,66 @@
package com.example.deliciousfoodapp;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import com.example.deliciousfoodapp.R;
import java.util.List;
import java.util.Map;
public class HomeMyAdapter extends BaseAdapter {
private List<Map<String, Object>> datas;
private Context mContext;
public HomeMyAdapter(List<Map<String, Object>> datas, Context mContext) {
this.datas = datas;
this.mContext = mContext;
}
@Override
public int getCount() {
// 返回数据的总数
return datas.size();
}
@Override
public Object getItem(int position) {
// 返回在list中指定位置的数据的内容
return datas.get(position);
}
@Override
public long getItemId(int position) {
// 返回数据在list中所在的位置
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
if (convertView == null) {
// 使用自定义的布局文件作为Layout
convertView = LayoutInflater.from(mContext).inflate(
R.layout.homelist_item_layout, null);
// 减少findView的次数
holder = new ViewHolder();
// 初始化布局中的元素
holder.mImageView = (ImageView)
convertView.findViewById(R.id.imageview);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
// 从传入的数据中提取数据并绑定到指定的view中
holder.mImageView.setImageResource((Integer) datas.get(position).get("img"));
return convertView;
}
static class ViewHolder {
ImageView mImageView;
}
}

@ -0,0 +1,58 @@
package com.example.deliciousfoodapp;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import com.example.deliciousfoodapp.R;
import java.util.List;
import java.util.Map;
public class HomeNewAdapter extends BaseAdapter {
List<Map<String,Object>> datas;
Context mContext;
HomeNewAdapter(List<Map<String,Object>> datas, Context mContext){
this.datas=datas;
this.mContext=mContext;
}
@Override
public int getCount() {
return datas.size();
}
@Override
public Object getItem(int position) {
return datas.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if(convertView==null){
convertView= LayoutInflater.from(mContext).inflate(R.layout.homelist_item_layout,null);
holder=new ViewHolder();
holder.mImageView=convertView.findViewById(R.id.imageview);
convertView.setTag(holder);
}else{
holder= (ViewHolder) convertView.getTag();
}
holder.mImageView.setImageResource((Integer) datas.get(position).get("img"));
return convertView;
}
static class ViewHolder {
ImageView mImageView;
}
}

@ -0,0 +1,89 @@
package com.example.deliciousfoodapp;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.example.deliciousfoodapp.shopFragment;
public class IndexActivity extends AppCompatActivity implements View.OnClickListener{
public LinearLayout homeline,foodline,shoppingline,personline;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_index);
homeline=findViewById(R.id.home);
homeline.setOnClickListener(this);
foodline=findViewById(R.id.food);
foodline.setOnClickListener(this);
shoppingline=findViewById(R.id.shopping);
shoppingline.setOnClickListener(this);
personline=findViewById(R.id.person);
personline.setOnClickListener(this);
int id =getIntent().getIntExtra("id",0);
if(id==1){
// 需要返回个人中心时,就将 personFragment 加载到 IndexActivity 中
replaceFragment(new personFragment());
}else{
// 将 homeFragment 加载到 IndexActivity 中
replaceFragment(new homeFragment());
}
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.home) {
replaceFragment(new homeFragment());
} else if (id == R.id.food) {
replaceFragment(new foodFragment());
} else if (id == R.id.shopping) {
replaceFragment(new shopFragment());
} else if (id == R.id.person) {
replaceFragment(new personFragment());
}
}
private void replaceFragment(Fragment fragment) {
FragmentManager fragmentManager=getSupportFragmentManager();
FragmentTransaction transaction=fragmentManager.beginTransaction();
transaction.replace(R.id.framlayout,fragment);
transaction.commit();
}
public void click(View view) {
Intent intent = new Intent(IndexActivity.this,UserinformationActivity.class);
startActivity(intent);
}
public void click2(View view) {
Intent intent = new Intent(IndexActivity.this,LoginActivity.class);
startActivity(intent);
}
public void clicktime(View view) {
Intent intent = new Intent(IndexActivity.this,AlarmClockActivity.class);
startActivity(intent);
}
public void clickrecipe(View view) {
// 指定网址
String url = "https://www.xiangha.com/";
// 创建Intent对象指定动作为ACTION_VIEW数据为指定的网址
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
// 启动Intent跳转到指定网址
startActivity(intent);
}
}

@ -0,0 +1,109 @@
package com.example.deliciousfoodapp;
import android.content.Intent;
import android.content.SharedPreferences;
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 androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.example.deliciousfoodapp.db.UserDbHelper;
import com.example.deliciousfoodapp.entity.UserInfo;
public class LoginActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_login);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
Button button1 = findViewById(R.id.buttonlogin);
Button button2 = findViewById(R.id.buttonregister);
EditText name = findViewById(R.id.editText);
EditText password = findViewById(R.id.editText2);
CheckBox rememberpassword = findViewById(R.id.rememberpassword);
//获取mSharedPreferences实例
SharedPreferences mSharedPreferences = getSharedPreferences("user", MODE_PRIVATE);
//是否勾选了记住密码
final boolean[] is_remember = {mSharedPreferences.getBoolean("is_remember", false)};
if (is_remember[0]) {
String username = mSharedPreferences.getString("username", null);
String userpassword = mSharedPreferences.getString("userpassword", null);
name.setText(username);
password.setText(userpassword);
rememberpassword.setChecked(true);
}
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String s = name.getText().toString();
String s1 = password.getText().toString();
CheckBox checkBox = findViewById(R.id.checkBox); // 找到布局文件中的 CheckBox
// 检查复选框是否被勾选
boolean isAgreed = checkBox.isChecked();
if (TextUtils.isEmpty(s) && TextUtils.isEmpty(s1)) {
Toast.makeText(LoginActivity.this, "请输入用户名和密码", Toast.LENGTH_SHORT).show();
} else if (!isAgreed) {
// 如果复选框未被勾选,弹出提示
Toast.makeText(LoginActivity.this, "请同意《用户服务协议》及《基本功能隐私协议》", Toast.LENGTH_SHORT).show();
} else {
UserInfo login = UserDbHelper.getInstance(LoginActivity.this).login(s);
if (login != null) {
if (s.equals(login.getUsername()) && s1.equals(login.getPassword())) {
SharedPreferences.Editor edit = mSharedPreferences.edit();
edit.putBoolean("is_remember", is_remember[0]);
edit.putString("username", s);
edit.putString("userpassword", s1);
edit.apply();
Intent intent = new Intent(LoginActivity.this, IndexActivity.class);
intent.putExtra("username",s);
startActivity(intent);
Toast.makeText(LoginActivity.this, "恭喜登录成功", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(LoginActivity.this, "用户名或密码错误", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(LoginActivity.this, "未注册", Toast.LENGTH_SHORT).show();
}
}
}
});
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(intent);
}
});
//记住密码复选框
rememberpassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
is_remember[0] = isChecked;
}
});
}
}

@ -0,0 +1,36 @@
package com.example.deliciousfoodapp;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_main);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
}
});
}
}

@ -0,0 +1,88 @@
package com.example.deliciousfoodapp;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;
public class MyService extends Service {
boolean running=false; //定义启动服务和停止服务的标志
String str="来自服务器的信息..."; //初始默认的显示信息
public MyService() {
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
Log.i("MyService", "绑定服务 onBind()");
return new MyBinder(); //匿名类形式返回MyBinder类的对象
}
//自定义内部类MyBinder类继承Binder类
class MyBinder extends Binder {
void setData(String s){
MyService.this.str=s; //修改MyService中的值
}
MyService getService() {
return MyService.this;
}
}
@Override
public void onCreate() {
super.onCreate();
Log.i("MyService", " 创建服务onCreate () ");
//启动一个新的线程
new Thread(){
@Override
public void run() {
super.run();
running=true;
int i=1;
while(running) {
try {
String s1=i+":"+str;
Log.i("MyService", s1);
i++;
if(callback!=null){
//调用接口中的方法获取数据
callback.dataChanged(s1);
}
sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i("MyService", "启动服务 onStartCommand ()");
str=intent.getStringExtra("data"); //intent 传递参数
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onDestroy() {
super.onDestroy();
Log.i("MyService", "停止服务 onDestroy ()");
running=false;
}
@Override
public boolean onUnbind(Intent intent) {
Log.i("MyService", " 解除绑定 onUnbind ()");
return super.onUnbind(intent);
}
//自定义一个接口,用于监听数据的改变
static interface CallBack{
void dataChanged(String data);
}
//定义Callback 的对象以及getter/setter 的方法
CallBack callback;
public CallBack getCallback() {
return callback;
}
public void setCallback(CallBack callback) {
this.callback = callback;
}
}

@ -0,0 +1,77 @@
package com.example.deliciousfoodapp;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.example.deliciousfoodapp.db.CarDbHelper;
import com.example.deliciousfoodapp.entity.FoodInfo;
public class ProductDetailsActivity extends AppCompatActivity {
private ImageView product_img;
private TextView product_title;
private TextView product_price;
private TextView product_details;
private TextView product_next;
private FoodInfo foodInfo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_product_details);
//获取传递的数据
foodInfo=(FoodInfo) getIntent().getSerializableExtra("foodInfo");
//返回
findViewById(R.id.toolbar).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//初始化控件
product_img = findViewById(R.id.product_img);
product_title = findViewById(R.id.product_title);
product_price = findViewById(R.id.product_price);
product_details = findViewById(R.id.product_details);
product_next = findViewById(R.id.product_next);
//设置数据
if(null!=foodInfo){
product_img.setImageResource(foodInfo.getFood_img());
product_title.setText(foodInfo.getFood_title());
product_details.setText(foodInfo.getFood_details());
product_next.setText(foodInfo.getFood_next());
product_price.setText(foodInfo.getFood_price()+"");
}
//加入购物车
findViewById(R.id.addCar).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//加入到购物车
int row = CarDbHelper.getInstance(ProductDetailsActivity.this).addCar("zsan",foodInfo.getFood_id(),foodInfo.getFood_img(),foodInfo.getFood_title(),foodInfo.getFood_price());
if(row>0){
Toast.makeText(ProductDetailsActivity.this,"添加成功",Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(ProductDetailsActivity.this,"添加失败",Toast.LENGTH_SHORT).show();
}
}
});
}
}

@ -0,0 +1,120 @@
package com.example.deliciousfoodapp;
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.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.deliciousfoodapp.db.UserDbHelper;
public class RegisterActivity extends AppCompatActivity implements RadioGroup.OnCheckedChangeListener, View.OnClickListener {
//定义字符串用来保存各个信息
private String username_str = "";
private String password_str = "";
private String surepassword_str = "";
private String phone_str = "";
private String email_str = "";
private String address_str = "";
//默认为男性选中
private String genderRadioGroup_str = "男";
private String taste_str = "1";
//组件定义
EditText username_edit, password_edit, surepassword_edit, phone_edit, email_edit, address_edit;
RadioGroup genderRadioGroup_group;
RadioButton nan_but, nv_but;
CheckBox sour, sweet, spicy;
Button register;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
//组件初始化
username_edit = (EditText) findViewById(R.id.usernamebox);
password_edit = (EditText) findViewById(R.id.passwordbox);
surepassword_edit = (EditText) findViewById(R.id.surepasswordbox);
phone_edit = (EditText) findViewById(R.id.phonebox);
email_edit = (EditText) findViewById(R.id.emailbox);
address_edit = (EditText) findViewById(R.id.addressbox);
genderRadioGroup_group = (RadioGroup) findViewById(R.id.genderRadioGroup);
//添加监听事件
genderRadioGroup_group.setOnCheckedChangeListener(this);
nan_but = (RadioButton) findViewById(R.id.maleRadioButton);
sour = (CheckBox) findViewById(R.id.checkbox_sour);
sweet = (CheckBox) findViewById(R.id.checkbox_sweet);
spicy = (CheckBox) findViewById(R.id.checkbox_spicy);
register = (Button) findViewById(R.id.referbutton);
register.setOnClickListener(this);
}
@Override
public void onClick(View view) {
if (view.getId() == R.id.referbutton) {
// 获取用户名、手机号、密码等信息
username_str = username_edit.getText().toString();
password_str = password_edit.getText().toString();
surepassword_str = surepassword_edit.getText().toString();
phone_str = phone_edit.getText().toString();
email_str = email_edit.getText().toString();
address_str = address_edit.getText().toString();
// 获取喜欢的口味即复选框的值
taste_str = ""; // 清除上一次已经选中的选项
if (sour.isChecked()) {
taste_str += sour.getText().toString();
}
if (sweet.isChecked()) {
taste_str += sweet.getText().toString();
}
if (spicy.isChecked()) {
taste_str += spicy.getText().toString();
}
if (TextUtils.isEmpty(username_str) && TextUtils.isEmpty(password_str)) {
Toast.makeText(RegisterActivity.this, "请输入用户名和密码", Toast.LENGTH_SHORT).show();
} else if (!password_str.equals(surepassword_str)) {
Toast.makeText(RegisterActivity.this, "两次输入的密码不一致", Toast.LENGTH_SHORT).show();
}else if (password_str.length() < 6 ) {
Toast.makeText(RegisterActivity.this, "密码必须包含至少6位的数字、字母或符号", Toast.LENGTH_SHORT).show();
}
else if (phone_str.length() < 11 ||phone_str.length() > 11) {
Toast.makeText(RegisterActivity.this, "请正确填写11位手机号", Toast.LENGTH_SHORT).show();
}else {
int row = UserDbHelper.getInstance(RegisterActivity.this).register(username_str, password_str, surepassword_str, phone_str, email_str, address_str, genderRadioGroup_str, taste_str);
if (row > 0) {
Intent intent = new Intent(this, RegisterinformationActivity.class);
Bundle bundle = new Bundle();
bundle.putString("usernamebox", username_str);
bundle.putString("passwordbox", password_str);
bundle.putString("surepasswordbox", surepassword_str);
bundle.putString("phonebox", phone_str);
bundle.putString("emailbox", email_str);
bundle.putString("addressbox", address_str);
bundle.putString("genderRadioGroup", genderRadioGroup_str);
bundle.putString("tastebox", taste_str);
intent.putExtras(bundle);
startActivity(intent);
Toast.makeText(RegisterActivity.this, "注册成功", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(RegisterActivity.this, "注册失败", Toast.LENGTH_SHORT).show();
}
}
}
}
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
//根据用户选择来改变sex_str的值
genderRadioGroup_str = checkedId == R.id.maleRadioButton ? "男性" : "女性";
}
}

@ -0,0 +1,62 @@
package com.example.deliciousfoodapp;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
public class RegisterinformationActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_registerinformation);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
Intent intent=this.getIntent();
Bundle bundle=intent.getExtras();
String username=bundle.getString("usernamebox");
String password=bundle.getString("passwordbox");
String surepassword=bundle.getString("surepasswordbox");
String phone=bundle.getString("phonebox");
String email=bundle.getString("emailbox");
String address=bundle.getString("addressbox");
String gender=bundle.getString("genderRadioGroup");
String taste=bundle.getString("tastebox");
TextView show_text=(TextView)findViewById(R.id.show_content);
show_text.setText("用户名为:"+username+"\n"+"登录密码为:"+password+"\n"+"确认密码为:"
+surepassword+"\n"+"手机号码为:"+phone+"\n"+"电子邮箱为:"+email+"\n"+"所在地为:"
+address+"\n"+"性别是:"+gender+"\n"+"喜欢的口味是:"+taste+"\n");
return insets;
});
Button gobackbutton = (Button) findViewById(R.id.gobackbutton);
gobackbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(RegisterinformationActivity.this).setTitle("系统提示")
.setMessage("请确认所有信息都正确后再点击“确定")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Intent intent=new Intent(RegisterinformationActivity.this, LoginActivity.class);
startActivity(intent);
}
}).setNegativeButton("返回", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).show();
}
});
}
}

@ -0,0 +1,99 @@
package com.example.deliciousfoodapp;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.deliciousfoodapp.db.UserDbHelper;
import com.example.deliciousfoodapp.entity.UserInfo;
import java.util.List;
public class UserinformationActivity extends AppCompatActivity {
public ListView user_list;
private List<UserInfo> list;
private SQLiteDatabase sqLiteDatabase;
//假设数据库用户不超过10个
private String[] user_mes;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i("SQLite","Sea_del");
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_userinformation);
user_list=findViewById(R.id.mes);
UserDbHelper users=new UserDbHelper(UserinformationActivity.this);
sqLiteDatabase=users.getReadableDatabase();
//获取从数据库查询到的数据
list=users.querydata(sqLiteDatabase);
Log.i("SQLite","list.size()="+list.size());
//把获取到的信息添加到用户名数组中
user_mes=new String[list.size()];
for (int i = 0; i < list.size(); i++) {
// 构建用户信息字符串,每行都带有注释
user_mes[i] = "用户" + (i+1) + "名字:" +
list.get(i).getUsername() + " 密码:" +
list.get(i).getPassword() + " 电话号码:" +
list.get(i).getPhone() + " 邮箱:" +
list.get(i).getEmail() + " 地址:" +
list.get(i).getAddress() + " 性别:" +
list.get(i).getGender() + " 口味:" +
list.get(i).getTaste()+"\n";
}
//把用户名显示在ListView上
final ArrayAdapter<String> adapter=new ArrayAdapter<String>
(UserinformationActivity.this,android.R.layout.simple_list_item_1,user_mes);
user_list.setAdapter(adapter);
//为listview每个元素添加点击事件
user_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
final int id=list.get(i).getUser_id();
//弹出一个对话框
new AlertDialog.Builder(UserinformationActivity.this).setTitle("系统提示")
//设置显示的内容
.setMessage("确定删除该条数据吗!")
//添加确定按钮
.setPositiveButton("确定",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//删除数据操作首先获取到id
UserDbHelper user_database=new UserDbHelper(UserinformationActivity.this);
SQLiteDatabase sqLiteDatabase=user_database.getWritableDatabase();
user_database.delete(sqLiteDatabase,id);
refresh();
Toast.makeText(UserinformationActivity.this,"删除成功",Toast.LENGTH_SHORT).show();
}
}).setNegativeButton("取消",new DialogInterface.OnClickListener() {//添加返回按钮
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).show();//在按键响应事件中显示此对话框
}
});
}
//刷新页面方法
private void refresh() {
finish();
Intent intent = new Intent(UserinformationActivity.this, UserinformationActivity.class);
startActivity(intent);
}
public void clickbacklogin(View view) {
Intent intent = new Intent(UserinformationActivity.this,IndexActivity.class);
intent.putExtra("id",1);
startActivity(intent);
}
}

@ -0,0 +1,114 @@
package com.example.deliciousfoodapp.adapter;
import android.annotation.SuppressLint;
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.deliciousfoodapp.R;
import com.example.deliciousfoodapp.entity.CarInfo;
import java.util.ArrayList;
import java.util.List;
public class CarListAdapter extends RecyclerView.Adapter<CarListAdapter.MyHolder> {
private List<CarInfo> mCarInfoList=new ArrayList<>();
public void setCarInfoList(List<CarInfo> list){
this.mCarInfoList=list;
notifyDataSetChanged();
}
@NonNull
@Override
public MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.car_list_item,null);
return new MyHolder(view);
}
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(@NonNull MyHolder holder, int position) {
//绑定数据
CarInfo carInfo=mCarInfoList.get(position);
holder.product_img.setImageResource(carInfo.getProduct_img());
holder.product_title.setText(carInfo.getProduct_title());
holder.product_price.setText(carInfo.getProduct_price()+"");
holder.product_count.setText(carInfo.getProduct_count()+"");
//设置点击事件
holder.btn_subtract.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(null!=mOnItemClickListner){
mOnItemClickListner.onSubTractOnClick(carInfo,position);
}
}
});
holder.btn_plus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(null!=mOnItemClickListner){
mOnItemClickListner.onPlusOnClick(carInfo,position);
}
}
});
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if (mOnItemClickListner!=null){
mOnItemClickListner.delOnClick(carInfo,position);
}
return true;
}
});
}
@Override
public int getItemCount() {
return mCarInfoList.size();
}
static class MyHolder extends RecyclerView.ViewHolder{
ImageView product_img;
TextView product_title;
TextView product_price;
TextView product_count;
TextView btn_subtract;
TextView btn_plus;
public MyHolder(@NonNull View itemView) {
super(itemView);
product_img=itemView.findViewById(R.id.product_img);
product_title=itemView.findViewById(R.id.product_title);
product_price=itemView.findViewById(R.id.product_price);
product_count=itemView.findViewById(R.id.product_count);
btn_subtract=itemView.findViewById(R.id.btn_subtract);
btn_plus=itemView.findViewById(R.id.btn_plus);
}
}
private onItemClickListener mOnItemClickListner;
public void setOnItemClickListner(onItemClickListener mOnItemClickListner) {
this.mOnItemClickListner = mOnItemClickListner;
}
public interface onItemClickListener{
void onPlusOnClick(CarInfo carInfo,int position);
void onSubTractOnClick(CarInfo carInfo,int position);
void delOnClick(CarInfo carInfo,int position);
}
}

@ -0,0 +1,94 @@
package com.example.deliciousfoodapp.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
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.deliciousfoodapp.R;
import java.util.ArrayList;
import java.util.List;
public class FoodLeftAdapter extends RecyclerView.Adapter<FoodLeftAdapter.MyHolder> {
private List<String>dataList=new ArrayList<>();
private int currentIndex=0;
public FoodLeftAdapter(List<String> dataList){
this.dataList=dataList;
}
@NonNull
@Override
public MyHolder onCreateViewHolder(@NonNull ViewGroup parent,int viewType){
View view=LayoutInflater.from(parent.getContext()).inflate(R.layout.item_left_food,null);
return new MyHolder(view);
}
@SuppressLint("RecyclerView")
@Override
public void onBindViewHolder (@NonNull MyHolder holder,int position){
//绑定数据
String name = dataList.get(position);
holder.textView.setText(name);
if (currentIndex == position) {
holder.itemView.setBackgroundResource(R.drawable.type_selector_bg);
} else {
holder.itemView.setBackgroundResource(0); // 清除背景
}
//分类的点击事件
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(null!=mLeftListOnClickItemListener){//点击事件作用于左边整条列表上
mLeftListOnClickItemListener.onItemClick(position);//如果它不为空回调一个position
setCurrentIndex(position); // 更新选中项索引
}
}
});
//点击它就出现高亮前面有一个标识
if(currentIndex==position){
holder.itemView.setBackgroundResource(R.drawable.type_selector_bg);
}
}
@Override
public int getItemCount(){
return dataList.size();
}
static class MyHolder extends RecyclerView.ViewHolder {
TextView textView;
public MyHolder(@NonNull View itemView) {
super(itemView);
textView=itemView.findViewById(R.id.name);
}
}
private LeftListOnClickItemListener mLeftListOnClickItemListener;
// public LeftListOnClickItemListener getLeftListOnClickItemListener(){
// return mLeftListOnClickItemListener;
// }
public void setLeftListOnClickItemListener(LeftListOnClickItemListener leftListOnClickItemListener){
mLeftListOnClickItemListener=leftListOnClickItemListener;
}
//写一个点击事件
public interface LeftListOnClickItemListener{
void onItemClick(int position);
}
public void setCurrentIndex(int position){
this.currentIndex=position;
notifyDataSetChanged();//刷新一下
}
}

@ -0,0 +1,89 @@
package com.example.deliciousfoodapp.adapter;
import android.content.Context;
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.deliciousfoodapp.R;
import com.example.deliciousfoodapp.entity.FoodInfo;
import java.util.ArrayList;
import java.util.List;
public class FoodRightAdapter extends RecyclerView.Adapter<FoodRightAdapter.ViewHolder> {
private List<FoodInfo> mFoodInfos=new ArrayList<>();
public void setListData(List<FoodInfo> list){
this.mFoodInfos=list;
//刷新
notifyDataSetChanged();
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
//加布局
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_right_food, null);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
//绑定数据
FoodInfo foodInfo =mFoodInfos.get(position);
holder.food_img.setImageResource(foodInfo.getFood_img());
holder.food_title.setText(foodInfo.getFood_title());
holder.food_details.setText(foodInfo.getFood_details());
//价格是int类型但是只能设置为文本类型在后面加个+加引号
holder.food_price.setText(foodInfo.getFood_price()+"");
holder.food_next.setText(foodInfo.getFood_next());
//设置点击事件,使得点击商品出现商品详情页
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(null!=mOnItemClickListener){
mOnItemClickListener.onItemClick(foodInfo,position);
}
}
});
}
@Override
public int getItemCount() {
return mFoodInfos.size();
}
static class ViewHolder extends RecyclerView.ViewHolder {
ImageView food_img;
TextView food_title;
TextView food_details;
TextView food_price;
TextView food_next;
public ViewHolder(@NonNull View itemView) {
super(itemView);
food_img = itemView.findViewById(R.id.food_img);
food_title = itemView.findViewById(R.id.food_title);
food_details = itemView.findViewById(R.id.food_details);
food_price= itemView.findViewById(R.id.food_price);
food_next= itemView.findViewById(R.id.food_next);
}
}
private onItemClickListener mOnItemClickListener;
public void setOnItemClickListener(onItemClickListener onItemClickListener) {
mOnItemClickListener = onItemClickListener;
}
public interface onItemClickListener{
void onItemClick(FoodInfo foodInfo,int position);
}
}

@ -0,0 +1,170 @@
package com.example.deliciousfoodapp.db;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
import com.example.deliciousfoodapp.entity.CarInfo;
import java.util.ArrayList;
import java.util.List;
public class CarDbHelper extends SQLiteOpenHelper {
private static CarDbHelper sHelper;
private static final String DB_NAME = "car.db"; //数据库名
private static final int VERSION = 1; //版本号
//必须实现其中一个构方法
public CarDbHelper(@Nullable Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
//创建单例,供使用调用该类里面的的增删改查的方法
public synchronized static CarDbHelper getInstance(Context context) {
if (null == sHelper) {
sHelper = new CarDbHelper(context, DB_NAME, null, VERSION);
}
return sHelper;
}
@Override
public void onCreate(SQLiteDatabase db) {
//创建car_table表
db.execSQL("create table car_table(_id integer primary key autoincrement, " +
"username text," + //用户名
"product_id text," +
"product_img integer," +
"product_title text," +
"product_price integer," +
"product_count integer" +
")");
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
}
//添加到购物车
public int addCar(String username, int product_id, int product_img,String product_title,int product_price) {
//判断是否添加过商品,如果添加过,只需要修改商品的数量即可
CarInfo addCar=isaddCar(username,product_id);
if (addCar==null){
//获取SQLiteDatabase实例
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
//填充占位符
values.put("username", username);
values.put("product_id", product_id);
values.put("product_img", product_img);
values.put("product_title", product_title);
values.put("product_price", product_price);
values.put("product_count", 1);
String nullColumnHack = "values(null,?,?,?,?,?,?)";
//执行
int insert = (int) db.insert("car_table", nullColumnHack, values);
db.close();
return insert;
}else{
return updateProduct(addCar.getCar_id(),addCar);
}
}
//修改购物车
public int updateProduct(int car_id,CarInfo carInfo) {
//获取SQLiteDatabase实例
SQLiteDatabase db = getWritableDatabase();
// 填充占位符
ContentValues values = new ContentValues();
values.put("product_count", carInfo.getProduct_count()+1);
// 执行SQL
int update = db.update("car_table", values, " _id=?", new String[]{car_id+""});
// 关闭数据库连接
db.close();
return update;
}
//减少购物车内商品的数量
public int subStartupdateProduct(int car_id,CarInfo carInfo) {
if (carInfo.getProduct_count()>=2){
//获取SQLiteDatabase实例
SQLiteDatabase db = getWritableDatabase();
// 填充占位符
ContentValues values = new ContentValues();
values.put("product_count", carInfo.getProduct_count()-1);
// 执行SQL
int update = db.update("car_table", values, " _id=?", new String[]{car_id+""});
// 关闭数据库连接
db.close();
return update;
}
return 0;
}
//根据用户名和商品ID判断有没有添加过商品到购物车
@SuppressLint("Range")
public CarInfo isaddCar(String username,int product_id) {
//获取SQLiteDatabase实例
SQLiteDatabase db = getReadableDatabase();
CarInfo carInfo = null;
String sql = "select _id,username,product_id,product_img,product_title, product_price,product_count from car_table where username=? and product_id=?";
String[] selectionArgs = {username,product_id+""};
Cursor cursor = db.rawQuery(sql, selectionArgs);
if (cursor.moveToNext()) {
int car_id = cursor.getInt(cursor.getColumnIndex("_id"));
String name = cursor.getString(cursor.getColumnIndex("username"));
int productId = cursor.getInt(cursor.getColumnIndex("product_id"));
int product_img = cursor.getInt(cursor.getColumnIndex("product_img"));
String product_title = cursor.getString(cursor.getColumnIndex("product_title"));
int product_price = cursor.getInt(cursor.getColumnIndex("product_price"));
int product_count = cursor.getInt(cursor.getColumnIndex("product_count"));
carInfo = new CarInfo(car_id, name, productId,product_img, product_title,product_price,product_count);
}
cursor.close();
db.close();
return carInfo;
}
//根据用户名查找
@SuppressLint("Range")
public List<CarInfo> queryCarList(String username) {
//获取SQLiteDatabase实例
SQLiteDatabase db = getReadableDatabase();
List<CarInfo> list = new ArrayList<>();
String sql = "select _id,username,product_id,product_img,product_title, product_price,product_count from car_table where username=? ";
String[] selectionArgs = {username};
Cursor cursor = db.rawQuery(sql, selectionArgs);
while (cursor.moveToNext()) {
int car_id = cursor.getInt(cursor.getColumnIndex("_id"));
String name = cursor.getString(cursor.getColumnIndex("username"));
int productId = cursor.getInt(cursor.getColumnIndex("product_id"));
int product_img = cursor.getInt(cursor.getColumnIndex("product_img"));
String product_title = cursor.getString(cursor.getColumnIndex("product_title"));
int product_price = cursor.getInt(cursor.getColumnIndex("product_price"));
int product_count = cursor.getInt(cursor.getColumnIndex("product_count"));
list.add(new CarInfo(car_id, name, productId,product_img, product_title,product_price,product_count));
}
cursor.close();
db.close();
return list;
}
//删除购物车商品
public int delete(String car_id) {
//获取SQLiteDatabase实例
SQLiteDatabase db = getWritableDatabase();
// 执行SQL
int delete = db.delete("car_table", " _id=?", new String[]{car_id});
// 关闭数据库连接
db.close();
return delete;
}
}

@ -0,0 +1,145 @@
package com.example.deliciousfoodapp.db;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import androidx.annotation.Nullable;
import com.example.deliciousfoodapp.entity.UserInfo;
import java.util.ArrayList;
import java.util.List;
public class UserDbHelper extends SQLiteOpenHelper {
private static UserDbHelper sHelper;
private static final String DB_NAME = "user2.db"; //数据库名
private static final int VERSION = 1; //版本号
private static final String TABLE_NAME = "user_table";
//必须实现其中一个构方法
public UserDbHelper(@Nullable Context context) {
super(context, DB_NAME, null, VERSION);
}
//创建单例,供使用调用该类里面的的增删改查的方法
public synchronized static UserDbHelper getInstance(Context context) {
if (null == sHelper) {
sHelper = new UserDbHelper(context);
}
return sHelper;
}
@Override
public void onCreate(SQLiteDatabase db) {
//创建user_table表
db.execSQL("create table " + TABLE_NAME + "(user_id integer primary key autoincrement, " +
"username text," + //用户名
"password text," + //密码
"surepassword text," +
"phone text," +
"email text," +
"address text," +
"gender text," +
"taste text" +
")");
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
}
//登录
/**
*
*/
@SuppressLint("Range")
public UserInfo login(String username) {
//获取SQLiteDatabase实例
SQLiteDatabase db = getReadableDatabase();
UserInfo userInfo = null;
String sql = "select user_id,username,password,surepassword,phone,email,address,gender,taste from " + TABLE_NAME + " where username=?";
String[] selectionArgs = {username};
Cursor cursor = db.rawQuery(sql, selectionArgs);
if (cursor.moveToNext()) {
int user_id = cursor.getInt(cursor.getColumnIndex("user_id"));
String name = cursor.getString(cursor.getColumnIndex("username"));
String password = cursor.getString(cursor.getColumnIndex("password"));
String surepassword= cursor.getString(cursor.getColumnIndex("surepassword"));
String phone = cursor.getString(cursor.getColumnIndex("phone"));
String email= cursor.getString(cursor.getColumnIndex("email"));
String address = cursor.getString(cursor.getColumnIndex("address"));
String gender= cursor.getString(cursor.getColumnIndex("gender"));
String taste = cursor.getString(cursor.getColumnIndex("taste"));
userInfo = new UserInfo(user_id, name, password,surepassword,phone,email,address,gender,taste);
}
cursor.close();
//db.close();
return userInfo;
}
//注册
public int register(String username, String password,String surepassword,String phone,String email,String address,String gender,String taste) {
//获取SQLiteDatabase实例
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
//填充占位符
values.put("username", username);
values.put("password", password);
values.put("surepassword", surepassword);
values.put("phone", phone);
values.put("email", email);
values.put("address", address);
values.put("gender", gender);
values.put("taste", taste);
//执行
int insert =(int) db.insert(TABLE_NAME, null, values);
//db.close();
return insert;
}
//删除数据
public void delete(SQLiteDatabase sqLiteDatabase, int id) {
SQLiteDatabase db = getWritableDatabase();
db.delete(TABLE_NAME, "user_id=?", new String[]{String.valueOf(id)});
db.close();
}
//查询数据
@SuppressLint("Range")
public List<UserInfo> querydata(SQLiteDatabase sqLiteDatabase) {
SQLiteDatabase db = getReadableDatabase();
Cursor cursor = db.query(TABLE_NAME, null, null, null, null, null, "user_id ASC");
List<UserInfo> list = new ArrayList<>();
while (cursor.moveToNext()) {
int id = cursor.getInt(cursor.getColumnIndex("user_id")); // Check if "user_id" is the correct column name
Log.i("SQLite","id="+id);
String username = cursor.getString(cursor.getColumnIndex("username"));
Log.i("SQLite","username="+username);
String password = cursor.getString(cursor.getColumnIndex("password"));
Log.i("SQLite","password="+password);
String surepassword = cursor.getString(cursor.getColumnIndex("surepassword"));
Log.i("SQLite","surepassword="+surepassword);
String phone = cursor.getString(cursor.getColumnIndex("phone"));
Log.i("SQLite","phone="+phone);
String email = cursor.getString(cursor.getColumnIndex("email"));
Log.i("SQLite","email="+email);
String address = cursor.getString(cursor.getColumnIndex("address"));
Log.i("SQLite","address="+address);
String gender = cursor.getString(cursor.getColumnIndex("gender"));
Log.i("SQLite","gender="+gender);
String taste = cursor.getString(cursor.getColumnIndex("taste"));
Log.i("SQLite","taste="+taste);
list.add(new UserInfo(id, username, password, surepassword, phone, email, address, gender, taste));
}
cursor.close();
//db.close();
return list;
}
}

@ -0,0 +1,78 @@
package com.example.deliciousfoodapp.entity;
public class CarInfo {
private int car_id;
private String username;
private int product_id;
private int product_img;
private String product_title;
private int product_price;
private int product_count;
public CarInfo(int car_id, String username, int product_id, int product_img, String product_title, int product_price, int product_count) {
this.car_id = car_id;
this.username = username;
this.product_id = product_id;
this.product_img = product_img;
this.product_title = product_title;
this.product_price = product_price;
this.product_count = product_count;
}
public int getProduct_count() {
return product_count;
}
public void setProduct_count(int product_count) {
this.product_count = product_count;
}
public int getCar_id() {
return car_id;
}
public void setCar_id(int car_id) {
this.car_id = car_id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getProduct_id() {
return product_id;
}
public void setProduct_id(int product_id) {
this.product_id = product_id;
}
public int getProduct_img() {
return product_img;
}
public void setProduct_img(int product_img) {
this.product_img = product_img;
}
public String getProduct_title() {
return product_title;
}
public void setProduct_title(String product_title) {
this.product_title = product_title;
}
public int getProduct_price() {
return product_price;
}
public void setProduct_price(int product_price) {
this.product_price = product_price;
}
}

@ -0,0 +1,159 @@
package com.example.deliciousfoodapp.entity;
import com.example.deliciousfoodapp.R;
import java.util.ArrayList;
import java.util.List;
public class FoodDataService {
//提供数据
public static List<FoodInfo> getListData(int position){
List<FoodInfo> list=new ArrayList<>();
if(position==0){
list.add(new FoodInfo(0, R.drawable.one1,"天然清爽,健康选择。","酸甜可口,带有清新的果香,满足你对健康生活的追求。",12,"元/斤"));
list.add(new FoodInfo(1, R.drawable.one2,"独特魅力,色彩斑斓。","口感清爽,果肉细腻,多汁爽口,是时尚人士的首选。",15,"元/斤"));
list.add(new FoodInfo(2, R.drawable.one3,"果香四溢,甜蜜滋味。","水分丰富,果肉细腻,口感清甜,让你尽情享受夏日的清凉。",14,"元/斤"));
list.add(new FoodInfo(3, R.drawable.one4,"酸甜可口,果香扑鼻。","口感丰富多汁爽口富含维生素C是夏日解暑的最佳选择。",8,"元/斤"));
list.add(new FoodInfo(4, R.drawable.one5,"美味小巧,诱人色泽。","果肉鲜嫩,酸甜可口,口感丰富,是爱情的象征。",46,"元/1斤"));
list.add(new FoodInfo(5, R.drawable.one6,"清新怡人,酸甜可口。","富含维生素C口感鲜爽可制作饮料或调味料增添生活情趣。",13,"元/斤"));
list.add(new FoodInfo(6, R.drawable.one7,"果肉细腻,香甜可口。","鲜红诱人,汁水丰富,口感浓郁,是夏日水果中的佳品。",36,"元/斤"));
list.add(new FoodInfo(7, R.drawable.one8,"明星风采,独特风味。","口感清爽果肉多汁味道独特富含维生素C让你倍感清新。",10,"元/斤"));
}else if(position==1){
list.add(new FoodInfo(8, R.drawable.two1,"新鲜炒酱、烹饪必备。","汁水丰富,口感鲜甜,色泽鲜艳,是健康餐桌上的明星。",6,"元/斤"));
list.add(new FoodInfo(9, R.drawable.two2,"凉拌、生吃首选。","口感清脆,汁水丰富,清凉解暑,是夏日的必备蔬菜。",3,"元/斤"));
list.add(new FoodInfo(10, R.drawable.two3,"蔬菜沙拉、炖汤佳品。","口感甘甜,营养丰富,富含胡萝卜素,有益眼睛健康。",5,"元/斤"));
list.add(new FoodInfo(11, R.drawable.two4,"清炒、煮汤、火锅必备。","叶片脆嫩,汁水鲜甜,营养丰富,是家常菜的主角。",2,"元/斤"));
list.add(new FoodInfo(12, R.drawable.two5,"烧茄子、酱茄子、烤茄子。","肉质细嫩,口感鲜美,烹饪多样,满足不同口味需求。",4,"元/斤"));
list.add(new FoodInfo(13, R.drawable.two6,"炒菜、凉拌、烧烤。","口感爽脆,香气诱人,是各类菜肴的调味佳品。",3,"元/斤"));
list.add(new FoodInfo(14, R.drawable.two7,"汆、炒、煮皆宜。","叶片嫩绿口感爽滑富含维生素C有益健康。",7,"元/斤"));
list.add(new FoodInfo(15, R.drawable.two8,"炖、煮、炸、烤皆可。","口感绵软,味道浓郁,是各类美食的基础材料。",3,"元/斤"));
}else if(position==2){
list.add(new FoodInfo(16, R.drawable.three1,"澳洲和牛,口感细腻,肉香四溢,尽享尊贵美味。","肉质鲜嫩多汁,口感柔滑,带有淡淡的奶香,令人回味无穷。",100,"元/斤"));
list.add(new FoodInfo(17, R.drawable.three2,"黑山猪肉,肉质鲜美,口感醇厚,健康又美味。","肉质紧实,口感鲜美,带有淡淡的甜香,是烹饪佳肴的绝佳选择。",200,"元/斤"));
list.add(new FoodInfo(18, R.drawable.three3,"新疆羊肉,肉质鲜嫩,口感独特,草原风情尽在其中。","羊肉鲜美无膻,口感细腻,带有一种独特的草原香气,令人陶醉。",90,"元/斤"));
list.add(new FoodInfo(19, R.drawable.three4,"山林散养鸡,肉质紧实,口感鲜美,营养又健康。","鸡肉鲜美多汁,口感滑嫩,带有山林的自然清香,是健康饮食的首选。",120,"元/斤"));
list.add(new FoodInfo(20, R.drawable.three5,"深海金枪鱼,肉质细腻,口感鲜美,海洋馈赠的珍品。","鱼肉鲜嫩爽滑,口感鲜美,带有淡淡的海洋气息,令人流连忘返。",300,"元/斤"));
list.add(new FoodInfo(21, R.drawable.three6,"金华火腿,口感醇香,肉质鲜美,烹饪佳品不容错过。","金华火腿,口感醇香,肉质鲜美,烹饪佳品不容错过。",260,"元/斤"));
list.add(new FoodInfo(22, R.drawable.three7,"炭烤羊排,外酥里嫩,香气四溢,烧烤美味尽在其中。","羊排经过炭火慢烤,外酥里嫩,口感鲜美,香气扑鼻,是烧烤爱好者的最爱。",280,"元/斤"));
list.add(new FoodInfo(23, R.drawable.three8,"香煎培根,口感香脆,肉质鲜美,美味早餐的不二之选。","培根经过香煎,口感香脆,肉质鲜美,搭配面包或鸡蛋食用更佳。",166,"元/斤"));
}else if(position==3){
list.add(new FoodInfo(24, R.drawable.four1,"皮薄馅足,汤汁鲜美,品尝传统小吃之经典。","小笼包皮薄如纸,内馅鲜嫩多汁,轻咬一口,汤汁四溢,口感细腻。",15,"元/笼"));
list.add(new FoodInfo(25, R.drawable.four2,"香脆可口,馅料丰富,街头小吃之首选。","煎饼果子外皮金黄酥脆,内馅饱满,口感层次丰富,是早餐或夜宵的绝佳选择。",10,"元/个"));
list.add(new FoodInfo(26, R.drawable.four3,"外酥里嫩,气味独特,挑战味蕾的臭豆腐。","臭豆腐经过特殊发酵,外皮酥脆,内里嫩滑,口感独特,是喜欢尝试不同风味食客的选择。",16,"元/份"));
list.add(new FoodInfo(27, R.drawable.four4,"肉质鲜嫩,香气扑鼻,烧烤小吃的代表之作。","羊肉串选用优质羊肉,经过精心烤制,肉质鲜嫩多汁,香气四溢,是烧烤爱好者的最爱。",2,"元/串"));
list.add(new FoodInfo(28, R.drawable.four5,"麻辣鲜香,食材丰富,味蕾的麻辣盛宴。","麻辣烫选用多种食材,搭配麻辣底料,口感麻辣鲜香,让人回味无穷,是喜欢辣味食客的不二之选。",30,"元/份"));
list.add(new FoodInfo(29, R.drawable.four6,"甜而不腻,外酥内软,传统甜点的魅力所在。","糖油粑粑外皮酥脆,内里软糯,甜度适中,口感丰富,是喜欢甜食者的心头好。",8,"元/个"));
list.add(new FoodInfo(30, R.drawable.four7,"冷面筋道,酱料浓郁,街头巷尾的美食佳品。","烤冷面选用优质冷面,搭配特制酱料,口感筋道爽滑,酱香四溢,是夜市小吃的一大特色。",10,"元/份"));
list.add(new FoodInfo(31, R.drawable.four8,"酸辣可口,粉质滑嫩,开胃解馋的小吃之选。","酸辣粉选用优质红薯粉,搭配酸辣汤汁,口感滑嫩爽口,酸辣适中,是开胃解馋的绝佳小吃。",12,"元/碗"));
}else if(position==4){
list.add(new FoodInfo(32, R.drawable.five1,"绵软细腻,口感丝滑,尽享甜品的优雅时光。","慕斯蛋糕口感轻盈,入口即化,搭配丰富的水果和果酱,层次丰富,甜而不腻。",20,"元/块"));
list.add(new FoodInfo(33, R.drawable.five2,"咖啡香浓,口感丰富,传统意式甜点的经典之作。","提拉米苏融合了咖啡的苦涩、可可的浓郁和奶油的绵密,口感层次丰富,令人回味无穷。",20,"元/份"));
list.add(new FoodInfo(34, R.drawable.five3,"巧克力浓郁,口感醇厚,满足巧克力控的味蕾。","黑森林蛋糕外层覆盖着浓郁的巧克力,内里则是松软的蛋糕和酸甜的樱桃,口感丰富,甜而不腻。",35,"元/块"));
list.add(new FoodInfo(35, R.drawable.five4,"色彩缤纷,口感酥脆,法式甜点的精致之选。","马卡龙外壳酥脆,内里柔软,色彩缤纷,口感轻盈,是下午茶时光的绝佳伴侣。",9,"元/个"));
list.add(new FoodInfo(36, R.drawable.five5,"榴莲飘香,口感滑嫩,热带风味的甜品盛宴。","榴莲班戟外皮薄脆,内馅是浓郁的榴莲肉,口感滑嫩,香气四溢,是榴莲爱好者的最爱。",20,"元/个"));
list.add(new FoodInfo(37, R.drawable.five6,"芒果香甜,口感嫩滑,夏日清凉的甜品佳品。","芒果布丁以新鲜芒果为原料,口感嫩滑,芒果的香甜与布丁的细腻完美结合,是夏日消暑的绝佳选择。",16,"元/杯"));
list.add(new FoodInfo(38, R.drawable.five7,"焦糖香浓,口感细腻,传统英式甜点的魅力所在。","焦糖炖蛋口感柔滑,焦糖的香甜与蛋液的细腻完美结合,入口即化,是甜品爱好者的不二之选。",15,"元/份"));
list.add(new FoodInfo(39, R.drawable.five8,"芒果清爽,口感丰富,夏日解暑的甜品之选。","杨枝甘露以芒果、西柚等水果为主料,口感清爽,酸甜适中,是夏日消暑、解渴的绝佳甜品。",18,"元/碗"));
}else if(position==5){
list.add(new FoodInfo(40, R.drawable.six1,"酱香浓郁,面条劲道,品尝地道北京风味。","炸酱面以黄酱炸制而成,面条筋道有弹性,酱香与面条完美融合,口感丰富。",19,"元/份"));
list.add(new FoodInfo(41, R.drawable.six2,"米饭香糯,配料丰富,传统炒饭的经典之作。","扬州炒饭选用优质米饭,搭配虾仁、鸡蛋等丰富食材,口感香糯,味道鲜美。",13,"元/份"));
list.add(new FoodInfo(42, R.drawable.six3,"肉质鲜嫩,馍香四溢,西北美食的代表之作。","肉夹馍选用肥瘦相间的猪肉,搭配烤制得香脆的白吉馍,口感鲜嫩多汁,香气扑鼻。",10,"元/个"));
list.add(new FoodInfo(43, R.drawable.six4,"面条外滑内筋,汤料浓郁,山西面食的典范。","刀削面以特制刀具削出,面条外滑内筋,搭配特制汤料,口感爽滑,味道鲜美。",10,"元/碗"));
list.add(new FoodInfo(44, R.drawable.six5,"皮薄馅嫩,汤汁鲜美,品味江南传统小吃。","小笼包皮薄如纸,内馅鲜嫩多汁,轻轻一咬,汤汁四溢,口感细腻。",15,"元/笼"));
list.add(new FoodInfo(45, R.drawable.six6,"皮薄馅鲜,口感爽滑,品味岭南早茶经典。","虾饺外皮白嫩,内馅是鲜嫩的虾仁,口感爽滑,鲜美可口,是广东早茶的一大特色。",16,"元/份"));
list.add(new FoodInfo(46, R.drawable.six7,"麻辣鲜香,面条筋道,四川风味小吃之选。","担担面以麻辣著称,面条筋道有弹性,搭配特制麻辣酱料,口感麻辣鲜香,让人回味无穷。",16,"元/份"));
list.add(new FoodInfo(47, R.drawable.six8,"米线细滑,汤料鲜美,云南特色主食之选。","过桥米线选用优质米线,搭配丰富的食材和特制汤料,口感细滑,味道鲜美,是云南地区的特色美食。",10,"元/份"));
}else if(position==6){
list.add(new FoodInfo(48, R.drawable.seven1,"面条筋道,汤底醇厚,尽享传统面食的美味。","刀削面面条外滑内筋,搭配浓郁的汤底和丰富的配料,口感筋道,滋味醇厚。",12,"元/碗"));
list.add(new FoodInfo(49, R.drawable.seven2,"面条劲道,汤鲜味美,河南特色面食不容错过。","烩面选用优质面粉制成,面条劲道爽滑,汤底鲜美浓郁,口感层次丰富",15,"元/碗"));
list.add(new FoodInfo(50, R.drawable.seven3,"面条劲道,汤料鲜美,品味安徽地道面食。","安徽板面选用优质面粉手工制作,面条劲道有弹性,搭配特制汤料和浇头,口感鲜美,是安徽地区的传统面食。",19,"元/碗"));
list.add(new FoodInfo(51, R.drawable.seven4,"酸辣可口,面条爽滑,品味西北独特风味。","臊子面以酸辣著称,面条细薄爽滑,搭配特制臊子汤料,口感酸辣适中,令人回味无穷。",13,"元/碗"));
list.add(new FoodInfo(52, R.drawable.seven5,"口感筋道,麻酱香浓,武汉特色早餐之选。","热干面面条筋道有弹性,搭配特制麻酱和调料,口感麻辣香浓,是武汉人钟爱的早餐面食。",16,"元/碗"));
list.add(new FoodInfo(53, R.drawable.seven6,"面条细滑,汤底浓郁,品尝地道的西北拉面。","兰州拉面面条细薄爽滑,汤底选用牛肉和多种香料熬制,口感鲜美浓郁,是西北地区的特色面食。",10,"元/碗"));
list.add(new FoodInfo(54, R.drawable.seven7,"面条劲道,酱料浓郁,新疆风味面食不容错过。","新疆拌面选用优质面粉制成,面条劲道有弹性,搭配特制酱料和蔬菜,口感丰富多样,具有浓郁的新疆风味。",11,"元/碗"));
list.add(new FoodInfo(55, R.drawable.seven8,"麻辣过瘾,面条劲道,四川特色面食之选。","燃面以麻辣著称,面条劲道有嚼劲,搭配丰富的配料和特制辣椒油,口感麻辣过瘾,是四川地区的特色面食。",14,"元/碗"));
}else if(position==7){
list.add(new FoodInfo(56, R.drawable.eight1,"蟹肉鲜嫩,口感细腻,品尝秋季海鲜美味。","大闸蟹肉质饱满,清蒸后蟹肉更加鲜嫩,口感细腻,香气四溢,是秋季不可错过的海鲜佳肴。",45,"元/只"));
list.add(new FoodInfo(57, R.drawable.eight2,"生蚝鲜嫩,蒜香浓郁,海鲜烧烤的不二之选。","生蚝口感鲜嫩,搭配蒜蓉烤制,蒜香与海鲜的鲜甜完美融合,让人回味无穷。",36,"元/份"));
list.add(new FoodInfo(58, R.drawable.eight3,"虾球鲜嫩,香辣可口,海鲜炒菜的经典之作。","虾球个大肉厚,经过香辣炒制,口感鲜嫩多汁,香辣味浓,让人食欲大增。",33,"元/盘"));
list.add(new FoodInfo(59, R.drawable.eight4,"鱼肉鲜嫩,口感滑爽,清蒸保持原汁原味。","海鲈鱼肉质细腻,清蒸后口感滑嫩,清香四溢,是健康美味的海鲜之选。",60,"元/斤"));
list.add(new FoodInfo(60, R.drawable.eight5,"鲍鱼鲜美,口感弹牙,红烧更显尊贵气质。","鲍鱼营养丰富,红烧后口感弹牙,味道鲜美,是高端海鲜菜品中的佼佼者。",30,"元/只"));
list.add(new FoodInfo(61, R.drawable.eight6,"海虾鲜嫩,口感清甜,白灼保留原始风味。","海虾肉质紧实,白灼后口感清甜,鲜美无比,是简单却美味的海鲜吃法。",78,"元/斤"));
list.add(new FoodInfo(62, R.drawable.eight7,"蛤蜊鲜嫩,酱香浓郁,海鲜下饭的好搭档。","蛤蜊肉质肥美,经过酱爆炒制,口感鲜嫩多汁,酱香四溢,是搭配米饭的绝佳选择。",50,"元/份"));
list.add(new FoodInfo(63, R.drawable.eight8,"扇贝肥美,蒜蓉提香,海鲜蒸菜的佳品。","扇贝肉质肥美,搭配蒜蓉和粉丝蒸制,口感鲜嫩,蒜香四溢,是海鲜蒸菜中的佳品。",43,"元/份"));
}else if(position==8){
list.add(new FoodInfo(64, R.drawable.nine1,"外酥里嫩,甜辣适中,韩式风味独特迷人。","韩式炸鸡外皮酥脆,内里鲜嫩多汁,搭配特制甜辣酱,口感层次丰富,甜辣适中。",38,"元/份"));
list.add(new FoodInfo(65, R.drawable.nine2,"金黄酥脆,肉质鲜嫩,美式快餐经典之选。","美式炸鸡色泽金黄,外皮酥脆,鸡肉鲜嫩多汁,搭配薯条和汉堡,是快餐爱好者的最爱。",19,"元/块"));
list.add(new FoodInfo(66, R.drawable.nine3,"鸡腿肉多,口感香酥,满足肉食爱好者的味蕾。","炸鸡腿选用大鸡腿,肉质饱满,炸制后外皮香酥,内里鲜嫩多汁,是肉食爱好者的首选。",12,"元/个"));
list.add(new FoodInfo(67, R.drawable.nine4,"鸡块小巧,口感鲜嫩,日式风味别具一格。","日式炸鸡块小巧可爱,外皮酥脆,内里鸡肉鲜嫩多汁,搭配日式酱料,风味独特。",15,"元/份"));
list.add(new FoodInfo(68, R.drawable.nine5,"蒜香浓郁,鸡翅鲜嫩,口感丰富回味无穷。","炸鸡翅外皮酥脆,内里鲜嫩多汁,搭配特制蒜香酱料,口感丰富,蒜香四溢。",14,"元/份"));
list.add(new FoodInfo(69, R.drawable.nine6,"鸡柳嫩滑,香辣可口,美味不容错过。","炸鸡柳选用鸡胸肉切成条状,炸制后口感嫩滑,搭配香辣调料,味道浓郁,让人回味无穷。",10,"元/份"));
list.add(new FoodInfo(70, R.drawable.nine7,"蜂蜜甜润,芥末刺激,炸鸡新口味等你来尝。","炸鸡搭配蜂蜜和芥末酱料,口感甜润中带着一丝刺激,是炸鸡爱好者的新选择。",26,"元/份"));
list.add(new FoodInfo(71, R.drawable.nine8,"秘制酱料,香气四溢,炸鸡美味更胜一筹。","炸鸡搭配店家秘制酱料,口感层次丰富,香气扑鼻,让人一吃难忘。",24,"元/份"));
}else if(position==9){
list.add(new FoodInfo(72, R.drawable.ten1,"清爽解暑,酸甜可口,夏日畅饮首选。","柠檬汽水口感清爽,酸甜适中,冰镇后更加解暑,是夏季消暑的绝佳饮品。",8,"元/杯"));
list.add(new FoodInfo(73, R.drawable.ten2,"浓郁香醇,口感丝滑,咖啡爱好者的挚爱。","摩卡咖啡融合了浓郁的咖啡香和丝滑的奶油口感,每一口都让人陶醉。",12,"元/杯"));
list.add(new FoodInfo(74, R.drawable.ten3,"新鲜天然,口感纯正,健康饮品新选择。","鲜榨果汁选用新鲜水果,口感纯正,保留了水果的原始营养和口感。",15,"元/杯"));
list.add(new FoodInfo(75, R.drawable.ten4,"丝滑香浓,奶香四溢,奶茶控的必备之选。","手摇奶茶口感丝滑,奶香浓郁,每一口都充满了浓郁的奶茶味。",10,"元/杯"));
list.add(new FoodInfo(76, R.drawable.ten5,"清新怡人,口感甘醇,绿茶爱好者的心头好。","薄荷绿茶口感清新,带有淡淡的薄荷香,是解暑提神的好饮品。",13,"元/杯"));
list.add(new FoodInfo(77, R.drawable.ten6,"香甜可口,口感细腻,夏日甜品的不二之选。","椰奶奶昔口感细腻,香甜可口,椰奶的香气与奶昔的绵密完美结合。",15,"元/杯"));
list.add(new FoodInfo(78, R.drawable.ten7,"浓郁香甜,口感醇厚,冬日暖心的最佳选择。","热巧克力口感醇厚,香甜浓郁,每一口都让人感受到温暖和甜蜜。",20,"元/杯"));
list.add(new FoodInfo(79, R.drawable.ten8,"柚香四溢,口感甜润,健康养颜的饮品佳品。","蜂蜜柚子茶口感甜润,柚香四溢,蜂蜜和柚子的完美结合,既健康又养颜。",13,"元/杯"));
}else if(position==10){
list.add(new FoodInfo(80, R.drawable.eleven1,"豆浆滑嫩,油条香脆,经典早点搭配。","豆浆口感滑嫩,油条外酥里嫩,两者搭配相得益彰,是早餐桌上的常客。",3,"元/杯"));
list.add(new FoodInfo(81, R.drawable.eleven2,"皮薄馅足,汤汁鲜美,传统早点之经典。","小笼包皮薄馅嫩,轻咬一口汤汁四溢,鲜美无比,是早餐的绝佳选择。",10,"元/笼"));
list.add(new FoodInfo(82, R.drawable.eleven3,"口感酥脆,馅料丰富,美味早餐速食。","煎饼果子外皮酥脆,内馅丰富多样,口感层次分明,是快捷美味的早餐选择。",10,"元/个"));
list.add(new FoodInfo(83, R.drawable.eleven4,"鸡蛋鲜嫩,饼皮香酥,营养美味早餐。","鸡蛋灌饼将鲜嫩的鸡蛋灌入香酥的饼皮中,口感丰富,营养满满,是早餐的好选择。",8,"元/个"));
list.add(new FoodInfo(84, R.drawable.eleven5,"嫩滑爽口,口感细腻,早餐轻食之选。","豆腐脑口感嫩滑,细腻爽口,搭配甜咸酱料皆宜,是早餐桌上的清爽美食。",4,"元/碗"));
list.add(new FoodInfo(85, R.drawable.eleven6,"面条筋道,牛肉鲜香,早餐面食新选择。","牛肉面选用筋道的面条和鲜嫩的牛肉,汤底浓郁,口感丰富,是早餐面食的新宠。",16,"元/碗"));
list.add(new FoodInfo(86, R.drawable.eleven7,"口感丰富,营养全面,早餐养生粥品。","八宝粥选用多种食材熬制而成,口感丰富,营养全面,是早餐养生的好选择。",6,"元/碗"));
list.add(new FoodInfo(87, R.drawable.eleven8,"软糯香甜,口感独特,传统早点风味。","糍粑口感软糯,香甜可口,带有独特的传统风味,是早餐桌上的美味小吃。",4,"元/个"));
}else if(position==11){
list.add(new FoodInfo(88, R.drawable.twelve1,"香脆可口,馅料丰富,传统风味回味无穷。","黄山烧饼皮薄馅足,口感香脆,馅料丰富多样,每一口都充满了传统风味。",14,"元/包"));
list.add(new FoodInfo(89, R.drawable.twelve2,"茶韵悠长,口感醇厚,品茗之选。","云南普洱茶香气独特,口感醇厚,回甘悠长,是品茗者的挚爱。",25,"元/份"));
list.add(new FoodInfo(90, R.drawable.twelve3,"口感滑嫩,营养丰富,健康食材之选。","东北黑木耳肉质厚实,口感滑嫩,营养丰富,是健康饮食的必备食材。",26,"元/斤"));
list.add(new FoodInfo(91, R.drawable.twelve4,"咸香可口,肉质鲜美,传统美食佳品。","四川腊肉选用优质猪肉,经过独特工艺腌制而成,口感咸香,肉质鲜美。",79,"元/斤"));
list.add(new FoodInfo(92, R.drawable.twelve5,"甜度适中,口感饱满,健康零食新宠。","新疆大枣果实饱满,甜度适中,口感鲜美,是健康零食的绝佳选择。",32,"元/斤"));
list.add(new FoodInfo(93, R.drawable.twelve6,"肉质饱满,甜而不腻,滋补养生佳品。","福建桂圆干选用优质桂圆,经过精心加工而成,肉质饱满,口感甜美,是滋补养生的好食材。",55,"元/包"));
list.add(new FoodInfo(94, R.drawable.twelve7,"口感脆嫩,营养丰富,烹饪佳肴之选。","湖北莲藕口感脆嫩,营养丰富,是烹饪各种佳肴的优质食材。",22,"元/斤"));
list.add(new FoodInfo(95, R.drawable.twelve8,"果肉饱满,甜酸适中,果中佳品。","广西沙田柚果皮薄而光滑,果肉饱满多汁,甜酸适中,是柚子中的佳品。",13,"元/个"));
}else if(position==12){
list.add(new FoodInfo(96, R.drawable.thirteen1,"清新爽口,脆嫩多汁,夏日消暑好选择。","拍黄瓜口感脆嫩,清爽多汁,搭配特制酱料,是夏日餐桌上的必备凉菜。",13,"元/份"));
list.add(new FoodInfo(97, R.drawable.thirteen2,"滑嫩可口,酸辣适中,开胃下饭两不误。","凉拌海带选用新鲜海带,口感滑嫩,搭配酸辣调料,既开胃又下饭。",12,"元/份"));
list.add(new FoodInfo(98, R.drawable.thirteen3,"麻辣鲜香,口感弹牙,川菜经典之一。","红油耳片选用猪耳,口感弹牙,搭配特制红油调料,麻辣鲜香,是川菜中的经典凉菜。",18,"元/份"));
list.add(new FoodInfo(99, R.drawable.thirteen4,"蒜香浓郁,肉质鲜嫩,凉菜中的美味佳肴。","蒜泥白肉选用五花肉,口感鲜嫩,搭配特制蒜泥调料,蒜香四溢,美味可口。",26,"元/份"));
list.add(new FoodInfo(100, R.drawable.thirteen5,"口感细腻,香醇可口,传统凉菜新体验。","凉拌皮蛋选用优质皮蛋,口感细腻,搭配特制调料,香醇可口,是传统凉菜的新体验。",20,"元/份"));
list.add(new FoodInfo(101, R.drawable.thirteen6,"酸爽开胃,口感脆嫩,家常凉菜好选择。","醋溜土豆丝选用新鲜土豆,切成细丝,口感脆嫩,搭配醋溜调料,酸爽开胃,是家常凉菜的好选择。",17,"元/份"));
list.add(new FoodInfo(102, R.drawable.thirteen7,"色彩诱人,口感丰富,营养美味两不误。","凉拌三丝由胡萝卜丝、黄瓜丝和木耳丝组成,色彩诱人,口感丰富,既营养又美味。",14,"元/份"));
list.add(new FoodInfo(103, R.drawable.thirteen8,"口感筋道,香味四溢,健康美味凉菜。","香拌豆腐皮选用优质豆腐皮,口感筋道,搭配特制调料,香味四溢,是健康美味的凉菜选择。",11,"元/份"));
}else if(position==13){
list.add(new FoodInfo(104, R.drawable.fourteen1,"滑嫩可口,汤汁鲜美,品味传统杭州美味。","西湖牛肉羹选用嫩牛肉,搭配时令蔬菜,口感滑嫩,汤汁鲜美,是杭州传统名菜。",60,"元/份"));
list.add(new FoodInfo(105, R.drawable.fourteen2,"清爽解腻,味道鲜美,家常汤品好选择。","紫菜蛋花汤选用优质紫菜和新鲜鸡蛋,口感清爽,味道鲜美,是家常餐桌上的必备汤品。",13,"元/份"));
list.add(new FoodInfo(106, R.drawable.fourteen3,"甜润可口,滋补养颜,女性养颜佳品。","银耳莲子羹选用银耳和莲子,口感甜润,具有滋补养颜的功效,是女性养颜的佳品。",28,"元/份"));
list.add(new FoodInfo(107, R.drawable.fourteen4,"酸辣适中,口感浓郁,开胃提神好汤品。","酸辣汤选用多种食材,口感酸辣浓郁,既开胃又提神,是冬季暖身的好选择。",23,"元/份"));
list.add(new FoodInfo(108, R.drawable.fourteen5,"口感细腻,香甜可口,南瓜美味新体验。","南瓜羹选用新鲜南瓜,口感细腻,香甜可口,是南瓜美味的新体验,适合各类人群品尝。",10,"元/份"));
list.add(new FoodInfo(109, R.drawable.fourteen6,"清爽解暑,口感鲜甜,夏日消暑好汤品。","冬瓜薏米汤选用冬瓜和薏米,口感清爽鲜甜,具有消暑利湿的功效,是夏日消暑的好选择。",10,"元/份"));
list.add(new FoodInfo(110, R.drawable.fourteen7,"汤鲜味美,营养丰富,家常滋补好汤品。","豆腐鲫鱼汤选用新鲜鲫鱼和嫩豆腐,口感鲜美,营养丰富,是家常滋补的好选择。",33,"元/份"));
list.add(new FoodInfo(111, R.drawable.fourteen8,"口感醇厚,滋补养生,传统中式汤品。","四神汤选用淮山、芡实、莲子、茯苓四种食材,口感醇厚,具有滋补养生的功效,是传统中式汤品的代表。",32,"元/份"));
}else if(position==14){
list.add(new FoodInfo(112, R.drawable.fifteen1,"外酥内软,口感层次分明,法式风情尽在口中。","法式长棍外皮金黄酥脆,内部柔软有弹性,每一口都能感受到丰富的口感层次。",27,"元/根"));
list.add(new FoodInfo(113, R.drawable.fifteen2,"健康全麦,口感扎实,早餐首选。","全麦吐司选用优质全麦粉制作,口感扎实,富含纤维,是健康早餐的不二之选。",14,"元/袋"));
list.add(new FoodInfo(114, R.drawable.fifteen3,"柔软香甜,馅料丰富,欧式风情美味。","软欧包外皮柔软,内馅丰富多样,口感香甜,让人回味无穷。",19,"元/个"));
list.add(new FoodInfo(115, R.drawable.fifteen4,"咸甜适中,口感松软,肉松爱好者必尝。","肉松面包外皮松软,内馅咸甜适中的肉松,口感丰富,是肉松爱好者的首选。",7,"元/个"));
list.add(new FoodInfo(116, R.drawable.fifteen5,"香甜可口,提子干点缀,口感更佳。","提子干面包中镶嵌着香甜的提子干,口感丰富,每一口都充满了甜蜜。",17,"元/个"));
list.add(new FoodInfo(117, R.drawable.fifteen6,"椰香四溢,口感酥脆,热带风情味蕾享。","椰蓉面包外层撒满椰蓉,口感酥脆,充满浓郁的椰香,让人仿佛置身于热带。",16,"元/个"));
list.add(new FoodInfo(118, R.drawable.fifteen7,"巧克力浓郁,口感香甜,甜食爱好者的福音。","巧克力面包内馅巧克力浓郁,口感香甜,是甜食爱好者不可错过的美味。",21,"元/个"));
list.add(new FoodInfo(119, R.drawable.fifteen8,"黑芝麻香浓,口感醇厚,营养又美味。","黑芝麻面包选用优质黑芝麻,口感醇厚,香浓四溢,是营养又美味的面包佳品。",11,"元/个"));
}else{
list.add(new FoodInfo(120, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!","口味:甜 场地:湖南",10,"元/斤"));
list.add(new FoodInfo(121, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!","口味:甜 场地:湖南",10,"元/斤"));
list.add(new FoodInfo(122, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!","口味:甜 场地:湖南",10,"元/斤"));
list.add(new FoodInfo(123, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!","口味:甜 场地:湖南",10,"元/斤"));
list.add(new FoodInfo(124, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!","口味:甜 场地:湖南",10,"元/斤"));
list.add(new FoodInfo(125, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!","口味:甜 场地:湖南",10,"元/斤"));
list.add(new FoodInfo(126, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!","口味:甜 场地:湖南",10,"元/斤"));
list.add(new FoodInfo(127, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!","口味:甜 场地:湖南",10,"元/斤"));
}
return list;
}
}

@ -0,0 +1,69 @@
package com.example.deliciousfoodapp.entity;
import java.io.Serializable;
public class FoodInfo implements Serializable {
private int food_id;
private int food_img;
private String food_title;
private String food_details;
private int food_price;
private String food_next;
public FoodInfo(int food_id, int food_img, String food_title, String food_details, int food_price,String food_next) {
this.food_id = food_id;
this.food_img = food_img;
this.food_title = food_title;
this.food_details = food_details;
this.food_price = food_price;
this.food_next = food_next;
}
public int getFood_id() {
return food_id;
}
public void setFood_id(int food_id) {
this.food_id = food_id;
}
public int getFood_img() {
return food_img;
}
public void setFood_img(int food_img) {
this.food_img = food_img;
}
public String getFood_title() {
return food_title;
}
public void setFood_title(String food_title) {
this.food_title = food_title;
}
public String getFood_details() {
return food_details;
}
public void setFood_details(String food_details) {
this.food_details = food_details;
}
public int getFood_price() {
return food_price;
}
public void setFood_price(int food_price) {
this.food_price = food_price;
}
public String getFood_next() {
return food_next;
}
public void setFood_next(String food_next) {
this.food_next = food_next;
}
}

@ -0,0 +1,101 @@
package com.example.deliciousfoodapp.entity;
public class UserInfo {
private int user_id;
private String username;
private String password;
private String surepassword;
private String phone;
private String email;
private String address;
private String gender;
private String taste;
public static UserInfo sUserInfo;
public static UserInfo getUserInfo(){
return sUserInfo;
}
public UserInfo(int user_id, String username, String password,String surepassword,String phone,String email,String address,String gender,String taste) {
this.user_id = user_id;
this.username = username;
this.password = password;
this.surepassword = surepassword;
this.phone = phone;
this.email = email;
this.address = address;
this.gender = gender;
this.taste = taste;
}
public int getUser_id() {
return user_id;
}
public void setUser_id(int user_id) {
this.user_id = user_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 getSurepassword() {
return surepassword;
}
public void setSurepassword(String surepassword) {
this.surepassword = surepassword;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String adress) {
this.address = adress;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getTaste() {
return taste;
}
public void setTaste(String taste) {
this.taste = taste;
}
}

@ -0,0 +1,102 @@
package com.example.deliciousfoodapp;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import com.example.deliciousfoodapp.R;
import com.example.deliciousfoodapp.adapter.FoodLeftAdapter;
import com.example.deliciousfoodapp.adapter.FoodRightAdapter;
import com.example.deliciousfoodapp.entity.FoodDataService;
import com.example.deliciousfoodapp.entity.FoodInfo;
import java.util.ArrayList;
import java.util.List;
public class foodFragment extends Fragment {
private View rootView;
private RecyclerView foodleftRecyclerView;
private RecyclerView foodrightRecyclerView;
private FoodLeftAdapter mLeftListAdapter;
private FoodRightAdapter mRightListAdapter;
private List<String> leftDataList=new ArrayList<>();
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
rootView=inflater.inflate(R.layout.fragment_food, container, false);
//初始化控件
foodleftRecyclerView=rootView.findViewById(R.id.foodleftRecyclerView);
foodrightRecyclerView=rootView.findViewById(R.id.foodrightRecyclerView);
return rootView;
}
@Override
public void onActivityCreated(@NonNull Bundle savedInstanceState){
super.onActivityCreated(savedInstanceState);
leftDataList.add("水果");
leftDataList.add("蔬菜");
leftDataList.add("肉类");
leftDataList.add("小吃");
leftDataList.add("甜点");
leftDataList.add("主食类");
leftDataList.add("面食");
leftDataList.add("海鲜");
leftDataList.add("炸鸡");
leftDataList.add("饮品");
leftDataList.add("早点");
leftDataList.add("土特产");
leftDataList.add("凉菜");
leftDataList.add("汤羹");
leftDataList.add("面包");
mLeftListAdapter=new FoodLeftAdapter(leftDataList);
foodleftRecyclerView.setAdapter(mLeftListAdapter);
mRightListAdapter=new FoodRightAdapter();
foodrightRecyclerView.setAdapter(mRightListAdapter);
//默认加载美食数据
mRightListAdapter.setListData(FoodDataService.getListData(0));
//recyclerview点击事件
mRightListAdapter.setOnItemClickListener(new FoodRightAdapter.onItemClickListener(){
@Override
public void onItemClick(FoodInfo foodInfo,int position){
//跳转传值
Intent intent=new Intent(getActivity(),ProductDetailsActivity.class);
//intent传递对象的时候实体类一定要FoodInfo implements Serializable
intent.putExtra("foodInfo",foodInfo);
startActivity(intent);
}
});
//recyclerview点击事件
mLeftListAdapter.setLeftListOnClickItemListener(new FoodLeftAdapter.LeftListOnClickItemListener() {
@Override
public void onItemClick(int position) {
//Toast.makeText(getActivity(),position+"----",Toast.LENGTH_SHORT).show();
mLeftListAdapter.setCurrentIndex(position);
//点击左侧分类就切换右侧的数据
mRightListAdapter.setListData(FoodDataService.getListData(position));
}
});
}
}

@ -0,0 +1,64 @@
package com.example.deliciousfoodapp;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class homeFragment extends Fragment {
private ListView mListView;
private HomeNewAdapter myAdapter;
private List<Map<String, Object>> datas = new ArrayList<>(); // 使用datas作为数据源
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_home, container, false);
initData(); // 使用datas作为数据源
mListView = view.findViewById(R.id.homelistview);
myAdapter = new HomeNewAdapter(datas, requireContext()); // 使用datas作为数据源
mListView.setAdapter(myAdapter);
return view;
}
// 自定义数据,也可以添加网络数据
private void initData() {
Map<String, Object> map = new HashMap<>();
map.put("img", R.drawable.one);
datas.add(map);
map = new HashMap<>();
map.put("img", R.drawable.two);
datas.add(map);
map = new HashMap<>();
map.put("img", R.drawable.three);
datas.add(map);
map = new HashMap<>();
map.put("img", R.drawable.four);
datas.add(map);
map = new HashMap<>();
map.put("img", R.drawable.five);
datas.add(map);
map = new HashMap<>();
map.put("img", R.drawable.six);
datas.add(map);
}
}

@ -0,0 +1,86 @@
package com.example.deliciousfoodapp;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.example.deliciousfoodapp.R;
public class personFragment extends Fragment {
TextView tv_username;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_person, container, false);
tv_username = view.findViewById(R.id.tv_username);
//退出登录
view.findViewById(R.id.exit).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(getContext())
.setTitle("温馨提示")
.setMessage("确定要退出登录吗?")
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 取消退出登录操作
}
})
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 退出登录的逻辑
getActivity().finish();
// 打开登录页面
Intent intent = new Intent(getActivity(), LoginActivity.class);
startActivity(intent);
}
})
.show();
}
});
//查看食谱
// view.findViewById(R.id.exit).setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
//
// }
// });
//
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// 设置用户数据
String username = getActivity().getIntent().getStringExtra("username");
if (username != null) {
// 设置用户名数据到tv_username位置
tv_username.setText(username);
}
}
}
// Button button = view.findViewById(R.id.exit); // 在fragment的布局中找到按钮
// button.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Intent intent = new Intent(getActivity(), LoginActivity.class); // 使用getActivity()获取当前fragment所在的activity
// startActivity(intent);
// }
// });

@ -0,0 +1,72 @@
package com.example.deliciousfoodapp.placeholder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Helper class for providing sample content for user interfaces created by
* Android template wizards.
* <p>
* TODO: Replace all uses of this class before publishing your app.
*/
public class PlaceholderContent {
/**
* An array of sample (placeholder) items.
*/
public static final List<PlaceholderItem> ITEMS = new ArrayList<PlaceholderItem>();
/**
* A map of sample (placeholder) items, by ID.
*/
public static final Map<String, PlaceholderItem> ITEM_MAP = new HashMap<String, PlaceholderItem>();
private static final int COUNT = 25;
static {
// Add some sample items.
for (int i = 1; i <= COUNT; i++) {
addItem(createPlaceholderItem(i));
}
}
private static void addItem(PlaceholderItem item) {
ITEMS.add(item);
ITEM_MAP.put(item.id, item);
}
private static PlaceholderItem createPlaceholderItem(int position) {
return new PlaceholderItem(String.valueOf(position), "Item " + position, makeDetails(position));
}
private static String makeDetails(int position) {
StringBuilder builder = new StringBuilder();
builder.append("Details about Item: ").append(position);
for (int i = 0; i < position; i++) {
builder.append("\nMore details information here.");
}
return builder.toString();
}
/**
* A placeholder item representing a piece of content.
*/
public static class PlaceholderItem {
public final String id;
public final String content;
public final String details;
public PlaceholderItem(String id, String content, String details) {
this.id = id;
this.content = content;
this.details = details;
}
@Override
public String toString() {
return content;
}
}
}

@ -0,0 +1,126 @@
package com.example.deliciousfoodapp;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import com.example.deliciousfoodapp.R;
import com.example.deliciousfoodapp.adapter.CarListAdapter;
import com.example.deliciousfoodapp.db.CarDbHelper;
import com.example.deliciousfoodapp.entity.CarInfo;
import java.util.List;
public class shopFragment extends Fragment {
private View rootview;
private RecyclerView recyclerView;
private TextView total;
private Button btn_total;
private CarListAdapter mCarListAdapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
rootview=inflater.inflate(R.layout.fragment_shop, container, false);
recyclerView=rootview.findViewById(R.id.recyclerView);
total=rootview.findViewById(R.id.total);
btn_total=rootview.findViewById(R.id.btn_total);
return rootview;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
//初始化mCarListAdapter
mCarListAdapter = new CarListAdapter();
//设置适配器
recyclerView.setAdapter(mCarListAdapter);
//recyclerView点击事件
mCarListAdapter.setOnItemClickListner(new CarListAdapter.onItemClickListener() {
@Override
public void onPlusOnClick(CarInfo carInfo, int position) {
//加
CarDbHelper.getInstance(getActivity()).updateProduct(carInfo.getCar_id(),carInfo);
loadData();
}
@Override
public void delOnClick(CarInfo carInfo, int position) {
new AlertDialog.Builder(getActivity())
.setTitle("温馨提示")
.setMessage("确认是否要删除商品")
.setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
CarDbHelper.getInstance(getActivity()).delete(carInfo.getCar_id()+"");
loadData();
}
})
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.show();
}
@Override
public void onSubTractOnClick(CarInfo carInfo, int position) {
//减
CarDbHelper.getInstance(getActivity()).subStartupdateProduct(carInfo.getCar_id(),carInfo);
loadData();
}
});
//结算点击事件
btn_total.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
loadData();
}
private void setTotalData(List<CarInfo> list){
int toTalCount=0;
for (int i= 0; i < list.size(); i++) {
int price=list.get(i).getProduct_price()*list.get(i).getProduct_count();
toTalCount=toTalCount+price;
}
//设置数据
total.setText(toTalCount+".00");
}
public void loadData(){
//获取数据,用户名写死
List<CarInfo> carList= CarDbHelper.getInstance(getActivity()).queryCarList("zsan");
//设置数据
mCarListAdapter.setCarInfoList(carList);
//计算总的价格
setTotalData(carList);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save