使用新方式实现调料页面,优化涉及页面
This commit is contained in:
@@ -65,6 +65,7 @@ dependencies {
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(libs.material)
|
||||
implementation(libs.androidx.gridlayout)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.androidx.junit)
|
||||
androidTestImplementation(libs.androidx.espresso.core)
|
||||
|
||||
@@ -76,6 +76,8 @@
|
||||
android:name=".ui.FoodSearchActivity"
|
||||
android:screenOrientation="portrait"
|
||||
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
|
||||
<activity android:name="com.shuwei.dish.match.ui.DeviceConfigActivity" />
|
||||
<activity android:name="com.shuwei.dish.match.ui.SubmitFoodActivity" />
|
||||
|
||||
|
||||
</application>
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
"popularName" : "生抽",
|
||||
"canteenId" : "1678234139391512577",
|
||||
"relateionType_dictText" : "食材原材料",
|
||||
"sort" : 12,
|
||||
"sort" : 11,
|
||||
"isDel" : 0,
|
||||
"createTime" : "2025-08-18 10:19:08"
|
||||
},
|
||||
@@ -200,7 +200,7 @@
|
||||
"popularName" : "菜籽油,爱菊菜籽油",
|
||||
"canteenId" : "1678234139391512577",
|
||||
"relateionType_dictText" : "食材原材料",
|
||||
"sort" : 14,
|
||||
"sort" : 10,
|
||||
"isDel" : 0,
|
||||
"createTime" : "2025-08-18 10:19:19"
|
||||
}
|
||||
|
||||
@@ -71,8 +71,17 @@ class TextCellAdapter(var list: MutableList<SeasoningEntity>) :
|
||||
fun loadCell(tvCell: TextView, item: SeasoningEntity) {
|
||||
if (item.goodsName.isNullOrBlank()) {
|
||||
tvCell.run {
|
||||
text = "未配置"
|
||||
setTextColor(ContextCompat.getColor(context, R.color.black999))
|
||||
text = buildSpannableString {
|
||||
appendText(
|
||||
"未配置",
|
||||
ForegroundColorSpan("#999999".toColorInt()),
|
||||
StyleSpan(Typeface.BOLD),
|
||||
AbsoluteSizeSpan(28, true),
|
||||
LineHeightSpan { text, start, end, spanstartv, v, fm ->
|
||||
fm.descent += 10.dp // 增加行间距
|
||||
}
|
||||
)}
|
||||
//setTextColor(ContextCompat.getColor(context, R.color.black999))
|
||||
}
|
||||
} else {
|
||||
// if (item.pageType == 1) {
|
||||
@@ -87,7 +96,7 @@ class TextCellAdapter(var list: MutableList<SeasoningEntity>) :
|
||||
}
|
||||
|
||||
fun getTextSpan(item: SeasoningEntity): SpannableStringBuilder {
|
||||
val endIndex = if (item.sort == 14) 10 else 6
|
||||
val endIndex = if (item.sort == 10 || item.sort == 14) 10 else 6
|
||||
var name = item.goodsName!!
|
||||
if (name.length > endIndex) {
|
||||
name = "${name.substring(0, endIndex)}…"
|
||||
@@ -103,7 +112,6 @@ class TextCellAdapter(var list: MutableList<SeasoningEntity>) :
|
||||
}
|
||||
)
|
||||
append("\n")
|
||||
|
||||
val weight = item.useWeight ?: 0.toDouble()
|
||||
val weightColor = if (weight == 0.toDouble()) "#999999" else "#00BC71"
|
||||
appendText(
|
||||
|
||||
@@ -89,8 +89,8 @@ class AppRepository(val appDao: AppDao) {
|
||||
appDao.clearAllSeasoning()
|
||||
}
|
||||
|
||||
suspend fun deleteEmptySeasoning() = withContext(Dispatchers.IO) {
|
||||
appDao.deleteEmptySeasoning()
|
||||
suspend fun deleteSeasoningBySort(sort: Int) = withContext(Dispatchers.IO) {
|
||||
appDao.deleteSeasoningBySort(sort)
|
||||
}
|
||||
|
||||
suspend fun insertSeasoningList(items: MutableList<SeasoningEntity>) =
|
||||
|
||||
@@ -60,7 +60,7 @@ interface AppDao {
|
||||
suspend fun getSeasoningById(id: Long): SeasoningEntity?
|
||||
|
||||
@Query("SELECT * FROM dm_seasoning WHERE isDel = 0 AND sort = :sort")
|
||||
suspend fun getSeasoningBySort(sort: Int): SeasoningEntity?
|
||||
suspend fun getSeasoningBySort(sort: Int): MutableList<SeasoningEntity>?
|
||||
|
||||
@Query("SELECT * FROM dm_seasoning WHERE isDel = 0 AND goodsId = :goodsId")
|
||||
suspend fun getSeasoningByGoodsId(goodsId: Int): SeasoningEntity?
|
||||
@@ -71,8 +71,8 @@ interface AppDao {
|
||||
@Query("SELECT * FROM dm_seasoning WHERE isDel = 0 AND goodsName LIKE '%' || :query || '%'")
|
||||
suspend fun search(query: String): MutableList<SeasoningEntity>
|
||||
|
||||
@Query("DELETE FROM dm_seasoning WHERE isDel = 0 AND goodsId = -1 AND goodsName = ''")
|
||||
suspend fun deleteEmptySeasoning(): Int
|
||||
@Query("DELETE FROM dm_seasoning WHERE isDel = 0 AND sort = :sort")
|
||||
suspend fun deleteSeasoningBySort(sort:Int): Int
|
||||
|
||||
@Query("DELETE FROM dm_seasoning WHERE isDel = 0")
|
||||
suspend fun clearAllSeasoning(): Int
|
||||
|
||||
@@ -6,8 +6,8 @@ object UrlConfig {
|
||||
// const val DISH_DETAIL = "$BASE_URL/scales/goodsUseList?foodId={foodId}&foodWeight={foodWeight}"
|
||||
// const val DISH_LIST = "$BASE_URL/scales/getRestInfoFoods?eaId=99&type=0&foodName"
|
||||
|
||||
// const val BASE_URL = "http://192.168.1.207:9102"
|
||||
const val BASE_URL = "https://yyjk.shuziweidao.com/gateway"
|
||||
const val BASE_URL = "http://192.168.1.207:9102"
|
||||
// const val BASE_URL = "https://yyjk.shuziweidao.com/gateway"
|
||||
// const val DISH_LIST = "$BASE_URL/scales/getRestInfoFoods?eaId=99&type=0&foodName"
|
||||
|
||||
const val DISH_DETAIL = "$BASE_URL/food/stFoodInfoMatching/queryById"
|
||||
|
||||
@@ -0,0 +1,318 @@
|
||||
package com.shuwei.dish.match.ui
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.style.AbsoluteSizeSpan
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.text.style.LineHeightSpan
|
||||
import android.text.style.StyleSpan
|
||||
import android.widget.TextView
|
||||
import androidx.core.graphics.toColorInt
|
||||
import androidx.core.view.forEach
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.shuwei.dish.match.base.BaseActivity
|
||||
import com.shuwei.dish.match.base.BaseApp
|
||||
import com.shuwei.dish.match.databinding.LayoutFoodRemindBinding
|
||||
import com.shuwei.dish.match.db.AppRepository
|
||||
import com.shuwei.dish.match.dialog.CommonDialog
|
||||
import com.shuwei.dish.match.entity.SeasoningEntity
|
||||
import com.shuwei.dish.match.entity.ResetReasoningRecord
|
||||
import com.shuwei.dish.match.utils.DataUtil
|
||||
import com.shuwei.dish.match.utils.JsonAssetsLoader
|
||||
import com.shuwei.dish.match.utils.MultiClickDetector
|
||||
import com.shuwei.dish.match.utils.WeightUtil
|
||||
import com.shuwei.dish.match.utils.ext.appendText
|
||||
import com.shuwei.dish.match.utils.ext.buildSpannableString
|
||||
import com.shuwei.dish.match.utils.ext.dp
|
||||
import com.shuwei.dish.match.utils.ext.startActivity
|
||||
import com.shuwei.dish.match.utils.ext.toast
|
||||
import com.shuwei.dish.match.utils.ext.visible
|
||||
import com.shuwei.dish.match.viewmodel.AppViewModel
|
||||
import com.shuwei.dish.match.viewmodel.factory.AppFactory
|
||||
import com.shuwei.dish.match.R
|
||||
import com.shuwei.dish.match.adapter.TextCellAdapter
|
||||
import com.shuwei.dish.match.databinding.ActivityDeviceConfigBinding
|
||||
import com.shuwei.dish.match.dialog.BottomDialog2
|
||||
import com.shuwei.dish.match.utils.ext.clickWithDebounce
|
||||
|
||||
class DeviceConfigActivity : BaseActivity() {
|
||||
|
||||
companion object {
|
||||
|
||||
const val TAG = "DeviceSettingActivity"
|
||||
|
||||
const val COOK_MODE = "cookMode"
|
||||
|
||||
val modeList = listOf<ModeBean>(
|
||||
ModeBean("制作模式", "菜品快速制作,记录熟重"),
|
||||
ModeBean("采样模式", "菜品快速制作,记录熟重"),
|
||||
ModeBean("品控模式", "菜品快速制作,记录熟重")
|
||||
)
|
||||
}
|
||||
|
||||
data class ModeBean(
|
||||
var modeName: String,
|
||||
var modeDesc: String
|
||||
)
|
||||
|
||||
private lateinit var binding: ActivityDeviceConfigBinding
|
||||
|
||||
private lateinit var appViewModel: AppViewModel
|
||||
|
||||
private var cookMode: Int = 0
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityDeviceConfigBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
cookMode = intent.getIntExtra(COOK_MODE, 0)
|
||||
initViewModel()
|
||||
setHeaderBackground()
|
||||
setTitleBar(titleBarAction = {
|
||||
it.visible()
|
||||
}, titleAction = {
|
||||
it.text = "设备配置"
|
||||
}, rightIconActon = {
|
||||
it.visible()
|
||||
it.alpha = 0.0F
|
||||
it.setImageResource(R.drawable.ic_setting)
|
||||
it.setOnClickListener {
|
||||
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 -> {
|
||||
binding.rbModeCook.isChecked = true
|
||||
binding.rbModeSampling.isChecked = false
|
||||
loadCookSpan(isClicked = true)
|
||||
loadSamplingSpan()
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
addGridItemListener()
|
||||
loadSeasoning()
|
||||
}
|
||||
|
||||
private var seasoningItems = mutableListOf<SeasoningEntity>()
|
||||
private fun addGridItemListener() {
|
||||
binding.include.root.forEach { child->
|
||||
(child as TextView).run {
|
||||
clickWithDebounce {
|
||||
val sort = tag.toString().toInt()
|
||||
val entity = seasoningItems.firstOrNull { it.sort == sort } ?: SeasoningEntity()
|
||||
clickGridItem(sort, entity)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
}
|
||||
}.onFailure { it.printStackTrace() }
|
||||
}
|
||||
|
||||
private fun initViewModel() {
|
||||
val db = BaseApp.instance!!.database
|
||||
val factory =
|
||||
AppFactory(AppRepository(db.appDao()))
|
||||
appViewModel =
|
||||
ViewModelProvider(this, factory)[AppViewModel::class.java]
|
||||
}
|
||||
|
||||
private fun loadSeasoning() {
|
||||
appViewModel.loadSeasoning {
|
||||
seasoningItems.clear()
|
||||
seasoningItems.addAll(it)
|
||||
initConfigData()
|
||||
setGridData(seasoningItems)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initConfigData() {
|
||||
repeat(12) {num->
|
||||
val firstOne = seasoningItems.firstOrNull {it.sort == num}
|
||||
if (firstOne == null) {
|
||||
seasoningItems.add(SeasoningEntity().also { it.sort = num })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setGridData(list: MutableList<SeasoningEntity>) {
|
||||
val gridLayout = binding.include.root
|
||||
list.forEach { entity ->
|
||||
val tag = entity.sort.toString()
|
||||
val child = gridLayout.findViewWithTag<TextView>(tag)
|
||||
TextCellAdapter.loadCell(child, entity)
|
||||
}
|
||||
}
|
||||
|
||||
private fun clickGridItem(sort: Int, entity: SeasoningEntity) {
|
||||
val currentAddress = DataUtil.getWeighAddressArray().get(sort)
|
||||
// val seasoningEntity = list.first{it.sort == sort}
|
||||
BottomDialog2(
|
||||
weighIndex = sort,
|
||||
weighAddress = currentAddress,
|
||||
clickName = entity.goodsName
|
||||
).show(this) { item ->
|
||||
syncItem(entity, item)
|
||||
//3-调料
|
||||
entity.materialType = 3
|
||||
entity.sort = sort
|
||||
saveSeasoning(entity) {
|
||||
val child = binding.include.root.findViewWithTag<TextView>(sort.toString())
|
||||
TextCellAdapter.loadCell(child, entity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun syncItem(oldItem: SeasoningEntity, newItem: SeasoningEntity) {
|
||||
oldItem.run {
|
||||
goodsId = newItem.goodsId
|
||||
goodsName = newItem.goodsName
|
||||
goodsOrRelationCode = newItem.goodsOrRelationCode
|
||||
relateionType = newItem.relateionType
|
||||
materialType = newItem.materialType
|
||||
allEdible = newItem.allEdible
|
||||
useWeight = newItem.useWeight
|
||||
popularName = newItem.popularName
|
||||
canteenId = newItem.canteenId
|
||||
relateionType_dictText = newItem.relateionType_dictText
|
||||
|
||||
foodId = newItem.foodId
|
||||
sort = newItem.sort
|
||||
}
|
||||
}
|
||||
|
||||
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, action: () -> Unit = {}) {
|
||||
appViewModel.saveSeasoning(entity) {
|
||||
action()
|
||||
toast("保存成功")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -236,7 +236,8 @@ class DishSamplingActivity : BaseActivity() {
|
||||
food.foodName = showFoodName
|
||||
food.cookMode = 1
|
||||
Log.d(TAG, "goToSubmit: goodsList:${list.toJsonString()}")
|
||||
startActivity<SubmitDishActivity> {
|
||||
// startActivity<SubmitDishActivity> {
|
||||
startActivity<SubmitFoodActivity> {
|
||||
putExtra(SubmitDishActivity.GOODS_LIST, list as java.io.Serializable)
|
||||
putExtra(SubmitDishActivity.FOOD_ITEM, food as Serializable)
|
||||
}
|
||||
|
||||
@@ -60,7 +60,10 @@ class HomeActivity : BaseActivity() {
|
||||
// startActivity<SamplingListActivity>()
|
||||
// }
|
||||
|
||||
// appViewModel.deleteEmptySeasoning()
|
||||
// appViewModel.deleteSeasoningBySort(12)
|
||||
// appViewModel.deleteSeasoningBySort(11)
|
||||
// appViewModel.deleteSeasoningBySort(13)
|
||||
// appViewModel.deleteSeasoningBySort(14)
|
||||
// appViewModel.deleteCookFoodAndGoods(0,"") {}
|
||||
// appViewModel.getCookFoodGoodsList("") {goodsList->
|
||||
// goodsList.forEach {
|
||||
@@ -68,8 +71,12 @@ class HomeActivity : BaseActivity() {
|
||||
// appViewModel.updateGoods(it)
|
||||
// }
|
||||
// }
|
||||
// appViewModel.clearAllSeasoning()
|
||||
// appViewModel.clearAllSeasoning(){}
|
||||
|
||||
|
||||
binding.btnDeviceConfig.setOnClickListener {
|
||||
startActivity<SubmitFoodActivity>{}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initRecyclerView() {
|
||||
|
||||
@@ -148,7 +148,8 @@ class PrepareCookActivity : BaseActivity() {
|
||||
return
|
||||
}
|
||||
Log.d(TAG, "goToSubmit: goodsList:${goodsList?.toJsonString()}")
|
||||
startActivity<SubmitDishActivity> {
|
||||
// startActivity<SubmitDishActivity> {
|
||||
startActivity<SubmitFoodActivity> {
|
||||
putExtra(SubmitDishActivity.GOODS_LIST, goodsList as Serializable)
|
||||
putExtra(SubmitDishActivity.FOOD_ITEM, food as Serializable)
|
||||
}
|
||||
|
||||
@@ -64,8 +64,11 @@ class SamplingListActivity : BaseActivity() {
|
||||
it.visible()
|
||||
it.setImageResource(R.drawable.ic_setting)
|
||||
it.setOnClickListener {
|
||||
startActivity<DeviceSettingActivity> {
|
||||
putExtra(DeviceSettingActivity.COOK_MODE, 2)
|
||||
// startActivity<DeviceSettingActivity> {
|
||||
// putExtra(DeviceSettingActivity.COOK_MODE, 2)
|
||||
// }
|
||||
startActivity<DeviceConfigActivity> {
|
||||
putExtra(DeviceConfigActivity.COOK_MODE, 2)
|
||||
}
|
||||
}
|
||||
}, backAction = {
|
||||
@@ -116,7 +119,8 @@ class SamplingListActivity : BaseActivity() {
|
||||
val item = list[position]
|
||||
if (item.isCooking) {
|
||||
//烹饪中,跳到称熟重页面
|
||||
context.startActivity<SubmitDishActivity> {
|
||||
// context.startActivity<SubmitDishActivity> {
|
||||
context.startActivity<SubmitFoodActivity> {
|
||||
putExtra(
|
||||
SubmitDishActivity.FOOD_ITEM,
|
||||
item as Serializable
|
||||
|
||||
@@ -54,8 +54,11 @@ class SelectDishActivity : BaseActivity() {
|
||||
it.visible()
|
||||
it.setImageResource(R.drawable.ic_setting)
|
||||
it.setOnClickListener {
|
||||
startActivity<DeviceSettingActivity> {
|
||||
putExtra(DeviceSettingActivity.COOK_MODE, 1)
|
||||
// startActivity<DeviceSettingActivity> {
|
||||
// putExtra(DeviceSettingActivity.COOK_MODE, 1)
|
||||
// }
|
||||
startActivity<DeviceConfigActivity> {
|
||||
putExtra(DeviceConfigActivity.COOK_MODE, 1)
|
||||
}
|
||||
}
|
||||
}, backAction = {
|
||||
|
||||
@@ -0,0 +1,440 @@
|
||||
package com.shuwei.dish.match.ui
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.util.SparseArray
|
||||
import android.util.SparseIntArray
|
||||
import android.widget.TextView
|
||||
import androidx.core.util.forEach
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.aithings.Weigher
|
||||
import com.google.gson.reflect.TypeToken
|
||||
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.base.BaseActivity
|
||||
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.db.AppRepository
|
||||
|
||||
import com.shuwei.dish.match.entity.CookFoodEntity
|
||||
import com.shuwei.dish.match.entity.CookFoodGoodsEntity
|
||||
import com.shuwei.dish.match.entity.FoodRecord
|
||||
import com.shuwei.dish.match.entity.SeasoningEntity
|
||||
import com.shuwei.dish.match.http.HttpUtil
|
||||
import com.shuwei.dish.match.http.UrlConfig
|
||||
import com.shuwei.dish.match.utils.DataUtil
|
||||
import com.shuwei.dish.match.utils.WeightUtil
|
||||
import com.shuwei.dish.match.utils.ext.clickWithDebounce
|
||||
import com.shuwei.dish.match.utils.ext.gone
|
||||
import com.shuwei.dish.match.utils.ext.startActivity
|
||||
import com.shuwei.dish.match.utils.ext.toJsonString
|
||||
import com.shuwei.dish.match.utils.ext.toType
|
||||
import com.shuwei.dish.match.utils.ext.toast
|
||||
import com.shuwei.dish.match.utils.ext.visible
|
||||
import com.shuwei.dish.match.viewmodel.AppViewModel
|
||||
import com.shuwei.dish.match.viewmodel.factory.AppFactory
|
||||
|
||||
@SuppressLint("UseSparseArrays")
|
||||
class SubmitFoodActivity : BaseActivity() {
|
||||
|
||||
companion object {
|
||||
const val TAG = "SubmitDishActivity"
|
||||
const val FOOD_ITEM = "foodItem"
|
||||
const val GOODS_LIST = "goodsList"
|
||||
}
|
||||
|
||||
private lateinit var binding: ActivitySubmitFoodBinding
|
||||
|
||||
private var food: FoodRecord? = null
|
||||
private var goodsList: MutableList<CookFoodGoodsEntity>? = null
|
||||
|
||||
private var isCooking = false
|
||||
|
||||
private val cookFoodEntity by lazy {
|
||||
CookFoodEntity().apply {
|
||||
food?.let {
|
||||
foodId = it.foodId ?: ""
|
||||
foodName = it.foodName
|
||||
cookMode = it.cookMode
|
||||
dinnerType = it.dinnerType
|
||||
}
|
||||
canteenId = BaseApp.canteenId
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unchecked_cast", "DEPRECATION")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivitySubmitFoodBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
initViewModel()
|
||||
setHeaderBackground()
|
||||
intent.extras?.apply {
|
||||
food = getSerializable(FOOD_ITEM) as FoodRecord?
|
||||
Log.d(TAG, "onCreate: cookMode=${food?.cookMode}")
|
||||
isCooking = food?.isCooking ?: false
|
||||
if (isCooking) {
|
||||
//烹饪中,从本地查询数据
|
||||
loadSeasoningFromLocal()
|
||||
} else {
|
||||
//非烹饪中,从菜品主辅材配置页面带入数据
|
||||
goodsList = getSerializable(GOODS_LIST) as MutableList<CookFoodGoodsEntity>?
|
||||
}
|
||||
}
|
||||
setTitleBar(titleBarAction = {
|
||||
it.visible()
|
||||
}, titleAction = {
|
||||
it.text = food?.foodName
|
||||
}, rightIconActon = {
|
||||
it.gone()
|
||||
it.setImageResource(R.drawable.ic_setting)
|
||||
it.setOnClickListener {
|
||||
//startActivity<DeviceSettingActivity>()
|
||||
}
|
||||
})
|
||||
addViewListener()
|
||||
}
|
||||
|
||||
private fun loadSeasoningFromLocal() {
|
||||
appViewModel.getCookFoodGoodsList(foodId = food!!.foodId!!, cookMode = food!!.cookMode) { it ->
|
||||
goodsList = mutableListOf()
|
||||
//设置主辅材数据
|
||||
goodsList?.addAll(it.filter { goods -> goods.materialType != 3 })
|
||||
|
||||
//获取调料数据并展示
|
||||
val filterList: List<SeasoningEntity>? = it.filter { goods -> goods.materialType == 3 }
|
||||
.map { entity ->
|
||||
SeasoningEntity().also { se ->
|
||||
se.goodsId = entity.goodsId
|
||||
se.goodsName = entity.goodsName
|
||||
se.goodsOrRelationCode = entity.goodsOrRelationCode
|
||||
se.relateionType = entity.relateionType
|
||||
se.materialType = entity.materialType
|
||||
se.allEdible = entity.allEdible
|
||||
se.useWeight = entity.useWeight
|
||||
se.popularName = entity.popularName
|
||||
se.canteenId = entity.canteenId
|
||||
se.relateionType_dictText = entity.relateionType_dictText
|
||||
se.foodId = entity.foodId
|
||||
se.sort = entity.sort
|
||||
se.pageType = 0
|
||||
}
|
||||
}
|
||||
filterList?.toMutableList()?.let { cellData ->
|
||||
loadTextCell(cellData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// private lateinit var seasoningList: List<SeasoningEntity>
|
||||
// private var isFirstSave = true
|
||||
// fun updateSeasoningList(list: MutableList<SeasoningEntity>) {
|
||||
// if (isFirstSave) {
|
||||
// val json = list.toJsonString()
|
||||
// val typeToken = object : TypeToken<List<SeasoningEntity>>() {}
|
||||
// seasoningList = json.toType(typeToken = typeToken)
|
||||
// isFirstSave = false
|
||||
// }
|
||||
// }
|
||||
|
||||
private val seasoningArray by lazy {
|
||||
SparseArray<Double>()
|
||||
}
|
||||
|
||||
|
||||
private val firstGoodsArray by lazy {
|
||||
SparseArray<Int>()
|
||||
}
|
||||
|
||||
private fun addViewListener() {
|
||||
addWeightListener()
|
||||
binding.btnWeightClear.setOnClickListener { Weigher.tareTwo(1) }
|
||||
|
||||
binding.btnCook.clickWithDebounce {
|
||||
cook()
|
||||
}
|
||||
|
||||
binding.btnSubmit.clickWithDebounce {
|
||||
if (cookFoodEntity.foodWeight <= 0.toDouble()) {
|
||||
toast("未识别到菜品熟重")
|
||||
return@clickWithDebounce
|
||||
}
|
||||
submit()
|
||||
}
|
||||
}
|
||||
|
||||
private fun addWeightListener() {
|
||||
WeightUtil.addWeightListener(getWeight = { address, state, weight ->
|
||||
if (address == 1) {
|
||||
cookFoodEntity.foodWeight = weight.toDouble()
|
||||
binding.tvTotalWeight.text = "${weight / 1000f}"
|
||||
}
|
||||
val firstWeight = firstGoodsArray.get(address, null)
|
||||
if (firstWeight == null) {
|
||||
//未设置数据
|
||||
firstGoodsArray.put(address, weight)
|
||||
return@addWeightListener
|
||||
}
|
||||
var realUseWeight = firstWeight - weight
|
||||
realUseWeight = if (realUseWeight > 0) realUseWeight else 0
|
||||
seasoningArray.put(address, realUseWeight.toDouble())
|
||||
|
||||
refreshSeasoningWeight()
|
||||
})
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun refreshSeasoningWeight() {
|
||||
if (seasoningItems.isEmpty()) {
|
||||
return
|
||||
}
|
||||
seasoningItems.let { items ->
|
||||
weightRelateArray.forEach { key, value ->
|
||||
items[key].useWeight =
|
||||
(seasoningArray.get(value) ?: 0.toDouble()) + getCookingSeasoning(value)
|
||||
}
|
||||
}
|
||||
setGridData(seasoningItems)
|
||||
// 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()
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private fun getCookingSeasoning(address: Int): Double {
|
||||
if (isCooking.not()) return 0.toDouble()
|
||||
if (seasoningItems.isEmpty()) return 0.toDouble()
|
||||
val weight = seasoningItems[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 ->
|
||||
put(value, key)
|
||||
// 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 = seasoningItems
|
||||
//(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 typeToken = object : TypeToken<List<CookFoodGoodsEntity>>() {}
|
||||
val tempSeasoningList = seasoningJson.toType(typeToken = typeToken)
|
||||
goodsList?.addAll(tempSeasoningList)
|
||||
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 submit() {
|
||||
if (food == null || goodsList.isNullOrEmpty()) {
|
||||
toast("未获取到菜品或构成信息")
|
||||
return
|
||||
}
|
||||
val realSeasoningData = seasoningItems
|
||||
if (realSeasoningData.isEmpty() && !isCooking) {
|
||||
toast("未获取到调料信息")
|
||||
return
|
||||
}
|
||||
if (realSeasoningData.isNotEmpty()&&realSeasoningData[0].goodsId.isNullOrBlank()) {
|
||||
toast("还未设置调料信息,请去设置页面操作")
|
||||
return
|
||||
}
|
||||
showLoading()
|
||||
//只有制作和采样列表页面才能进入设置页面,提交页面无法进行设置,不存在调料数据被修改的问题
|
||||
val seasoningJson = realSeasoningData.toJsonString()
|
||||
val typeToken = object : TypeToken<List<CookFoodGoodsEntity>>() {}
|
||||
val tempSeasoningList = seasoningJson.toType(typeToken = typeToken)
|
||||
tempSeasoningList.forEach { entity ->
|
||||
val realWeight = entity.useWeight ?: 0.toDouble()
|
||||
val filterData = goodsList?.firstOrNull { it.goodsId == entity.goodsId }
|
||||
//确保重量大于0,且无重复数据
|
||||
if (realWeight > 0.toDouble() && filterData == null) {
|
||||
goodsList?.add(entity)
|
||||
}
|
||||
}
|
||||
|
||||
cookFoodEntity.let {
|
||||
it.stFoodInfoConstituteList = this@SubmitFoodActivity.goodsList
|
||||
it.dinnerType = when(it.dinnerType) {
|
||||
"1" -> "早餐"
|
||||
"2" -> "午餐"
|
||||
"3" -> "晚餐"
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
val isSamplingData = food!!.cookMode == 1
|
||||
if (isSamplingData) {
|
||||
//采样模式没有foodId
|
||||
cookFoodEntity.foodId = ""
|
||||
goodsList?.forEach { it.foodId = "" }
|
||||
}
|
||||
val json = cookFoodEntity.toJsonString()
|
||||
Log.d(TAG, "submit: json=$json")
|
||||
HttpUtil.postJson(
|
||||
url = UrlConfig.SUBMIT_DISH,
|
||||
json = json,
|
||||
doSuccess = {
|
||||
Log.d(TAG, "submit: postJson=$it")
|
||||
submitSuccess(isSamplingData)
|
||||
}, doFailure = { code, msg ->
|
||||
Log.d(TAG, "submit: postJson:code=$code,msg=$msg")
|
||||
toast(msg)
|
||||
dismissLoading()
|
||||
})
|
||||
}
|
||||
|
||||
private fun submitSuccess(isSamplingData: Boolean) {
|
||||
if (food?.foodId.isNullOrBlank()) {
|
||||
//本地无删除数据直接跳转页面
|
||||
dismissLoading()
|
||||
jumpPage(isSamplingData, false)
|
||||
return
|
||||
}
|
||||
//删除本地数据
|
||||
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()
|
||||
if (isCooking.not()) {
|
||||
//烹饪中使用本地数据,未烹饪则使用默认的调料配置数据
|
||||
appViewModel.loadSeasoning {
|
||||
Log.d(TAG, "onResume: loadSeasoning:${it.toJsonString()}")
|
||||
loadTextCell(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var seasoningItems = mutableListOf<SeasoningEntity>()
|
||||
private fun loadTextCell(list: MutableList<SeasoningEntity>) {
|
||||
seasoningItems.clear()
|
||||
seasoningItems.addAll(list)
|
||||
initConfigData()
|
||||
setGridData(list)
|
||||
}
|
||||
|
||||
private fun initConfigData() {
|
||||
repeat(12) {num->
|
||||
val firstOne = seasoningItems.firstOrNull {it.sort == num}
|
||||
if (firstOne == null) {
|
||||
seasoningItems.add(SeasoningEntity().also { it.sort = num })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setGridData(list: MutableList<SeasoningEntity>) {
|
||||
val gridLayout = binding.include.root
|
||||
list.forEach { entity ->
|
||||
val tag = entity.sort.toString()
|
||||
val child = gridLayout.findViewWithTag<TextView>(tag)
|
||||
TextCellAdapter.loadCell(child, entity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.shuwei.dish.match.http.UrlConfig
|
||||
import com.shuwei.dish.match.ui.PrepareCookActivity
|
||||
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.utils.SwipeCallback
|
||||
import com.shuwei.dish.match.utils.ext.startActivity
|
||||
import com.shuwei.dish.match.utils.ext.toJsonString
|
||||
@@ -59,7 +60,8 @@ class DishListFragment : Fragment() {
|
||||
val item = list[position]
|
||||
if (item.isCooking) {
|
||||
//烹饪中,跳到称熟重页面
|
||||
context.startActivity<SubmitDishActivity> {
|
||||
// context.startActivity<SubmitDishActivity> {
|
||||
context.startActivity<SubmitFoodActivity> {
|
||||
putExtra(
|
||||
SubmitDishActivity.FOOD_ITEM,
|
||||
item as Serializable
|
||||
|
||||
@@ -16,13 +16,30 @@ object DataUtil {
|
||||
put(7, 7)
|
||||
put(8, 8)
|
||||
put(9, 5)
|
||||
put(12, 4)
|
||||
put(10, 3)
|
||||
put(11, 3)
|
||||
put(13, 3)
|
||||
put(14, 3)
|
||||
put(11, 4)
|
||||
}
|
||||
}
|
||||
|
||||
// fun getWeighAddressArray(): SparseIntArray {
|
||||
// return SparseIntArray().apply {
|
||||
// put(0, 12)
|
||||
// put(1, 13)
|
||||
// put(2, 14)
|
||||
// put(3, 9)
|
||||
// put(4, 10)
|
||||
// put(5, 11)
|
||||
// put(6, 6)
|
||||
// put(7, 7)
|
||||
// put(8, 8)
|
||||
// put(9, 5)
|
||||
// put(12, 4)
|
||||
// put(10, 3)
|
||||
// put(11, 3)
|
||||
// put(13, 3)
|
||||
// put(14, 3)
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -161,9 +161,9 @@ class AppViewModel(private val rep: AppRepository) : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteEmptySeasoning() {
|
||||
fun deleteSeasoningBySort(sort: Int) {
|
||||
viewModelScope.launch {
|
||||
rep.deleteEmptySeasoning()
|
||||
rep.deleteSeasoningBySort(sort)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,23 +174,30 @@ class AppViewModel(private val rep: AppRepository) : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAll(list: MutableList<SeasoningEntity>) {
|
||||
viewModelScope.launch {
|
||||
list.forEach {
|
||||
rep.updateSeasoning(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
// fun updateAll(list: MutableList<SeasoningEntity>) {
|
||||
// viewModelScope.launch {
|
||||
// list.forEach {
|
||||
// rep.updateSeasoning(it)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
fun saveSeasoning(entity: SeasoningEntity, block: () -> Unit) {
|
||||
viewModelScope.launch {
|
||||
val seasoning = rep.getSeasoningBySort(entity.sort)
|
||||
if (seasoning == null) {
|
||||
rep.insertSeasoning(entity)
|
||||
val list = rep.getSeasoningBySort(entity.sort)
|
||||
val size = list?.size?:0
|
||||
if (size == 1) {
|
||||
rep.updateSeasoning(entity.also { it.id = list!![0].id })
|
||||
block()
|
||||
return@launch
|
||||
}
|
||||
rep.updateSeasoning(entity.also { it.id = seasoning.id })
|
||||
if (size > 1) {
|
||||
list?.forEach {
|
||||
rep.deleteSeasoningBySort(it.sort)
|
||||
}
|
||||
}
|
||||
entity.id = 0
|
||||
rep.insertSeasoning(entity)
|
||||
block()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:background="@drawable/bg_other_page">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@drawable/shape_white_30_corners"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="106dp"
|
||||
android:paddingStart="30dp"
|
||||
android:paddingEnd="30dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:text="菜品模式设置"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSetting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:text="配置终端默认模式"
|
||||
android:textColor="@color/gray_b4"
|
||||
android:textSize="28sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<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" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/modeRadioGroup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rbModeCook"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="190dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@color/white"
|
||||
android:button="@null"
|
||||
android:drawableEnd="@drawable/mode_select"
|
||||
android:textSize="36sp"
|
||||
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/rbModeSampling"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="190dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@color/white"
|
||||
android:button="@null"
|
||||
android:drawableEnd="@drawable/mode_select"
|
||||
android:textSize="36sp"
|
||||
tools:text="采样模式" />
|
||||
</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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="@drawable/shape_white_30_corners"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:text="@string/seasoning_setting"
|
||||
android:textColor="@color/black666"
|
||||
android:textSize="28sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:text="@string/seasoning_setting2"
|
||||
android:textColor="@color/gray_b4"
|
||||
android:textSize="28sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/include"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
layout="@layout/layout_grid"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -35,208 +35,4 @@
|
||||
tools:itemCount="3"
|
||||
tools:listitem="@layout/list_item_home_mode"/>
|
||||
|
||||
<!-- <com.google.android.material.card.MaterialCardView-->
|
||||
<!-- android:id="@+id/cardCook"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="180dp"-->
|
||||
<!-- android:layout_marginStart="60dp"-->
|
||||
<!-- android:layout_marginTop="60dp"-->
|
||||
<!-- android:layout_marginEnd="60dp"-->
|
||||
<!-- app:cardBackgroundColor="@color/white"-->
|
||||
<!-- app:cardCornerRadius="30dp"-->
|
||||
<!-- app:cardElevation="0dp"-->
|
||||
<!-- app:rippleColor="#B0BEC5">-->
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:gravity="center_vertical"-->
|
||||
<!-- android:orientation="horizontal">-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_width="100dp"-->
|
||||
<!-- android:layout_height="100dp"-->
|
||||
<!-- android:layout_marginStart="40dp"-->
|
||||
<!-- android:src="@drawable/ic_mode_cook"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- tools:ignore="ContentDescription" />-->
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="40dp"-->
|
||||
<!-- android:layout_weight="1"-->
|
||||
<!-- android:gravity="start|center_vertical"-->
|
||||
<!-- android:orientation="vertical">-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:maxLines="1"-->
|
||||
<!-- android:text="@string/mode_cook"-->
|
||||
<!-- android:textColor="@color/mode_name"-->
|
||||
<!-- android:textSize="36sp"-->
|
||||
<!-- android:textStyle="bold" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="20dp"-->
|
||||
<!-- android:maxLines="1"-->
|
||||
<!-- android:text="@string/cook_mode_desc"-->
|
||||
<!-- android:textColor="@color/mode_desc"-->
|
||||
<!-- android:textSize="26sp" />-->
|
||||
|
||||
<!-- </LinearLayout>-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_width="20dp"-->
|
||||
<!-- android:layout_height="20dp"-->
|
||||
<!-- android:layout_marginEnd="20dp"-->
|
||||
<!-- android:src="@drawable/ic_arrow_right"-->
|
||||
<!-- tools:ignore="ContentDescription" />-->
|
||||
<!-- </LinearLayout>-->
|
||||
<!-- </com.google.android.material.card.MaterialCardView>-->
|
||||
|
||||
<!-- <com.google.android.material.card.MaterialCardView-->
|
||||
<!-- android:id="@+id/cardSampling"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="90dp"-->
|
||||
<!-- android:layout_marginStart="35dp"-->
|
||||
<!-- android:layout_marginTop="15dp"-->
|
||||
<!-- android:layout_marginEnd="35dp"-->
|
||||
<!-- app:cardBackgroundColor="@color/white"-->
|
||||
<!-- app:cardCornerRadius="15dp"-->
|
||||
<!-- app:cardElevation="0dp"-->
|
||||
<!-- app:rippleColor="@color/ripple_color">-->
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:gravity="center_vertical"-->
|
||||
<!-- android:orientation="horizontal">-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_width="50dp"-->
|
||||
<!-- android:layout_height="50dp"-->
|
||||
<!-- android:layout_marginStart="20dp"-->
|
||||
<!-- android:src="@drawable/ic_mode_sampling"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- tools:ignore="ContentDescription" />-->
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="20dp"-->
|
||||
<!-- android:layout_weight="1"-->
|
||||
<!-- android:gravity="start|center_vertical"-->
|
||||
<!-- android:orientation="vertical">-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:maxLines="1"-->
|
||||
<!-- android:text="@string/mode_sampling"-->
|
||||
<!-- android:textColor="@color/mode_name"-->
|
||||
<!-- android:textSize="18sp"-->
|
||||
<!-- android:textStyle="bold" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="10dp"-->
|
||||
<!-- android:maxLines="1"-->
|
||||
<!-- android:text="@string/sampling_mode_desc"-->
|
||||
<!-- android:textColor="@color/mode_desc"-->
|
||||
<!-- android:textSize="13sp" />-->
|
||||
|
||||
<!-- </LinearLayout>-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_width="20dp"-->
|
||||
<!-- android:layout_height="20dp"-->
|
||||
<!-- android:layout_marginEnd="20dp"-->
|
||||
<!-- android:src="@drawable/ic_arrow_right"-->
|
||||
<!-- tools:ignore="ContentDescription" />-->
|
||||
<!-- </LinearLayout>-->
|
||||
<!-- </com.google.android.material.card.MaterialCardView>-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="15dp"-->
|
||||
<!-- android:text="@string/lock_remind"-->
|
||||
<!-- android:textColor="@color/lock_remind"-->
|
||||
<!-- android:textSize="13sp" />-->
|
||||
|
||||
<!-- <com.google.android.material.card.MaterialCardView-->
|
||||
<!-- android:id="@+id/cardQuality"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="90dp"-->
|
||||
<!-- android:layout_marginStart="35dp"-->
|
||||
<!-- android:layout_marginTop="15dp"-->
|
||||
<!-- android:layout_marginEnd="35dp"-->
|
||||
<!-- app:cardBackgroundColor="@color/white"-->
|
||||
<!-- app:cardCornerRadius="15dp"-->
|
||||
<!-- app:cardElevation="0dp"-->
|
||||
<!-- app:rippleColor="@color/ripple_color">-->
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="match_parent"-->
|
||||
<!-- android:gravity="center_vertical"-->
|
||||
<!-- android:orientation="horizontal">-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_width="50dp"-->
|
||||
<!-- android:layout_height="50dp"-->
|
||||
<!-- android:layout_marginStart="20dp"-->
|
||||
<!-- android:src="@drawable/ic_mode_quality"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- tools:ignore="ContentDescription" />-->
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginStart="20dp"-->
|
||||
<!-- android:layout_weight="1"-->
|
||||
<!-- android:gravity="start|center_vertical"-->
|
||||
<!-- android:orientation="vertical">-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:maxLines="1"-->
|
||||
<!-- android:text="@string/mode_quality"-->
|
||||
<!-- android:textColor="@color/mode_name2"-->
|
||||
<!-- android:textSize="18sp"-->
|
||||
<!-- android:textStyle="bold" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="10dp"-->
|
||||
<!-- android:maxLines="1"-->
|
||||
<!-- android:text="@string/quality_mode_desc"-->
|
||||
<!-- android:textColor="@color/mode_desc2"-->
|
||||
<!-- android:textSize="13sp" />-->
|
||||
|
||||
<!-- </LinearLayout>-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_width="20dp"-->
|
||||
<!-- android:layout_height="20dp"-->
|
||||
<!-- android:layout_marginEnd="20dp"-->
|
||||
<!-- android:src="@drawable/ic_lock"-->
|
||||
<!-- tools:ignore="ContentDescription" />-->
|
||||
<!-- </LinearLayout>-->
|
||||
<!-- </com.google.android.material.card.MaterialCardView>-->
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:background="@drawable/bg_other_page">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@drawable/shape_white_30_corners"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:text="@string/seasoning"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:textColor="@color/black666"
|
||||
android:textSize="28sp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/include"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
layout="@layout/layout_grid"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@drawable/shape_white_30_corners"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="30dp"
|
||||
android:paddingEnd="30dp">
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:gravity="center"
|
||||
android:text="熟重"
|
||||
android:textColor="@color/black666"
|
||||
android:textSize="28sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnWeightClear"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:background="@drawable/shape_green_stroke"
|
||||
android:gravity="center"
|
||||
android:text="清零"
|
||||
android:textColor="@color/dish_green"
|
||||
android:textSize="28sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTotalWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="false"
|
||||
android:text="0.00"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="90sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvWeightUnit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:includeFontPadding="false"
|
||||
android:text="千克"
|
||||
android:textColor="@color/black999"
|
||||
android:textSize="32sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnCook"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="制作"
|
||||
android:background="@drawable/ripple_effect_light"
|
||||
android:textColor="@color/dish_green"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold" />
|
||||
<!-- android:background="@drawable/shape_green_stroke"-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnSubmit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/ripple_effect_green"
|
||||
android:gravity="center"
|
||||
android:text="提交"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="32sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,258 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.gridlayout.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="725dp"
|
||||
android:paddingStart="23dp"
|
||||
android:paddingEnd="22dp"
|
||||
android:paddingTop="30dp"
|
||||
android:paddingBottom="20dp"
|
||||
app:columnCount="3"
|
||||
app:orientation="vertical"
|
||||
app:rowCount="5">
|
||||
|
||||
<!-- 第1行 -->
|
||||
<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="0"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="0"
|
||||
tools:text="0" />
|
||||
|
||||
<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="1"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="0"
|
||||
tools:text="1" />
|
||||
|
||||
<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="2"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="0"
|
||||
tools:text="2" />
|
||||
|
||||
<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="3"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="1"
|
||||
tools:text="3" />
|
||||
|
||||
<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="4"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="1"
|
||||
tools:text="4" />
|
||||
|
||||
<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="5"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="1"
|
||||
tools:text="5" />
|
||||
|
||||
<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="6"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="2"
|
||||
tools:text="6" />
|
||||
|
||||
<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="7"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="2"
|
||||
tools:text="7" />
|
||||
|
||||
<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="8"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="2"
|
||||
tools:text="8" />
|
||||
|
||||
<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="9"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="3"
|
||||
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="11"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_row="4"
|
||||
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>
|
||||
@@ -13,6 +13,8 @@
|
||||
android:gravity="center"
|
||||
android:layout_margin="15dp"
|
||||
tools:text="椒盐"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:background="@drawable/shape_white_12_corners"/>
|
||||
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user