From 6387d9a7766967dc0c5a57a0f338c4bd3165e671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=A2=9E=E9=A3=9E?= <331023091@qq.com> Date: Fri, 26 Sep 2025 15:54:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=9C=BA=E5=90=AF=E5=8A=A8=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=90=9C=E7=B4=A2=E9=A3=9F?= =?UTF-8?q?=E6=9D=90=E7=BA=BF=E4=B8=8A=E8=BE=B9=E8=B7=9D=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/shuwei/dish/match/utils/BootReceiver.kt | 4 ++-- .../java/com/shuwei/dish/match/utils/WeightUtil.kt | 12 ++++++++++-- .../main/res/layout/list_item_search_goods_info.xml | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/shuwei/dish/match/utils/BootReceiver.kt b/app/src/main/java/com/shuwei/dish/match/utils/BootReceiver.kt index 6ef02d5..35f6830 100644 --- a/app/src/main/java/com/shuwei/dish/match/utils/BootReceiver.kt +++ b/app/src/main/java/com/shuwei/dish/match/utils/BootReceiver.kt @@ -3,13 +3,13 @@ package com.shuwei.dish.match.utils import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import com.shuwei.dish.match.ui.HomeActivity +import com.shuwei.dish.match.ui.InitActivity class BootReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { if (Intent.ACTION_BOOT_COMPLETED == intent.action) { // 启动服务或Activity - val launchIntent = Intent(context, HomeActivity::class.java) + val launchIntent = Intent(context, InitActivity::class.java) launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) context.startActivity(launchIntent) } diff --git a/app/src/main/java/com/shuwei/dish/match/utils/WeightUtil.kt b/app/src/main/java/com/shuwei/dish/match/utils/WeightUtil.kt index 974a972..5954883 100644 --- a/app/src/main/java/com/shuwei/dish/match/utils/WeightUtil.kt +++ b/app/src/main/java/com/shuwei/dish/match/utils/WeightUtil.kt @@ -47,7 +47,11 @@ object WeightUtil { } fun getWeight() { - Weigher2.getWeight() + try { + Weigher2.getWeight() + } catch (e: Exception) { + e.printStackTrace() + } } fun startContinuousRead() { @@ -64,7 +68,11 @@ object WeightUtil { } fun tareTwo(address: Int) { - Weigher2.tareTwo(address) + try { + Weigher2.tareTwo(address) + } catch (e: Exception) { + e.printStackTrace() + } } private fun runOnUiThread(action: () -> Unit) { diff --git a/app/src/main/res/layout/list_item_search_goods_info.xml b/app/src/main/res/layout/list_item_search_goods_info.xml index 6dfefda..96717a4 100644 --- a/app/src/main/res/layout/list_item_search_goods_info.xml +++ b/app/src/main/res/layout/list_item_search_goods_info.xml @@ -10,6 +10,7 @@ android:layout_height="100dp" android:textColor="@color/black666" android:textSize="30sp" + android:paddingHorizontal="5dp" android:gravity="center" android:layout_margin="15dp" tools:text="椒盐"