第五次实验代码

master
Cyh020229 2 years ago
parent 504ecf4489
commit 3a43575d36

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

@ -21,6 +21,7 @@
<activity android:name=".UserActivity" />
<activity android:name=".RegisterActivity"/>
<activity android:name=".CategoryActivity" />
<activity android:name=".IndexActivity" />
</application>
</manifest>

@ -8,10 +8,7 @@ import android.widget.ListView;
import androidx.annotation.Nullable;
import com.example.orangesale_02.R;
import com.example.orangesale_02.Adapter;
import com.example.orangesale_02.Product;
import com.example.orangesale_02.SetDetailFragment;
import com.example.orangesale_02.adapter.Adapter;
import java.math.BigDecimal;
import java.util.ArrayList;

@ -1,4 +1,4 @@
package com.example.orangesale_02.activity;
package com.example.orangesale_02;
import android.app.Activity;
import android.app.FragmentTransaction;
@ -9,7 +9,6 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.example.orangesale_02.R;
import com.example.orangesale_02.fragment.IndexFragment;
import com.example.orangesale_02.fragment.PearsonFragment;
import com.example.orangesale_02.fragment.ProductFragment;

@ -45,7 +45,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
if(validateLogin())
{
Intent intent1=new Intent(MainActivity.this,UserActivity.class);
Intent intent1=new Intent(MainActivity.this,IndexActivity.class);
Bundle bundle=new Bundle();
MyDatabaseHelper myDatabaseHelper=new MyDatabaseHelper(MainActivity.this);
bundle.putString("username",usernameText.getText().toString());

@ -1,4 +1,4 @@
package com.example.orangesale_02;
package com.example.orangesale_02.adapter;
import android.content.Context;
import android.graphics.Color;

@ -1,4 +1,4 @@
package com.example.orangesale_05.adapter;
package com.example.orangesale_02.adapter;
import android.content.Context;
import android.util.Log;
@ -9,8 +9,8 @@ import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.orangesale_05.R;
import com.example.orangesale_05.entity.Product;
import com.example.orangesale_02.R;
import com.example.orangesale_02.entity.Product;
import java.util.List;

@ -1,4 +1,4 @@
package com.example.orangesale_02;
package com.example.orangesale_02.entity;
public class OrangeUser {
private Integer id;

@ -1,4 +1,4 @@
package com.example.orangesale_05.entity;
package com.example.orangesale_02.entity;
import java.math.BigDecimal;

@ -1,4 +1,4 @@
package com.example.orangesale_05.fragment;
package com.example.orangesale_02.fragment;
import android.app.Fragment;
import android.os.Bundle;
@ -12,9 +12,9 @@ import android.widget.SearchView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.orangesale_05.R;
import com.example.orangesale_05.adapter.ProductAdapter;
import com.example.orangesale_05.entity.Product;
import com.example.orangesale_02.R;
import com.example.orangesale_02.adapter.ProductAdapter;
import com.example.orangesale_02.entity.Product;
import java.math.BigDecimal;
import java.util.ArrayList;
@ -75,28 +75,28 @@ public class IndexFragment extends Fragment implements View.OnClickListener {
private void initData() {
productList = new ArrayList<>();
Product product = new Product();
product.setImageUrlId(R.drawable.juzip);
product.setImageUrlId(R.drawable.orange);
product.setProductName("橘子");
product.setProductPrice(new BigDecimal("9.9"));
product.setProductPrice(new BigDecimal("29.9"));
Product product1 = new Product();
product1.setImageUrlId(R.drawable.orange);
product1.setProductName("橙子");
product1.setImageUrlId(R.drawable.pingguo);
product1.setProductName("苹果");
product1.setProductPrice(new BigDecimal("29.9"));
Product product2 = new Product();
product2.setImageUrlId(R.drawable.youzip);
product2.setProductName("子");
product2.setImageUrlId(R.drawable.chengzi);
product2.setProductName("子");
product2.setProductPrice(new BigDecimal("19.9"));
Product product3 = new Product();
product3.setImageUrlId(R.drawable.xiguap);
product3.setProductName("西瓜");
product3.setImageUrlId(R.drawable.youzi);
product3.setProductName("柚子");
product3.setProductPrice(new BigDecimal("19.9"));
Product product4 = new Product();
product4.setImageUrlId(R.drawable.applep);
product4.setProductName("苹果");
product4.setImageUrlId(R.drawable.taozi);
product4.setProductName("桃子");
product4.setProductPrice(new BigDecimal("49.9"));
Product product5 = new Product();
product5.setImageUrlId(R.drawable.lemonp);
product5.setProductName("柠檬");
product5.setImageUrlId(R.drawable.shali);
product5.setProductName("西瓜");
product5.setProductPrice(new BigDecimal("9.9"));
productList.add(product);
productList.add(product1);

@ -1,4 +1,4 @@
package com.example.orangesale_05.fragment;
package com.example.orangesale_02.fragment;
import android.app.Fragment;
import android.os.Bundle;
@ -12,7 +12,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.orangesale_05.R;
import com.example.orangesale_02.R;
public class PearsonFragment extends Fragment implements View.OnClickListener {
private ImageView userIconImage;

@ -1,4 +1,4 @@
package com.example.orangesale_05.fragment;
package com.example.orangesale_02.fragment;
import android.app.Fragment;
import android.os.Bundle;
@ -9,7 +9,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.orangesale_05.R;
import com.example.orangesale_02.R;
public class ProductFragment extends Fragment {
@Nullable

@ -1,4 +1,4 @@
package com.example.orangesale_05.fragment;
package com.example.orangesale_02.fragment;
import android.app.Fragment;
import android.os.Bundle;
@ -9,7 +9,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.orangesale_05.R;
import com.example.orangesale_02.R;
public class ShoppingCartFragment extends Fragment {
@Nullable

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,18 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
android:orientation="vertical"
tools:context=".IndexActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- <LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5">
</androidx.constraintlayout.widget.ConstraintLayout>
<include layout="@layout/content_user"/>
</LinearLayout>-->
<FrameLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<!--底部导航-->
<include layout="@layout/content_nav" />
</LinearLayout>
</LinearLayout>

@ -41,7 +41,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#FFEFA549">
>
<TextView
android:id="@+id/category_product_content"
android:layout_width="match_parent"
@ -92,7 +92,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#FFEFA549">
>
<TextView
android:id="@+id/category_product_content1"
android:layout_width="match_parent"

@ -2,14 +2,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E8E8E8"
android:background="#7EEDBF9B"
android:orientation="vertical">
<SearchView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/index_menu"
android:background="#EDBB64"
android:focusable="false"
android:iconifiedByDefault="false"
android:queryHint="请输入搜索内容" />
@ -20,12 +20,12 @@
android:layout_marginLeft="1dp"
android:layout_marginTop="20dp"
android:layout_marginRight="1dp"
android:background="@drawable/index_menu"
android:background="#EDBB64"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="122dp"
android:layout_marginTop="5dp"
android:orientation="horizontal">
@ -38,9 +38,9 @@
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/chengzi" />
android:layout_width="79dp"
android:layout_height="89dp"
android:src="@drawable/xuecheng" />
<TextView
android:layout_width="wrap_content"
@ -60,9 +60,9 @@
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/youzi" />
android:layout_width="76dp"
android:layout_height="87dp"
android:src="@drawable/wendanyou" />
<TextView
android:layout_width="wrap_content"
@ -82,9 +82,9 @@
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/juzi" />
android:layout_width="77dp"
android:layout_height="89dp"
android:src="@drawable/orange" />
<TextView
android:layout_width="wrap_content"
@ -104,9 +104,9 @@
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/xigua" />
android:layout_width="80dp"
android:layout_height="87dp"
android:src="@drawable/shali" />
<TextView
android:layout_width="wrap_content"
@ -134,9 +134,9 @@
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/li" />
android:layout_width="77dp"
android:layout_height="82dp"
android:src="@drawable/shali" />
<TextView
android:layout_width="wrap_content"
@ -156,9 +156,9 @@
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/apple" />
android:layout_width="76dp"
android:layout_height="82dp"
android:src="@drawable/pingguo" />
<TextView
android:layout_width="wrap_content"
@ -178,15 +178,15 @@
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/lemon" />
android:layout_width="102dp"
android:layout_height="78dp"
android:src="@drawable/putao" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="柠檬"
android:text="putao"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
@ -200,22 +200,22 @@
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mangguo" />
android:layout_width="74dp"
android:layout_height="82dp"
android:src="@drawable/taozi" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="芒果"
android:text="桃子"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<include layout="@layout/index_famous"/>
<include layout="@layout/index_famous" />
</LinearLayout>

@ -2,7 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
android:orientation="horizontal"
android:background="#EDBB64">
<!--首页-->
<LinearLayout
@ -25,7 +26,7 @@
android:layout_gravity="center"
android:text="首页"
android:textColor="#000"
android:textSize="18sp" />
android:textSize="12sp" />
</LinearLayout>
<!--间隔线-->
<ImageView
@ -53,7 +54,7 @@
android:layout_gravity="center"
android:text="商品"
android:textColor="#000"
android:textSize="18sp" />
android:textSize="12sp" />
</LinearLayout>
<!--间隔线-->
@ -82,7 +83,7 @@
android:layout_gravity="center"
android:text="购物车"
android:textColor="#000"
android:textSize="18sp" />
android:textSize="12sp" />
</LinearLayout>
<!--间隔线-->
@ -112,7 +113,7 @@
android:layout_gravity="center"
android:text="我"
android:textColor="#000"
android:textSize="18sp" />
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>

@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#7EEDBF9B"
android:layout_marginTop="15dp"
android:orientation="vertical">
@ -11,7 +12,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#FFF"
android:background="#EDBB64"
android:orientation="horizontal">
<TextView
@ -45,7 +46,7 @@
android:id="@+id/index_famous_gridview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E8E8E8"
android:background="#7EEDBF9B"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:numColumns="2" />

Loading…
Cancel
Save