This commit is contained in:
jjLv 2025-08-28 16:32:58 +08:00
parent aff997d3db
commit 5af720c2d6
21 changed files with 161 additions and 73 deletions

View File

@ -120,6 +120,7 @@ public class MainActivity extends AppCompatActivity {
private MainActivity activity;
TabLayout mTabLayout;
TextView titleView, userName;
Button exit;
private TextView timeShow, tvWeight;
private Handler mHandler = new Handler(Looper.getMainLooper());
private ShutdownReceiver shutdownReceiver;
@ -194,12 +195,13 @@ public class MainActivity extends AppCompatActivity {
dishAdapter = new DishAdapter(MainActivity.this, dishList, MainActivity.this);
dishGridView.setAdapter(dishAdapter);
userName = findViewById(R.id.username);
exit = findViewById(R.id.exit);
ThreadPoolManager.getExecutor().execute(() -> {
String userNameStr = AppDatabase.getDatabase(this).loginInfoDao().getLoginInfoOne().getUserName();
runOnUiThread(() -> userName.setText(userNameStr));
});
userName.setOnClickListener(v -> DialogLoader.getInstance().showConfirmDialog(
exit.setOnClickListener(v -> DialogLoader.getInstance().showConfirmDialog(
this,
"是否退出登录?",
getString(R.string.lab_yes),
@ -228,7 +230,7 @@ public class MainActivity extends AppCompatActivity {
stallSpinner.setOnItemSelectedListener((spinner, position, id, item) -> {
String stallId = stallBeanList.get(position).getStallId();
Log.e("stallSpinner", "Selected stallId: " + stallId + ", stallName: " + stallBeanList.get(position).getStallName());
initMealTimeTab(stallId);
initDishData(stallId);
});
}
@ -378,7 +380,7 @@ public class MainActivity extends AppCompatActivity {
if (decimal.compareTo(BigDecimal.valueOf(124)) > 0) {
// 如果重量大于100表示秤上有物品
keepASample.setEnabled(true);
keepASample.setBackground(getDrawable(R.drawable.btn_border_bg_10_dark_green));
keepASample.setBackground(getDrawable(R.drawable.title_bg));
keepASample.setText(getString(R.string.keepASample));
} else {
// 如果重量小于等于0表示秤上没有物品

View File

@ -87,7 +87,7 @@ public class DishAdapter extends BaseAdapter {
boolean isSampled = StringHelper.isEmptyAndNull(bean.getSampleSaveTime());
holder.isRecord.setText(isSampled ? "未留样" : "已留样");
holder.dishItemLinearLayout.setBackgroundResource(
isSampled ? R.drawable.btn_border_bg_10_dark_green : R.drawable.btn_border_bg_10_dark_green_1
isSampled ? R.drawable.btn_border_bg_10_dark_blue : R.drawable.btn_border_bg_10_dark_green_1
);
ViewHolder finalHolder = holder;
holder.dishItemLinearLayout.setOnClickListener(v -> {
@ -103,12 +103,12 @@ public class DishAdapter extends BaseAdapter {
if (StringHelper.isEmptyAndNull(dish.getSampleSaveTime())) {
LinearLayout itemLayout = (LinearLayout) viewGroup.getChildAt(list.indexOf(dish));
if (itemLayout != null) {
itemLayout.setBackgroundResource(R.drawable.btn_border_bg_10_dark_green);
itemLayout.setBackgroundResource(R.drawable.btn_border_bg_10_dark_blue);
}
}
}
//设置当前选择菜品的底色
finalHolder.dishItemLinearLayout.setBackgroundResource(R.drawable.btn_border_bg_10_dark_blue);
finalHolder.dishItemLinearLayout.setBackgroundResource(R.drawable.btn_border_bg_5_fe6d4b);
mainActivity.updateDishDate(clickedBean);
}
});

View File

@ -268,6 +268,7 @@ public class OkHttpService {
//get方法
public String httpGet(String url, Context context) {
try {
Log.e("OkHttpService", "httpGet: " + url);
OkHttpClient client = getInstance();
Request request = new Request.Builder().url(url).addHeader(
"Authorization", "Bearer " + AppDatabase.getDatabase(context).loginInfoDao().getLoginInfoOne().getToken()

View File

@ -25,10 +25,10 @@ public class WorkConfig {
throw new UnsupportedOperationException("Cannot instantiate utility class");
}
//本地
// protected static String baseUrl = "http://192.168.0.34:48380/smart-canteen";
// protected static String prefixesUrl = "http://192.168.0.34:48380";
protected static String baseUrl = "http://192.168.0.244:48380/smart-canteen";
protected static String prefixesUrl = "http://192.168.0.244:48380";
// protected static String baseUrl = "http://192.168.0.244:48380/smart-canteen";
// protected static String prefixesUrl = "http://192.168.0.244:48380";
protected static String fileUrl = "http://192.168.0.14:9090/lnyst/";
protected static String updateUrl = "https://www.baidu.com";
protected static String serverUri = "tcp://192.168.0.244:1883";

View File

@ -1,5 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#409eff"/>
<solid android:color="#4C81F4"/>
<corners android:radius="10dp"/>
</shape>

View File

@ -1,5 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/app_color_grey"/>
<corners android:radius="10dp"/>
<corners android:radius="5dp"/>
</shape>

View File

@ -1,5 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#13aa34"/>
<solid android:color="#33D148"/>
<corners android:radius="10dp"/>
</shape>

View File

@ -1,8 +1,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#60ffffff"/>
<solid android:color="#25C6E0FF"/>
<stroke
android:width="1.5dp"
android:color="#9ddedc"/> <!-- 浅灰色 -->
android:width="2dp"
android:color="#ffffff" />
<corners android:radius="10dp"/>
</shape>

View File

@ -1,6 +1,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#709A9A9A"/>
<solid android:color="#FFFFFF"/>
<stroke
android:width="1dp"
android:color="#D6D6D6"/> <!-- 浅灰色 -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 694 KiB

View File

@ -0,0 +1,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#7D97FF"
android:endColor="#4367F5"
android:angle="180"/>
<corners android:radius="5dp"/>
</shape>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -19,7 +19,7 @@
android:layout_width="150dp"
android:layout_height="wrap_content"
android:id="@+id/dish_item_linear_layout"
android:background="@drawable/btn_border_bg_10_dark_green"
android:background="@drawable/btn_border_bg_10_dark_blue"
android:orientation="vertical"
android:padding="20dp">
<TextView
@ -37,11 +37,12 @@
android:id="@+id/tv_keep_sample_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/config_margin_5dp"
android:layout_marginStart="@dimen/config_margin_10dp"
android:layout_marginEnd="@dimen/config_margin_10dp"
android:layout_weight="2"
android:gravity="center"
android:text="未留样"
android:textColor="@color/white"
android:textSize="18sp" />
android:textSize="16sp" />
</LinearLayout>

View File

@ -9,12 +9,14 @@
<include layout="@layout/activity_title"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FFFFFF"
android:padding="@dimen/config_margin_20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:padding="10dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -49,6 +51,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="@dimen/config_margin_10dp">
<LinearLayout
android:layout_width="0dp"
@ -84,6 +87,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="@dimen/config_margin_10dp">
<LinearLayout
android:layout_width="0dp"
@ -119,6 +123,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="@dimen/config_margin_10dp">
<LinearLayout
android:layout_width="0dp"
@ -154,6 +159,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="@dimen/config_margin_10dp">
<LinearLayout
android:layout_width="0dp"
@ -189,6 +195,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="@dimen/config_margin_10dp">
<LinearLayout
android:layout_width="0dp"
@ -224,6 +231,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_marginTop="@dimen/config_margin_10dp">
<LinearLayout
android:layout_width="0dp"

View File

@ -1,13 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/machine_root_id"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F2F9FF"
android:orientation="vertical">
<include layout="@layout/activity_title"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_height="95dp"
android:padding="@dimen/config_margin_10dp"
android:orientation="horizontal">
<LinearLayout
@ -19,6 +22,7 @@
android:id="@+id/canteen_spinner"
style="@style/Material.SpinnerStyle"
android:layout_height="50dp"
app:ms_dropdown_max_height="300dp"
android:enabled="false"
android:minWidth="200dp" />
@ -26,6 +30,7 @@
android:id="@+id/stall_spinner"
style="@style/Material.SpinnerStyle"
android:layout_height="50dp"
app:ms_dropdown_max_height="300dp"
android:layout_marginStart="10dp"
android:minWidth="200dp" />
@ -33,6 +38,7 @@
android:id="@+id/storage_status_spinner"
style="@style/Material.SpinnerStyle"
android:layout_height="50dp"
app:ms_dropdown_max_height="300dp"
android:layout_marginStart="@dimen/config_margin_10dp"
android:minWidth="200dp" />
@ -60,7 +66,7 @@
style="?android:attr/buttonBarButtonStyle"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:background="@drawable/btn_border_bg_10_dark_green"
android:background="@drawable/title_bg"
android:text="@string/query" />
<Button
@ -69,16 +75,23 @@
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:background="@drawable/btn_border_bg_10_dark_green"
android:background="@drawable/btn_border_bg_10_dark_gray"
android:text="@string/reset" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/config_margin_10dp"
android:orientation="vertical">
<include layout="@layout/activity_keep_sample_title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<include layout="@layout/activity_keep_sample_list" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@ -18,7 +18,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_height="50dp"
android:orientation="horizontal"
android:background="#F4F4F4">
<TextView
@ -28,6 +28,7 @@
android:text="食堂"
android:textSize="20sp"
android:textColor="#000000"
android:background="#F2F2F2"
android:gravity="center"
android:padding="10dp"/>
<TextView
@ -37,6 +38,7 @@
android:text="档口"
android:textSize="20sp"
android:textColor="#000000"
android:background="#F2F2F2"
android:gravity="center"
android:padding="10dp"/>
<TextView
@ -44,6 +46,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="餐次"
android:background="#F2F2F2"
android:textSize="20sp"
android:textColor="#000000"
android:gravity="center"
@ -54,6 +57,7 @@
android:layout_weight="1"
android:text="菜品名称"
android:textSize="20sp"
android:background="#F2F2F2"
android:textColor="#000000"
android:gravity="center"
android:padding="10dp"/>
@ -64,6 +68,7 @@
android:text="存放状态"
android:textSize="20sp"
android:textColor="#000000"
android:background="#F2F2F2"
android:gravity="center"
android:padding="10dp"/>
<TextView
@ -73,6 +78,7 @@
android:text="在柜时长"
android:textSize="20sp"
android:textColor="#000000"
android:background="#F2F2F2"
android:gravity="center"
android:padding="10dp"/>
<TextView
@ -82,6 +88,7 @@
android:text="打印时间"
android:textSize="20sp"
android:textColor="#000000"
android:background="#F2F2F2"
android:gravity="center"
android:padding="10dp"/>
<TextView
@ -89,6 +96,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="操作"
android:background="#F2F2F2"
android:textSize="20sp"
android:textColor="#000000"
android:gravity="center"

View File

@ -25,31 +25,44 @@
<LinearLayout
android:layout_width="500dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_gravity="center_vertical"
android:layout_marginStart="240dp"
android:padding="50dp"
android:background="@drawable/btn_border_bg_10_60ffffff"
android:background="@drawable/btn_border_bg_10_white_1"
android:orientation="vertical">
<ImageView
android:layout_gravity="center"
android:layout_width="120dp"
android:layout_height="120dp"
android:contentDescription="@string/image_desc"
android:src="@drawable/ic_login_logo"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12pt"
android:textColor="#4C81F4"
android:fontFamily="@font/source_han_sans_cn_bold"
android:textFontWeight="1000"
android:text="智能留样称"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="28sp"
android:layout_marginTop="10dp"
android:textFontWeight="1000"
android:text="@string/app_name"/>
android:textSize="8pt"
android:textColor="#333333"
android:textFontWeight="500"
android:fontFamily="@font/source_han_sans_cn_bold"
android:text="欢迎登录"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginStart="@dimen/config_margin_10dp"
android:textColor="#666666"
android:textFontWeight="400"
android:text="welcome to login in"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:background="@drawable/edit_text_bg"
android:padding="10dp">
@ -67,17 +80,20 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLength="20"
android:text="13866134935"
android:hint="@string/please_enter_username"
android:textColorHint="#999999"
android:text="13866134935"
android:inputType="textPersonName"
android:background="@android:color/transparent"
android:paddingLeft="10dp"
android:autofillHints="" />
android:paddingStart="10dp"
android:autofillHints=""
tools:ignore="RtlSymmetry" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginTop="@dimen/config_margin_20dp"
android:layout_marginEnd="10dp"
android:orientation="horizontal"
android:background="@drawable/edit_text_bg"
android:padding="10dp">
@ -97,26 +113,29 @@
android:autofillHints=""
android:background="@android:color/transparent"
android:hint="@string/please_enter_password"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"
android:inputType="textPassword"
android:paddingLeft="10dp"
android:text="Bonus$2028" />
<ImageView
android:id="@+id/check_password"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_eye_close"
android:contentDescription="@string/image_desc" />
android:contentDescription="@string/image_desc"
android:src="@drawable/ic_eye_close" />
</LinearLayout>
<com.xuexiang.xui.widget.layout.XUIButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginTop="@dimen/config_margin_20dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="@dimen/config_margin_20dp"
android:text="@string/login"
android:textColor="@color/white"
android:textSize="18sp"
android:backgroundTint="#006e6b"
android:backgroundTint="#4C81F4"
android:id="@+id/btn_login"/>
<TextView
android:id="@+id/tv_forget_password"

View File

@ -2,11 +2,13 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/xui_config_color_background_pressed"
android:orientation="vertical">
<include layout="@layout/activity_title"
android:id="@+id/title"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
@ -14,14 +16,22 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
android:fontFamily="@font/source_han_sans_cn_medium"
android:layout_marginStart="20dp"
android:textSize="28sp"/>
android:textSize="15pt"/>
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/source_han_sans_cn_medium"
android:text="智小样"
android:textSize="28sp"/>
android:textSize="15pt"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/source_han_sans_cn_medium"
android:text="!"
android:textSize="15pt"/>
<LinearLayout
style="?android:attr/buttonBarStyle"
android:layout_width="match_parent"
@ -36,8 +46,17 @@
android:layout_height="40dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="20dp"
android:background="@drawable/btn_border_bg_10_dark_green"
android:background="@drawable/title_bg"
android:text="@string/sampleRetentionRecord" />
<Button
android:id="@+id/exit"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="20dp"
android:background="@drawable/btn_border_bg_10_dark_gray"
android:text="@string/exit" />
<Button
android:id="@+id/setting"
@ -47,7 +66,7 @@
android:visibility="gone"
android:layout_marginStart="10dp"
android:layout_marginEnd="20dp"
android:background="@drawable/btn_border_bg_10_dark_green"
android:background="@drawable/title_bg"
android:text="@string/setting" />
</LinearLayout>
</LinearLayout>
@ -60,27 +79,31 @@
android:id="@+id/canteen_spinner"
android:minWidth="250dp"
android:enabled="false"
app:ms_dropdown_max_height="300dp"
style="@style/Material.SpinnerStyle" />
<com.xuexiang.xui.widget.spinner.materialspinner.MaterialSpinner
android:id="@+id/stall_spinner"
android:minWidth="250dp"
style="@style/Material.SpinnerStyle"
app:ms_dropdown_max_height="300dp"
android:layout_marginStart="10dp"/>
<Button
android:layout_width="150dp"
android:layout_height="40dp"
android:text="搜索"
android:visibility="gone"
android:layout_marginStart="@dimen/config_margin_20dp"
android:id="@+id/search"
android:background="@drawable/btn_border_bg_10_dark_green"/>
android:background="@drawable/title_bg"/>
<Button
android:layout_width="150dp"
android:layout_height="40dp"
android:text="刷新"
android:layout_marginStart="@dimen/config_margin_20dp"
android:id="@+id/refresh"
android:background="@drawable/btn_border_bg_10_dark_green"/>
android:layout_width="150dp"
android:layout_height="42dp"
android:layout_marginStart="@dimen/config_margin_20dp"
android:background="@drawable/title_bg"
android:text="刷新" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -100,6 +123,8 @@
android:layout_height="wrap_content"
android:text="@string/collectSamplePhotos"
android:textFontWeight="800"
android:fontFamily="@font/source_han_sans_cn_bold"
android:textColor="#333333"
android:textSize="22sp"/>
<SurfaceView
android:id="@+id/take_photo_surface_view"
@ -113,9 +138,11 @@
android:layout_height="wrap_content"
android:text="@string/pleaseSelectTheDishOnTheRightFirst"
android:textFontWeight="800"
android:fontFamily="@font/source_han_sans_regular"
android:layout_marginTop="10dp"
android:textColor="#606060"
android:gravity="center"
android:textSize="22sp"/>
android:textSize="6pt"/>
</LinearLayout>
<RelativeLayout
android:layout_width="0dp"
@ -130,6 +157,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pleaseSelectTheDishesForSampleRetention"
android:fontFamily="@font/source_han_sans_cn_bold"
android:textColor="#333333"
android:textFontWeight="800"
android:textSize="22sp"/>
<EditText

View File

@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@color/color_dark_green"
android:background="@drawable/title_bg"
android:orientation="vertical">
<TextView
@ -12,12 +12,11 @@
android:layout_height="50dp"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:visibility="gone"
android:text="@string/back"
android:gravity="center"
android:textSize="22sp"
android:textColor="@color/white"
android:background="@drawable/btn_border_bg_10_dark_green_stroke"
android:background="@drawable/btn_border_bg_10_dark_blue"
/>
<TextView
android:id="@+id/page_title"