修改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() //// loadSeasoning()
//// }
// detector.setOnDelayedMultiClickListener(it) {
// defaultDataSettingDialog()
// } // }
detector.setOnDelayedMultiClickListener(it) { // }
defaultDataSettingDialog() // })
} //
} // loadQualitySpan(isEnable = false)
}) // when (cookMode) {
// 1 -> {
loadQualitySpan(isEnable = false) // binding.rbModeCook.isChecked = true
when (cookMode) { // binding.rbModeSampling.isChecked = false
1 -> { // loadCookSpan(isClicked = true)
binding.rbModeCook.isChecked = true // loadSamplingSpan()
binding.rbModeSampling.isChecked = false // }
loadCookSpan(isClicked = true) //
loadSamplingSpan() // 2 -> {
} // binding.rbModeCook.isChecked = false
// binding.rbModeSampling.isChecked = true
2 -> { // loadCookSpan()
binding.rbModeCook.isChecked = false // loadSamplingSpan(isClicked = true)
binding.rbModeSampling.isChecked = true // }
loadCookSpan() //
loadSamplingSpan(isClicked = true) // else -> 0
} // }
//
else -> 0 // binding.rbModeCook.setOnClickListener {
} // binding.rbModeCook.isChecked = true
// binding.rbModeSampling.isChecked = false
binding.rbModeCook.setOnClickListener { // loadCookSpan(isClicked = true)
binding.rbModeCook.isChecked = true // loadSamplingSpan()
binding.rbModeSampling.isChecked = false // startActivity<SelectDishActivity> { }
loadCookSpan(isClicked = true) // finish()
loadSamplingSpan() // }
startActivity<SelectDishActivity> { } // binding.rbModeSampling.setOnClickListener {
finish() // binding.rbModeCook.isChecked = false
} // binding.rbModeSampling.isChecked = true
binding.rbModeSampling.setOnClickListener { // loadCookSpan()
binding.rbModeCook.isChecked = false // loadSamplingSpan(isClicked = true)
binding.rbModeSampling.isChecked = true // startActivity<SamplingListActivity> { }
loadCookSpan() // finish()
loadSamplingSpan(isClicked = true) // }
startActivity<SamplingListActivity> { } // }
finish() //
} // val detector = MultiClickDetector(targetCount = 10, intervalMs = 800)
} //
// private fun defaultDataSettingDialog() {
val detector = MultiClickDetector(targetCount = 10, intervalMs = 800) // val remindBinding = LayoutFoodRemindBinding.inflate(layoutInflater)
// remindBinding.tvDialogTitle.text = "温馨提示"
private fun defaultDataSettingDialog() { // remindBinding.tvDialogContent.text = "您好,使用默认配置作为您的调料数据,则已有配置将被清除,确认吗?"
val remindBinding = LayoutFoodRemindBinding.inflate(layoutInflater) // CommonDialog(this).apply {
remindBinding.tvDialogTitle.text = "温馨提示" // messageView = remindBinding.root
remindBinding.tvDialogContent.text = "您好,使用默认配置作为您的调料数据,则已有配置将被清除,确认吗?" // leftText = "取消"
CommonDialog(this).apply { // rightText = "确认"
messageView = remindBinding.root // onLeftClick = { dismiss() }
leftText = "取消" // onRightClick = {
rightText = "确认" // dismiss()
onLeftClick = { dismiss() } // resetList()
onRightClick = { // }
dismiss() // onDismiss = { hideStatusBar() }
resetList() // }.show()
} // }
onDismiss = { hideStatusBar() } //
}.show() // private fun resetList() {
} // runCatching {
// val record = JsonAssetsLoader.parseJsonFromAssets<ResetReasoningRecord>(this,"default_seasoning_list.json")
private fun resetList() { // val addressArray = DataUtil.getWeighAddressArray()
runCatching { // val weightArray = WeightUtil.weightArray
val record = JsonAssetsLoader.parseJsonFromAssets<ResetReasoningRecord>(this,"default_seasoning_list.json") // appViewModel.clearAllSeasoning {
val addressArray = DataUtil.getWeighAddressArray() // record?.list?.forEach { entity ->
val weightArray = WeightUtil.weightArray // entity.useWeight = weightArray[addressArray[entity.sort]].toDouble()
appViewModel.clearAllSeasoning { // appViewModel.saveSeasoning(entity){}
record?.list?.forEach { entity -> // }
entity.useWeight = weightArray[addressArray[entity.sort]].toDouble() // loadSeasoning()
appViewModel.saveSeasoning(entity){} // }
} // }.onFailure { it.printStackTrace() }
loadSeasoning() // }
} //
}.onFailure { it.printStackTrace() } // private fun initViewModel() {
} // val db = BaseApp.instance!!.database
// val factory =
private fun initViewModel() { // AppFactory(AppRepository(db.appDao()))
val db = BaseApp.instance!!.database // appViewModel =
val factory = // ViewModelProvider(this, factory)[AppViewModel::class.java]
AppFactory(AppRepository(db.appDao())) // }
appViewModel = //
ViewModelProvider(this, factory)[AppViewModel::class.java] // override fun onResume() {
} // super.onResume()
// loadSeasoning()
override fun onResume() { // }
super.onResume() //
loadSeasoning() // private fun loadSeasoning() {
} // appViewModel.loadSeasoning { it ->
// SeasoningCellTool.loadData(
private fun loadSeasoning() { // activity = this,
appViewModel.loadSeasoning { it -> // initList = it,
SeasoningCellTool.loadData( // recyclerView = binding.rvSeasoning,
activity = this, // tvCell = binding.tvRightBottomCell,
initList = it, // pageType = 1
recyclerView = binding.rvSeasoning, // )
tvCell = binding.tvRightBottomCell, // }
pageType = 1 // }
) //
} //
} // private fun loadQualitySpan(isClicked: Boolean = false, isEnable: Boolean = true) {
// binding.rbModeQuality.text =
// getModeTextSpan(
private fun loadQualitySpan(isClicked: Boolean = false, isEnable: Boolean = true) { // topText = modeList[2].modeName,
binding.rbModeQuality.text = // bottomText = modeList[2].modeDesc,
getModeTextSpan( // topColor = if (isEnable) if (isClicked) "#00BC71" else "#000000" else "#B4B4B4",
topText = modeList[2].modeName, // bottomColor = if (isEnable) "#8B8B8B" else "#B4B4B4"
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(
private fun loadSamplingSpan(isClicked: Boolean = false, isEnable: Boolean = true) { // topText = modeList[1].modeName,
binding.rbModeSampling.text = // bottomText = modeList[1].modeDesc,
getModeTextSpan( // topColor = if (isEnable) if (isClicked) "#00BC71" else "#000000" else "#B4B4B4",
topText = modeList[1].modeName, // bottomColor = if (isEnable) "#8B8B8B" else "#B4B4B4"
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(
private fun loadCookSpan(isClicked: Boolean = false, isEnable: Boolean = true) { // topText = modeList[0].modeName,
binding.rbModeCook.text = // bottomText = modeList[0].modeDesc,
getModeTextSpan( // topColor = if (isEnable) if (isClicked) "#00BC71" else "#000000" else "#B4B4B4",
topText = modeList[0].modeName, // bottomColor = if (isEnable) "#8B8B8B" else "#B4B4B4"
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,
private fun getModeTextSpan( // bottomText: String,
topText: String, // bottomColor: String
topColor: String, // ): SpannableStringBuilder {
bottomText: String, //
bottomColor: String //
): SpannableStringBuilder { // return buildSpannableString {
// appendText(
// topText,
return buildSpannableString { // ForegroundColorSpan(topColor.toColorInt()),
appendText( // StyleSpan(Typeface.BOLD),
topText, // AbsoluteSizeSpan(36, true),
ForegroundColorSpan(topColor.toColorInt()), // LineHeightSpan { text, start, end, spanstartv, v, fm ->
StyleSpan(Typeface.BOLD), // fm.descent += 10.dp // 增加行间距
AbsoluteSizeSpan(36, true), // }
LineHeightSpan { text, start, end, spanstartv, v, fm -> // )
fm.descent += 10.dp // 增加行间距 // append("\n")
} // appendText(
) // bottomText,
append("\n") // ForegroundColorSpan(bottomColor.toColorInt()),
appendText( // AbsoluteSizeSpan(26, true)
bottomText, // )
ForegroundColorSpan(bottomColor.toColorInt()), // }
AbsoluteSizeSpan(26, true) // }
) //
} // fun saveSeasoning(entity: SeasoningEntity) {
} // appViewModel.saveSeasoning(entity) {
// toast("保存成功")
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
// }
// }
// val isSamplingData = food!!.cookMode == 1
// if (isSamplingData) {
// //生成临时foodId,解决采样模式没有foodId,无法关联数据的问题
// val tempFoodId = cookFoodEntity.foodId.ifBlank { "${System.currentTimeMillis()}" }
// cookFoodEntity.foodId = tempFoodId
// }
// //全部设置同一foodId
// goodsList?.forEach {
// it.foodId = cookFoodEntity.foodId
// }
// //保存菜品-保存主辅料调料
// appViewModel.saveCookFoodAndGoods(
// cookMode = food!!.cookMode,
// entity = cookFoodEntity,
// list = goodsList,
// onFinish = {
// runOnUiThread {
// dismissLoading()
// jumpPage(isSamplingData, true)
// }
// })
// } // }
//
private fun cook() { // private fun submit() {
if (food == null || goodsList.isNullOrEmpty()) { // if (food == null || goodsList.isNullOrEmpty()) {
toast("未获取到菜品或构成信息") // toast("未获取到菜品或构成信息")
return // return
} // }
val realSeasoningData = (binding.rvSeasoning.adapter as TextCellAdapter).list // val realSeasoningData = (binding.rvSeasoning.adapter as TextCellAdapter).list
if (realSeasoningData.isEmpty() && !isCooking) { // if (realSeasoningData.isEmpty() && !isCooking) {
toast("未获取到调料信息") // toast("未获取到调料信息")
return // return
} // }
if (realSeasoningData.isNotEmpty()&&realSeasoningData[0].goodsId.isNullOrBlank()) { // if (realSeasoningData.isNotEmpty()&&realSeasoningData[0].goodsId.isNullOrBlank()) {
toast("还未设置调料信息,请去设置页面操作") // toast("还未设置调料信息,请去设置页面操作")
return // return
} // }
showLoading() // 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) // tempSeasoningList.forEach { entity ->
cookFoodEntity.let { // val realWeight = entity.useWeight ?: 0.toDouble()
it.dinnerType = when (it.dinnerType) { // val filterData = goodsList?.firstOrNull { it.goodsId == entity.goodsId }
"早餐" -> "1" // //确保重量大于0,且无重复数据
"午餐" -> "2" // if (realWeight > 0.toDouble() && filterData == null) {
"晚餐" -> "3" // goodsList?.add(entity)
else -> it.dinnerType // }
} // }
} //
val isSamplingData = food!!.cookMode == 1 // cookFoodEntity.let {
if (isSamplingData) { // it.stFoodInfoConstituteList = this@SubmitDishActivity.goodsList
//生成临时foodId,解决采样模式没有foodId,无法关联数据的问题 // it.dinnerType = when(it.dinnerType) {
val tempFoodId = cookFoodEntity.foodId.ifBlank { "${System.currentTimeMillis()}" } // "1" -> "早餐"
cookFoodEntity.foodId = tempFoodId // "2" -> "午餐"
} // "3" -> "晚餐"
//全部设置同一foodId // else -> null
goodsList?.forEach { // }
it.foodId = cookFoodEntity.foodId // }
} //
//保存菜品-保存主辅料调料 // val isSamplingData = food!!.cookMode == 1
appViewModel.saveCookFoodAndGoods( // if (isSamplingData) {
cookMode = food!!.cookMode, // //采样模式没有foodId
entity = cookFoodEntity, // cookFoodEntity.foodId = ""
list = goodsList, // goodsList?.forEach { it.foodId = "" }
onFinish = { // }
runOnUiThread { // val json = cookFoodEntity.toJsonString()
dismissLoading() // Log.d(TAG, "submit: json=$json")
jumpPage(isSamplingData, true) // HttpUtil.postJson(
} // url = UrlConfig.SUBMIT_DISH,
}) // json = json,
} // doSuccess = {
// Log.d(TAG, "submit: postJson=$it")
private fun submit() { // submitSuccess(isSamplingData)
if (food == null || goodsList.isNullOrEmpty()) { // }, doFailure = { code, msg ->
toast("未获取到菜品或构成信息") // Log.d(TAG, "submit: postJson:code=$code,msg=$msg")
return // toast(msg)
} // dismissLoading()
val realSeasoningData = (binding.rvSeasoning.adapter as TextCellAdapter).list // })
if (realSeasoningData.isEmpty() && !isCooking) { // }
toast("未获取到调料信息") //
return // private fun submitSuccess(isSamplingData: Boolean) {
} // if (food?.foodId.isNullOrBlank()) {
if (realSeasoningData.isNotEmpty()&&realSeasoningData[0].goodsId.isNullOrBlank()) { // //本地无删除数据直接跳转页面
toast("还未设置调料信息,请去设置页面操作") // dismissLoading()
return // jumpPage(isSamplingData, false)
} // return
showLoading() // }
//只有制作和采样列表页面才能进入设置页面,提交页面无法进行设置,不存在调料数据被修改的问题 // //删除本地数据
val seasoningJson = realSeasoningData.toJsonString() // appViewModel.deleteCookFoodAndGoods(
val typeToken = object : TypeToken<List<CookFoodGoodsEntity>>() {} // cookMode = food!!.cookMode,
val tempSeasoningList = seasoningJson.toType(typeToken = typeToken) // foodId = food!!.foodId!!
tempSeasoningList.forEach { entity -> // ) {
val realWeight = entity.useWeight ?: 0.toDouble() // dismissLoading()
val filterData = goodsList?.firstOrNull { it.goodsId == entity.goodsId } // jumpPage(isSamplingData, false)
//确保重量大于0,且无重复数据 // }
if (realWeight > 0.toDouble() && filterData == null) { // }
goodsList?.add(entity) //
} // private fun jumpPage(isSampling: Boolean, isCooking: Boolean) {
} // if (isSampling) {
// startActivity<SamplingListActivity> {
cookFoodEntity.let { // putExtra(SelectDishActivity.IS_COOKING, isCooking)
it.stFoodInfoConstituteList = this@SubmitDishActivity.goodsList // }
it.dinnerType = when(it.dinnerType) { // return
"1" -> "早餐" // }
"2" -> "午餐" // startActivity<SelectDishActivity> {
"3" -> "晚餐" // putExtra(SelectDishActivity.IS_COOKING, isCooking)
else -> null // putExtra(SelectDishActivity.DINNER_TYPE, food?.dinnerType)
} // }
} // }
//
val isSamplingData = food!!.cookMode == 1 // private lateinit var appViewModel: AppViewModel
if (isSamplingData) { //
//采样模式没有foodId // private fun initViewModel() {
cookFoodEntity.foodId = "" // val db = BaseApp.instance!!.database
goodsList?.forEach { it.foodId = "" } // val factory =
} // AppFactory(AppRepository(db.appDao()))
val json = cookFoodEntity.toJsonString() // appViewModel =
Log.d(TAG, "submit: json=$json") // ViewModelProvider(this, factory)[AppViewModel::class.java]
HttpUtil.postJson( // }
url = UrlConfig.SUBMIT_DISH, //
json = json, // override fun onResume() {
doSuccess = { // super.onResume()
Log.d(TAG, "submit: postJson=$it") // binding.tvRightBottomCell.visible()
submitSuccess(isSamplingData) // if (isCooking.not()) {
}, doFailure = { code, msg -> // //烹饪中使用本地数据,未烹饪则使用默认的调料配置数据
Log.d(TAG, "submit: postJson:code=$code,msg=$msg") // appViewModel.loadSeasoning {
toast(msg) // Log.d(TAG, "onResume: loadSeasoning:${it.toJsonString()}")
dismissLoading() // loadTextCell(it)
}) // }
} // }
// }
private fun submitSuccess(isSamplingData: Boolean) { //
if (food?.foodId.isNullOrBlank()) { // private fun loadTextCell(list: MutableList<SeasoningEntity>) {
//本地无删除数据直接跳转页面 // SeasoningCellTool.loadData(
dismissLoading() // activity = this,
jumpPage(isSamplingData, false) // initList = list,
return // recyclerView = binding.rvSeasoning,
} // tvCell = binding.tvRightBottomCell
//删除本地数据 // )
appViewModel.deleteCookFoodAndGoods( // }
cookMode = food!!.cookMode, //}
foodId = food!!.foodId!! //
) { //
dismissLoading()
jumpPage(isSamplingData, false)
}
}
private fun jumpPage(isSampling: Boolean, isCooking: Boolean) {
if (isSampling) {
startActivity<SamplingListActivity> {
putExtra(SelectDishActivity.IS_COOKING, isCooking)
}
return
}
startActivity<SelectDishActivity> {
putExtra(SelectDishActivity.IS_COOKING, isCooking)
putExtra(SelectDishActivity.DINNER_TYPE, food?.dinnerType)
}
}
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,76 +43,80 @@
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="采样模式" />
<!-- <com.google.android.material.divider.MaterialDivider-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_marginEnd="30dp"-->
<!-- android:background="@color/gray_eb" />-->
<RadioButton
android:id="@+id/rbModeQuality"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:button="@null"
android:drawableEnd="@drawable/ic_dish_disable"
android:enabled="false"
android:textColor="@color/gray_b4"
android:textSize="36sp"
tools:text="品控模式" />
</LinearLayout> </LinearLayout>
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:background="@color/gray_eb" />
<RadioButton
android:id="@+id/rbModeQuality"
android:layout_width="match_parent"
android:layout_height="190dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:button="@null"
android:drawableEnd="@drawable/ic_dish_disable"
android:enabled="false"
android:textColor="@color/gray_b4"
android:textSize="36sp"
tools:text="品控模式" />
</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">