refactor(ui): 更新布局样式和清理无用代码
- 将活动主秤页面背景从颜色改为 drawable 背景 - 调整主秤页面标题的内边距、文字颜色和去除外边距 - 修改返回按钮尺寸并调整内边距为水平方向 - 更新设置页面三个组件的背景 drawable 样式 - 删除 ApiService 中大量注释掉的无用 API 接口代码 - 移除 CommonDialog 中不必要的导入和完整包名引用 - 清理 DataBean 中多个无用的数据类定义 - 新增白色带灰色边框圆角背景 drawable 资源
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package com.shuwei.dish.match.dialog
|
package com.shuwei.dish.match.dialog
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
@@ -8,13 +7,12 @@ import android.os.Bundle
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.Window
|
import android.view.Window
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import androidx.annotation.StyleRes
|
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import com.shuwei.dish.match.base.DeviceRole
|
import com.shuwei.dish.match.base.DeviceRole
|
||||||
import com.shuwei.dish.match.base.GlobalData
|
import com.shuwei.dish.match.base.GlobalData
|
||||||
import com.shuwei.dish.match.databinding.DialogCommonBinding
|
import com.shuwei.dish.match.databinding.DialogCommonBinding
|
||||||
import com.shuwei.dish.match.utils.ext.dp
|
import com.shuwei.dish.match.utils.ext.dp
|
||||||
import java.lang.ref.WeakReference
|
import com.shuwei.dish.match.R
|
||||||
|
|
||||||
open class CommonDialog(
|
open class CommonDialog(
|
||||||
context: Context
|
context: Context
|
||||||
@@ -77,7 +75,7 @@ open class CommonDialog(
|
|||||||
// 透明背景,让 shape_dialog_bg 的阴影层正常显示
|
// 透明背景,让 shape_dialog_bg 的阴影层正常显示
|
||||||
setBackgroundDrawable(ColorDrawable())
|
setBackgroundDrawable(ColorDrawable())
|
||||||
// 应用缩放+淡入淡出动画
|
// 应用缩放+淡入淡出动画
|
||||||
setWindowAnimations(com.shuwei.dish.match.R.style.CommonDialogAnimation)
|
setWindowAnimations(R.style.CommonDialogAnimation)
|
||||||
}
|
}
|
||||||
// 主/从设备边距微调:主设备内容区域更大,适当增加上下留白
|
// 主/从设备边距微调:主设备内容区域更大,适当增加上下留白
|
||||||
val verticalMargin = if (GlobalData.deviceRole == DeviceRole.MASTER) 48.dp else 36.dp
|
val verticalMargin = if (GlobalData.deviceRole == DeviceRole.MASTER) 48.dp else 36.dp
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import android.net.Uri
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
data class HomeModeBean(
|
data class HomeModeBean(
|
||||||
|
|
||||||
var modeName: String = "",
|
var modeName: String = "",
|
||||||
var modeDesc: String = "",
|
var modeDesc: String = "",
|
||||||
var modeIconId: Int = 0,
|
var modeIconId: Int = 0,
|
||||||
@@ -14,34 +13,6 @@ data class HomeModeBean(
|
|||||||
var onClick: (() -> Unit)? = null
|
var onClick: (() -> Unit)? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
data class FoodRecordBean(
|
|
||||||
var records: MutableList<FoodRecord>? = null,
|
|
||||||
var total: Int,
|
|
||||||
var size: Int,
|
|
||||||
var current: Int,
|
|
||||||
var page: Int
|
|
||||||
)
|
|
||||||
|
|
||||||
data class GoodsRecordBean(
|
|
||||||
var records: MutableList<CookFoodGoodsEntity>? = null,
|
|
||||||
var total: Int,
|
|
||||||
var size: Int,
|
|
||||||
var current: Int,
|
|
||||||
var page: Int
|
|
||||||
)
|
|
||||||
|
|
||||||
data class SeasoningRecordBean(
|
|
||||||
var records: MutableList<SeasoningEntity>? = null,
|
|
||||||
var total: Int,
|
|
||||||
var size: Int,
|
|
||||||
var current: Int,
|
|
||||||
var page: Int
|
|
||||||
)
|
|
||||||
|
|
||||||
data class ResetReasoningRecord(
|
|
||||||
val list: MutableList<SeasoningEntity>
|
|
||||||
)
|
|
||||||
|
|
||||||
data class FoodCollectionBean(
|
data class FoodCollectionBean(
|
||||||
var imageUri: Uri? = null,
|
var imageUri: Uri? = null,
|
||||||
var bitmap: Bitmap? = null,
|
var bitmap: Bitmap? = null,
|
||||||
@@ -80,25 +51,4 @@ data class FoodCollectionBean(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//data class DishDetailEntity(
|
|
||||||
// var foodId: String? = null,
|
|
||||||
// var foodWeight: Double? = null,
|
|
||||||
// var foodRealWeight: Double? = null,
|
|
||||||
// var voList: List<DishPartEntity>? = null
|
|
||||||
//)
|
|
||||||
|
|
||||||
//data class DishPartEntity(
|
|
||||||
// var foodId: String? = null,
|
|
||||||
// var foodName: String? = null,
|
|
||||||
// var foodWeight: Int? = null,
|
|
||||||
// var useWeight: Int? = null,
|
|
||||||
// var useRealWeight: Int? = null,
|
|
||||||
// var goodsId: Int? = null,
|
|
||||||
// var goodsName: String? = null,
|
|
||||||
// var materialType: Int? = null,
|
|
||||||
// var isSetFinished: Boolean = false,
|
|
||||||
// var isItemClicked: Boolean = false,
|
|
||||||
// var isSamplingPage: Boolean = false
|
|
||||||
//)
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -68,46 +68,4 @@ interface ApiService {
|
|||||||
@Body param: MutableMap<String, Any>
|
@Body param: MutableMap<String, Any>
|
||||||
): ApiResponse<MutableList<SeasoningEntity>?>
|
): ApiResponse<MutableList<SeasoningEntity>?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// *获取配置信息
|
|
||||||
// */
|
|
||||||
// @GET("/equipment/stEquipment/queryByEquipmentCode")
|
|
||||||
// suspend fun getDeviceInfo(
|
|
||||||
// @Query("equipmentCode") equipmentCode: String,
|
|
||||||
// @Query("appVersion") appVersion: String = App.appVersion
|
|
||||||
// ): ApiResponse<DeviceConfigInfo>
|
|
||||||
//
|
|
||||||
// @GET
|
|
||||||
// suspend fun getAccessToken(
|
|
||||||
// @Url url: String = UrlConfig.GET_ACCESS_TOKEN,
|
|
||||||
// @Query("qrcodeId") qrcodeId: String
|
|
||||||
// ): ApiResponse<String?>
|
|
||||||
//
|
|
||||||
// @GET
|
|
||||||
// suspend fun getShelfList(
|
|
||||||
// @Url url: String = UrlConfig.GET_SHELF_LIST,
|
|
||||||
// @Query("deviceId") deviceId: String
|
|
||||||
// ): ApiResponse<ShelfResult>
|
|
||||||
//
|
|
||||||
// @GET
|
|
||||||
// suspend fun getGoodsList(
|
|
||||||
// @Url url: String = UrlConfig.GET_GOODS_LIST,
|
|
||||||
// @Query("canteenId") canteenId: String = "0",
|
|
||||||
// @Query("goodsName") goodsName: String? = null,
|
|
||||||
// @Query("pageNo") pageNo: Int = 1,
|
|
||||||
// @Query("pageSize") pageSize: Int = 50
|
|
||||||
// ): ApiResponse<MutableList<GoodsModel>?>
|
|
||||||
//
|
|
||||||
// @POST
|
|
||||||
// suspend fun saveShelfGoodsList(
|
|
||||||
// @Url url: String = UrlConfig.SAVE_SHELF_GOODS_LIST,
|
|
||||||
// @Body body: ShelfBody
|
|
||||||
// ): ApiResponse<Any?>
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@color/white"/>
|
||||||
|
<corners android:radius="15dp"/>
|
||||||
|
<stroke android:color="#DCDCDC" android:width="1dp"/>
|
||||||
|
</shape>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
tools:background="@color/bg_color">
|
tools:background="@drawable/bg_other_page">
|
||||||
|
|
||||||
<!-- 顶部标题 -->
|
<!-- 顶部标题 -->
|
||||||
<TextView
|
<TextView
|
||||||
@@ -12,13 +12,12 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginTop="10dp"
|
android:paddingVertical="5dp"
|
||||||
android:layout_marginBottom="10dp"
|
|
||||||
android:text="全设备秤数据监控"
|
android:text="全设备秤数据监控"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:textColor="@color/home_title"
|
android:textColor="@color/white"
|
||||||
android:textSize="36sp"
|
android:textSize="36sp"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
@@ -30,18 +29,16 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@id/tvMasterTitle"
|
app:layout_constraintTop_toBottomOf="@id/tvMasterTitle"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_marginBottom="16dp"
|
android:textColor="@color/white"
|
||||||
android:textColor="@color/home_sub_title"
|
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
tools:text="已发现设备:3 台" />
|
tools:text="已发现设备:3 台" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ivMasterBack"
|
android:id="@+id/ivMasterBack"
|
||||||
android:layout_width="70dp"
|
android:layout_width="90dp"
|
||||||
android:layout_height="60dp"
|
android:layout_height="0dp"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:paddingStart="30dp"
|
android:paddingHorizontal="30dp"
|
||||||
android:paddingEnd="10dp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/tvMasterTitle"
|
app:layout_constraintTop_toTopOf="@id/tvMasterTitle"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/tvMasterTitle"
|
app:layout_constraintBottom_toBottomOf="@id/tvMasterTitle"
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginTop="30dp"
|
android:layout_marginTop="30dp"
|
||||||
android:layout_marginHorizontal="32dp"
|
android:layout_marginHorizontal="32dp"
|
||||||
android:background="@drawable/shape_white_fb_15_corners2"
|
android:background="@drawable/shape_white_dc_15_corners"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:clipToOutline="true">
|
android:clipToOutline="true">
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginHorizontal="32dp"
|
android:layout_marginHorizontal="32dp"
|
||||||
android:layout_marginTop="50dp"
|
android:layout_marginTop="50dp"
|
||||||
android:background="@drawable/shape_white_fb_15_corners2"
|
android:background="@drawable/shape_white_dc_15_corners"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:clipToOutline="true">
|
android:clipToOutline="true">
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginHorizontal="32dp"
|
android:layout_marginHorizontal="32dp"
|
||||||
android:layout_marginTop="50dp"
|
android:layout_marginTop="50dp"
|
||||||
android:background="@drawable/shape_white_fb_15_corners2"
|
android:background="@drawable/shape_white_dc_15_corners"
|
||||||
android:foreground="?android:attr/selectableItemBackground"
|
android:foreground="?android:attr/selectableItemBackground"
|
||||||
android:clipToOutline="true">
|
android:clipToOutline="true">
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user