refactor(setting): 重构设置页面界面和功能结构
- 将底部导航菜单替换为三个独立的功能卡片布局 - 添加餐品模式、调料区设置和食材采样功能入口 - 移除原有的Fragment容器和标签页切换逻辑 - 更新CollectFragment以使用新的SingleFragmentActivity架构 - 修改相机权限检查逻辑并添加权限拒绝提示对话框 - 简化DeviceConfigFragment和SeasoningConfigFragment的依赖导入 - 在设置页面添加当前模式显示和跳转功能 - 重构调料配置页面的日志记录和高亮逻辑
This commit is contained in:
@@ -2,33 +2,19 @@ package com.shuwei.dish.match.ui
|
|||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.Color
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.ViewGroup
|
import android.provider.Settings
|
||||||
import androidx.appcompat.widget.AppCompatButton
|
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.graphics.toColorInt
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import androidx.camera.view.PreviewView
|
|
||||||
import androidx.core.view.updateLayoutParams
|
|
||||||
import com.shuwei.dish.match.R
|
|
||||||
import com.shuwei.dish.match.base.BaseActivity
|
import com.shuwei.dish.match.base.BaseActivity
|
||||||
import com.shuwei.dish.match.base.DeviceRole
|
|
||||||
import com.shuwei.dish.match.base.GlobalData
|
|
||||||
import com.shuwei.dish.match.databinding.ActivitySettingBinding
|
import com.shuwei.dish.match.databinding.ActivitySettingBinding
|
||||||
import com.shuwei.dish.match.databinding.LayoutCameraPreviewBinding
|
import com.shuwei.dish.match.dialog.CommonDialog
|
||||||
import com.shuwei.dish.match.ui.fragment.CollectFragment
|
|
||||||
import com.shuwei.dish.match.ui.fragment.DeviceConfigFragment
|
|
||||||
import com.shuwei.dish.match.ui.fragment.SeasoningConfigFragment
|
|
||||||
import com.shuwei.dish.match.utils.CameraUtils
|
|
||||||
import com.shuwei.dish.match.utils.SpTool
|
import com.shuwei.dish.match.utils.SpTool
|
||||||
import com.shuwei.dish.match.utils.ext.dp
|
import com.shuwei.dish.match.utils.ext.clickWithDebounce
|
||||||
import com.shuwei.dish.match.utils.ext.gone
|
import com.shuwei.dish.match.utils.ext.gone
|
||||||
import com.shuwei.dish.match.utils.ext.startActivity
|
|
||||||
import com.shuwei.dish.match.utils.ext.toast
|
|
||||||
import com.shuwei.dish.match.utils.ext.visible
|
import com.shuwei.dish.match.utils.ext.visible
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,10 +28,10 @@ class SettingActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var binding: ActivitySettingBinding
|
private lateinit var binding: ActivitySettingBinding
|
||||||
private val cameraUtils: CameraUtils by lazy {
|
// private val cameraUtils: CameraUtils by lazy {
|
||||||
CameraUtils(this)
|
// CameraUtils(this)
|
||||||
}
|
// }
|
||||||
private lateinit var previewView: PreviewView
|
// private lateinit var previewView: PreviewView
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
@@ -55,104 +41,51 @@ class SettingActivity : BaseActivity() {
|
|||||||
setTitleBar(titleBarAction = {
|
setTitleBar(titleBarAction = {
|
||||||
it.visible()
|
it.visible()
|
||||||
}, titleAction = {
|
}, titleAction = {
|
||||||
it.text = "设置"
|
it.text = "设备设置"
|
||||||
}, rightIconActon = {
|
}, rightIconActon = {
|
||||||
it.gone()
|
it.gone()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 默认显示设备配置Fragment
|
initView()
|
||||||
if (savedInstanceState == null) {
|
|
||||||
showDeviceConfigFragment()
|
|
||||||
}
|
|
||||||
|
|
||||||
initUI()
|
// // 默认显示设备配置Fragment
|
||||||
|
// if (savedInstanceState == null) {
|
||||||
|
// showDeviceConfigFragment()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// initUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化UI和事件监听
|
|
||||||
*/
|
|
||||||
private fun initUI() {
|
|
||||||
// 设备配置按钮点击事件
|
|
||||||
binding.btnDeviceConfig.setOnClickListener {
|
|
||||||
showDeviceConfigFragment()
|
|
||||||
|
|
||||||
loadTabStyle(button = binding.btnDeviceConfig, isSelected = true)
|
private fun initView() {
|
||||||
loadTabStyle(button = binding.btnSeasoningConfig, isSelected = false)
|
binding.tvCurrentMode.text = when (SpTool.cookMode) {
|
||||||
loadTabStyle(button = binding.btnFoodCollect, isSelected = false)
|
0 -> "当前:制作模式"
|
||||||
|
1 -> "当前:采样模式"
|
||||||
|
else -> "当前:未知模式"
|
||||||
}
|
}
|
||||||
|
binding.llCookMode.clickWithDebounce {
|
||||||
// 调料配置按钮点击事件
|
SingleFragmentActivity.start(this, SingleFragmentActivity.PageType.COOK_MODE)
|
||||||
binding.btnSeasoningConfig.setOnClickListener {
|
|
||||||
showSeasoningConfigFragment()
|
|
||||||
|
|
||||||
loadTabStyle(button = binding.btnDeviceConfig, isSelected = false)
|
|
||||||
loadTabStyle(button = binding.btnSeasoningConfig, isSelected = true)
|
|
||||||
loadTabStyle(button = binding.btnFoodCollect, isSelected = false)
|
|
||||||
}
|
}
|
||||||
|
binding.llSeasoningConfig.clickWithDebounce {
|
||||||
// 菜品采集按钮点击事件
|
SingleFragmentActivity.start(this, SingleFragmentActivity.PageType.SEASONING_CONFIG)
|
||||||
binding.btnFoodCollect.setOnClickListener {
|
|
||||||
checkCameraPermissionAndShowFragment()
|
|
||||||
|
|
||||||
loadTabStyle(button = binding.btnDeviceConfig, isSelected = false)
|
|
||||||
loadTabStyle(button = binding.btnSeasoningConfig, isSelected = false)
|
|
||||||
loadTabStyle(button = binding.btnFoodCollect, isSelected = true)
|
|
||||||
}
|
}
|
||||||
|
binding.llFoodCollect.clickWithDebounce {
|
||||||
// 主设备显示「秤数据监控」入口
|
checkCameraPermission()
|
||||||
if (GlobalData.deviceRole == DeviceRole.MASTER) {
|
|
||||||
binding.btnScaleMonitor.visible()
|
|
||||||
binding.btnScaleMonitor.setOnClickListener {
|
|
||||||
startActivity<MasterScaleActivity>()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化按钮颜色(默认设备配置为选中状态)
|
|
||||||
|
|
||||||
loadTabStyle(button = binding.btnDeviceConfig, isSelected = true)
|
|
||||||
loadTabStyle(button = binding.btnSeasoningConfig, isSelected = false)
|
|
||||||
loadTabStyle(button = binding.btnFoodCollect, isSelected = false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /** 刷新角色按钮文字 */
|
private fun openCollectPage() {
|
||||||
// private fun updateRoleButtonText() {
|
SingleFragmentActivity.start(this, SingleFragmentActivity.PageType.FOOD_COLLECT)
|
||||||
// val roleLabel = if (GlobalData.deviceRole == DeviceRole.MASTER) "主设备" else "子设备"
|
|
||||||
// binding.btnDeviceRole.text = "设备角色:$roleLabel"
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载顶部Tab按钮样式
|
|
||||||
*
|
|
||||||
* @param button 按钮
|
|
||||||
* @param isSelected 是否选中
|
|
||||||
*/
|
|
||||||
private fun loadTabStyle(button: AppCompatButton, isSelected: Boolean) {
|
|
||||||
button.apply {
|
|
||||||
if (isSelected){
|
|
||||||
// 选中
|
|
||||||
setTextColor(Color.WHITE)
|
|
||||||
textSize = 28f
|
|
||||||
setTypeface(null, android.graphics.Typeface.BOLD)
|
|
||||||
background = ContextCompat.getDrawable(this@SettingActivity, R.drawable.bg_btn_underline)
|
|
||||||
} else {
|
|
||||||
// 未选中
|
|
||||||
setTextColor("#5E7585".toColorInt())
|
|
||||||
textSize = 26f
|
|
||||||
setTypeface(null, android.graphics.Typeface.NORMAL)
|
|
||||||
background = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查相机权限并显示 CollectFragment
|
* 检查相机权限并显示 CollectFragment
|
||||||
*/
|
*/
|
||||||
@SuppressLint("ObsoleteSdkInt")
|
@SuppressLint("ObsoleteSdkInt")
|
||||||
private fun checkCameraPermissionAndShowFragment() {
|
private fun checkCameraPermission() {
|
||||||
val collectFragment = fragmentList[2]
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||||
// Android 6.0 以下,直接显示 Fragment
|
// Android 6.0 以下,直接打开
|
||||||
showFragment(collectFragment)
|
openCollectPage()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (ContextCompat.checkSelfPermission(
|
if (ContextCompat.checkSelfPermission(
|
||||||
@@ -160,109 +93,228 @@ class SettingActivity : BaseActivity() {
|
|||||||
Manifest.permission.CAMERA
|
Manifest.permission.CAMERA
|
||||||
) == PackageManager.PERMISSION_GRANTED
|
) == PackageManager.PERMISSION_GRANTED
|
||||||
) {
|
) {
|
||||||
// 权限已授予,直接显示 Fragment
|
// 权限已授予,直接打开
|
||||||
showFragment(collectFragment)
|
openCollectPage()
|
||||||
} else {
|
} else {
|
||||||
// 权限未授予,申请权限
|
// 权限未授予,申请权限
|
||||||
requestPermission(Manifest.permission.CAMERA) { isGranted ->
|
requestPermission(Manifest.permission.CAMERA) { isGranted ->
|
||||||
if (isGranted) {
|
if (isGranted) {
|
||||||
// 权限已授予,显示 CollectFragment
|
// 权限已授予,直接打开
|
||||||
showFragment(collectFragment)
|
openCollectPage()
|
||||||
} else {
|
} else {
|
||||||
// 权限被拒绝
|
// 权限被拒绝
|
||||||
toast("暂无相机权限,无法使用菜品采集功能")
|
showNotGrantedCameraPermissionDialog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private fun showNotGrantedCameraPermissionDialog() {
|
||||||
* 初始化相机
|
CommonDialog(this)
|
||||||
* @param container 相机预览容器
|
.setTitle("温馨提示")
|
||||||
*/
|
.setContent("暂无相机权限,无法使用菜品采集功能,请确认是否同意开始权限?")
|
||||||
fun initCamera(container: ViewGroup) {
|
.setNegativeButton("不同意")
|
||||||
cameraUtils.initCamera()
|
.setPositiveButton("同意") {
|
||||||
val previewBinding =
|
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
|
||||||
LayoutCameraPreviewBinding.inflate(layoutInflater, container)
|
data = Uri.fromParts("package", packageName, null)
|
||||||
previewView = previewBinding.previewView.also {
|
|
||||||
it.updateLayoutParams {
|
|
||||||
width = 456.dp
|
|
||||||
height = 342.dp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cameraUtils.setPreviewController(previewView)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activity 恢复时绑定相机
|
|
||||||
*/
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
cameraUtils.bind()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Activity 暂停时解绑相机
|
|
||||||
*/
|
|
||||||
override fun onPause() {
|
|
||||||
super.onPause()
|
|
||||||
cameraUtils.unbind()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 提供给 Fragment 调用的拍照方法
|
|
||||||
*/
|
|
||||||
fun takePhoto(succCallback: (Uri) -> Unit, failCallback: (msg: String) -> Unit = {}) {
|
|
||||||
cameraUtils.takePhoto(succCallback = succCallback, failCallback = failCallback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示设备切换Fragment
|
|
||||||
*/
|
|
||||||
private fun showDeviceConfigFragment() {
|
|
||||||
showFragment(fragmentList[0])
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示设调料配置Fragment
|
|
||||||
*/
|
|
||||||
private fun showSeasoningConfigFragment() {
|
|
||||||
showFragment(fragmentList[1])
|
|
||||||
}
|
|
||||||
|
|
||||||
private val fragmentList = mutableListOf<Fragment>().apply {
|
|
||||||
add(DeviceConfigFragment())
|
|
||||||
add(SeasoningConfigFragment())
|
|
||||||
add(CollectFragment())
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 显示指定的 Fragment
|
|
||||||
* 使用 add/show/hide 方式管理 Fragment,避免重复创建
|
|
||||||
* 已添加的 Fragment 直接显示,未添加的 Fragment 先添加再显示
|
|
||||||
*/
|
|
||||||
private fun showFragment(fragment: Fragment) {
|
|
||||||
runCatching {
|
|
||||||
supportFragmentManager.beginTransaction().apply {
|
|
||||||
// 如果 Fragment 还未添加到容器中,则添加
|
|
||||||
if (!fragment.isAdded) {
|
|
||||||
add(binding.fragmentContainer.id, fragment)
|
|
||||||
} else {
|
|
||||||
// 已添加过,直接显示
|
|
||||||
show(fragment)
|
|
||||||
}
|
}
|
||||||
|
startActivity(intent) {
|
||||||
// 隐藏其他 Fragment
|
checkCameraPermission()
|
||||||
fragmentList.forEach { otherFragment ->
|
|
||||||
if (otherFragment != fragment && otherFragment.isAdded) {
|
|
||||||
hide(otherFragment)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
commit()
|
|
||||||
}
|
}
|
||||||
}.onFailure {
|
.show()
|
||||||
it.printStackTrace()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 初始化UI和事件监听
|
||||||
|
// */
|
||||||
|
// private fun initUI() {
|
||||||
|
// // 设备配置按钮点击事件
|
||||||
|
// binding.btnDeviceConfig.setOnClickListener {
|
||||||
|
// showDeviceConfigFragment()
|
||||||
|
//
|
||||||
|
// loadTabStyle(button = binding.btnDeviceConfig, isSelected = true)
|
||||||
|
// loadTabStyle(button = binding.btnSeasoningConfig, isSelected = false)
|
||||||
|
// loadTabStyle(button = binding.btnFoodCollect, isSelected = false)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 调料配置按钮点击事件
|
||||||
|
// binding.btnSeasoningConfig.setOnClickListener {
|
||||||
|
// showSeasoningConfigFragment()
|
||||||
|
//
|
||||||
|
// loadTabStyle(button = binding.btnDeviceConfig, isSelected = false)
|
||||||
|
// loadTabStyle(button = binding.btnSeasoningConfig, isSelected = true)
|
||||||
|
// loadTabStyle(button = binding.btnFoodCollect, isSelected = false)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 菜品采集按钮点击事件
|
||||||
|
// binding.btnFoodCollect.setOnClickListener {
|
||||||
|
// checkCameraPermissionAndShowFragment()
|
||||||
|
//
|
||||||
|
// loadTabStyle(button = binding.btnDeviceConfig, isSelected = false)
|
||||||
|
// loadTabStyle(button = binding.btnSeasoningConfig, isSelected = false)
|
||||||
|
// loadTabStyle(button = binding.btnFoodCollect, isSelected = true)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 主设备显示「秤数据监控」入口
|
||||||
|
// if (GlobalData.deviceRole == DeviceRole.MASTER) {
|
||||||
|
// binding.btnScaleMonitor.visible()
|
||||||
|
// binding.btnScaleMonitor.setOnClickListener {
|
||||||
|
// startActivity<MasterScaleActivity>()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 初始化按钮颜色(默认设备配置为选中状态)
|
||||||
|
//
|
||||||
|
// loadTabStyle(button = binding.btnDeviceConfig, isSelected = true)
|
||||||
|
// loadTabStyle(button = binding.btnSeasoningConfig, isSelected = false)
|
||||||
|
// loadTabStyle(button = binding.btnFoodCollect, isSelected = false)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 加载顶部Tab按钮样式
|
||||||
|
// *
|
||||||
|
// * @param button 按钮
|
||||||
|
// * @param isSelected 是否选中
|
||||||
|
// */
|
||||||
|
// private fun loadTabStyle(button: AppCompatButton, isSelected: Boolean) {
|
||||||
|
// button.apply {
|
||||||
|
// if (isSelected){
|
||||||
|
// // 选中
|
||||||
|
// setTextColor(Color.WHITE)
|
||||||
|
// textSize = 28f
|
||||||
|
// setTypeface(null, android.graphics.Typeface.BOLD)
|
||||||
|
// background = ContextCompat.getDrawable(this@SettingActivity, R.drawable.bg_btn_underline)
|
||||||
|
// } else {
|
||||||
|
// // 未选中
|
||||||
|
// setTextColor("#5E7585".toColorInt())
|
||||||
|
// textSize = 26f
|
||||||
|
// setTypeface(null, android.graphics.Typeface.NORMAL)
|
||||||
|
// background = null
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 检查相机权限并显示 CollectFragment
|
||||||
|
// */
|
||||||
|
// @SuppressLint("ObsoleteSdkInt")
|
||||||
|
// private fun checkCameraPermissionAndShowFragment() {
|
||||||
|
// val collectFragment = fragmentList[2]
|
||||||
|
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||||
|
// // Android 6.0 以下,直接显示 Fragment
|
||||||
|
// showFragment(collectFragment)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// if (ContextCompat.checkSelfPermission(
|
||||||
|
// this,
|
||||||
|
// Manifest.permission.CAMERA
|
||||||
|
// ) == PackageManager.PERMISSION_GRANTED
|
||||||
|
// ) {
|
||||||
|
// // 权限已授予,直接显示 Fragment
|
||||||
|
// showFragment(collectFragment)
|
||||||
|
// } else {
|
||||||
|
// // 权限未授予,申请权限
|
||||||
|
// requestPermission(Manifest.permission.CAMERA) { isGranted ->
|
||||||
|
// if (isGranted) {
|
||||||
|
// // 权限已授予,显示 CollectFragment
|
||||||
|
// showFragment(collectFragment)
|
||||||
|
// } else {
|
||||||
|
// // 权限被拒绝
|
||||||
|
// toast("暂无相机权限,无法使用菜品采集功能")
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 初始化相机
|
||||||
|
// * @param container 相机预览容器
|
||||||
|
// */
|
||||||
|
// fun initCamera(container: ViewGroup) {
|
||||||
|
// cameraUtils.initCamera()
|
||||||
|
// val previewBinding =
|
||||||
|
// LayoutCameraPreviewBinding.inflate(layoutInflater, container)
|
||||||
|
// previewView = previewBinding.previewView.also {
|
||||||
|
// it.updateLayoutParams {
|
||||||
|
// width = 456.dp
|
||||||
|
// height = 342.dp
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// cameraUtils.setPreviewController(previewView)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Activity 恢复时绑定相机
|
||||||
|
// */
|
||||||
|
// override fun onResume() {
|
||||||
|
// super.onResume()
|
||||||
|
// cameraUtils.bind()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * Activity 暂停时解绑相机
|
||||||
|
// */
|
||||||
|
// override fun onPause() {
|
||||||
|
// super.onPause()
|
||||||
|
// cameraUtils.unbind()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 提供给 Fragment 调用的拍照方法
|
||||||
|
// */
|
||||||
|
// fun takePhoto(succCallback: (Uri) -> Unit, failCallback: (msg: String) -> Unit = {}) {
|
||||||
|
// cameraUtils.takePhoto(succCallback = succCallback, failCallback = failCallback)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 显示设备切换Fragment
|
||||||
|
// */
|
||||||
|
// private fun showDeviceConfigFragment() {
|
||||||
|
// showFragment(fragmentList[0])
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 显示设调料配置Fragment
|
||||||
|
// */
|
||||||
|
// private fun showSeasoningConfigFragment() {
|
||||||
|
// showFragment(fragmentList[1])
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private val fragmentList = mutableListOf<Fragment>().apply {
|
||||||
|
// add(DeviceConfigFragment())
|
||||||
|
// add(SeasoningConfigFragment())
|
||||||
|
// add(CollectFragment())
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 显示指定的 Fragment
|
||||||
|
// * 使用 add/show/hide 方式管理 Fragment,避免重复创建
|
||||||
|
// * 已添加的 Fragment 直接显示,未添加的 Fragment 先添加再显示
|
||||||
|
// */
|
||||||
|
// private fun showFragment(fragment: Fragment) {
|
||||||
|
// runCatching {
|
||||||
|
// supportFragmentManager.beginTransaction().apply {
|
||||||
|
// // 如果 Fragment 还未添加到容器中,则添加
|
||||||
|
// if (!fragment.isAdded) {
|
||||||
|
// add(binding.fragmentContainer.id, fragment)
|
||||||
|
// } else {
|
||||||
|
// // 已添加过,直接显示
|
||||||
|
// show(fragment)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 隐藏其他 Fragment
|
||||||
|
// fragmentList.forEach { otherFragment ->
|
||||||
|
// if (otherFragment != fragment && otherFragment.isAdded) {
|
||||||
|
// hide(otherFragment)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// commit()
|
||||||
|
// }
|
||||||
|
// }.onFailure {
|
||||||
|
// it.printStackTrace()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,15 +17,22 @@ import com.shuwei.dish.match.utils.ext.visible
|
|||||||
*/
|
*/
|
||||||
class SingleFragmentActivity : BaseActivity() {
|
class SingleFragmentActivity : BaseActivity() {
|
||||||
|
|
||||||
|
interface LifecycleCallback {
|
||||||
|
fun onActivityResume()
|
||||||
|
fun onActivityPause()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支持的页面类型枚举
|
* 支持的页面类型枚举
|
||||||
* 新增页面时在此追加枚举值,并在 [createFragment] 中补充对应分支
|
* 新增页面时在此追加枚举值,并在 [createFragment] 中补充对应分支
|
||||||
*/
|
*/
|
||||||
enum class PageType {
|
enum class PageType {
|
||||||
/** 菜品采集页 */
|
/** 菜品采集页 */
|
||||||
COLLECT,
|
FOOD_COLLECT,
|
||||||
|
|
||||||
/** 设备配置页 */
|
/** 设备配置页 */
|
||||||
DEVICE_CONFIG,
|
COOK_MODE,
|
||||||
|
|
||||||
/** 调料配置页 */
|
/** 调料配置页 */
|
||||||
SEASONING_CONFIG,
|
SEASONING_CONFIG,
|
||||||
}
|
}
|
||||||
@@ -46,6 +53,11 @@ class SingleFragmentActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var lifecycleCallback: LifecycleCallback? = null
|
||||||
|
fun setLifecycleCallback(callback: LifecycleCallback) {
|
||||||
|
lifecycleCallback = callback
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setHeaderBackground()
|
setHeaderBackground()
|
||||||
@@ -80,8 +92,8 @@ class SingleFragmentActivity : BaseActivity() {
|
|||||||
* 根据页面类型返回对应标题文本
|
* 根据页面类型返回对应标题文本
|
||||||
*/
|
*/
|
||||||
private fun getTitleForPage(pageType: PageType): String = when (pageType) {
|
private fun getTitleForPage(pageType: PageType): String = when (pageType) {
|
||||||
PageType.COLLECT -> "菜品采集"
|
PageType.FOOD_COLLECT -> "菜品采集"
|
||||||
PageType.DEVICE_CONFIG -> "设备配置"
|
PageType.COOK_MODE -> "设备配置"
|
||||||
PageType.SEASONING_CONFIG -> "调料配置"
|
PageType.SEASONING_CONFIG -> "调料配置"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,8 +101,19 @@ class SingleFragmentActivity : BaseActivity() {
|
|||||||
* 根据页面类型创建对应 Fragment 实例
|
* 根据页面类型创建对应 Fragment 实例
|
||||||
*/
|
*/
|
||||||
private fun createFragment(pageType: PageType): Fragment = when (pageType) {
|
private fun createFragment(pageType: PageType): Fragment = when (pageType) {
|
||||||
PageType.COLLECT -> CollectFragment()
|
PageType.FOOD_COLLECT -> CollectFragment()
|
||||||
PageType.DEVICE_CONFIG -> DeviceConfigFragment()
|
PageType.COOK_MODE -> DeviceConfigFragment()
|
||||||
PageType.SEASONING_CONFIG -> SeasoningConfigFragment()
|
PageType.SEASONING_CONFIG -> SeasoningConfigFragment()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
lifecycleCallback?.onActivityResume()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
super.onPause()
|
||||||
|
lifecycleCallback?.onActivityPause()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,24 +10,29 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
|
import androidx.camera.view.PreviewView
|
||||||
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import com.shuwei.dish.match.R
|
import com.shuwei.dish.match.R
|
||||||
import com.shuwei.dish.match.adapter.FoodCollectionAdapter
|
import com.shuwei.dish.match.adapter.FoodCollectionAdapter
|
||||||
import com.shuwei.dish.match.base.BaseFragment
|
import com.shuwei.dish.match.base.BaseFragment
|
||||||
import com.shuwei.dish.match.databinding.FragmentCollectBinding
|
import com.shuwei.dish.match.databinding.FragmentCollectBinding
|
||||||
|
import com.shuwei.dish.match.databinding.LayoutCameraPreviewBinding
|
||||||
import com.shuwei.dish.match.dialog.Loading
|
import com.shuwei.dish.match.dialog.Loading
|
||||||
import com.shuwei.dish.match.objbox.FoodCollectionBean
|
import com.shuwei.dish.match.objbox.FoodCollectionBean
|
||||||
import com.shuwei.dish.match.objbox.FoodModule
|
import com.shuwei.dish.match.objbox.FoodModule
|
||||||
import com.shuwei.dish.match.ui.SettingActivity
|
import com.shuwei.dish.match.ui.SingleFragmentActivity
|
||||||
import com.shuwei.dish.match.utils.BitmapSaver
|
import com.shuwei.dish.match.utils.BitmapSaver
|
||||||
|
import com.shuwei.dish.match.utils.CameraUtils
|
||||||
import com.shuwei.dish.match.utils.Debouncer
|
import com.shuwei.dish.match.utils.Debouncer
|
||||||
import com.shuwei.dish.match.utils.ImageUtil
|
import com.shuwei.dish.match.utils.ImageUtil
|
||||||
import com.shuwei.dish.match.utils.LogSaveUtil
|
import com.shuwei.dish.match.utils.LogSaveUtil
|
||||||
import com.shuwei.dish.match.utils.ext.clickWithDebounce
|
import com.shuwei.dish.match.utils.ext.clickWithDebounce
|
||||||
|
import com.shuwei.dish.match.utils.ext.dp
|
||||||
import com.shuwei.dish.match.utils.ext.toast
|
import com.shuwei.dish.match.utils.ext.toast
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
class CollectFragment : BaseFragment<FragmentCollectBinding>() {
|
class CollectFragment : BaseFragment<FragmentCollectBinding>(){
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "CollectFragment"
|
private const val TAG = "CollectFragment"
|
||||||
@@ -58,7 +63,8 @@ class CollectFragment : BaseFragment<FragmentCollectBinding>() {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
private val debouncer = Debouncer(2000)
|
private val debouncer = Debouncer(2000)
|
||||||
private lateinit var settingActivity: SettingActivity
|
// private lateinit var settingActivity: SettingActivity
|
||||||
|
private lateinit var currentActivity: SingleFragmentActivity
|
||||||
|
|
||||||
private val collectionAdapter: FoodCollectionAdapter by lazy {
|
private val collectionAdapter: FoodCollectionAdapter by lazy {
|
||||||
FoodCollectionAdapter(foodCollectionList).apply {
|
FoodCollectionAdapter(foodCollectionList).apply {
|
||||||
@@ -168,7 +174,7 @@ class CollectFragment : BaseFragment<FragmentCollectBinding>() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
showWaitingDialog("采集中……")
|
showWaitingDialog("采集中……")
|
||||||
settingActivity.takePhoto(succCallback = cameraCallback, failCallback = { errMsg ->
|
cameraUtils.takePhoto(succCallback = cameraCallback, failCallback = { errMsg ->
|
||||||
hideWaitingDialog()
|
hideWaitingDialog()
|
||||||
// toast("拍照异常,请重新操作")
|
// toast("拍照异常,请重新操作")
|
||||||
// if (cameraErrorCount >= 10) {
|
// if (cameraErrorCount >= 10) {
|
||||||
@@ -183,9 +189,18 @@ class CollectFragment : BaseFragment<FragmentCollectBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun initialize() {
|
override fun initialize() {
|
||||||
settingActivity = activity as SettingActivity
|
currentActivity = activity as SingleFragmentActivity
|
||||||
// 首次显示 CollectFragment 时初始化相机
|
// 首次显示 CollectFragment 时初始化相机
|
||||||
settingActivity.initCamera(binding.flCameraPreview)
|
initCamera(binding.flCameraPreview)
|
||||||
|
currentActivity.setLifecycleCallback(object : SingleFragmentActivity.LifecycleCallback {
|
||||||
|
override fun onActivityResume() {
|
||||||
|
cameraUtils.bind()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onActivityPause() {
|
||||||
|
cameraUtils.unbind()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
binding.rvFoodList.let {
|
binding.rvFoodList.let {
|
||||||
it.layoutManager =
|
it.layoutManager =
|
||||||
@@ -361,7 +376,7 @@ class CollectFragment : BaseFragment<FragmentCollectBinding>() {
|
|||||||
|
|
||||||
private fun searchByFoodName(name: String, block: (String) -> Unit) {}
|
private fun searchByFoodName(name: String, block: (String) -> Unit) {}
|
||||||
private fun hideWaitingDialog() {
|
private fun hideWaitingDialog() {
|
||||||
settingActivity.dismissLoading()
|
currentActivity.dismissLoading()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showWaitingDialog(msg: String) {
|
private fun showWaitingDialog(msg: String) {
|
||||||
@@ -369,6 +384,30 @@ class CollectFragment : BaseFragment<FragmentCollectBinding>() {
|
|||||||
Loading.updateContent(msg)
|
Loading.updateContent(msg)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
settingActivity.showLoading(msg)
|
currentActivity.showLoading(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private lateinit var previewView: PreviewView
|
||||||
|
|
||||||
|
private val cameraUtils: CameraUtils by lazy {
|
||||||
|
CameraUtils(requireActivity())
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化相机
|
||||||
|
* @param container 相机预览容器
|
||||||
|
*/
|
||||||
|
fun initCamera(container: ViewGroup) {
|
||||||
|
cameraUtils.initCamera()
|
||||||
|
val previewBinding =
|
||||||
|
LayoutCameraPreviewBinding.inflate(layoutInflater, container)
|
||||||
|
previewView = previewBinding.previewView.also {
|
||||||
|
it.updateLayoutParams {
|
||||||
|
width = 456.dp
|
||||||
|
height = 342.dp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cameraUtils.setPreviewController(previewView)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,46 +1,22 @@
|
|||||||
package com.shuwei.dish.match.ui.fragment
|
package com.shuwei.dish.match.ui.fragment
|
||||||
|
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.os.Bundle
|
|
||||||
import android.text.SpannableStringBuilder
|
import android.text.SpannableStringBuilder
|
||||||
import android.text.style.AbsoluteSizeSpan
|
import android.text.style.AbsoluteSizeSpan
|
||||||
import android.text.style.ForegroundColorSpan
|
import android.text.style.ForegroundColorSpan
|
||||||
import android.text.style.LineHeightSpan
|
import android.text.style.LineHeightSpan
|
||||||
import android.text.style.StyleSpan
|
import android.text.style.StyleSpan
|
||||||
import android.util.Log
|
|
||||||
import android.util.SparseArray
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.FrameLayout
|
|
||||||
import androidx.core.graphics.toColorInt
|
import androidx.core.graphics.toColorInt
|
||||||
import androidx.core.view.forEach
|
|
||||||
import androidx.lifecycle.ViewModelProvider
|
|
||||||
import com.shuwei.dish.match.base.BaseApp
|
|
||||||
import com.shuwei.dish.match.base.BaseFragment
|
import com.shuwei.dish.match.base.BaseFragment
|
||||||
import com.shuwei.dish.match.databinding.FragmentDeviceConfigBinding
|
import com.shuwei.dish.match.databinding.FragmentDeviceConfigBinding
|
||||||
import com.shuwei.dish.match.db.AppRepository
|
|
||||||
import com.shuwei.dish.match.dialog.SeasoningSearchDialog
|
|
||||||
import com.shuwei.dish.match.entity.SeasoningEntity
|
|
||||||
import com.shuwei.dish.match.entity.ResetReasoningRecord
|
|
||||||
import com.shuwei.dish.match.adapter.TextCellAdapter
|
|
||||||
import com.shuwei.dish.match.base.BaseActivity
|
|
||||||
import com.shuwei.dish.match.utils.AddressUtil
|
|
||||||
import com.shuwei.dish.match.utils.JsonAssetsLoader
|
|
||||||
import com.shuwei.dish.match.utils.MultiClickDetector
|
|
||||||
import com.shuwei.dish.match.utils.WeightUtil
|
|
||||||
import com.shuwei.dish.match.utils.ext.appendText
|
|
||||||
import com.shuwei.dish.match.utils.ext.buildSpannableString
|
|
||||||
import com.shuwei.dish.match.utils.ext.dp
|
|
||||||
import com.shuwei.dish.match.utils.ext.clickWithDebounce
|
|
||||||
import com.shuwei.dish.match.utils.ext.gone
|
|
||||||
import com.shuwei.dish.match.utils.ext.toast
|
|
||||||
import com.shuwei.dish.match.utils.ext.visible
|
|
||||||
import com.shuwei.dish.match.viewmodel.AppViewModel
|
|
||||||
import com.shuwei.dish.match.viewmodel.factory.AppFactory
|
|
||||||
import com.shuwei.dish.match.ui.SamplingListActivity
|
import com.shuwei.dish.match.ui.SamplingListActivity
|
||||||
import com.shuwei.dish.match.ui.SelectDishActivity
|
import com.shuwei.dish.match.ui.SelectDishActivity
|
||||||
import com.shuwei.dish.match.utils.SpTool
|
import com.shuwei.dish.match.utils.SpTool
|
||||||
|
import com.shuwei.dish.match.utils.ext.appendText
|
||||||
|
import com.shuwei.dish.match.utils.ext.buildSpannableString
|
||||||
|
import com.shuwei.dish.match.utils.ext.dp
|
||||||
import com.shuwei.dish.match.utils.ext.startActivity
|
import com.shuwei.dish.match.utils.ext.startActivity
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,10 +41,10 @@ class DeviceConfigFragment : BaseFragment<FragmentDeviceConfigBinding>() {
|
|||||||
|
|
||||||
// private lateinit var appViewModel: AppViewModel
|
// private lateinit var appViewModel: AppViewModel
|
||||||
|
|
||||||
private val weightArray = SparseArray<Double>()
|
// private val weightArray = SparseArray<Double>()
|
||||||
private val addressArray = AddressUtil.getWeighAddressArray()
|
// private val addressArray = AddressUtil.getWeighAddressArray()
|
||||||
private var seasoningItems = mutableListOf<SeasoningEntity>()
|
// private var seasoningItems = mutableListOf<SeasoningEntity>()
|
||||||
private val detector = MultiClickDetector(targetCount = 10, intervalMs = 800)
|
// private val detector = MultiClickDetector(targetCount = 10, intervalMs = 800)
|
||||||
|
|
||||||
override fun inflateBinding(
|
override fun inflateBinding(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
@@ -77,7 +53,7 @@ class DeviceConfigFragment : BaseFragment<FragmentDeviceConfigBinding>() {
|
|||||||
return FragmentDeviceConfigBinding.inflate(inflater, container, false)
|
return FragmentDeviceConfigBinding.inflate(inflater, container, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun initialize(){
|
override fun initialize() {
|
||||||
initViewModel()
|
initViewModel()
|
||||||
initUI()
|
initUI()
|
||||||
// addWeighListener()
|
// addWeighListener()
|
||||||
@@ -140,7 +116,8 @@ class DeviceConfigFragment : BaseFragment<FragmentDeviceConfigBinding>() {
|
|||||||
loadCookSpan()
|
loadCookSpan()
|
||||||
loadSamplingSpan(isClicked = true)
|
loadSamplingSpan(isClicked = true)
|
||||||
activity?.startActivity<SamplingListActivity> {
|
activity?.startActivity<SamplingListActivity> {
|
||||||
putExtra(SamplingListActivity.IS_CONFIG_PAGE, true) }
|
putExtra(SamplingListActivity.IS_CONFIG_PAGE, true)
|
||||||
|
}
|
||||||
activity?.finish()
|
activity?.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,13 @@ 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.FragmentSeasoningConfigBinding
|
import com.shuwei.dish.match.databinding.FragmentSeasoningConfigBinding
|
||||||
import com.shuwei.dish.match.dialog.SeasoningSelectDialog
|
import com.shuwei.dish.match.dialog.SeasoningSelectDialog
|
||||||
|
import com.shuwei.dish.match.entity.SeasoningEntity
|
||||||
import com.shuwei.dish.match.entity.SeasoningSlotEntity
|
import com.shuwei.dish.match.entity.SeasoningSlotEntity
|
||||||
import com.shuwei.dish.match.scale.ScaleDeviceConfig
|
import com.shuwei.dish.match.scale.ScaleDeviceConfig
|
||||||
import com.shuwei.dish.match.scale.ScaleEvent
|
import com.shuwei.dish.match.scale.ScaleEvent
|
||||||
import com.shuwei.dish.match.scale.ScaleServiceManager
|
import com.shuwei.dish.match.scale.ScaleServiceManager
|
||||||
import com.shuwei.dish.match.scale.ScaleEvent.SlotConfig
|
import com.shuwei.dish.match.scale.ScaleEvent.SlotConfig
|
||||||
import com.shuwei.dish.match.ui.SettingActivity
|
import com.shuwei.dish.match.ui.SingleFragmentActivity
|
||||||
import com.shuwei.dish.match.utils.SizeTool
|
import com.shuwei.dish.match.utils.SizeTool
|
||||||
import com.shuwei.dish.match.utils.WeightUtil
|
import com.shuwei.dish.match.utils.WeightUtil
|
||||||
import com.shuwei.dish.match.utils.ext.dp
|
import com.shuwei.dish.match.utils.ext.dp
|
||||||
@@ -36,8 +37,10 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "SeasoningConfigFragment"
|
private const val TAG = "SeasoningConfigFragment"
|
||||||
|
|
||||||
/** 重量增加阈值(克),超过此值才触发高亮 */
|
/** 重量增加阈值(克),超过此值才触发高亮 */
|
||||||
private const val WEIGHT_DELTA_THRESHOLD = 10.0
|
private const val WEIGHT_DELTA_THRESHOLD = 10.0
|
||||||
|
|
||||||
/** 高亮自动恢复时间(毫秒) */
|
/** 高亮自动恢复时间(毫秒) */
|
||||||
private const val HIGHLIGHT_DURATION_MS = 15_000L
|
private const val HIGHLIGHT_DURATION_MS = 15_000L
|
||||||
}
|
}
|
||||||
@@ -47,21 +50,28 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
container: ViewGroup?
|
container: ViewGroup?
|
||||||
) = FragmentSeasoningConfigBinding.inflate(inflater, container, false)
|
) = FragmentSeasoningConfigBinding.inflate(inflater, container, false)
|
||||||
|
|
||||||
private lateinit var settingActivity: SettingActivity
|
private lateinit var currentActivity: SingleFragmentActivity
|
||||||
// private lateinit var appViewModel: AppViewModel
|
// private lateinit var appViewModel: AppViewModel
|
||||||
|
|
||||||
private val adapter22 by lazy { buildAdapter22() }
|
private val adapter22 by lazy { buildAdapter22() }
|
||||||
private val adapter18 by lazy { Seasoning18GridAdapter(showNameOnly = true, leftRightSpace = 20.dp) }
|
private val adapter18 by lazy {
|
||||||
|
Seasoning18GridAdapter(
|
||||||
|
showNameOnly = true,
|
||||||
|
leftRightSpace = 20.dp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/** 各秤的上一次重量快照,key 格式 "{deviceId}#{address}",用于计算 delta */
|
/** 各秤的上一次重量快照,key 格式 "{deviceId}#{address}",用于计算 delta */
|
||||||
private val weightSnapshot = mutableMapOf<String, Double>()
|
private val weightSnapshot = mutableMapOf<String, Double>()
|
||||||
|
|
||||||
/** 主线程 Handler,用于延迟清除高亮 */
|
/** 主线程 Handler,用于延迟清除高亮 */
|
||||||
private val mainHandler = Handler(Looper.getMainLooper())
|
private val mainHandler = Handler(Looper.getMainLooper())
|
||||||
|
|
||||||
/** 当前高亮清除任务,新高亮触发时取消旧任务 */
|
/** 当前高亮清除任务,新高亮触发时取消旧任务 */
|
||||||
private var clearHighlightRunnable: Runnable? = null
|
private var clearHighlightRunnable: Runnable? = null
|
||||||
|
|
||||||
override fun initialize() {
|
override fun initialize() {
|
||||||
settingActivity = activity as SettingActivity
|
currentActivity = activity as SingleFragmentActivity
|
||||||
// initViewModel()
|
// initViewModel()
|
||||||
setupRecyclerViews()
|
setupRecyclerViews()
|
||||||
bindAdapterClicks()
|
bindAdapterClicks()
|
||||||
@@ -73,62 +83,67 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
/** 绑定油盆格子点击,弹出调料选择弹窗并保存到 DEVICE_ID_1 */
|
/** 绑定油盆格子点击,弹出调料选择弹窗并保存到 DEVICE_ID_1 */
|
||||||
private fun bindOilSlotClick() {
|
private fun bindOilSlotClick() {
|
||||||
binding.tvOilSlot.setOnClickListener {
|
binding.tvOilSlot.setOnClickListener {
|
||||||
SeasoningSelectDialog(
|
openSeasoningSelectDialog(0) { item ->
|
||||||
activity = settingActivity,
|
binding.tvOilSlot.text = item.goodsName ?: "-"
|
||||||
clickIndex = 0,
|
saveSlotAndBroadcast(
|
||||||
onItemSelected = { item ->
|
SeasoningSlotEntity(
|
||||||
binding.tvOilSlot.text = item.goodsName ?: "-"
|
deviceId = ScaleDeviceConfig.DEVICE_ID_1,
|
||||||
saveSlotAndBroadcast(
|
address = 1,
|
||||||
SeasoningSlotEntity(
|
goodsId = item.goodsId,
|
||||||
deviceId = ScaleDeviceConfig.DEVICE_ID_1,
|
goodsName = item.goodsName ?: ""
|
||||||
address = 1,
|
|
||||||
goodsId = item.goodsId,
|
|
||||||
goodsName = item.goodsName ?: ""
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
).show()
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 绑定两个 Adapter 的格子点击,弹出调料选择弹窗 */
|
/** 绑定两个 Adapter 的格子点击,弹出调料选择弹窗 */
|
||||||
private fun bindAdapterClicks() {
|
private fun bindAdapterClicks() {
|
||||||
adapter22.onItemClick = { scaleData, position ->
|
adapter22.onItemClick = { scaleData, position ->
|
||||||
SeasoningSelectDialog(
|
openSeasoningSelectDialog(position) { item ->
|
||||||
activity = settingActivity,
|
adapter22.updateItemName(position, item.goodsName ?: "")
|
||||||
clickIndex = position,
|
saveSlotAndBroadcast(
|
||||||
onItemSelected = { item ->
|
SeasoningSlotEntity(
|
||||||
adapter22.updateItemName(position, item.goodsName ?: "")
|
deviceId = ScaleDeviceConfig.DEVICE_ID_22,
|
||||||
saveSlotAndBroadcast(
|
address = scaleData.address,
|
||||||
SeasoningSlotEntity(
|
goodsId = item.goodsId,
|
||||||
deviceId = ScaleDeviceConfig.DEVICE_ID_22,
|
goodsName = item.goodsName ?: ""
|
||||||
address = scaleData.address,
|
|
||||||
goodsId = item.goodsId,
|
|
||||||
goodsName = item.goodsName ?: ""
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
).show()
|
}
|
||||||
}
|
}
|
||||||
adapter18.onItemClick = { scaleData, position ->
|
adapter18.onItemClick = { scaleData, position ->
|
||||||
SeasoningSelectDialog(
|
openSeasoningSelectDialog(position) { item ->
|
||||||
activity = settingActivity,
|
adapter18.updateItemName(position, item.goodsName ?: "")
|
||||||
clickIndex = position,
|
saveSlotAndBroadcast(
|
||||||
onItemSelected = { item ->
|
SeasoningSlotEntity(
|
||||||
adapter18.updateItemName(position, item.goodsName ?: "")
|
deviceId = ScaleDeviceConfig.DEVICE_ID_18,
|
||||||
saveSlotAndBroadcast(
|
address = scaleData.address,
|
||||||
SeasoningSlotEntity(
|
goodsId = item.goodsId,
|
||||||
deviceId = ScaleDeviceConfig.DEVICE_ID_18,
|
goodsName = item.goodsName ?: ""
|
||||||
address = scaleData.address,
|
|
||||||
goodsId = item.goodsId,
|
|
||||||
goodsName = item.goodsName ?: ""
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
).show()
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开调料选择弹窗
|
||||||
|
*
|
||||||
|
* @param position 格子位置
|
||||||
|
* @param callback 调料选择回调
|
||||||
|
*/
|
||||||
|
private fun openSeasoningSelectDialog(
|
||||||
|
position: Int,
|
||||||
|
callback: (item: SeasoningEntity) -> Unit
|
||||||
|
) {
|
||||||
|
SeasoningSelectDialog(
|
||||||
|
activity = currentActivity,
|
||||||
|
clickIndex = position,
|
||||||
|
onItemSelected = callback
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将单个槽位写入 Room,再读取全量配置广播给子设备
|
* 将单个槽位写入 Room,再读取全量配置广播给子设备
|
||||||
* 仅主设备执行广播,子设备不调用此方法
|
* 仅主设备执行广播,子设备不调用此方法
|
||||||
@@ -153,6 +168,7 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
|
|
||||||
|
|
||||||
private val size by lazy { SizeTool.getFlexLayoutSize(20.dp) }
|
private val size by lazy { SizeTool.getFlexLayoutSize(20.dp) }
|
||||||
|
|
||||||
/** 构建上层(22格)Adapter,需要先计算格子尺寸 */
|
/** 构建上层(22格)Adapter,需要先计算格子尺寸 */
|
||||||
private fun buildAdapter22(): Seasoning22GridAdapter {
|
private fun buildAdapter22(): Seasoning22GridAdapter {
|
||||||
return Seasoning22GridAdapter(
|
return Seasoning22GridAdapter(
|
||||||
@@ -205,7 +221,8 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
}
|
}
|
||||||
// 加载油盆格子名称(address=1)
|
// 加载油盆格子名称(address=1)
|
||||||
val oilSlot = slotsOil.firstOrNull { it.address == 1 }
|
val oilSlot = slotsOil.firstOrNull { it.address == 1 }
|
||||||
binding.tvOilSlot.text = if (oilSlot != null && oilSlot.goodsName.isNotEmpty()) oilSlot.goodsName else "-"
|
binding.tvOilSlot.text =
|
||||||
|
if (oilSlot != null && oilSlot.goodsName.isNotEmpty()) oilSlot.goodsName else "-"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,7 +240,10 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
* - STATE_STABLE:无条件更新基准(覆盖取走调料/归零等场景)
|
* - STATE_STABLE:无条件更新基准(覆盖取走调料/归零等场景)
|
||||||
*/
|
*/
|
||||||
private fun addWeightListener() {
|
private fun addWeightListener() {
|
||||||
Log.d(TAG, "addWeightListener: 注册监听, deviceId=${GlobalData.deviceId}, role=${GlobalData.deviceRole}")
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"addWeightListener: 注册监听, deviceId=${GlobalData.deviceId}, role=${GlobalData.deviceRole}"
|
||||||
|
)
|
||||||
|
|
||||||
if (GlobalData.deviceRole == DeviceRole.MASTER) {
|
if (GlobalData.deviceRole == DeviceRole.MASTER) {
|
||||||
// 主设备:通过 allScales StateFlow 观测所有秤(含远端子设备秤)
|
// 主设备:通过 allScales StateFlow 观测所有秤(含远端子设备秤)
|
||||||
@@ -243,14 +263,21 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
val delta = data.weight - baseline
|
val delta = data.weight - baseline
|
||||||
Log.d(TAG, "allScales: key=$key address=${data.address} state=${data.state} weight=${data.weight} baseline=$baseline delta=$delta")
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"allScales: key=$key address=${data.address} state=${data.state} weight=${data.weight} baseline=$baseline delta=$delta"
|
||||||
|
)
|
||||||
when {
|
when {
|
||||||
// 仅在秤稳定后判断增量,避免取走物品时手部冲力造成误触发
|
// 仅在秤稳定后判断增量,避免取走物品时手部冲力造成误触发
|
||||||
data.state == WeightUtil.STATE_STABLE && delta > WEIGHT_DELTA_THRESHOLD -> {
|
data.state == WeightUtil.STATE_STABLE && delta > WEIGHT_DELTA_THRESHOLD -> {
|
||||||
weightSnapshot[snapshotKey] = data.weight
|
weightSnapshot[snapshotKey] = data.weight
|
||||||
Log.d(TAG, "allScales: 触发高亮 key=$key address=${data.address} delta=$delta")
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"allScales: 触发高亮 key=$key address=${data.address} delta=$delta"
|
||||||
|
)
|
||||||
triggerHighlight(data.deviceId, data.address, delta)
|
triggerHighlight(data.deviceId, data.address, delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
data.state == WeightUtil.STATE_STABLE -> {
|
data.state == WeightUtil.STATE_STABLE -> {
|
||||||
weightSnapshot[snapshotKey] = data.weight
|
weightSnapshot[snapshotKey] = data.weight
|
||||||
}
|
}
|
||||||
@@ -263,7 +290,10 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
WeightUtil.addWeightListener(TAG) { address, state, weight ->
|
WeightUtil.addWeightListener(TAG) { address, state, weight ->
|
||||||
val snapshotKey = "${GlobalData.deviceId}#$address"
|
val snapshotKey = "${GlobalData.deviceId}#$address"
|
||||||
val baseline = weightSnapshot[snapshotKey]
|
val baseline = weightSnapshot[snapshotKey]
|
||||||
Log.d(TAG, "onWeight: address=$address state=$state weight=$weight baseline=$baseline")
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"onWeight: address=$address state=$state weight=$weight baseline=$baseline"
|
||||||
|
)
|
||||||
|
|
||||||
if (baseline == null) {
|
if (baseline == null) {
|
||||||
weightSnapshot[snapshotKey] = weight
|
weightSnapshot[snapshotKey] = weight
|
||||||
@@ -271,7 +301,10 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val delta = weight - baseline
|
val delta = weight - baseline
|
||||||
Log.d(TAG, "onWeight: address=$address state=$state weight=$weight baseline=$baseline delta=$delta")
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"onWeight: address=$address state=$state weight=$weight baseline=$baseline delta=$delta"
|
||||||
|
)
|
||||||
|
|
||||||
when {
|
when {
|
||||||
// 仅在秤稳定后判断增量,避免取走物品时手部冲力造成误触发
|
// 仅在秤稳定后判断增量,避免取走物品时手部冲力造成误触发
|
||||||
@@ -280,6 +313,7 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
Log.d(TAG, "onWeight: 触发高亮 address=$address delta=$delta")
|
Log.d(TAG, "onWeight: 触发高亮 address=$address delta=$delta")
|
||||||
triggerHighlight(GlobalData.deviceId, address, delta)
|
triggerHighlight(GlobalData.deviceId, address, delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
state == WeightUtil.STATE_STABLE -> {
|
state == WeightUtil.STATE_STABLE -> {
|
||||||
weightSnapshot[snapshotKey] = weight
|
weightSnapshot[snapshotKey] = weight
|
||||||
}
|
}
|
||||||
@@ -302,7 +336,10 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
val pos18 = if (sourceDeviceId == ScaleDeviceConfig.DEVICE_ID_18)
|
val pos18 = if (sourceDeviceId == ScaleDeviceConfig.DEVICE_ID_18)
|
||||||
ScaleDeviceConfig.SCALE_ORDER_18.indexOf(address) else -1
|
ScaleDeviceConfig.SCALE_ORDER_18.indexOf(address) else -1
|
||||||
|
|
||||||
Log.d(TAG, "triggerHighlight: sourceDeviceId=$sourceDeviceId address=$address pos22=$pos22 pos18=$pos18")
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"triggerHighlight: sourceDeviceId=$sourceDeviceId address=$address pos22=$pos22 pos18=$pos18"
|
||||||
|
)
|
||||||
|
|
||||||
// 两个列表都不包含该地址,忽略
|
// 两个列表都不包含该地址,忽略
|
||||||
if (pos22 < 0 && pos18 < 0) {
|
if (pos22 < 0 && pos18 < 0) {
|
||||||
@@ -318,6 +355,7 @@ class SeasoningConfigFragment : BaseFragment<FragmentSeasoningConfigBinding>() {
|
|||||||
adapter22.highlightPosition(pos22)
|
adapter22.highlightPosition(pos22)
|
||||||
adapter18.clearHighlight()
|
adapter18.clearHighlight()
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
adapter18.highlightPosition(pos18)
|
adapter18.highlightPosition(pos18)
|
||||||
adapter22.clearHighlight()
|
adapter22.clearHighlight()
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -1,77 +1,165 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
tools:background="@color/bg_color"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<!-- 底部导航菜单 -->
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/bottomMenu"
|
android:id="@+id/ll_cook_mode"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="120dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:background="@android:color/transparent"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginHorizontal="32dp"
|
||||||
android:layout_marginBottom="10dp"
|
android:background="@drawable/shape_scale_cell">
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:layout_marginEnd="15dp"
|
|
||||||
android:elevation="8dp">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
<TextView
|
||||||
android:id="@+id/btnDeviceConfig"
|
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="70dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="设备切换"
|
android:text="餐品模式"
|
||||||
android:textSize="28sp"
|
android:textSize="32sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:background="@android:color/transparent" />
|
android:layout_marginStart="32dp"
|
||||||
|
android:textColor="@color/black333" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
<TextView
|
||||||
android:id="@+id/btnSeasoningConfig"
|
android:id="@+id/tvCurrentMode"
|
||||||
android:layout_width="0dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="70dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
tools:text="当前:制作模式"
|
||||||
android:text="调料配置"
|
|
||||||
android:textSize="26sp"
|
android:textSize="26sp"
|
||||||
android:background="@android:color/transparent" />
|
android:layout_marginStart="32dp"
|
||||||
|
android:textColor="@color/black999" />
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
|
||||||
android:id="@+id/btnFoodCollect"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="采集食材"
|
|
||||||
android:textSize="26sp"
|
|
||||||
android:background="@android:color/transparent" />
|
|
||||||
|
|
||||||
<!-- <androidx.appcompat.widget.AppCompatButton-->
|
|
||||||
<!-- android:id="@+id/btnDeviceRole"-->
|
|
||||||
<!-- android:layout_width="0dp"-->
|
|
||||||
<!-- android:layout_height="70dp"-->
|
|
||||||
<!-- android:layout_weight="1"-->
|
|
||||||
<!-- android:text="设备角色:子设备"-->
|
|
||||||
<!-- android:textSize="22sp"-->
|
|
||||||
<!-- android:background="@android:color/transparent" />-->
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatButton
|
|
||||||
android:id="@+id/btnScaleMonitor"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="70dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="秤数据监控"
|
|
||||||
android:textSize="26sp"
|
|
||||||
android:visibility="visible"
|
|
||||||
android:background="@android:color/transparent" />
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:src="@drawable/ic_arrow_right2"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Fragment 容器 -->
|
<LinearLayout
|
||||||
<FrameLayout
|
android:id="@+id/llSeasoningConfig"
|
||||||
android:id="@+id/fragmentContainer"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="120dp"
|
||||||
android:layout_weight="1" />
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginHorizontal="32dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:background="@drawable/shape_scale_cell">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="调料区设置"
|
||||||
|
android:textSize="32sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:textColor="@color/black333" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:src="@drawable/ic_arrow_right2"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/llFoodCollect"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginHorizontal="32dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:background="@drawable/shape_scale_cell">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="食材采样"
|
||||||
|
android:textSize="32sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:layout_marginStart="32dp"
|
||||||
|
android:textColor="@color/black333" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginEnd="20dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:src="@drawable/ic_arrow_right2"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- <!– 底部导航菜单 –>-->
|
||||||
|
<!-- <LinearLayout-->
|
||||||
|
<!-- android:id="@+id/bottomMenu"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="wrap_content"-->
|
||||||
|
<!-- android:orientation="horizontal"-->
|
||||||
|
<!-- android:background="@android:color/transparent"-->
|
||||||
|
<!-- android:layout_marginTop="10dp"-->
|
||||||
|
<!-- android:layout_marginBottom="10dp"-->
|
||||||
|
<!-- android:layout_marginStart="15dp"-->
|
||||||
|
<!-- android:layout_marginEnd="15dp"-->
|
||||||
|
<!-- android:elevation="8dp">-->
|
||||||
|
|
||||||
|
<!-- <androidx.appcompat.widget.AppCompatButton-->
|
||||||
|
<!-- android:id="@+id/btnDeviceConfig"-->
|
||||||
|
<!-- android:layout_width="0dp"-->
|
||||||
|
<!-- android:layout_height="70dp"-->
|
||||||
|
<!-- android:layout_weight="1"-->
|
||||||
|
<!-- android:text="设备切换"-->
|
||||||
|
<!-- android:textSize="28sp"-->
|
||||||
|
<!-- android:textStyle="bold"-->
|
||||||
|
<!-- android:background="@android:color/transparent" />-->
|
||||||
|
|
||||||
|
<!-- <androidx.appcompat.widget.AppCompatButton-->
|
||||||
|
<!-- android:id="@+id/btnSeasoningConfig"-->
|
||||||
|
<!-- android:layout_width="0dp"-->
|
||||||
|
<!-- android:layout_height="70dp"-->
|
||||||
|
<!-- android:layout_weight="1"-->
|
||||||
|
<!-- android:text="调料配置"-->
|
||||||
|
<!-- android:textSize="26sp"-->
|
||||||
|
<!-- android:background="@android:color/transparent" />-->
|
||||||
|
|
||||||
|
<!-- <androidx.appcompat.widget.AppCompatButton-->
|
||||||
|
<!-- android:id="@+id/btnFoodCollect"-->
|
||||||
|
<!-- android:layout_width="0dp"-->
|
||||||
|
<!-- android:layout_height="70dp"-->
|
||||||
|
<!-- android:layout_weight="1"-->
|
||||||
|
<!-- android:text="采集食材"-->
|
||||||
|
<!-- android:textSize="26sp"-->
|
||||||
|
<!-- android:background="@android:color/transparent" />-->
|
||||||
|
|
||||||
|
<!-- <androidx.appcompat.widget.AppCompatButton-->
|
||||||
|
<!-- android:id="@+id/btnScaleMonitor"-->
|
||||||
|
<!-- android:layout_width="0dp"-->
|
||||||
|
<!-- android:layout_height="70dp"-->
|
||||||
|
<!-- android:layout_weight="1"-->
|
||||||
|
<!-- android:text="秤数据监控"-->
|
||||||
|
<!-- android:textSize="26sp"-->
|
||||||
|
<!-- android:visibility="visible"-->
|
||||||
|
<!-- android:background="@android:color/transparent" />-->
|
||||||
|
|
||||||
|
<!-- </LinearLayout>-->
|
||||||
|
|
||||||
|
<!-- <!– Fragment 容器 –>-->
|
||||||
|
<!-- <FrameLayout-->
|
||||||
|
<!-- android:id="@+id/fragmentContainer"-->
|
||||||
|
<!-- android:layout_width="match_parent"-->
|
||||||
|
<!-- android:layout_height="0dp"-->
|
||||||
|
<!-- android:layout_weight="1" />-->
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user