From d5e8180cb3e9948db66abe8286c91363437553b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Wed, 20 Mar 2024 15:27:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=BB=91=E5=AE=9A=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HBL/Communication/WeightHelper.java | 2 +- .../java/com/bpa/scalage/MainActivity.java | 1 + .../com/bpa/scalage/control/FruitAdapter.java | 11 +- app/src/main/res/drawable/rectange.xml | 10 + app/src/main/res/layout/activity_main.xml | 16 +- .../layout/controlview/layout/menu_item.xml | 198 ++++++++++++------ 6 files changed, 155 insertions(+), 83 deletions(-) create mode 100644 app/src/main/res/drawable/rectange.xml diff --git a/app/src/main/java/com/bpa/scalage/HBL/Communication/WeightHelper.java b/app/src/main/java/com/bpa/scalage/HBL/Communication/WeightHelper.java index cb9a2d9..9ea1ff9 100644 --- a/app/src/main/java/com/bpa/scalage/HBL/Communication/WeightHelper.java +++ b/app/src/main/java/com/bpa/scalage/HBL/Communication/WeightHelper.java @@ -46,7 +46,7 @@ public class WeightHelper { cache.add(data.Content[i]); }); getCardData(); - Thread.sleep(50); + Thread.sleep(1); } @Override public void RunComplete() throws InterruptedException { diff --git a/app/src/main/java/com/bpa/scalage/MainActivity.java b/app/src/main/java/com/bpa/scalage/MainActivity.java index b6e9e15..4018a38 100644 --- a/app/src/main/java/com/bpa/scalage/MainActivity.java +++ b/app/src/main/java/com/bpa/scalage/MainActivity.java @@ -173,6 +173,7 @@ public class MainActivity extends AppCompatActivity { this.runOnUiThread(()->{ if (s<50){ welcome.setVisibility(View.VISIBLE); + RefreshConsumption(); }else{ welcome.setVisibility(View.GONE); RefreshConsumption(); diff --git a/app/src/main/java/com/bpa/scalage/control/FruitAdapter.java b/app/src/main/java/com/bpa/scalage/control/FruitAdapter.java index a5666df..31c4ef5 100644 --- a/app/src/main/java/com/bpa/scalage/control/FruitAdapter.java +++ b/app/src/main/java/com/bpa/scalage/control/FruitAdapter.java @@ -32,10 +32,10 @@ public class FruitAdapter extends ArrayAdapter { //为每一个子项加载设定的布局 View view=LayoutInflater.from(getContext()).inflate(R.layout.menu_item,parent,false); //分别获取 image view 和 textview 的实例 - MyImageView fruitimage =view.findViewById(R.id.iv_food_pic); +// MyImageView fruitimage =view.findViewById(R.id.iv_food_pic); TextView fruitname =view.findViewById(R.id.tv_food_name); TextView fruitprice =view.findViewById(R.id.tv_price); - TextView fruitvipprice =view.findViewById(R.id.tv_vipprice); +// TextView fruitvipprice =view.findViewById(R.id.tv_vipprice); Button add_car= view.findViewById(R.id.btn_add_car); add_car.setTag(position); if(add_car!=null)//点击事件打开,称重界面 @@ -62,10 +62,11 @@ public class FruitAdapter extends ArrayAdapter { }); } // 设置要显示的图片和文字 - fruitimage.glideAppLoadUrlImage(fruit.cover); +// fruitimage.glideAppLoadUrlImage(fruit.cover); fruitname.setText(fruit.name); - fruitprice.setText("非会员 ¥"+new java.text.DecimalFormat("#.00").format(fruit.price)+"/50g"); - fruitvipprice.setText("会员 ¥"+new java.text.DecimalFormat("#.00").format(fruit.vipPrice)+"/50g"); +// fruitprice.setText("单价 ¥"+new java.text.DecimalFormat("#.00").format(fruit.price)+"/50g"); + fruitprice.setText("单价 ¥"+fruit.price+"/50g"); +// fruitvipprice.setText("会员 ¥"+new java.text.DecimalFormat("#.00").format(fruit.vipPrice)+"/50g"); view.setTag(fruit); return view; } diff --git a/app/src/main/res/drawable/rectange.xml b/app/src/main/res/drawable/rectange.xml new file mode 100644 index 0000000..f5f2367 --- /dev/null +++ b/app/src/main/res/drawable/rectange.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 029483a..f6c0468 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -35,7 +35,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/dc_wz" - android:text="环球中心测试店铺" + android:text="- - - - - - - - - - - - - -" android:textSize="40dp" /> @@ -50,7 +50,7 @@ android:id="@+id/tv_food_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="回锅肉炒面" + android:text="- - - - - - - -" android:textColor="@color/dc_wz" android:textSize="65dp"> @@ -69,7 +69,7 @@ android:textColor="@color/dc_ts" android:textSize="50dp" android:layout_marginLeft="10dp" - android:text="15.00"/> + android:text="- - - -"/> + android:text="- - - -"/> + android:text="- - -"/> + android:text="- - -"/> + android:text="- - -"/> + android:text="- - -"/> - + android:layout_height="wrap_content" + app:containerCornerRadius="10dp" + app:containerDeltaLength="20px" + app:containerShadowColor="#AAAAAC" + app:containerShadowRadius="20px" + tools:ignore="Pxusage,RtlHardcoded"> - + android:background="@drawable/rectange"> - + - - - - - - - - - -