修改layout目录改为layout_sw800dp,优化调料显示UI,其它细节优化

This commit is contained in:
2025-09-03 17:40:28 +08:00
parent cde2dccd04
commit 03d3785e2b
46 changed files with 940 additions and 900 deletions
+30 -8
View File
@@ -1,3 +1,4 @@
plugins { plugins {
alias(libs.plugins.android.application) alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.android)
@@ -21,6 +22,8 @@ android {
abiFilters.addAll(listOf("armeabi", "armeabi-v7a")) abiFilters.addAll(listOf("armeabi", "armeabi-v7a"))
//, 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a' //, 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a'
} }
resConfigs("sw800dp")
} }
signingConfigs { signingConfigs {
create("debug_507") { create("debug_507") {
@@ -58,6 +61,25 @@ android {
pickFirst("lib/armeabi-v7a/libserial_port.so") pickFirst("lib/armeabi-v7a/libserial_port.so")
pickFirst("lib/arme64-v8a/libserial_port.so") pickFirst("lib/arme64-v8a/libserial_port.so")
} }
sourceSets {
named("main") {
res.setSrcDirs(
listOf(
"src/main/res",
"src/main/res/layout-sw800dp"
)
)
}
}
lint {
disable.add("MissingDefaultResource")
}
// productFlavors {
// create("sw800dp") {
// dimension = "screen"
//// resConfigs("en", "xxhdpi") // 可选额外配置
// }
// }
} }
dependencies { dependencies {
@@ -91,14 +113,14 @@ dependencies {
implementation("io.github.scwang90:refresh-header-classics:3.0.0-alpha") implementation("io.github.scwang90:refresh-header-classics:3.0.0-alpha")
//经典刷新头 //经典刷新头
implementation("io.github.scwang90:refresh-header-radar:3.0.0-alpha") implementation("io.github.scwang90:refresh-header-radar:3.0.0-alpha")
//雷达刷新头 // //雷达刷新头
implementation("io.github.scwang90:refresh-header-falsify:3.0.0-alpha") // implementation("io.github.scwang90:refresh-header-falsify:3.0.0-alpha")
//虚拟刷新头 // //虚拟刷新头
implementation("io.github.scwang90:refresh-header-material:3.0.0-alpha") // implementation("io.github.scwang90:refresh-header-material:3.0.0-alpha")
//谷歌刷新头 // //谷歌刷新头
implementation("io.github.scwang90:refresh-header-two-level:3.0.0-alpha") // implementation("io.github.scwang90:refresh-header-two-level:3.0.0-alpha")
//二级刷新头 // //二级刷新头
implementation("io.github.scwang90:refresh-footer-ball:3.0.0-alpha") // implementation("io.github.scwang90:refresh-footer-ball:3.0.0-alpha")
//球脉冲加载 //球脉冲加载
implementation("io.github.scwang90:refresh-footer-classics:3.0.0-alpha") implementation("io.github.scwang90:refresh-footer-classics:3.0.0-alpha")
//经典加载 //经典加载
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,134 +1,134 @@
package com.shuwei.dish.match.adapter //package com.shuwei.dish.match.adapter
//
import android.annotation.SuppressLint //import android.annotation.SuppressLint
import android.widget.TextView //import android.widget.TextView
import androidx.recyclerview.widget.GridLayoutManager //import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView //import androidx.recyclerview.widget.RecyclerView
import com.shuwei.dish.match.base.BaseActivity //import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.dialog.BottomDialog2 //import com.shuwei.dish.match.dialog.BottomDialog2
import com.shuwei.dish.match.entity.SeasoningEntity //import com.shuwei.dish.match.entity.SeasoningEntity
import com.shuwei.dish.match.ui.DeviceSettingActivity //import com.shuwei.dish.match.ui.DeviceSettingActivity
import com.shuwei.dish.match.ui.SubmitDishActivity //import com.shuwei.dish.match.ui.SubmitDishActivity
import com.shuwei.dish.match.utils.DataUtil //import com.shuwei.dish.match.utils.DataUtil
//
object SeasoningCellTool { //object SeasoningCellTool {
private val TAG = "SeasoningCellTool" // private val TAG = "SeasoningCellTool"
//
private val list = mutableListOf<SeasoningEntity>() // private val list = mutableListOf<SeasoningEntity>()
private lateinit var activity: BaseActivity // private lateinit var activity: BaseActivity
private var pageType: Int = 0 // private var pageType: Int = 0
//
@SuppressLint("StaticFieldLeak") // @SuppressLint("StaticFieldLeak")
private lateinit var cellAdapter: TextCellAdapter // private lateinit var cellAdapter: TextCellAdapter
//
@SuppressLint("NotifyDataSetChanged") // @SuppressLint("NotifyDataSetChanged")
fun loadData( // fun loadData(
activity: BaseActivity, // activity: BaseActivity,
initList: MutableList<SeasoningEntity>? = null, // initList: MutableList<SeasoningEntity>? = null,
recyclerView: RecyclerView, // recyclerView: RecyclerView,
tvCell: TextView, // tvCell: TextView,
pageType: Int = 0 // pageType: Int = 0
) { // ) {
this.activity = activity // this.activity = activity
this.pageType = pageType // this.pageType = pageType
list.clear() // list.clear()
val tempList = buildData(initList, pageType) // val tempList = buildData(initList, pageType)
list.addAll(tempList) // list.addAll(tempList)
recyclerView.run { // recyclerView.run {
if (adapter == null) { // if (adapter == null) {
layoutManager = GridLayoutManager( // layoutManager = GridLayoutManager(
activity, // activity,
3, // 3,
GridLayoutManager.VERTICAL, // GridLayoutManager.VERTICAL,
false // false
) // )
cellAdapter = TextCellAdapter(list).apply { // cellAdapter = TextCellAdapter(list).apply {
onCellClick = { position -> // onCellClick = { position ->
val currentAddress = DataUtil.getWeighAddressArray().get(position) // val currentAddress = DataUtil.getWeighAddressArray().get(position)
BottomDialog2( // BottomDialog2(
weighIndex = position, // weighIndex = position,
weighAddress = currentAddress, // weighAddress = currentAddress,
clickName = list[position].goodsName // clickName = list[position].goodsName
).show(activity) { item -> // ).show(activity) { item ->
list[position].let { current -> // list[position].let { current ->
syncItem(current, item) // syncItem(current, item)
//3-调料 // //3-调料
current.materialType = 3 // current.materialType = 3
current.sort = position // current.sort = position
} // }
notifyItemChanged(position) // notifyItemChanged(position)
if (position == 14) { // if (position == 14) {
syncItem(list[10], list[14]) // syncItem(list[10], list[14])
syncItem(list[11], list[14]) // syncItem(list[11], list[14])
syncItem(list[13], list[14]) // syncItem(list[13], list[14])
TextCellAdapter.loadCell(tvCell, list[14]) // TextCellAdapter.loadCell(tvCell, list[14])
notifyItemChanged(10) // notifyItemChanged(10)
notifyItemChanged(11) // notifyItemChanged(11)
notifyItemChanged(13) // notifyItemChanged(13)
notifyItemChanged(14) // notifyItemChanged(14)
} // }
if (activity is DeviceSettingActivity) { // if (activity is DeviceSettingActivity) {
//activity.list = list // //activity.list = list
activity.saveSeasoning(list[position]) // activity.saveSeasoning(list[position])
} // }
} // }
} // }
} // }
adapter = cellAdapter // adapter = cellAdapter
} else { // } else {
cellAdapter.notifyDataSetChanged() // cellAdapter.notifyDataSetChanged()
} // }
if (activity is SubmitDishActivity) { // if (activity is SubmitDishActivity) {
activity.updateSeasoningList(list) // activity.updateSeasoningList(list)
} // }
} // }
if (pageType == 1) { // if (pageType == 1) {
tvCell.setOnClickListener { // tvCell.setOnClickListener {
cellAdapter.onCellClick?.invoke(14) // cellAdapter.onCellClick?.invoke(14)
} // }
} // }
TextCellAdapter.loadCell(tvCell, list[list.size - 1]) // TextCellAdapter.loadCell(tvCell, list[list.size - 1])
} // }
//
private fun buildData( // private fun buildData(
initList: MutableList<SeasoningEntity>?, // initList: MutableList<SeasoningEntity>?,
pageType: Int = 0 // pageType: Int = 0
): MutableList<SeasoningEntity> { // ): MutableList<SeasoningEntity> {
val list = mutableListOf<SeasoningEntity>() // val list = mutableListOf<SeasoningEntity>()
repeat(15) { // repeat(15) {
list.add(SeasoningEntity().apply { this.pageType = pageType }) // list.add(SeasoningEntity().apply { this.pageType = pageType })
} // }
if (initList.isNullOrEmpty().not()) { // if (initList.isNullOrEmpty().not()) {
initList.forEach { // initList.forEach {
if (it.sort < list.size) { // if (it.sort < list.size) {
list[it.sort] = it.apply { this.pageType = pageType } // list[it.sort] = it.apply { this.pageType = pageType }
} // }
} // }
var lastItem = initList.firstOrNull { it.sort == 14 } // var lastItem = initList.firstOrNull { it.sort == 14 }
lastItem = lastItem ?: list[list.size - 1] // lastItem = lastItem ?: list[list.size - 1]
list[10] = lastItem // list[10] = lastItem
list[11] = lastItem // list[11] = lastItem
list[13] = lastItem // list[13] = lastItem
} // }
return list // return list
} // }
//
private fun syncItem(item: SeasoningEntity, newItem: SeasoningEntity) { // private fun syncItem(item: SeasoningEntity, newItem: SeasoningEntity) {
item.run { // item.run {
goodsId = newItem.goodsId // goodsId = newItem.goodsId
goodsName = newItem.goodsName // goodsName = newItem.goodsName
goodsOrRelationCode = newItem.goodsOrRelationCode // goodsOrRelationCode = newItem.goodsOrRelationCode
relateionType = newItem.relateionType // relateionType = newItem.relateionType
materialType = newItem.materialType // materialType = newItem.materialType
allEdible = newItem.allEdible // allEdible = newItem.allEdible
useWeight = newItem.useWeight // useWeight = newItem.useWeight
popularName = newItem.popularName // popularName = newItem.popularName
canteenId = newItem.canteenId // canteenId = newItem.canteenId
relateionType_dictText = newItem.relateionType_dictText // relateionType_dictText = newItem.relateionType_dictText
//
foodId = newItem.foodId // foodId = newItem.foodId
sort = newItem.sort // sort = newItem.sort
} // }
} // }
//
} //}
@@ -22,7 +22,7 @@
// //
// override fun onCreate(savedInstanceState: Bundle?) { // override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState) // super.onCreate(savedInstanceState)
// setContentView(R.layout.custom_toast) // setContentView(R.layout-sw800dp.custom_toast)
// findViewById<TextView>(R.id.tvMessage)?.text = message // findViewById<TextView>(R.id.tvMessage)?.text = message
// setCancelable(true) // setCancelable(true)
// if (message.isNullOrBlank() || // if (message.isNullOrBlank() ||
@@ -88,7 +88,7 @@
//// activity = activity, //// activity = activity,
//// themeResId = R.style.ToastDialogTheme, //// themeResId = R.style.ToastDialogTheme,
//// ).apply { //// ).apply {
//// setContentView(R.layout.custom_toast) //// setContentView(R.layout-sw800dp.custom_toast)
//// findViewById<TextView>(R.id.tvMessage)?.text = message //// findViewById<TextView>(R.id.tvMessage)?.text = message
//// setCancelable(true) //// setCancelable(true)
//// if (message.isNullOrBlank() || //// if (message.isNullOrBlank() ||
@@ -1,246 +1,246 @@
package com.shuwei.dish.match.ui //package com.shuwei.dish.match.ui
//
import android.graphics.Typeface //import android.graphics.Typeface
import android.os.Bundle //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 androidx.core.graphics.toColorInt //import androidx.core.graphics.toColorInt
import androidx.lifecycle.ViewModelProvider //import androidx.lifecycle.ViewModelProvider
import com.shuwei.dish.match.adapter.SeasoningCellTool //import com.shuwei.dish.match.adapter.SeasoningCellTool
import com.shuwei.dish.match.base.BaseActivity //import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.base.BaseApp //import com.shuwei.dish.match.base.BaseApp
import com.shuwei.dish.match.databinding.ActivityDeviceSettingBinding //import com.shuwei.dish.match.databinding.ActivityDeviceSettingBinding
import com.shuwei.dish.match.databinding.LayoutFoodRemindBinding //import com.shuwei.dish.match.databinding.LayoutFoodRemindBinding
import com.shuwei.dish.match.db.AppRepository //import com.shuwei.dish.match.db.AppRepository
import com.shuwei.dish.match.dialog.CommonDialog //import com.shuwei.dish.match.dialog.CommonDialog
import com.shuwei.dish.match.entity.SeasoningEntity //import com.shuwei.dish.match.entity.SeasoningEntity
import com.shuwei.dish.match.entity.ResetReasoningRecord //import com.shuwei.dish.match.entity.ResetReasoningRecord
import com.shuwei.dish.match.utils.DataUtil //import com.shuwei.dish.match.utils.DataUtil
import com.shuwei.dish.match.utils.JsonAssetsLoader //import com.shuwei.dish.match.utils.JsonAssetsLoader
import com.shuwei.dish.match.utils.MultiClickDetector //import com.shuwei.dish.match.utils.MultiClickDetector
import com.shuwei.dish.match.utils.WeightUtil //import com.shuwei.dish.match.utils.WeightUtil
import com.shuwei.dish.match.utils.ext.appendText //import com.shuwei.dish.match.utils.ext.appendText
import com.shuwei.dish.match.utils.ext.buildSpannableString //import com.shuwei.dish.match.utils.ext.buildSpannableString
import com.shuwei.dish.match.utils.ext.dp //import com.shuwei.dish.match.utils.ext.dp
import com.shuwei.dish.match.utils.ext.startActivity //import com.shuwei.dish.match.utils.ext.startActivity
import com.shuwei.dish.match.utils.ext.toast //import com.shuwei.dish.match.utils.ext.toast
import com.shuwei.dish.match.utils.ext.visible //import com.shuwei.dish.match.utils.ext.visible
import com.shuwei.dish.match.viewmodel.AppViewModel //import com.shuwei.dish.match.viewmodel.AppViewModel
import com.shuwei.dish.match.viewmodel.factory.AppFactory //import com.shuwei.dish.match.viewmodel.factory.AppFactory
import com.shuwei.dish.match.R //import com.shuwei.dish.match.R
//
class DeviceSettingActivity : BaseActivity() { //class DeviceSettingActivity : BaseActivity() {
//
companion object { // companion object {
//
const val TAG = "DeviceSettingActivity" // const val TAG = "DeviceSettingActivity"
//
const val COOK_MODE = "cookMode" // const val COOK_MODE = "cookMode"
//
val modeList = listOf<ModeBean>( // val modeList = listOf<ModeBean>(
ModeBean("制作模式", "菜品快速制作,记录熟重"), // ModeBean("制作模式", "菜品快速制作,记录熟重"),
ModeBean("采样模式", "菜品快速制作,记录熟重"), // ModeBean("采样模式", "菜品快速制作,记录熟重"),
ModeBean("品控模式", "菜品快速制作,记录熟重") // ModeBean("品控模式", "菜品快速制作,记录熟重")
) // )
} // }
//
data class ModeBean( // data class ModeBean(
var modeName: String, // var modeName: String,
var modeDesc: String // var modeDesc: String
) // )
//
private lateinit var binding: ActivityDeviceSettingBinding // private lateinit var binding: ActivityDeviceSettingBinding
//
private lateinit var appViewModel: AppViewModel // private lateinit var appViewModel: AppViewModel
//
private var cookMode: Int = 0 // private var cookMode: Int = 0
//
override fun onCreate(savedInstanceState: Bundle?) { // override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) // super.onCreate(savedInstanceState)
binding = ActivityDeviceSettingBinding.inflate(layoutInflater) // binding = ActivityDeviceSettingBinding.inflate(layoutInflater)
setContentView(binding.root) // setContentView(binding.root)
cookMode = intent.getIntExtra(COOK_MODE, 0) // cookMode = intent.getIntExtra(COOK_MODE, 0)
initViewModel() // initViewModel()
setHeaderBackground() // setHeaderBackground()
setTitleBar(titleBarAction = { // setTitleBar(titleBarAction = {
it.visible() // it.visible()
}, titleAction = { // }, titleAction = {
it.text = "设备配置" // it.text = "设备配置"
}, rightIconActon = { // }, rightIconActon = {
it.visible() // it.visible()
it.alpha = 0.0F // it.alpha = 0.0F
it.setImageResource(R.drawable.ic_setting) // it.setImageResource(R.drawable.ic_setting)
it.setOnClickListener { // it.setOnClickListener {
// appViewModel.clearAllSeasoning{ //// appViewModel.clearAllSeasoning{
//// loadSeasoning()
//// }
// detector.setOnDelayedMultiClickListener(it) {
// defaultDataSettingDialog()
// }
// }
// })
//
// loadQualitySpan(isEnable = false)
// when (cookMode) {
// 1 -> {
// binding.rbModeCook.isChecked = true
// binding.rbModeSampling.isChecked = false
// loadCookSpan(isClicked = true)
// loadSamplingSpan()
// }
//
// 2 -> {
// binding.rbModeCook.isChecked = false
// binding.rbModeSampling.isChecked = true
// loadCookSpan()
// loadSamplingSpan(isClicked = true)
// }
//
// else -> 0
// }
//
// binding.rbModeCook.setOnClickListener {
// binding.rbModeCook.isChecked = true
// binding.rbModeSampling.isChecked = false
// loadCookSpan(isClicked = true)
// loadSamplingSpan()
// startActivity<SelectDishActivity> { }
// finish()
// }
// binding.rbModeSampling.setOnClickListener {
// binding.rbModeCook.isChecked = false
// binding.rbModeSampling.isChecked = true
// loadCookSpan()
// loadSamplingSpan(isClicked = true)
// startActivity<SamplingListActivity> { }
// finish()
// }
// }
//
// val detector = MultiClickDetector(targetCount = 10, intervalMs = 800)
//
// private fun defaultDataSettingDialog() {
// val remindBinding = LayoutFoodRemindBinding.inflate(layoutInflater)
// remindBinding.tvDialogTitle.text = "温馨提示"
// remindBinding.tvDialogContent.text = "您好,使用默认配置作为您的调料数据,则已有配置将被清除,确认吗?"
// CommonDialog(this).apply {
// messageView = remindBinding.root
// leftText = "取消"
// rightText = "确认"
// onLeftClick = { dismiss() }
// onRightClick = {
// dismiss()
// resetList()
// }
// onDismiss = { hideStatusBar() }
// }.show()
// }
//
// private fun resetList() {
// runCatching {
// val record = JsonAssetsLoader.parseJsonFromAssets<ResetReasoningRecord>(this,"default_seasoning_list.json")
// val addressArray = DataUtil.getWeighAddressArray()
// val weightArray = WeightUtil.weightArray
// appViewModel.clearAllSeasoning {
// record?.list?.forEach { entity ->
// entity.useWeight = weightArray[addressArray[entity.sort]].toDouble()
// appViewModel.saveSeasoning(entity){}
// }
// loadSeasoning() // loadSeasoning()
// } // }
detector.setOnDelayedMultiClickListener(it) { // }.onFailure { it.printStackTrace() }
defaultDataSettingDialog() // }
} //
} // private fun initViewModel() {
}) // val db = BaseApp.instance!!.database
// val factory =
loadQualitySpan(isEnable = false) // AppFactory(AppRepository(db.appDao()))
when (cookMode) { // appViewModel =
1 -> { // ViewModelProvider(this, factory)[AppViewModel::class.java]
binding.rbModeCook.isChecked = true // }
binding.rbModeSampling.isChecked = false //
loadCookSpan(isClicked = true) // override fun onResume() {
loadSamplingSpan() // super.onResume()
} // loadSeasoning()
// }
2 -> { //
binding.rbModeCook.isChecked = false // private fun loadSeasoning() {
binding.rbModeSampling.isChecked = true // appViewModel.loadSeasoning { it ->
loadCookSpan() // SeasoningCellTool.loadData(
loadSamplingSpan(isClicked = true) // activity = this,
} // initList = it,
// recyclerView = binding.rvSeasoning,
else -> 0 // tvCell = binding.tvRightBottomCell,
} // pageType = 1
// )
binding.rbModeCook.setOnClickListener { // }
binding.rbModeCook.isChecked = true // }
binding.rbModeSampling.isChecked = false //
loadCookSpan(isClicked = true) //
loadSamplingSpan() // private fun loadQualitySpan(isClicked: Boolean = false, isEnable: Boolean = true) {
startActivity<SelectDishActivity> { } // binding.rbModeQuality.text =
finish() // getModeTextSpan(
} // topText = modeList[2].modeName,
binding.rbModeSampling.setOnClickListener { // bottomText = modeList[2].modeDesc,
binding.rbModeCook.isChecked = false // topColor = if (isEnable) if (isClicked) "#00BC71" else "#000000" else "#B4B4B4",
binding.rbModeSampling.isChecked = true // bottomColor = if (isEnable) "#8B8B8B" else "#B4B4B4"
loadCookSpan() // )
loadSamplingSpan(isClicked = true) // }
startActivity<SamplingListActivity> { } //
finish() // private fun loadSamplingSpan(isClicked: Boolean = false, isEnable: Boolean = true) {
} // binding.rbModeSampling.text =
} // getModeTextSpan(
// topText = modeList[1].modeName,
val detector = MultiClickDetector(targetCount = 10, intervalMs = 800) // bottomText = modeList[1].modeDesc,
// topColor = if (isEnable) if (isClicked) "#00BC71" else "#000000" else "#B4B4B4",
private fun defaultDataSettingDialog() { // bottomColor = if (isEnable) "#8B8B8B" else "#B4B4B4"
val remindBinding = LayoutFoodRemindBinding.inflate(layoutInflater) // )
remindBinding.tvDialogTitle.text = "温馨提示" // }
remindBinding.tvDialogContent.text = "您好,使用默认配置作为您的调料数据,则已有配置将被清除,确认吗?" //
CommonDialog(this).apply { // private fun loadCookSpan(isClicked: Boolean = false, isEnable: Boolean = true) {
messageView = remindBinding.root // binding.rbModeCook.text =
leftText = "取消" // getModeTextSpan(
rightText = "确认" // topText = modeList[0].modeName,
onLeftClick = { dismiss() } // bottomText = modeList[0].modeDesc,
onRightClick = { // topColor = if (isEnable) if (isClicked) "#00BC71" else "#000000" else "#B4B4B4",
dismiss() // bottomColor = if (isEnable) "#8B8B8B" else "#B4B4B4"
resetList() // )
} // }
onDismiss = { hideStatusBar() } //
}.show() // private fun getModeTextSpan(
} // topText: String,
// topColor: String,
private fun resetList() { // bottomText: String,
runCatching { // bottomColor: String
val record = JsonAssetsLoader.parseJsonFromAssets<ResetReasoningRecord>(this,"default_seasoning_list.json") // ): SpannableStringBuilder {
val addressArray = DataUtil.getWeighAddressArray() //
val weightArray = WeightUtil.weightArray //
appViewModel.clearAllSeasoning { // return buildSpannableString {
record?.list?.forEach { entity -> // appendText(
entity.useWeight = weightArray[addressArray[entity.sort]].toDouble() // topText,
appViewModel.saveSeasoning(entity){} // ForegroundColorSpan(topColor.toColorInt()),
} // StyleSpan(Typeface.BOLD),
loadSeasoning() // AbsoluteSizeSpan(36, true),
} // LineHeightSpan { text, start, end, spanstartv, v, fm ->
}.onFailure { it.printStackTrace() } // fm.descent += 10.dp // 增加行间距
} // }
// )
private fun initViewModel() { // append("\n")
val db = BaseApp.instance!!.database // appendText(
val factory = // bottomText,
AppFactory(AppRepository(db.appDao())) // ForegroundColorSpan(bottomColor.toColorInt()),
appViewModel = // AbsoluteSizeSpan(26, true)
ViewModelProvider(this, factory)[AppViewModel::class.java] // )
} // }
// }
override fun onResume() { //
super.onResume() // fun saveSeasoning(entity: SeasoningEntity) {
loadSeasoning() // appViewModel.saveSeasoning(entity) {
} // toast("保存成功")
// }
private fun loadSeasoning() { // }
appViewModel.loadSeasoning { it -> //
SeasoningCellTool.loadData( //}
activity = this,
initList = it,
recyclerView = binding.rvSeasoning,
tvCell = binding.tvRightBottomCell,
pageType = 1
)
}
}
private fun loadQualitySpan(isClicked: Boolean = false, isEnable: Boolean = true) {
binding.rbModeQuality.text =
getModeTextSpan(
topText = modeList[2].modeName,
bottomText = modeList[2].modeDesc,
topColor = if (isEnable) if (isClicked) "#00BC71" else "#000000" else "#B4B4B4",
bottomColor = if (isEnable) "#8B8B8B" else "#B4B4B4"
)
}
private fun loadSamplingSpan(isClicked: Boolean = false, isEnable: Boolean = true) {
binding.rbModeSampling.text =
getModeTextSpan(
topText = modeList[1].modeName,
bottomText = modeList[1].modeDesc,
topColor = if (isEnable) if (isClicked) "#00BC71" else "#000000" else "#B4B4B4",
bottomColor = if (isEnable) "#8B8B8B" else "#B4B4B4"
)
}
private fun loadCookSpan(isClicked: Boolean = false, isEnable: Boolean = true) {
binding.rbModeCook.text =
getModeTextSpan(
topText = modeList[0].modeName,
bottomText = modeList[0].modeDesc,
topColor = if (isEnable) if (isClicked) "#00BC71" else "#000000" else "#B4B4B4",
bottomColor = if (isEnable) "#8B8B8B" else "#B4B4B4"
)
}
private fun getModeTextSpan(
topText: String,
topColor: String,
bottomText: String,
bottomColor: String
): SpannableStringBuilder {
return buildSpannableString {
appendText(
topText,
ForegroundColorSpan(topColor.toColorInt()),
StyleSpan(Typeface.BOLD),
AbsoluteSizeSpan(36, true),
LineHeightSpan { text, start, end, spanstartv, v, fm ->
fm.descent += 10.dp // 增加行间距
}
)
append("\n")
appendText(
bottomText,
ForegroundColorSpan(bottomColor.toColorInt()),
AbsoluteSizeSpan(26, true)
)
}
}
fun saveSeasoning(entity: SeasoningEntity) {
appViewModel.saveSeasoning(entity) {
toast("保存成功")
}
}
}
@@ -239,8 +239,8 @@ class DishSamplingActivity : BaseActivity() {
Log.d(TAG, "goToSubmit: goodsList:${list.toJsonString()}") Log.d(TAG, "goToSubmit: goodsList:${list.toJsonString()}")
// startActivity<SubmitDishActivity> { // startActivity<SubmitDishActivity> {
startActivity<SubmitFoodActivity> { startActivity<SubmitFoodActivity> {
putExtra(SubmitDishActivity.GOODS_LIST, list as java.io.Serializable) putExtra(SubmitFoodActivity.GOODS_LIST, list as java.io.Serializable)
putExtra(SubmitDishActivity.FOOD_ITEM, food as Serializable) putExtra(SubmitFoodActivity.FOOD_ITEM, food as Serializable)
} }
} }
binding.etInputDish.let { v -> binding.etInputDish.let { v ->
@@ -150,8 +150,8 @@ class PrepareCookActivity : BaseActivity() {
Log.d(TAG, "goToSubmit: goodsList:${goodsList?.toJsonString()}") Log.d(TAG, "goToSubmit: goodsList:${goodsList?.toJsonString()}")
// startActivity<SubmitDishActivity> { // startActivity<SubmitDishActivity> {
startActivity<SubmitFoodActivity> { startActivity<SubmitFoodActivity> {
putExtra(SubmitDishActivity.GOODS_LIST, goodsList as Serializable) putExtra(SubmitFoodActivity.GOODS_LIST, goodsList as Serializable)
putExtra(SubmitDishActivity.FOOD_ITEM, food as Serializable) putExtra(SubmitFoodActivity.FOOD_ITEM, food as Serializable)
} }
} }
@@ -122,7 +122,7 @@ class SamplingListActivity : BaseActivity() {
// context.startActivity<SubmitDishActivity> { // context.startActivity<SubmitDishActivity> {
context.startActivity<SubmitFoodActivity> { context.startActivity<SubmitFoodActivity> {
putExtra( putExtra(
SubmitDishActivity.FOOD_ITEM, SubmitFoodActivity.FOOD_ITEM,
item as Serializable item as Serializable
) )
} }
@@ -287,7 +287,7 @@ class SamplingListActivity : BaseActivity() {
emptyViewBinding!!.tvContent.text = "暂无数据" emptyViewBinding!!.tvContent.text = "暂无数据"
emptyViewBinding!!.tvSubContent.text = "今日暂无采样数据,点击下方按钮新增采样" emptyViewBinding!!.tvSubContent.text = "今日暂无采样数据,点击下方按钮新增采样"
dishAdapter.stateView = emptyViewBinding!!.root dishAdapter.stateView = emptyViewBinding!!.root
//dishAdapter.setStateViewLayout(requireContext(), R.layout.layout_empty_view) //dishAdapter.setStateViewLayout(requireContext(), R.layout-sw800dp.layout_empty_view)
binding.refreshLayout.run { binding.refreshLayout.run {
setEnableRefresh(binding.dishRadioGroup.checkedRadioButtonId == R.id.rbSamplingFinished) setEnableRefresh(binding.dishRadioGroup.checkedRadioButtonId == R.id.rbSamplingFinished)
@@ -1,429 +1,429 @@
package com.shuwei.dish.match.ui //package com.shuwei.dish.match.ui
//
import android.annotation.SuppressLint //import android.annotation.SuppressLint
import android.os.Bundle //import android.os.Bundle
import android.util.Log //import android.util.Log
import android.util.SparseArray //import android.util.SparseArray
import android.util.SparseIntArray //import android.util.SparseIntArray
import androidx.core.util.forEach //import androidx.core.util.forEach
import androidx.lifecycle.ViewModelProvider //import androidx.lifecycle.ViewModelProvider
import com.aithings.Weigher //import com.aithings.Weigher
import com.google.gson.reflect.TypeToken //import com.google.gson.reflect.TypeToken
import com.shuwei.dish.match.R //import com.shuwei.dish.match.R
import com.shuwei.dish.match.adapter.SeasoningCellTool //import com.shuwei.dish.match.adapter.SeasoningCellTool
import com.shuwei.dish.match.adapter.TextCellAdapter //import com.shuwei.dish.match.adapter.TextCellAdapter
import com.shuwei.dish.match.base.BaseActivity //import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.base.BaseApp //import com.shuwei.dish.match.base.BaseApp
import com.shuwei.dish.match.databinding.ActivitySubmitDishBinding //import com.shuwei.dish.match.databinding.ActivitySubmitDishBinding
import com.shuwei.dish.match.db.AppRepository //import com.shuwei.dish.match.db.AppRepository
//
import com.shuwei.dish.match.entity.CookFoodEntity //import com.shuwei.dish.match.entity.CookFoodEntity
import com.shuwei.dish.match.entity.CookFoodGoodsEntity //import com.shuwei.dish.match.entity.CookFoodGoodsEntity
import com.shuwei.dish.match.entity.FoodRecord //import com.shuwei.dish.match.entity.FoodRecord
import com.shuwei.dish.match.entity.SeasoningEntity //import com.shuwei.dish.match.entity.SeasoningEntity
import com.shuwei.dish.match.http.HttpUtil //import com.shuwei.dish.match.http.HttpUtil
import com.shuwei.dish.match.http.UrlConfig //import com.shuwei.dish.match.http.UrlConfig
import com.shuwei.dish.match.utils.DataUtil //import com.shuwei.dish.match.utils.DataUtil
import com.shuwei.dish.match.utils.WeightUtil //import com.shuwei.dish.match.utils.WeightUtil
import com.shuwei.dish.match.utils.ext.clickWithDebounce //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.startActivity
import com.shuwei.dish.match.utils.ext.toJsonString //import com.shuwei.dish.match.utils.ext.toJsonString
import com.shuwei.dish.match.utils.ext.toType //import com.shuwei.dish.match.utils.ext.toType
import com.shuwei.dish.match.utils.ext.toast //import com.shuwei.dish.match.utils.ext.toast
import com.shuwei.dish.match.utils.ext.visible //import com.shuwei.dish.match.utils.ext.visible
import com.shuwei.dish.match.viewmodel.AppViewModel //import com.shuwei.dish.match.viewmodel.AppViewModel
import com.shuwei.dish.match.viewmodel.factory.AppFactory //import com.shuwei.dish.match.viewmodel.factory.AppFactory
//
@SuppressLint("UseSparseArrays") //@SuppressLint("UseSparseArrays")
class SubmitDishActivity : BaseActivity() { //class SubmitDishActivity : BaseActivity() {
//
companion object { // companion object {
const val TAG = "SubmitDishActivity" // const val TAG = "SubmitDishActivity"
const val FOOD_ITEM = "foodItem" // const val FOOD_ITEM = "foodItem"
const val GOODS_LIST = "goodsList" // const val GOODS_LIST = "goodsList"
} // }
//
private lateinit var binding: ActivitySubmitDishBinding // private lateinit var binding: ActivitySubmitDishBinding
//
private var food: FoodRecord? = null // private var food: FoodRecord? = null
private var goodsList: MutableList<CookFoodGoodsEntity>? = null // private var goodsList: MutableList<CookFoodGoodsEntity>? = null
//
private var isCooking = false // private var isCooking = false
//
private val cookFoodEntity by lazy { // private val cookFoodEntity by lazy {
CookFoodEntity().apply { // CookFoodEntity().apply {
food?.let { // food?.let {
foodId = it.foodId ?: "" // foodId = it.foodId ?: ""
foodName = it.foodName // foodName = it.foodName
cookMode = it.cookMode // cookMode = it.cookMode
dinnerType = it.dinnerType // dinnerType = it.dinnerType
} // }
canteenId = BaseApp.canteenId // canteenId = BaseApp.canteenId
} // }
} // }
//
@Suppress("unchecked_cast", "DEPRECATION") // @Suppress("unchecked_cast", "DEPRECATION")
override fun onCreate(savedInstanceState: Bundle?) { // override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) // super.onCreate(savedInstanceState)
binding = ActivitySubmitDishBinding.inflate(layoutInflater) // binding = ActivitySubmitDishBinding.inflate(layoutInflater)
setContentView(binding.root) // setContentView(binding.root)
initViewModel() // initViewModel()
setHeaderBackground() // setHeaderBackground()
intent.extras?.apply { // intent.extras?.apply {
food = getSerializable(FOOD_ITEM) as FoodRecord? // food = getSerializable(FOOD_ITEM) as FoodRecord?
Log.d(TAG, "onCreate: cookMode=${food?.cookMode}") // Log.d(TAG, "onCreate: cookMode=${food?.cookMode}")
isCooking = food?.isCooking ?: false // isCooking = food?.isCooking ?: false
if (isCooking) { // if (isCooking) {
//烹饪中,从本地查询数据 // //烹饪中,从本地查询数据
loadSeasoningFromLocal() // loadSeasoningFromLocal()
} else { // } else {
//非烹饪中,从菜品主辅材配置页面带入数据 // //非烹饪中,从菜品主辅材配置页面带入数据
goodsList = getSerializable(GOODS_LIST) as MutableList<CookFoodGoodsEntity>? // goodsList = getSerializable(GOODS_LIST) as MutableList<CookFoodGoodsEntity>?
} // }
} // }
setTitleBar(titleBarAction = { // setTitleBar(titleBarAction = {
it.visible() // it.visible()
}, titleAction = { // }, titleAction = {
it.text = food?.foodName // it.text = food?.foodName
}, rightIconActon = { // }, rightIconActon = {
it.gone() // it.gone()
it.setImageResource(R.drawable.ic_setting) // it.setImageResource(R.drawable.ic_setting)
it.setOnClickListener { // it.setOnClickListener {
//startActivity<DeviceSettingActivity>() // //startActivity<DeviceSettingActivity>()
} // }
}) // })
addViewListener() // addViewListener()
} // }
//
private fun loadSeasoningFromLocal() { // private fun loadSeasoningFromLocal() {
appViewModel.getCookFoodGoodsList(foodId = food!!.foodId!!, cookMode = food!!.cookMode) { it -> // appViewModel.getCookFoodGoodsList(foodId = food!!.foodId!!, cookMode = food!!.cookMode) { it ->
goodsList = mutableListOf() // goodsList = mutableListOf()
//设置主辅材数据 // //设置主辅材数据
goodsList?.addAll(it.filter { goods -> goods.materialType != 3 }) // goodsList?.addAll(it.filter { goods -> goods.materialType != 3 })
//
//获取调料数据并展示 // //获取调料数据并展示
val filterList: List<SeasoningEntity>? = it.filter { goods -> goods.materialType == 3 } // val filterList: List<SeasoningEntity>? = it.filter { goods -> goods.materialType == 3 }
.map { entity -> // .map { entity ->
SeasoningEntity().also { se -> // SeasoningEntity().also { se ->
se.goodsId = entity.goodsId // se.goodsId = entity.goodsId
se.goodsName = entity.goodsName // se.goodsName = entity.goodsName
se.goodsOrRelationCode = entity.goodsOrRelationCode // se.goodsOrRelationCode = entity.goodsOrRelationCode
se.relateionType = entity.relateionType // se.relateionType = entity.relateionType
se.materialType = entity.materialType // se.materialType = entity.materialType
se.allEdible = entity.allEdible // se.allEdible = entity.allEdible
se.useWeight = entity.useWeight // se.useWeight = entity.useWeight
se.popularName = entity.popularName // se.popularName = entity.popularName
se.canteenId = entity.canteenId // se.canteenId = entity.canteenId
se.relateionType_dictText = entity.relateionType_dictText // se.relateionType_dictText = entity.relateionType_dictText
se.foodId = entity.foodId // se.foodId = entity.foodId
se.sort = entity.sort // se.sort = entity.sort
se.pageType = 0 // se.pageType = 0
} // }
} // }
filterList?.toMutableList()?.let { cellData -> // filterList?.toMutableList()?.let { cellData ->
loadTextCell(cellData) // loadTextCell(cellData)
} // }
} // }
} // }
//
//
private lateinit var seasoningList: List<SeasoningEntity> // private lateinit var seasoningList: List<SeasoningEntity>
private var isFirstSave = true // private var isFirstSave = true
fun updateSeasoningList(list: MutableList<SeasoningEntity>) { // fun updateSeasoningList(list: MutableList<SeasoningEntity>) {
if (isFirstSave) { // if (isFirstSave) {
val json = list.toJsonString() // val json = list.toJsonString()
val typeToken = object : TypeToken<List<SeasoningEntity>>() {} // val typeToken = object : TypeToken<List<SeasoningEntity>>() {}
seasoningList = json.toType(typeToken = typeToken) // seasoningList = json.toType(typeToken = typeToken)
isFirstSave = false // isFirstSave = false
} // }
} // }
//
private val seasoningArray by lazy { // private val seasoningArray by lazy {
SparseArray<Double>() // SparseArray<Double>()
} // }
//
//
private val firstGoodsArray by lazy { // private val firstGoodsArray by lazy {
SparseArray<Int>() // SparseArray<Int>()
} // }
//
private fun addViewListener() { // private fun addViewListener() {
addWeightListener() // addWeightListener()
binding.btnWeightClear.setOnClickListener { Weigher.tareTwo(1) } // binding.btnWeightClear.setOnClickListener { Weigher.tareTwo(1) }
//
binding.btnCook.clickWithDebounce { // binding.btnCook.clickWithDebounce {
cook() // cook()
} // }
//
binding.btnSubmit.clickWithDebounce { // binding.btnSubmit.clickWithDebounce {
if (cookFoodEntity.foodWeight <= 0.toDouble()) { // if (cookFoodEntity.foodWeight <= 0.toDouble()) {
toast("未识别到菜品熟重") // toast("未识别到菜品熟重")
return@clickWithDebounce // return@clickWithDebounce
} // }
submit() // submit()
} // }
} // }
//
private fun addWeightListener() { // private fun addWeightListener() {
WeightUtil.addWeightListener(getWeight = { address, state, weight -> // WeightUtil.addWeightListener(getWeight = { address, state, weight ->
if (address == 1) { // if (address == 1) {
cookFoodEntity.foodWeight = weight.toDouble() // cookFoodEntity.foodWeight = weight.toDouble()
binding.tvTotalWeight.text = "${weight / 1000f}" // binding.tvTotalWeight.text = "${weight / 1000f}"
} // }
// if (state != SensorScale.STATE_STABLE) { //// if (state != SensorScale.STATE_STABLE) {
//// return@addWeightListener
//// }
// val firstWeight = firstGoodsArray.get(address, null)
//// if (firstWeight != weight) {
//// Log.d(
//// TAG,
//// "addViewListener: state=$state,address=$address,weight=$weight,firstWeight=$firstWeight"
//// )
//// }
// if (firstWeight == null) {
// //未设置数据
// firstGoodsArray.put(address, weight)
// return@addWeightListener // return@addWeightListener
// } // }
val firstWeight = firstGoodsArray.get(address, null) //// val cookingWeight =
// if (firstWeight != weight) { //// if (isCooking && seasoningList.isNullOrEmpty().not())
// Log.d( //// seasoningList?.get(weightRelateArray2.get(address))?.weight ?: 0
// TAG, //// else 0
// "addViewListener: state=$state,address=$address,weight=$weight,firstWeight=$firstWeight" //// var realUseWeight = firstWeight - weight + cookingWeight
// ) // var realUseWeight = firstWeight - weight
// } // realUseWeight = if (realUseWeight > 0) realUseWeight else 0
if (firstWeight == null) { //// Log.d(
//未设置数据 //// TAG,
firstGoodsArray.put(address, weight) //// "addViewListener: state=$state,address=$address,总共使用重量:$realUseWeight"
return@addWeightListener //// )
} // seasoningArray.put(address, realUseWeight.toDouble())
// val cookingWeight =
// if (isCooking && seasoningList.isNullOrEmpty().not())
// seasoningList?.get(weightRelateArray2.get(address))?.weight ?: 0
// else 0
// var realUseWeight = firstWeight - weight + cookingWeight
var realUseWeight = firstWeight - weight
realUseWeight = if (realUseWeight > 0) realUseWeight else 0
// Log.d(
// TAG,
// "addViewListener: state=$state,address=$address,总共使用重量:$realUseWeight"
// )
seasoningArray.put(address, realUseWeight.toDouble())
refreshSeasoningWeight()
})
}
@SuppressLint("NotifyDataSetChanged")
private fun refreshSeasoningWeight() {
binding.rvSeasoning.adapter?.let { adapter ->
if (adapter is TextCellAdapter) {
adapter.list.let { items ->
weightRelateArray.forEach { key, value ->
items[key].useWeight =
(seasoningArray.get(value) ?: 0.toDouble()) + getCookingSeasoning(value)
}
}
adapter.notifyDataSetChanged()
TextCellAdapter.loadCell(binding.tvRightBottomCell, adapter.list[14])
}
}
}
private fun getCookingSeasoning(address: Int): Double {
if (isCooking.not()) return 0.toDouble()
if (seasoningList.isEmpty()) return 0.toDouble()
val weight = seasoningList[weightRelateArray2.get(address)].useWeight ?: 0.toDouble()
//Log.i(TAG, "getCookingSeasoning: weight[${address}]=$weight,seasoningList=${seasoningList.toJsonString()}")
return weight
}
private val weightRelateArray2 by lazy {
SparseIntArray().apply {
weightRelateArray.forEach { key, value ->
if (value == 3) {
put(3, 14)
} else {
put(value, key)
}
}
}
}
private val weightRelateArray by lazy {
DataUtil.getWeighAddressArray()
}
// private fun prepareData(acton: () -> Unit) {
// //
// refreshSeasoningWeight()
// })
// }
//
// @SuppressLint("NotifyDataSetChanged")
// private fun refreshSeasoningWeight() {
// binding.rvSeasoning.adapter?.let { adapter ->
// if (adapter is TextCellAdapter) {
// adapter.list.let { items ->
// weightRelateArray.forEach { key, value ->
// items[key].useWeight =
// (seasoningArray.get(value) ?: 0.toDouble()) + getCookingSeasoning(value)
// }
// }
// adapter.notifyDataSetChanged()
// TextCellAdapter.loadCell(binding.tvRightBottomCell, adapter.list[14])
// }
// }
// }
//
// private fun getCookingSeasoning(address: Int): Double {
// if (isCooking.not()) return 0.toDouble()
// if (seasoningList.isEmpty()) return 0.toDouble()
// val weight = seasoningList[weightRelateArray2.get(address)].useWeight ?: 0.toDouble()
// //Log.i(TAG, "getCookingSeasoning: weight[${address}]=$weight,seasoningList=${seasoningList.toJsonString()}")
// return weight
// }
//
// private val weightRelateArray2 by lazy {
// SparseIntArray().apply {
// weightRelateArray.forEach { key, value ->
// if (value == 3) {
// put(3, 14)
// } else {
// put(value, key)
// }
// }
// }
// }
//
// private val weightRelateArray by lazy {
// DataUtil.getWeighAddressArray()
// }
//
//// private fun prepareData(acton: () -> Unit) {
////
//// //只有制作和采样列表页面才能进入设置页面,提交页面无法进行设置,不存在调料数据被修改的问题
//// val seasoningJson = realSeasoningData.toJsonString()
//// val typeToken = object : TypeToken<List<CookFoodGoodsEntity>>() {}
//// val tempSeasoningList = seasoningJson.toType(typeToken = typeToken)
//// goodsList?.addAll(tempSeasoningList)
//// acton()
////
//// }
//
// private fun cook() {
// if (food == null || goodsList.isNullOrEmpty()) {
// toast("未获取到菜品或构成信息")
// return
// }
// val realSeasoningData = (binding.rvSeasoning.adapter as TextCellAdapter).list
// if (realSeasoningData.isEmpty() && !isCooking) {
// toast("未获取到调料信息")
// return
// }
// if (realSeasoningData.isNotEmpty()&&realSeasoningData[0].goodsId.isNullOrBlank()) {
// toast("还未设置调料信息,请去设置页面操作")
// return
// }
// showLoading()
// //只有制作和采样列表页面才能进入设置页面,提交页面无法进行设置,不存在调料数据被修改的问题 // //只有制作和采样列表页面才能进入设置页面,提交页面无法进行设置,不存在调料数据被修改的问题
// val seasoningJson = realSeasoningData.toJsonString() // val seasoningJson = realSeasoningData.toJsonString()
// val typeToken = object : TypeToken<List<CookFoodGoodsEntity>>() {} // val typeToken = object : TypeToken<List<CookFoodGoodsEntity>>() {}
// val tempSeasoningList = seasoningJson.toType(typeToken = typeToken) // val tempSeasoningList = seasoningJson.toType(typeToken = typeToken)
// goodsList?.addAll(tempSeasoningList) // goodsList?.addAll(tempSeasoningList)
// acton() // cookFoodEntity.let {
// // it.dinnerType = when (it.dinnerType) {
// "早餐" -> "1"
// "午餐" -> "2"
// "晚餐" -> "3"
// else -> it.dinnerType
// } // }
// }
private fun cook() { // val isSamplingData = food!!.cookMode == 1
if (food == null || goodsList.isNullOrEmpty()) { // if (isSamplingData) {
toast("未获取到菜品或构成信息") // //生成临时foodId,解决采样模式没有foodId,无法关联数据的问题
return // val tempFoodId = cookFoodEntity.foodId.ifBlank { "${System.currentTimeMillis()}" }
} // cookFoodEntity.foodId = tempFoodId
val realSeasoningData = (binding.rvSeasoning.adapter as TextCellAdapter).list // }
if (realSeasoningData.isEmpty() && !isCooking) { // //全部设置同一foodId
toast("未获取到调料信息") // goodsList?.forEach {
return // it.foodId = cookFoodEntity.foodId
} // }
if (realSeasoningData.isNotEmpty()&&realSeasoningData[0].goodsId.isNullOrBlank()) { // //保存菜品-保存主辅料调料
toast("还未设置调料信息,请去设置页面操作") // appViewModel.saveCookFoodAndGoods(
return // cookMode = food!!.cookMode,
} // entity = cookFoodEntity,
showLoading() // list = goodsList,
//只有制作和采样列表页面才能进入设置页面,提交页面无法进行设置,不存在调料数据被修改的问题 // onFinish = {
val seasoningJson = realSeasoningData.toJsonString() // runOnUiThread {
val typeToken = object : TypeToken<List<CookFoodGoodsEntity>>() {} // dismissLoading()
val tempSeasoningList = seasoningJson.toType(typeToken = typeToken) // jumpPage(isSamplingData, true)
goodsList?.addAll(tempSeasoningList) // }
cookFoodEntity.let { // })
it.dinnerType = when (it.dinnerType) { // }
"早餐" -> "1" //
"午餐" -> "2" // private fun submit() {
"晚餐" -> "3" // if (food == null || goodsList.isNullOrEmpty()) {
else -> it.dinnerType // toast("未获取到菜品或构成信息")
} // return
} // }
val isSamplingData = food!!.cookMode == 1 // val realSeasoningData = (binding.rvSeasoning.adapter as TextCellAdapter).list
if (isSamplingData) { // if (realSeasoningData.isEmpty() && !isCooking) {
//生成临时foodId,解决采样模式没有foodId,无法关联数据的问题 // toast("未获取到调料信息")
val tempFoodId = cookFoodEntity.foodId.ifBlank { "${System.currentTimeMillis()}" } // return
cookFoodEntity.foodId = tempFoodId // }
} // if (realSeasoningData.isNotEmpty()&&realSeasoningData[0].goodsId.isNullOrBlank()) {
//全部设置同一foodId // toast("还未设置调料信息,请去设置页面操作")
goodsList?.forEach { // return
it.foodId = cookFoodEntity.foodId // }
} // showLoading()
//保存菜品-保存主辅料调料 // //只有制作和采样列表页面才能进入设置页面,提交页面无法进行设置,不存在调料数据被修改的问题
appViewModel.saveCookFoodAndGoods( // val seasoningJson = realSeasoningData.toJsonString()
cookMode = food!!.cookMode, // val typeToken = object : TypeToken<List<CookFoodGoodsEntity>>() {}
entity = cookFoodEntity, // val tempSeasoningList = seasoningJson.toType(typeToken = typeToken)
list = goodsList, // tempSeasoningList.forEach { entity ->
onFinish = { // val realWeight = entity.useWeight ?: 0.toDouble()
runOnUiThread { // val filterData = goodsList?.firstOrNull { it.goodsId == entity.goodsId }
dismissLoading() // //确保重量大于0,且无重复数据
jumpPage(isSamplingData, true) // if (realWeight > 0.toDouble() && filterData == null) {
} // goodsList?.add(entity)
}) // }
} // }
//
private fun submit() { // cookFoodEntity.let {
if (food == null || goodsList.isNullOrEmpty()) { // it.stFoodInfoConstituteList = this@SubmitDishActivity.goodsList
toast("未获取到菜品或构成信息") // it.dinnerType = when(it.dinnerType) {
return // "1" -> "早餐"
} // "2" -> "午餐"
val realSeasoningData = (binding.rvSeasoning.adapter as TextCellAdapter).list // "3" -> "晚餐"
if (realSeasoningData.isEmpty() && !isCooking) { // else -> null
toast("未获取到调料信息") // }
return // }
} //
if (realSeasoningData.isNotEmpty()&&realSeasoningData[0].goodsId.isNullOrBlank()) { // val isSamplingData = food!!.cookMode == 1
toast("还未设置调料信息,请去设置页面操作") // if (isSamplingData) {
return // //采样模式没有foodId
} // cookFoodEntity.foodId = ""
showLoading() // goodsList?.forEach { it.foodId = "" }
//只有制作和采样列表页面才能进入设置页面,提交页面无法进行设置,不存在调料数据被修改的问题 // }
val seasoningJson = realSeasoningData.toJsonString() // val json = cookFoodEntity.toJsonString()
val typeToken = object : TypeToken<List<CookFoodGoodsEntity>>() {} // Log.d(TAG, "submit: json=$json")
val tempSeasoningList = seasoningJson.toType(typeToken = typeToken) // HttpUtil.postJson(
tempSeasoningList.forEach { entity -> // url = UrlConfig.SUBMIT_DISH,
val realWeight = entity.useWeight ?: 0.toDouble() // json = json,
val filterData = goodsList?.firstOrNull { it.goodsId == entity.goodsId } // doSuccess = {
//确保重量大于0,且无重复数据 // Log.d(TAG, "submit: postJson=$it")
if (realWeight > 0.toDouble() && filterData == null) { // submitSuccess(isSamplingData)
goodsList?.add(entity) // }, doFailure = { code, msg ->
} // Log.d(TAG, "submit: postJson:code=$code,msg=$msg")
} // toast(msg)
// dismissLoading()
cookFoodEntity.let { // })
it.stFoodInfoConstituteList = this@SubmitDishActivity.goodsList // }
it.dinnerType = when(it.dinnerType) { //
"1" -> "早餐" // private fun submitSuccess(isSamplingData: Boolean) {
"2" -> "午餐" // if (food?.foodId.isNullOrBlank()) {
"3" -> "晚餐" // //本地无删除数据直接跳转页面
else -> null // dismissLoading()
} // jumpPage(isSamplingData, false)
} // return
// }
val isSamplingData = food!!.cookMode == 1 // //删除本地数据
if (isSamplingData) { // appViewModel.deleteCookFoodAndGoods(
//采样模式没有foodId // cookMode = food!!.cookMode,
cookFoodEntity.foodId = "" // foodId = food!!.foodId!!
goodsList?.forEach { it.foodId = "" } // ) {
} // dismissLoading()
val json = cookFoodEntity.toJsonString() // jumpPage(isSamplingData, false)
Log.d(TAG, "submit: json=$json") // }
HttpUtil.postJson( // }
url = UrlConfig.SUBMIT_DISH, //
json = json, // private fun jumpPage(isSampling: Boolean, isCooking: Boolean) {
doSuccess = { // if (isSampling) {
Log.d(TAG, "submit: postJson=$it") // startActivity<SamplingListActivity> {
submitSuccess(isSamplingData) // putExtra(SelectDishActivity.IS_COOKING, isCooking)
}, doFailure = { code, msg -> // }
Log.d(TAG, "submit: postJson:code=$code,msg=$msg") // return
toast(msg) // }
dismissLoading() // startActivity<SelectDishActivity> {
}) // putExtra(SelectDishActivity.IS_COOKING, isCooking)
} // putExtra(SelectDishActivity.DINNER_TYPE, food?.dinnerType)
// }
private fun submitSuccess(isSamplingData: Boolean) { // }
if (food?.foodId.isNullOrBlank()) { //
//本地无删除数据直接跳转页面 // private lateinit var appViewModel: AppViewModel
dismissLoading() //
jumpPage(isSamplingData, false) // private fun initViewModel() {
return // val db = BaseApp.instance!!.database
} // val factory =
//删除本地数据 // AppFactory(AppRepository(db.appDao()))
appViewModel.deleteCookFoodAndGoods( // appViewModel =
cookMode = food!!.cookMode, // ViewModelProvider(this, factory)[AppViewModel::class.java]
foodId = food!!.foodId!! // }
) { //
dismissLoading() // override fun onResume() {
jumpPage(isSamplingData, false) // super.onResume()
} // binding.tvRightBottomCell.visible()
} // if (isCooking.not()) {
// //烹饪中使用本地数据,未烹饪则使用默认的调料配置数据
private fun jumpPage(isSampling: Boolean, isCooking: Boolean) { // appViewModel.loadSeasoning {
if (isSampling) { // Log.d(TAG, "onResume: loadSeasoning:${it.toJsonString()}")
startActivity<SamplingListActivity> { // loadTextCell(it)
putExtra(SelectDishActivity.IS_COOKING, isCooking) // }
} // }
return // }
} //
startActivity<SelectDishActivity> { // private fun loadTextCell(list: MutableList<SeasoningEntity>) {
putExtra(SelectDishActivity.IS_COOKING, isCooking) // SeasoningCellTool.loadData(
putExtra(SelectDishActivity.DINNER_TYPE, food?.dinnerType) // activity = this,
} // initList = list,
} // recyclerView = binding.rvSeasoning,
// tvCell = binding.tvRightBottomCell
private lateinit var appViewModel: AppViewModel // )
// }
private fun initViewModel() { //}
val db = BaseApp.instance!!.database //
val factory = //
AppFactory(AppRepository(db.appDao()))
appViewModel =
ViewModelProvider(this, factory)[AppViewModel::class.java]
}
override fun onResume() {
super.onResume()
binding.tvRightBottomCell.visible()
if (isCooking.not()) {
//烹饪中使用本地数据,未烹饪则使用默认的调料配置数据
appViewModel.loadSeasoning {
Log.d(TAG, "onResume: loadSeasoning:${it.toJsonString()}")
loadTextCell(it)
}
}
}
private fun loadTextCell(list: MutableList<SeasoningEntity>) {
SeasoningCellTool.loadData(
activity = this,
initList = list,
recyclerView = binding.rvSeasoning,
tvCell = binding.tvRightBottomCell
)
}
}
@@ -11,11 +11,9 @@ import androidx.lifecycle.ViewModelProvider
import com.aithings.Weigher import com.aithings.Weigher
import com.google.gson.reflect.TypeToken import com.google.gson.reflect.TypeToken
import com.shuwei.dish.match.R import com.shuwei.dish.match.R
import com.shuwei.dish.match.adapter.SeasoningCellTool
import com.shuwei.dish.match.adapter.TextCellAdapter import com.shuwei.dish.match.adapter.TextCellAdapter
import com.shuwei.dish.match.base.BaseActivity import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.base.BaseApp import com.shuwei.dish.match.base.BaseApp
import com.shuwei.dish.match.databinding.ActivitySubmitDishBinding
import com.shuwei.dish.match.databinding.ActivitySubmitFoodBinding import com.shuwei.dish.match.databinding.ActivitySubmitFoodBinding
import com.shuwei.dish.match.db.AppRepository import com.shuwei.dish.match.db.AppRepository
@@ -20,7 +20,6 @@ import com.shuwei.dish.match.http.HttpUtil
import com.shuwei.dish.match.http.UrlConfig import com.shuwei.dish.match.http.UrlConfig
import com.shuwei.dish.match.ui.PrepareCookActivity import com.shuwei.dish.match.ui.PrepareCookActivity
import com.shuwei.dish.match.ui.SelectDishActivity import com.shuwei.dish.match.ui.SelectDishActivity
import com.shuwei.dish.match.ui.SubmitDishActivity
import com.shuwei.dish.match.ui.SubmitFoodActivity import com.shuwei.dish.match.ui.SubmitFoodActivity
import com.shuwei.dish.match.utils.SwipeCallback import com.shuwei.dish.match.utils.SwipeCallback
import com.shuwei.dish.match.utils.ext.startActivity import com.shuwei.dish.match.utils.ext.startActivity
@@ -63,7 +62,7 @@ class DishListFragment : Fragment() {
// context.startActivity<SubmitDishActivity> { // context.startActivity<SubmitDishActivity> {
context.startActivity<SubmitFoodActivity> { context.startActivity<SubmitFoodActivity> {
putExtra( putExtra(
SubmitDishActivity.FOOD_ITEM, SubmitFoodActivity.FOOD_ITEM,
item as Serializable item as Serializable
) )
} }
@@ -72,7 +71,7 @@ class DishListFragment : Fragment() {
item.dinnerType = dinnerType item.dinnerType = dinnerType
context.startActivity<PrepareCookActivity> { context.startActivity<PrepareCookActivity> {
putExtra( putExtra(
SubmitDishActivity.FOOD_ITEM, SubmitFoodActivity.FOOD_ITEM,
item as Serializable item as Serializable
) )
} }
@@ -220,7 +219,7 @@ class DishListFragment : Fragment() {
emptyViewBinding!!.tvContent.text = "暂无数据" emptyViewBinding!!.tvContent.text = "暂无数据"
emptyViewBinding!!.tvSubContent.text = "获取菜品数据失败,请检查网络设置或稍后重试" emptyViewBinding!!.tvSubContent.text = "获取菜品数据失败,请检查网络设置或稍后重试"
dishAdapter.stateView = emptyViewBinding!!.root dishAdapter.stateView = emptyViewBinding!!.root
//dishAdapter.setStateViewLayout(requireContext(), R.layout.layout_empty_view) //dishAdapter.setStateViewLayout(requireContext(), R.layout-sw800dp.layout_empty_view)
} }
private fun finishRefresh() { private fun finishRefresh() {
@@ -204,7 +204,7 @@
// emptyViewBinding!!.tvContent.text = "暂无数据" // emptyViewBinding!!.tvContent.text = "暂无数据"
// emptyViewBinding!!.tvSubContent.text = "今日暂无采样数据,点击下方按钮新增采样" // emptyViewBinding!!.tvSubContent.text = "今日暂无采样数据,点击下方按钮新增采样"
// dishAdapter.stateView = emptyViewBinding!!.root // dishAdapter.stateView = emptyViewBinding!!.root
// //dishAdapter.setStateViewLayout(requireContext(), R.layout.layout_empty_view) // //dishAdapter.setStateViewLayout(requireContext(), R.layout-sw800dp.layout_empty_view)
// //
// binding.refreshLayout.run { // binding.refreshLayout.run {
// setEnableRefresh(false) // setEnableRefresh(false)
@@ -15,8 +15,8 @@ object DataUtil {
put(6, 6) put(6, 6)
put(7, 7) put(7, 7)
put(8, 8) put(8, 8)
put(9, 5) put(9, 3)
put(10, 3) put(10, 5)
put(11, 4) put(11, 4)
} }
} }
@@ -0,0 +1,14 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item android:gravity="bottom">
<shape android:shape="rectangle">
<solid android:color="@color/gray_eb" />
<size android:height="1dp" />
</shape>
</item>
</layer-list>
@@ -5,11 +5,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:background="@drawable/bg_other_page"> tools:background="@drawable/bg_other_page"
tools:ignore="HardcodedText">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginStart="30dp" android:layout_marginStart="30dp"
android:layout_marginEnd="30dp" android:layout_marginEnd="30dp"
android:background="@drawable/shape_white_30_corners" android:background="@drawable/shape_white_30_corners"
@@ -18,8 +20,9 @@
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="106dp" android:layout_height="106dp"
android:paddingStart="30dp" android:layout_marginStart="30dp"
android:paddingEnd="30dp"> android:layout_marginEnd="30dp"
android:background="@drawable/bg_bottom_line">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -40,62 +43,64 @@
android:textSize="28sp" /> android:textSize="28sp" />
</FrameLayout> </FrameLayout>
<com.google.android.material.divider.MaterialDivider <!-- <com.google.android.material.divider.MaterialDivider-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="1dp" <!-- android:layout_height="1dp"-->
android:layout_marginStart="30dp" <!-- android:layout_marginStart="30dp"-->
android:layout_marginEnd="30dp" <!-- android:layout_marginEnd="30dp"-->
android:background="@color/gray_eb" /> <!-- android:background="@color/gray_eb" />-->
<LinearLayout <LinearLayout
android:id="@+id/modeRadioGroup" android:id="@+id/modeRadioGroup"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<RadioButton <RadioButton
android:id="@+id/rbModeCook" android:id="@+id/rbModeCook"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="190dp" android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginStart="30dp" android:layout_marginStart="30dp"
android:layout_marginEnd="30dp" android:layout_marginEnd="30dp"
android:background="@color/white"
android:button="@null" android:button="@null"
android:drawableEnd="@drawable/mode_select" android:drawableEnd="@drawable/mode_select"
android:background="@drawable/bg_bottom_line"
android:textSize="36sp" android:textSize="36sp"
tools:text="制作模式" /> tools:text="制作模式" />
<com.google.android.material.divider.MaterialDivider <!-- <com.google.android.material.divider.MaterialDivider-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="1dp" <!-- android:layout_height="1dp"-->
android:layout_marginStart="30dp" <!-- android:layout_marginStart="30dp"-->
android:layout_marginEnd="30dp" <!-- android:layout_marginEnd="30dp"-->
android:background="@color/gray_eb" /> <!-- android:background="@color/gray_eb" />-->
<RadioButton <RadioButton
android:id="@+id/rbModeSampling" android:id="@+id/rbModeSampling"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="190dp" android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginStart="30dp" android:layout_marginStart="30dp"
android:layout_marginEnd="30dp" android:layout_marginEnd="30dp"
android:background="@color/white"
android:button="@null" android:button="@null"
android:drawableEnd="@drawable/mode_select" android:drawableEnd="@drawable/mode_select"
android:background="@drawable/bg_bottom_line"
android:textSize="36sp" android:textSize="36sp"
tools:text="采样模式" /> tools:text="采样模式" />
</LinearLayout>
<com.google.android.material.divider.MaterialDivider <!-- <com.google.android.material.divider.MaterialDivider-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="1dp" <!-- android:layout_height="1dp"-->
android:layout_marginStart="30dp" <!-- android:layout_marginStart="30dp"-->
android:layout_marginEnd="30dp" <!-- android:layout_marginEnd="30dp"-->
android:background="@color/gray_eb" /> <!-- android:background="@color/gray_eb" />-->
<RadioButton <RadioButton
android:id="@+id/rbModeQuality" android:id="@+id/rbModeQuality"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="190dp" android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginStart="30dp" android:layout_marginStart="30dp"
android:layout_marginEnd="30dp" android:layout_marginEnd="30dp"
android:button="@null" android:button="@null"
@@ -105,11 +110,13 @@
android:textSize="36sp" android:textSize="36sp"
tools:text="品控模式" /> tools:text="品控模式" />
</LinearLayout> </LinearLayout>
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="30dp" android:layout_marginTop="30dp"
android:layout_marginBottom="60dp"
android:background="@drawable/shape_white_30_corners" android:background="@drawable/shape_white_30_corners"
android:orientation="vertical" android:orientation="vertical"
android:layout_marginStart="30dp" android:layout_marginStart="30dp"
@@ -3,9 +3,10 @@
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" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
tools:background="@drawable/bg_other_page"> tools:background="@drawable/bg_other_page"
tools:ignore="HardcodedText">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -39,14 +40,13 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_marginStart="30dp" android:layout_marginStart="30dp"
android:layout_marginTop="10dp" android:layout_marginTop="30dp"
android:layout_marginEnd="30dp" android:layout_marginEnd="30dp"
android:background="@drawable/shape_white_30_corners" android:background="@drawable/shape_white_30_corners"
android:orientation="vertical" android:orientation="vertical"
android:paddingStart="30dp" android:paddingStart="30dp"
android:paddingEnd="30dp"> android:paddingEnd="30dp">
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@@ -78,8 +78,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center" android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
@@ -65,7 +65,7 @@
<!-- android:textSize="28sp"--> <!-- android:textSize="28sp"-->
<!-- android:visibility="gone"/>--> <!-- android:visibility="gone"/>-->
<!-- <com.scwang.smart.refresh.layout.SmartRefreshLayout--> <!-- <com.scwang.smart.refresh.layout-sw800dp.SmartRefreshLayout-->
<!-- android:id="@+id/refreshLayout"--> <!-- android:id="@+id/refreshLayout"-->
<!-- android:layout_width="match_parent"--> <!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"--> <!-- android:layout_height="match_parent"-->
@@ -81,13 +81,13 @@
<!-- android:layout_width="match_parent"--> <!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"--> <!-- android:layout_height="match_parent"-->
<!-- android:overScrollMode="never"--> <!-- android:overScrollMode="never"-->
<!-- tools:listitem="@layout/list_item_dish" />--> <!-- tools:listitem="@layout-sw800dp/list_item_dish" />-->
<!-- <com.scwang.smart.refresh.footer.ClassicsFooter--> <!-- <com.scwang.smart.refresh.footer.ClassicsFooter-->
<!-- android:layout_width="match_parent"--> <!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content" />--> <!-- android:layout_height="wrap_content" />-->
<!-- </com.scwang.smart.refresh.layout.SmartRefreshLayout>--> <!-- </com.scwang.smart.refresh.layout-sw800dp.SmartRefreshLayout>-->
<!-- </LinearLayout>--> <!-- </LinearLayout>-->
<!-- <TextView--> <!-- <TextView-->
@@ -195,7 +195,7 @@
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="120dp" android:layout_height="255dp"
android:layout_marginStart="7dp" android:layout_marginStart="7dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginTop="7dp" android:layout_marginTop="7dp"
@@ -209,9 +209,31 @@
android:textSize="28sp" android:textSize="28sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_column="0" app:layout_column="0"
app:layout_columnSpan="2"
app:layout_gravity="fill_horizontal"
app:layout_row="3"
app:layout_rowSpan="2"
tools:text="9" />
<TextView
android:layout_width="0dp"
android:layout_height="120dp"
android:layout_marginStart="7dp"
android:layout_marginEnd="8dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="8dp"
android:background="@drawable/selector_text_cell"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:tag="10"
android:textColor="@color/black"
android:textSize="28sp"
android:textStyle="bold"
app:layout_column="2"
app:layout_columnWeight="1" app:layout_columnWeight="1"
app:layout_row="3" app:layout_row="3"
tools:text="9" /> tools:text="10" />
<TextView <TextView
android:layout_width="0dp" android:layout_width="0dp"
@@ -228,31 +250,8 @@
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="28sp" android:textSize="28sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_column="0" app:layout_column="2"
app:layout_columnWeight="1" app:layout_columnWeight="1"
app:layout_row="4" app:layout_row="4"
tools:text="11" /> tools:text="11" />
<TextView
android:layout_width="0dp"
android:layout_height="255dp"
android:layout_marginStart="7dp"
android:layout_marginEnd="8dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="8dp"
android:background="@drawable/selector_text_cell"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:tag="10"
android:textColor="@color/black"
android:textSize="28sp"
android:textStyle="bold"
app:layout_column="1"
app:layout_columnSpan="2"
app:layout_gravity="fill_horizontal"
app:layout_row="3"
app:layout_rowSpan="2"
tools:text="10" />
</androidx.gridlayout.widget.GridLayout> </androidx.gridlayout.widget.GridLayout>
+1
View File
@@ -12,5 +12,6 @@
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item> <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<!-- <item name="android:layout_width">828dp</item>-->
</style> </style>
</resources> </resources>
+1
View File
@@ -12,6 +12,7 @@
<!-- Status bar color. --> <!-- Status bar color. -->
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item> <item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<!-- <item name="android:layout_width">828dp</item>-->
</style> </style>
<style name="CookButtonStyle" parent="Widget.MaterialComponents.Button"> <style name="CookButtonStyle" parent="Widget.MaterialComponents.Button">