diff --git a/DeliciousFoodApp--杨松林第四次实验代码/.gitignore b/DeliciousFoodApp--杨松林第四次实验代码/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/.gitignore @@ -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 diff --git a/DeliciousFoodApp--杨松林第四次实验代码/.idea/.gitignore b/DeliciousFoodApp--杨松林第四次实验代码/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/DeliciousFoodApp--杨松林第四次实验代码/.idea/compiler.xml b/DeliciousFoodApp--杨松林第四次实验代码/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/.idea/deploymentTargetDropDown.xml b/DeliciousFoodApp--杨松林第四次实验代码/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..97082be --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/.idea/gradle.xml b/DeliciousFoodApp--杨松林第四次实验代码/.idea/gradle.xml new file mode 100644 index 0000000..0897082 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/.idea/migrations.xml b/DeliciousFoodApp--杨松林第四次实验代码/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/.idea/misc.xml b/DeliciousFoodApp--杨松林第四次实验代码/.idea/misc.xml new file mode 100644 index 0000000..9ae8e9f --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/.idea/misc.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/.gitignore b/DeliciousFoodApp--杨松林第四次实验代码/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/build.gradle.kts b/DeliciousFoodApp--杨松林第四次实验代码/app/build.gradle.kts new file mode 100644 index 0000000..e131386 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/build.gradle.kts @@ -0,0 +1,45 @@ +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) + testImplementation(libs.junit) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.espresso.core) +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/proguard-rules.pro b/DeliciousFoodApp--杨松林第四次实验代码/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/androidTest/java/com/example/deliciousfoodapp/ExampleInstrumentedTest.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/androidTest/java/com/example/deliciousfoodapp/ExampleInstrumentedTest.java new file mode 100644 index 0000000..bbb5b6a --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/androidTest/java/com/example/deliciousfoodapp/ExampleInstrumentedTest.java @@ -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 Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.example.deliciousfoodapp", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/AndroidManifest.xml b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..e8f5dc2 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/AndroidManifest.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/HomeMyAdapter.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/HomeMyAdapter.java new file mode 100644 index 0000000..23b0e91 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/HomeMyAdapter.java @@ -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> datas; + private Context mContext; + + public HomeMyAdapter(List> 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; + } + +} diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/HomeNewAdapter.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/HomeNewAdapter.java new file mode 100644 index 0000000..6d8a4cd --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/HomeNewAdapter.java @@ -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> datas; + Context mContext; + HomeNewAdapter(List> 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; + } +} + diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/IndexActivity.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/IndexActivity.java new file mode 100644 index 0000000..7c6b6d9 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/IndexActivity.java @@ -0,0 +1,53 @@ +package com.example.deliciousfoodapp; + +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; + +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); + replaceFragment(new homeFragment()); + } + @Override + public void onClick(View v) { + switch (v.getId()){ + case R.id.home: + replaceFragment(new homeFragment()); + break; + case R.id.food: + replaceFragment(new foodFragment()); + break; + case R.id.shopping: + replaceFragment(new shopFragment()); + break; + case 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(); + } +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/LoginActivity.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/LoginActivity.java new file mode 100644 index 0000000..dc910a9 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/LoginActivity.java @@ -0,0 +1,43 @@ +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 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 = (Button) findViewById(R.id.buttonlogin); + Button button2 = (Button) findViewById(R.id.buttonregister); + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(LoginActivity.this, IndexActivity.class); + startActivity(intent); + } + }); + button2.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent=new Intent(LoginActivity.this, RegisterActivity.class); + startActivity(intent); + } + }); + } +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/MainActivity.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/MainActivity.java new file mode 100644 index 0000000..22e6daf --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/MainActivity.java @@ -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); + } + }); + } +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/RegisterActivity.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/RegisterActivity.java new file mode 100644 index 0000000..6ee2d42 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/RegisterActivity.java @@ -0,0 +1,98 @@ +package com.example.deliciousfoodapp; + +import android.content.Intent; +import android.os.Bundle; +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 androidx.appcompat.app.AppCompatActivity; +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(); + } + + 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); + } + } + + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + //根据用户选择来改变sex_str的值 + genderRadioGroup_str = checkedId == R.id.maleRadioButton ? "男性" : "女性"; + } + +} diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/RegisterinformationActivity.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/RegisterinformationActivity.java new file mode 100644 index 0000000..a822a7a --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/RegisterinformationActivity.java @@ -0,0 +1,60 @@ +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(); + } + }); + } +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/adapter/FoodLeftAdapter.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/adapter/FoodLeftAdapter.java new file mode 100644 index 0000000..bdb70ef --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/adapter/FoodLeftAdapter.java @@ -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 { + private ListdataList=new ArrayList<>(); + private int currentIndex=0; + public FoodLeftAdapter(List 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();//刷新一下 + } +} diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/adapter/FoodRightAdapter.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/adapter/FoodRightAdapter.java new file mode 100644 index 0000000..8422553 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/adapter/FoodRightAdapter.java @@ -0,0 +1,68 @@ +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 { + private List mFoodInfos=new ArrayList<>(); + + public void setListData(List 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()); + } + + @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); + } + } +} diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/entity/FoodDataService.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/entity/FoodDataService.java new file mode 100644 index 0000000..b332fbc --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/entity/FoodDataService.java @@ -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 getListData(int position){ + List list=new ArrayList<>(); + if(position==0){ + list.add(new FoodInfo(0, R.drawable.grapefruit,"天然清爽,健康选择。","酸甜可口,带有清新的果香,满足你对健康生活的追求。",12,"元/斤")); + list.add(new FoodInfo(1, R.drawable.dragonfruit,"独特魅力,色彩斑斓。","口感清爽,果肉细腻,多汁爽口,是时尚人士的首选。",15,"元/斤")); + list.add(new FoodInfo(2, R.drawable.hamimelon,"果香四溢,甜蜜滋味。","水分丰富,果肉细腻,口感清甜,让你尽情享受夏日的清凉。",14,"元/斤")); + list.add(new FoodInfo(3, R.drawable.pineapple,"酸甜可口,果香扑鼻。","口感丰富,多汁爽口,富含维生素C,是夏日解暑的最佳选择。",8,"元/斤")); + list.add(new FoodInfo(4, R.drawable.cherry,"美味小巧,诱人色泽。","果肉鲜嫩,酸甜可口,口感丰富,是爱情的象征。",46,"元/1斤")); + list.add(new FoodInfo(5, R.drawable.lemon,"清新怡人,酸甜可口。","富含维生素C,口感鲜爽,可制作饮料或调味料,增添生活情趣。",13,"元/斤")); + list.add(new FoodInfo(6, R.drawable.starfruit,"果肉细腻,香甜可口。","鲜红诱人,汁水丰富,口感浓郁,是夏日水果中的佳品。",36,"元/斤")); + list.add(new FoodInfo(7, R.drawable.sweetcherry,"明星风采,独特风味。","口感清爽,果肉多汁,味道独特,富含维生素C,让你倍感清新。",10,"元/斤")); + }else if(position==1){ + list.add(new FoodInfo(8, R.drawable.one,"新鲜炒酱、烹饪必备。","汁水丰富,口感鲜甜,色泽鲜艳,是健康餐桌上的明星。",6,"元/斤")); + list.add(new FoodInfo(9, R.drawable.three,"凉拌、生吃首选。","口感清脆,汁水丰富,清凉解暑,是夏日的必备蔬菜。",3,"元/斤")); + list.add(new FoodInfo(10, R.drawable.one,"蔬菜沙拉、炖汤佳品。","口感甘甜,营养丰富,富含胡萝卜素,有益眼睛健康。",5,"元/斤")); + list.add(new FoodInfo(11, R.drawable.three,"清炒、煮汤、火锅必备。","叶片脆嫩,汁水鲜甜,营养丰富,是家常菜的主角。",2,"元/斤")); + list.add(new FoodInfo(12, R.drawable.one,"烧茄子、酱茄子、烤茄子。","肉质细嫩,口感鲜美,烹饪多样,满足不同口味需求。",4,"元/斤")); + list.add(new FoodInfo(13, R.drawable.three,"炒菜、凉拌、烧烤。","口感爽脆,香气诱人,是各类菜肴的调味佳品。",3,"元/斤")); + list.add(new FoodInfo(14, R.drawable.mango,"汆、炒、煮皆宜。","叶片嫩绿,口感爽滑,富含维生素C,有益健康。",7,"元/斤")); + list.add(new FoodInfo(15, R.drawable.two,"炖、煮、炸、烤皆可。","口感绵软,味道浓郁,是各类美食的基础材料。",3,"元/斤")); + }else if(position==2){ + list.add(new FoodInfo(16, R.drawable.one,"澳洲和牛,口感细腻,肉香四溢,尽享尊贵美味。","肉质鲜嫩多汁,口感柔滑,带有淡淡的奶香,令人回味无穷。",100,"元/斤")); + list.add(new FoodInfo(17, R.drawable.three,"黑山猪肉,肉质鲜美,口感醇厚,健康又美味。","肉质紧实,口感鲜美,带有淡淡的甜香,是烹饪佳肴的绝佳选择。",200,"元/斤")); + list.add(new FoodInfo(18, R.drawable.one,"新疆羊肉,肉质鲜嫩,口感独特,草原风情尽在其中。","羊肉鲜美无膻,口感细腻,带有一种独特的草原香气,令人陶醉。",90,"元/斤")); + list.add(new FoodInfo(19, R.drawable.three,"山林散养鸡,肉质紧实,口感鲜美,营养又健康。","鸡肉鲜美多汁,口感滑嫩,带有山林的自然清香,是健康饮食的首选。",120,"元/斤")); + list.add(new FoodInfo(20, R.drawable.one,"深海金枪鱼,肉质细腻,口感鲜美,海洋馈赠的珍品。","鱼肉鲜嫩爽滑,口感鲜美,带有淡淡的海洋气息,令人流连忘返。",300,"元/斤")); + list.add(new FoodInfo(21, R.drawable.three,"金华火腿,口感醇香,肉质鲜美,烹饪佳品不容错过。","金华火腿,口感醇香,肉质鲜美,烹饪佳品不容错过。",260,"元/斤")); + list.add(new FoodInfo(22, R.drawable.mango,"炭烤羊排,外酥里嫩,香气四溢,烧烤美味尽在其中。","羊排经过炭火慢烤,外酥里嫩,口感鲜美,香气扑鼻,是烧烤爱好者的最爱。",280,"元/斤")); + list.add(new FoodInfo(23, R.drawable.two,"香煎培根,口感香脆,肉质鲜美,美味早餐的不二之选。","培根经过香煎,口感香脆,肉质鲜美,搭配面包或鸡蛋食用更佳。",166,"元/斤")); + }else if(position==3){ + list.add(new FoodInfo(24, R.drawable.one,"皮薄馅足,汤汁鲜美,品尝传统小吃之经典。","小笼包皮薄如纸,内馅鲜嫩多汁,轻咬一口,汤汁四溢,口感细腻。",15,"元/笼")); + list.add(new FoodInfo(25, R.drawable.three,"香脆可口,馅料丰富,街头小吃之首选。","煎饼果子外皮金黄酥脆,内馅饱满,口感层次丰富,是早餐或夜宵的绝佳选择。",10,"元/个")); + list.add(new FoodInfo(26, R.drawable.one,"外酥里嫩,气味独特,挑战味蕾的臭豆腐。","臭豆腐经过特殊发酵,外皮酥脆,内里嫩滑,口感独特,是喜欢尝试不同风味食客的选择。",16,"元/份")); + list.add(new FoodInfo(27, R.drawable.three,"肉质鲜嫩,香气扑鼻,烧烤小吃的代表之作。","羊肉串选用优质羊肉,经过精心烤制,肉质鲜嫩多汁,香气四溢,是烧烤爱好者的最爱。",2,"元/串")); + list.add(new FoodInfo(28, R.drawable.one,"麻辣鲜香,食材丰富,味蕾的麻辣盛宴。","麻辣烫选用多种食材,搭配麻辣底料,口感麻辣鲜香,让人回味无穷,是喜欢辣味食客的不二之选。",30,"元/份")); + list.add(new FoodInfo(29, R.drawable.three,"甜而不腻,外酥内软,传统甜点的魅力所在。","糖油粑粑外皮酥脆,内里软糯,甜度适中,口感丰富,是喜欢甜食者的心头好。",8,"元/个")); + list.add(new FoodInfo(30, R.drawable.mango,"冷面筋道,酱料浓郁,街头巷尾的美食佳品。","烤冷面选用优质冷面,搭配特制酱料,口感筋道爽滑,酱香四溢,是夜市小吃的一大特色。",10,"元/份")); + list.add(new FoodInfo(31, R.drawable.two,"酸辣可口,粉质滑嫩,开胃解馋的小吃之选。","酸辣粉选用优质红薯粉,搭配酸辣汤汁,口感滑嫩爽口,酸辣适中,是开胃解馋的绝佳小吃。",12,"元/碗")); + }else if(position==4){ + list.add(new FoodInfo(32, R.drawable.one,"酸辣粉选用优质红薯粉,搭配酸辣汤汁,口感滑嫩爽口,酸辣适中,是开胃解馋的绝佳小吃。","慕斯蛋糕口感轻盈,入口即化,搭配丰富的水果和果酱,层次丰富,甜而不腻。",20,"元/块")); + list.add(new FoodInfo(33, R.drawable.three,"咖啡香浓,口感丰富,传统意式甜点的经典之作。","提拉米苏融合了咖啡的苦涩、可可的浓郁和奶油的绵密,口感层次丰富,令人回味无穷。",20,"元/份")); + list.add(new FoodInfo(34, R.drawable.one,"巧克力浓郁,口感醇厚,满足巧克力控的味蕾。","黑森林蛋糕外层覆盖着浓郁的巧克力,内里则是松软的蛋糕和酸甜的樱桃,口感丰富,甜而不腻。",35,"元/块")); + list.add(new FoodInfo(35, R.drawable.three,"色彩缤纷,口感酥脆,法式甜点的精致之选。","马卡龙外壳酥脆,内里柔软,色彩缤纷,口感轻盈,是下午茶时光的绝佳伴侣。",9,"元/个")); + list.add(new FoodInfo(36, R.drawable.one,"榴莲飘香,口感滑嫩,热带风味的甜品盛宴。","榴莲班戟外皮薄脆,内馅是浓郁的榴莲肉,口感滑嫩,香气四溢,是榴莲爱好者的最爱。",20,"元/个")); + list.add(new FoodInfo(37, R.drawable.three,"芒果香甜,口感嫩滑,夏日清凉的甜品佳品。","芒果布丁以新鲜芒果为原料,口感嫩滑,芒果的香甜与布丁的细腻完美结合,是夏日消暑的绝佳选择。",16,"元/杯")); + list.add(new FoodInfo(38, R.drawable.mango,"焦糖香浓,口感细腻,传统英式甜点的魅力所在。","焦糖炖蛋口感柔滑,焦糖的香甜与蛋液的细腻完美结合,入口即化,是甜品爱好者的不二之选。",15,"元/份")); + list.add(new FoodInfo(39, R.drawable.two,"芒果清爽,口感丰富,夏日解暑的甜品之选。","杨枝甘露以芒果、西柚等水果为主料,口感清爽,酸甜适中,是夏日消暑、解渴的绝佳甜品。",18,"元/碗")); + }else if(position==5){ + list.add(new FoodInfo(40, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(41, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(42, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(43, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(44, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(45, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(46, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(47, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + }else if(position==6){ + list.add(new FoodInfo(48, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(49, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(50, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(51, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(52, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(53, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(54, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(55, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + }else if(position==7){ + list.add(new FoodInfo(56, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(57, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(58, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(59, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(60, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(61, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(62, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(63, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + }else if(position==8){ + list.add(new FoodInfo(64, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(65, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(66, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(67, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(68, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(69, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(70, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(71, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + }else if(position==9){ + list.add(new FoodInfo(72, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(73, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(74, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(75, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(76, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(77, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(78, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(79, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",1,"元/1斤")); + }else if(position==10){ + list.add(new FoodInfo(80, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(81, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(82, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(83, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(84, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(85, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(86, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(87, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + }else if(position==11){ + list.add(new FoodInfo(88, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(89, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(90, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(91, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(92, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(93, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(94, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(95, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + }else if(position==12){ + list.add(new FoodInfo(96, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(97, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(98, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(99, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(100, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(101, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(102, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(103, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + }else if(position==13){ + list.add(new FoodInfo(104, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(105, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(106, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(107, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(108, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(109, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(110, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(111, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + }else if(position==14){ + list.add(new FoodInfo(112, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(113, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(114, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(115, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(116, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(117, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(118, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(119, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + }else{ + list.add(new FoodInfo(120, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(121, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(122, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(123, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(124, R.drawable.one,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(125, R.drawable.three,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(126, R.drawable.mango,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + list.add(new FoodInfo(127, R.drawable.two,"尝尝我们的招牌牛肉面,每一口都是对味蕾的极致诱惑!新鲜的牛肉片搭配着细腻的面条,汤汁鲜美浓郁,回味无穷。","口味:甜 场地:湖南",10,"元/1斤")); + } + return list; + } +} diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/entity/FoodInfo.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/entity/FoodInfo.java new file mode 100644 index 0000000..ebd512a --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/entity/FoodInfo.java @@ -0,0 +1,67 @@ +package com.example.deliciousfoodapp.entity; + +public class FoodInfo { + 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; + } +} diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/foodFragment.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/foodFragment.java new file mode 100644 index 0000000..15a7c98 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/foodFragment.java @@ -0,0 +1,81 @@ +package com.example.deliciousfoodapp; + +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.adapter.FoodLeftAdapter; +import com.example.deliciousfoodapp.adapter.FoodRightAdapter; +import com.example.deliciousfoodapp.entity.FoodDataService; + +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 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点击事件 + 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)); + } + }); + } +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/homeFragment.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/homeFragment.java new file mode 100644 index 0000000..4c817c2 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/homeFragment.java @@ -0,0 +1,67 @@ +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 com.example.deliciousfoodapp.R; +import com.example.deliciousfoodapp.HomeNewAdapter; + +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> list = new ArrayList<>(); + + @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(); + + mListView = view.findViewById(R.id.homelistview); + myAdapter = new HomeNewAdapter(list, requireContext()); + mListView.setAdapter(myAdapter); + + return view; + } + + // 自定义数据,也可以添加网络数据 + private void initData() { + Map map = new HashMap<>(); + map.put("img", R.drawable.one); + list.add(map); + + map = new HashMap<>(); + map.put("img", R.drawable.two); + list.add(map); + + map = new HashMap<>(); + map.put("img", R.drawable.three); + list.add(map); + + map = new HashMap<>(); + map.put("img", R.drawable.four); + list.add(map); + + map = new HashMap<>(); + map.put("img", R.drawable.five); + list.add(map); + + map = new HashMap<>(); + map.put("img", R.drawable.six); + list.add(map); + } +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/personFragment.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/personFragment.java new file mode 100644 index 0000000..bf28900 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/personFragment.java @@ -0,0 +1,28 @@ +package com.example.deliciousfoodapp; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.fragment.app.Fragment; + +import com.example.deliciousfoodapp.R; + + +public class personFragment extends Fragment { + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + + return inflater.inflate(R.layout.fragment_person, container, false); + } +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/placeholder/PlaceholderContent.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/placeholder/PlaceholderContent.java new file mode 100644 index 0000000..b67302f --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/placeholder/PlaceholderContent.java @@ -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. + *

+ * TODO: Replace all uses of this class before publishing your app. + */ +public class PlaceholderContent { + + /** + * An array of sample (placeholder) items. + */ + public static final List ITEMS = new ArrayList(); + + /** + * A map of sample (placeholder) items, by ID. + */ + public static final Map ITEM_MAP = new HashMap(); + + 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; + } + } +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/shopFragment.java b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/shopFragment.java new file mode 100644 index 0000000..bee3757 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/java/com/example/deliciousfoodapp/shopFragment.java @@ -0,0 +1,27 @@ +package com.example.deliciousfoodapp; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.fragment.app.Fragment; + +import com.example.deliciousfoodapp.R; + + +public class shopFragment extends Fragment { + + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + return inflater.inflate(R.layout.fragment_shop, container, false); + } +} \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/bg.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/bg.jpg new file mode 100644 index 0000000..41df2a3 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/bg.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/bg2.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/bg2.jpg new file mode 100644 index 0000000..1c744ff Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/bg2.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/cherry.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/cherry.png new file mode 100644 index 0000000..4ee2ef0 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/cherry.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/dragonfruit.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/dragonfruit.png new file mode 100644 index 0000000..0d3def7 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/dragonfruit.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/edittext_border.xml b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/edittext_border.xml new file mode 100644 index 0000000..1631c3d --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/edittext_border.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/five.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/five.jpg new file mode 100644 index 0000000..0524eb3 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/five.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/food.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/food.png new file mode 100644 index 0000000..07026cd Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/food.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/four.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/four.jpg new file mode 100644 index 0000000..00f77f4 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/four.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/gd1.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/gd1.png new file mode 100644 index 0000000..8086548 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/gd1.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/gd2.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/gd2.png new file mode 100644 index 0000000..3db29d7 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/gd2.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/grapefruit.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/grapefruit.png new file mode 100644 index 0000000..4bdc064 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/grapefruit.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/hamimelon.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/hamimelon.png new file mode 100644 index 0000000..86b6a45 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/hamimelon.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/home.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/home.png new file mode 100644 index 0000000..afd6af2 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/home.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/ic_launcher_background.xml b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/ic_launcher_foreground.xml b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/icecream.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/icecream.jpg new file mode 100644 index 0000000..480213f Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/icecream.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/information.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/information.jpg new file mode 100644 index 0000000..a4c2d58 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/information.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/jiancan.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/jiancan.png new file mode 100644 index 0000000..509bd68 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/jiancan.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/lemon.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/lemon.png new file mode 100644 index 0000000..ccbef74 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/lemon.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/mango.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/mango.jpg new file mode 100644 index 0000000..23fe438 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/mango.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/mb.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/mb.png new file mode 100644 index 0000000..aa8a425 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/mb.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/meishi.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/meishi.jpg new file mode 100644 index 0000000..72ce8c5 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/meishi.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/mlt.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/mlt.png new file mode 100644 index 0000000..150b57b Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/mlt.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/money.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/money.png new file mode 100644 index 0000000..8efdee3 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/money.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/money2.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/money2.png new file mode 100644 index 0000000..1c80f94 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/money2.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/more.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/more.png new file mode 100644 index 0000000..c68b765 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/more.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/ms.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/ms.png new file mode 100644 index 0000000..7125d11 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/ms.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/noodles.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/noodles.jpg new file mode 100644 index 0000000..bc28d95 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/noodles.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/one.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/one.jpg new file mode 100644 index 0000000..4e2ab58 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/one.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/password.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/password.png new file mode 100644 index 0000000..ab143ef Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/password.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/person.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/person.png new file mode 100644 index 0000000..782c6b9 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/person.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/pineapple.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/pineapple.png new file mode 100644 index 0000000..049a232 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/pineapple.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/pj.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/pj.png new file mode 100644 index 0000000..0457862 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/pj.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/qq.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/qq.jpg new file mode 100644 index 0000000..7d43729 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/qq.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/register.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/register.jpg new file mode 100644 index 0000000..9c1808e Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/register.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/rl.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/rl.png new file mode 100644 index 0000000..5c6da04 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/rl.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/seven.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/seven.jpg new file mode 100644 index 0000000..1f55564 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/seven.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/shopping.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/shopping.png new file mode 100644 index 0000000..ad037aa Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/shopping.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/six.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/six.jpg new file mode 100644 index 0000000..c922835 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/six.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/sk.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/sk.png new file mode 100644 index 0000000..8dc68dd Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/sk.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/starfruit.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/starfruit.png new file mode 100644 index 0000000..e033ad9 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/starfruit.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/sweetcherry.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/sweetcherry.png new file mode 100644 index 0000000..a368ec5 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/sweetcherry.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/td.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/td.png new file mode 100644 index 0000000..b66f984 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/td.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/three.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/three.jpg new file mode 100644 index 0000000..66783b0 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/three.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/title.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/title.jpg new file mode 100644 index 0000000..d2a9fb5 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/title.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/two.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/two.jpg new file mode 100644 index 0000000..5bcc909 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/two.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/type_selector_bg.xml b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/type_selector_bg.xml new file mode 100644 index 0000000..a99544e --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/type_selector_bg.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/user.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/user.png new file mode 100644 index 0000000..b1b6038 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/user.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/weibo.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/weibo.jpg new file mode 100644 index 0000000..48ed66b Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/weibo.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/weichat.jpg b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/weichat.jpg new file mode 100644 index 0000000..9e7948d Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/weichat.jpg differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/xx.png b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/xx.png new file mode 100644 index 0000000..5f4d7d0 Binary files /dev/null and b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/drawable/xx.png differ diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/layout/activity_index.xml b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/layout/activity_index.xml new file mode 100644 index 0000000..0a25b71 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/layout/activity_index.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/layout/activity_login.xml b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/layout/activity_login.xml new file mode 100644 index 0000000..3bccdf1 --- /dev/null +++ b/DeliciousFoodApp--杨松林第四次实验代码/app/src/main/res/layout/activity_login.xml @@ -0,0 +1,184 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +