优化数据拉取、新增、保存、详情、UI
This commit is contained in:
+14
-2
@@ -17,7 +17,9 @@ import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
|||||||
import com.zmkg.coaloperation.ui.tunneling.activity.TunnelingActivity
|
import com.zmkg.coaloperation.ui.tunneling.activity.TunnelingActivity
|
||||||
import com.zmkg.coaloperation.ui.tunneling.activity.WorkingPointActivity
|
import com.zmkg.coaloperation.ui.tunneling.activity.WorkingPointActivity
|
||||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
import com.zmkg.coaloperation.utils.toJsonString
|
import com.zmkg.coaloperation.utils.toJsonString
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
class TunnelWorkingFaceAdapter(var list: MutableList<TunnelWorkingFaceEntity>) :
|
class TunnelWorkingFaceAdapter(var list: MutableList<TunnelWorkingFaceEntity>) :
|
||||||
BaseQuickAdapter<TunnelWorkingFaceEntity, TunnelWorkingFaceAdapter.VH>(
|
BaseQuickAdapter<TunnelWorkingFaceEntity, TunnelWorkingFaceAdapter.VH>(
|
||||||
@@ -44,7 +46,9 @@ class TunnelWorkingFaceAdapter(var list: MutableList<TunnelWorkingFaceEntity>) :
|
|||||||
holder.binding.let { binding ->
|
holder.binding.let { binding ->
|
||||||
binding.includeHeader.root.isEnabled = false
|
binding.includeHeader.root.isEnabled = false
|
||||||
binding.tvWorkingFaceName.text = item.surfaceName
|
binding.tvWorkingFaceName.text = item.surfaceName
|
||||||
binding.llFaceRecord.visibility = if (item.isExpandRecord) View.VISIBLE else View.GONE
|
binding.llFaceRecord.let {
|
||||||
|
if (item.isExpandRecord) it.visible() else it.gone()
|
||||||
|
}
|
||||||
binding.ivExpandRecord.setImageResource(
|
binding.ivExpandRecord.setImageResource(
|
||||||
if (item.isExpandRecord) R.drawable.ic_arrow_down_white else R.drawable.ic_arrow_right_gray
|
if (item.isExpandRecord) R.drawable.ic_arrow_down_white else R.drawable.ic_arrow_right_gray
|
||||||
)
|
)
|
||||||
@@ -55,6 +59,10 @@ class TunnelWorkingFaceAdapter(var list: MutableList<TunnelWorkingFaceEntity>) :
|
|||||||
item.records = mutableListOf()
|
item.records = mutableListOf()
|
||||||
}
|
}
|
||||||
val size = item.records!!.size
|
val size = item.records!!.size
|
||||||
|
binding.includeHeader.root.let { header ->
|
||||||
|
if (size > 0) header.visible()
|
||||||
|
else header.gone()
|
||||||
|
}
|
||||||
rv.updateLayoutParams {
|
rv.updateLayoutParams {
|
||||||
height = if (size >= 3)
|
height = if (size >= 3)
|
||||||
ScreenUtil.dp2px(150F)
|
ScreenUtil.dp2px(150F)
|
||||||
@@ -91,7 +99,11 @@ class TunnelWorkingFaceAdapter(var list: MutableList<TunnelWorkingFaceEntity>) :
|
|||||||
inner class VH(var binding: ListItemTunnelWorkingFaceBinding) : BaseViewHolder(binding.root)
|
inner class VH(var binding: ListItemTunnelWorkingFaceBinding) : BaseViewHolder(binding.root)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
addChildClickViewIds(R.id.start_record, R.id.ivExpandRecord)
|
addChildClickViewIds(
|
||||||
|
R.id.start_record,
|
||||||
|
R.id.ivExpandRecord,
|
||||||
|
R.id.llWorkingFace
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+3
@@ -30,6 +30,9 @@ interface TunnelWorkingFaceRecordDao {
|
|||||||
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :recordId")
|
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :recordId")
|
||||||
fun getEntityById(recordId: Long): TunnelWorkingFaceRecordEntity
|
fun getEntityById(recordId: Long): TunnelWorkingFaceRecordEntity
|
||||||
|
|
||||||
|
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :surfaceId AND latestRecordState = '1' ORDER BY createTime ASC LIMIT 1")
|
||||||
|
fun getLastEntity(surfaceId: Long): TunnelWorkingFaceRecordEntity?
|
||||||
|
|
||||||
@Query("DELETE FROM tunnel_working_face_record")
|
@Query("DELETE FROM tunnel_working_face_record")
|
||||||
fun deleteAll(): Int
|
fun deleteAll(): Int
|
||||||
}
|
}
|
||||||
+5
-1
@@ -2,6 +2,7 @@ package com.zmkg.coaloperation.db.entiry.tunnel
|
|||||||
|
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
|
import androidx.room.Ignore
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import com.zmkg.coaloperation.utils.DateTimeUtil
|
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
@@ -59,4 +60,7 @@ class TunnelRoofLithologyEntity (
|
|||||||
* 数据状态:0-默认值,原始数据,1-已修改数据
|
* 数据状态:0-默认值,原始数据,1-已修改数据
|
||||||
*/
|
*/
|
||||||
var dataState: String = "0"
|
var dataState: String = "0"
|
||||||
): Parcelable
|
): Parcelable {
|
||||||
|
@Ignore
|
||||||
|
constructor():this(lithologyId = 0)
|
||||||
|
}
|
||||||
|
|||||||
+9
@@ -68,6 +68,10 @@ data class TunnelWorkingFaceRecordEntity (
|
|||||||
* 煤层高度
|
* 煤层高度
|
||||||
*/
|
*/
|
||||||
var seamHeight: String? = null,
|
var seamHeight: String? = null,
|
||||||
|
/**
|
||||||
|
* 涌水量
|
||||||
|
*/
|
||||||
|
var waterYield: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
@@ -84,6 +88,11 @@ data class TunnelWorkingFaceRecordEntity (
|
|||||||
*/
|
*/
|
||||||
var dataState: String = "0",
|
var dataState: String = "0",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面中昨日记录状态:0-默认值,非昨日记录,1-昨日记录
|
||||||
|
*/
|
||||||
|
var latestRecordState: String = "0",
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
var mineWorkingLithologyList: MutableList<TunnelRoofLithologyEntity>? = null,
|
var mineWorkingLithologyList: MutableList<TunnelRoofLithologyEntity>? = null,
|
||||||
|
|
||||||
|
|||||||
+5
@@ -31,6 +31,11 @@ class TunnelWorkingFaceRecordRepository(private val dao: TunnelWorkingFaceRecord
|
|||||||
suspend fun getEntityById(faceId: Long) = withContext(Dispatchers.IO) {
|
suspend fun getEntityById(faceId: Long) = withContext(Dispatchers.IO) {
|
||||||
dao.getEntityById(faceId)
|
dao.getEntityById(faceId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getLastEntity(surfaceId: Long) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getLastEntity(surfaceId)
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun deleteAll() = withContext(Dispatchers.IO) {
|
suspend fun deleteAll() = withContext(Dispatchers.IO) {
|
||||||
dao.deleteAll()
|
dao.deleteAll()
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -56,6 +56,11 @@ class TunnelWorkingFaceRecordViewModel(application: Application) : AndroidViewMo
|
|||||||
repository.getEntityById(recordId)
|
repository.getEntityById(recordId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getLastEntity(surfaceId: Long, action: (TunnelWorkingFaceRecordEntity?) -> Unit) = viewModelScope.launch {
|
||||||
|
val record = repository.getLastEntity(surfaceId)
|
||||||
|
action(record)
|
||||||
|
}
|
||||||
|
|
||||||
fun deleteAll(action: () -> Unit={}) = viewModelScope.launch {
|
fun deleteAll(action: () -> Unit={}) = viewModelScope.launch {
|
||||||
repository.deleteAll()
|
repository.deleteAll()
|
||||||
action()
|
action()
|
||||||
|
|||||||
+1
@@ -230,6 +230,7 @@ class AddWorkingPointActivity :
|
|||||||
Log.d(TAG, "saveFaceRecord: ${roofLithologyList.toJson()}")
|
Log.d(TAG, "saveFaceRecord: ${roofLithologyList.toJson()}")
|
||||||
|
|
||||||
workingFaceRecordViewModel.insert(faceRecord) {
|
workingFaceRecordViewModel.insert(faceRecord) {
|
||||||
|
EventBus.getDefault().post(faceRecord)
|
||||||
roofLithologyViewModel.insertList(roofLithologyList) {
|
roofLithologyViewModel.insertList(roofLithologyList) {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|||||||
+34
-7
@@ -41,12 +41,13 @@ class TunnelingActivity :
|
|||||||
|
|
||||||
private val workingFaceAdapter: TunnelWorkingFaceAdapter by lazy {
|
private val workingFaceAdapter: TunnelWorkingFaceAdapter by lazy {
|
||||||
TunnelWorkingFaceAdapter(workingFaceList).apply {
|
TunnelWorkingFaceAdapter(workingFaceList).apply {
|
||||||
setOnItemClickListener { _, _, position ->
|
setOnItemChildClickListener { _, view, position ->
|
||||||
|
if (view.id == R.id.llWorkingFace) {
|
||||||
toActivity(WorkingFaceDetailActivity::class.java, Bundle().apply {
|
toActivity(WorkingFaceDetailActivity::class.java, Bundle().apply {
|
||||||
putParcelable(WorkingFaceDetailActivity.FACE_DETAIL, workingFaceList[position])
|
putParcelable(WorkingFaceDetailActivity.FACE_DETAIL, workingFaceList[position])
|
||||||
})
|
})
|
||||||
|
return@setOnItemChildClickListener
|
||||||
}
|
}
|
||||||
setOnItemChildClickListener { _, view, position ->
|
|
||||||
if (view.id == R.id.ivExpandRecord) {
|
if (view.id == R.id.ivExpandRecord) {
|
||||||
val expandState = view.tag.toString().toBooleanStrictOrNull() ?: false
|
val expandState = view.tag.toString().toBooleanStrictOrNull() ?: false
|
||||||
workingFaceList[position].isExpandRecord = expandState.not()
|
workingFaceList[position].isExpandRecord = expandState.not()
|
||||||
@@ -126,10 +127,7 @@ class TunnelingActivity :
|
|||||||
workingFaceAdapter.notifyItemChanged(position)
|
workingFaceAdapter.notifyItemChanged(position)
|
||||||
return@getEntityList
|
return@getEntityList
|
||||||
}
|
}
|
||||||
val viewHolder =
|
val recordAdapter = getRecordAdapter(position)
|
||||||
mBinding.rvList.findViewHolderForLayoutPosition(position) as TunnelWorkingFaceAdapter.VH
|
|
||||||
val recordAdapter =
|
|
||||||
viewHolder.binding.rvFaceRecord.adapter as TunnelWorkingFaceRecordAdapter
|
|
||||||
recordAdapter.apply {
|
recordAdapter.apply {
|
||||||
list.clear()
|
list.clear()
|
||||||
// list.add(FACE_RECORD_HEADER)
|
// list.add(FACE_RECORD_HEADER)
|
||||||
@@ -143,6 +141,15 @@ class TunnelingActivity :
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
fun onWorkingFaceEvent(event: TunnelWorkingFaceEntity) {
|
fun onWorkingFaceEvent(event: TunnelWorkingFaceEntity) {
|
||||||
val index = workingFaceList.indexOfFirst { it.surfaceId == event.surfaceId }
|
val index = workingFaceList.indexOfFirst { it.surfaceId == event.surfaceId }
|
||||||
|
if (index == -1) {
|
||||||
|
//新增工作面
|
||||||
|
val insertIndex = workingFaceList.size
|
||||||
|
workingFaceList.add(event)
|
||||||
|
workingFaceAdapter.notifyItemInserted(insertIndex)
|
||||||
|
workingFaceAdapter.notifyItemRangeChanged(insertIndex, insertIndex+1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//修改工作面
|
||||||
workingFaceViewModel.getEntityById(event.surfaceId) { entity ->
|
workingFaceViewModel.getEntityById(event.surfaceId) { entity ->
|
||||||
workingFaceList[index] = entity
|
workingFaceList[index] = entity
|
||||||
workingFaceAdapter.notifyItemChanged(index)
|
workingFaceAdapter.notifyItemChanged(index)
|
||||||
@@ -151,7 +158,27 @@ class TunnelingActivity :
|
|||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
fun onFaceRecordEvent(event: TunnelWorkingFaceRecordEntity) {
|
fun onFaceRecordEvent(event: TunnelWorkingFaceRecordEntity) {
|
||||||
//TODO 折叠子列表
|
val position = workingFaceList.indexOfFirst { it.surfaceId == event.surfaceId }
|
||||||
|
val faceEntity = workingFaceList[position]
|
||||||
|
if (faceEntity.isExpandRecord.not()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
faceEntity.records?.let { records ->
|
||||||
|
val index = records.indexOfFirst { it.recordId == event.recordId }
|
||||||
|
if (index == -1) {
|
||||||
|
records.add(event)
|
||||||
|
} else {
|
||||||
|
records[index] = event
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val recordAdapter = getRecordAdapter(position)
|
||||||
|
recordAdapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getRecordAdapter(position:Int):TunnelWorkingFaceRecordAdapter {
|
||||||
|
val viewHolder =
|
||||||
|
mBinding.rvList.findViewHolderForLayoutPosition(position) as TunnelWorkingFaceAdapter.VH
|
||||||
|
return viewHolder.binding.rvFaceRecord.adapter as TunnelWorkingFaceRecordAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
@@ -287,6 +287,7 @@ class WorkFaceActivity :
|
|||||||
}
|
}
|
||||||
workingFaceViewModel.insert(workingFaceEntity) {
|
workingFaceViewModel.insert(workingFaceEntity) {
|
||||||
showToast("工作面新增完成")
|
showToast("工作面新增完成")
|
||||||
|
EventBus.getDefault().post(workingFaceEntity)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+34
-4
@@ -5,8 +5,12 @@ import android.view.View
|
|||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||||
import androidx.core.graphics.toColorInt
|
import androidx.core.graphics.toColorInt
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.zmkg.coaloperation.databinding.ActivityWorkingFaceDetailBinding
|
import com.zmkg.coaloperation.databinding.ActivityWorkingFaceDetailBinding
|
||||||
|
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
||||||
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelWorkingFaceEntity
|
||||||
|
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||||
|
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||||
import com.zmkg.coaloperation.ui.tunneling.adapter.TunnelingRockNatureAdapter
|
import com.zmkg.coaloperation.ui.tunneling.adapter.TunnelingRockNatureAdapter
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
||||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||||
@@ -26,7 +30,18 @@ class WorkingFaceDetailActivity :
|
|||||||
const val FACE_DETAIL = "faceDetail"
|
const val FACE_DETAIL = "faceDetail"
|
||||||
}
|
}
|
||||||
|
|
||||||
val tunnelingRockNatureAdapter: TunnelingRockNatureAdapter by lazy { TunnelingRockNatureAdapter() }
|
private val workingFaceRecordViewModel: TunnelWorkingFaceRecordViewModel by lazy {
|
||||||
|
ViewModelProvider(this)[TunnelWorkingFaceRecordViewModel::class.java]
|
||||||
|
}
|
||||||
|
|
||||||
|
private val roofLithologyViewModel: TunnelRoofLithologyViewModel by lazy {
|
||||||
|
ViewModelProvider(this)[TunnelRoofLithologyViewModel::class.java]
|
||||||
|
}
|
||||||
|
private val tunnelingRockNatureAdapter: TunnelingRockNatureAdapter by lazy {
|
||||||
|
TunnelingRockNatureAdapter(lithologyList)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val lithologyList:MutableList<TunnelRoofLithologyEntity> = mutableListOf()
|
||||||
|
|
||||||
private var faceDetail: TunnelWorkingFaceEntity? = null
|
private var faceDetail: TunnelWorkingFaceEntity? = null
|
||||||
|
|
||||||
@@ -70,8 +85,23 @@ class WorkingFaceDetailActivity :
|
|||||||
// }
|
// }
|
||||||
faceDetail = intent.getParcelableExtra(FACE_DETAIL)
|
faceDetail = intent.getParcelableExtra(FACE_DETAIL)
|
||||||
|
|
||||||
faceDetail?.let {
|
faceDetail?.let { detail ->
|
||||||
loadFaceDetail()
|
loadFaceDetail()
|
||||||
|
workingFaceRecordViewModel.getLastEntity(detail.surfaceId) { record ->
|
||||||
|
record?.let {
|
||||||
|
mBinding.tvYesterdayLen.text = "${it.workingFootage}m"
|
||||||
|
mBinding.tvWorkingFaceAngle.text = "${it.seamDip}"
|
||||||
|
// mBinding.tvMonthAccumulateLen.text = "${it.monthFootage}m"
|
||||||
|
mBinding.tvWorkingFaceWater.text = "${it.waterYield}"
|
||||||
|
|
||||||
|
roofLithologyViewModel.getEntityList(it.recordId) { list ->
|
||||||
|
list?.let {
|
||||||
|
lithologyList.addAll(it)
|
||||||
|
tunnelingRockNatureAdapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +137,7 @@ class WorkingFaceDetailActivity :
|
|||||||
bean ?: return
|
bean ?: return
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun stringToDouble(numText:String?): Double {
|
private fun stringToDouble(numText: String?): Double {
|
||||||
if (numText.isNullOrEmpty() || numText.isBlank()) return 0.toDouble()
|
if (numText.isNullOrEmpty() || numText.isBlank()) return 0.toDouble()
|
||||||
return numText.toDouble()
|
return numText.toDouble()
|
||||||
}
|
}
|
||||||
@@ -119,7 +149,7 @@ class WorkingFaceDetailActivity :
|
|||||||
|
|
||||||
val total = stringToDouble(bean.totalFootage)
|
val total = stringToDouble(bean.totalFootage)
|
||||||
val accumulative = stringToDouble(bean.accumulativeFootage)
|
val accumulative = stringToDouble(bean.accumulativeFootage)
|
||||||
val remaining =stringToDouble( bean.remainingFootage)
|
val remaining = stringToDouble(bean.remainingFootage)
|
||||||
|
|
||||||
tvLenTotal.text = "总进尺:${total}m"
|
tvLenTotal.text = "总进尺:${total}m"
|
||||||
tvLenAccumulate.text = "累计进尺:${accumulative}m"
|
tvLenAccumulate.text = "累计进尺:${accumulative}m"
|
||||||
|
|||||||
+21
-9
@@ -1,26 +1,38 @@
|
|||||||
package com.zmkg.coaloperation.ui.tunneling.adapter
|
package com.zmkg.coaloperation.ui.tunneling.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.MineWorkingLithology
|
import com.zmkg.coaloperation.databinding.ItemRockNatureBinding
|
||||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeItemBean
|
import com.zmkg.coaloperation.db.entiry.tunnel.TunnelRoofLithologyEntity
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 顶板岩性
|
* 顶板岩性
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class TunnelingRockNatureAdapter :
|
class TunnelingRockNatureAdapter(list: MutableList<TunnelRoofLithologyEntity>) :
|
||||||
BaseQuickAdapter<MineWorkingLithology, BaseViewHolder>(R.layout.item_rock_nature) {
|
BaseQuickAdapter<TunnelRoofLithologyEntity, TunnelingRockNatureAdapter.VH>(R.layout.item_rock_nature, list) {
|
||||||
|
|
||||||
|
inner class VH(var binding: ItemRockNatureBinding):BaseViewHolder(binding.root)
|
||||||
|
|
||||||
override fun convert(holder: BaseViewHolder, item: MineWorkingLithology) {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||||
holder.setText(R.id.tvRock1Start, "${item.positionStart}")
|
val binding = ItemRockNatureBinding.inflate(
|
||||||
.setText(R.id.tvRock1End, "${item.positionEnd}")
|
LayoutInflater.from(context),parent, false
|
||||||
.setText(R.id.tvRock1Name, item.lithologyType)
|
)
|
||||||
|
return VH(binding).also {
|
||||||
|
bindViewClickListener(it, viewType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun convert(holder: VH, item: TunnelRoofLithologyEntity) {
|
||||||
|
holder.binding.let {
|
||||||
|
it.tvRock1Start.text = item.positionStart
|
||||||
|
it.tvRock1End.text = item.positionEnd
|
||||||
|
it.tvRock1Name.text = item.lithologyType
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+4
@@ -155,6 +155,10 @@ class UserFragment :
|
|||||||
workingFaceViewModel.insertList(list) {}
|
workingFaceViewModel.insertList(list) {}
|
||||||
list.forEach { faceEntity ->
|
list.forEach { faceEntity ->
|
||||||
faceEntity.records?.let { recordList ->
|
faceEntity.records?.let { recordList ->
|
||||||
|
val lastRecordId = faceEntity.latestRecord?.recordId
|
||||||
|
val record = recordList.firstOrNull {it.recordId == lastRecordId}
|
||||||
|
record?.latestRecordState = "1"
|
||||||
|
|
||||||
//保存工作面记录数据
|
//保存工作面记录数据
|
||||||
workingFaceRecordViewModel.insertList(recordList)
|
workingFaceRecordViewModel.insertList(recordList)
|
||||||
recordList.forEach { recordEntity ->
|
recordList.forEach { recordEntity ->
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
android:id="@+id/toolbar_lay"
|
android:id="@+id/toolbar_lay"
|
||||||
layout="@layout/lay_title_right_bar" />
|
layout="@layout/lay_title_right_bar" />
|
||||||
|
|
||||||
<ScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginStart="20dp"
|
android:layout_marginStart="20dp"
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="10dp"
|
android:layout_marginBottom="10dp"
|
||||||
android:background="@drawable/bg_stroke_gray"
|
android:orientation="vertical"
|
||||||
android:orientation="vertical">
|
android:background="@drawable/bg_stroke_gray">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -266,7 +266,7 @@
|
|||||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||||
<!-- tools:minHeight="60dp" />-->
|
<!-- tools:minHeight="60dp" />-->
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<com.zmkg.coaloperation.view.NestedRecyclerView
|
||||||
android:id="@+id/rvLithology"
|
android:id="@+id/rvLithology"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -428,14 +428,14 @@
|
|||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
style="?android:attr/buttonBarStyle"
|
style="?android:attr/buttonBarStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="20dp"
|
android:paddingTop="20dp"
|
||||||
android:layout_marginBottom="20dp"
|
android:paddingBottom="20dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingStart="30dp"
|
android:paddingStart="30dp"
|
||||||
android:paddingEnd="30dp">
|
android:paddingEnd="30dp">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
android:text="岩"
|
android:text="岩"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</layout>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.allen.library.shape.ShapeLinearLayout
|
<com.allen.library.shape.ShapeLinearLayout
|
||||||
|
android:id="@+id/llWorkingFace"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="74dp"
|
android:layout_height="74dp"
|
||||||
android:layout_marginHorizontal="20dp"
|
android:layout_marginHorizontal="20dp"
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ ext {
|
|||||||
"core-testing" : "androidx.arch.core:core-testing:$archCore",
|
"core-testing" : "androidx.arch.core:core-testing:$archCore",
|
||||||
"core-runtime" : "androidx.arch.core:core-runtime:$archCore",
|
"core-runtime" : "androidx.arch.core:core-runtime:$archCore",
|
||||||
"coreKtx" : "androidx.core:core-ktx:1.8.0",
|
"coreKtx" : "androidx.core:core-ktx:1.8.0",
|
||||||
"kotlin-reflect" : "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion",
|
// "kotlin-reflect" : "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion",
|
||||||
//协程
|
//协程
|
||||||
"coroutines-core" : "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion",
|
"coroutines-core" : "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion",
|
||||||
"coroutines-android" : "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion",
|
"coroutines-android" : "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion",
|
||||||
|
|||||||
Reference in New Issue
Block a user