Compare commits
7
Commits
dev_lvmeng
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da67c4d4b2 | ||
|
|
413b36a836 | ||
|
|
410383563b | ||
|
|
fc77fa8f68 | ||
|
|
60713255b0 | ||
|
|
4ea76341c3 | ||
|
|
e959a71e85 |
@@ -78,7 +78,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||||
|
||||
api rootProject.ext.androidxLibs
|
||||
// ViewModel and LiveData
|
||||
api rootProject.ext.jetpackLibs
|
||||
@@ -110,9 +110,4 @@ dependencies {
|
||||
implementation("org.apache.poi:poi:5.2.3")
|
||||
implementation("org.apache.poi:poi-ooxml:5.2.3")
|
||||
|
||||
implementation 'androidx.fragment:fragment-ktx:1.6.0'
|
||||
|
||||
// implementation 'com.zhihu.android:matisse:0.6.0'
|
||||
implementation project(':matisse')
|
||||
implementation 'com.github.hackware1993:MagicIndicator:1.7.0'
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
package="com.zmkg.coaloperation">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||
@@ -18,7 +17,6 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
tools:replace="android:allowBackup">
|
||||
|
||||
@@ -47,7 +45,7 @@
|
||||
<activity android:name=".ui.user.activity.NetworkConfigActivity" />
|
||||
<activity android:name=".ui.user.activity.CacheManageActivity" />
|
||||
<activity android:name=".ui.user.activity.AboutUsActivity" />
|
||||
<activity android:name=".ui.geologging.GeologicalActivity" />
|
||||
<activity android:name=".ui.home.activity.GeologicalActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.WorkingFaceStatisticsActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.WorkingFaceRecordActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.WorkingFaceDetailActivity" />
|
||||
@@ -56,22 +54,6 @@
|
||||
<activity android:name=".ui.tunneling.activity.TunnelingActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.AddWorkingFaceActivity"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity android:name=".ui.mining.activity.MiningActivity" />
|
||||
<activity android:name=".ui.mining.activity.MiningFaceStatisticsActivity" />
|
||||
<activity android:name=".ui.mining.activity.MiningFaceDetailActivity" />
|
||||
<activity android:name=".ui.mining.activity.AddMiningFaceActivity"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity android:name=".ui.mining.activity.MiningFaceRecordActivity"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity android:name=".ui.user.activity.DataSyncActivity" />
|
||||
<activity android:name=".ui.wateryield.WaterYieldObserveActivity" />
|
||||
<activity android:name=".ui.wateryield.WaterYieldAddObservePointActivity"
|
||||
android:windowSoftInputMode="adjustPan"/>
|
||||
<activity android:name=".ui.wateryield.WaterYieldHomeActivity" />
|
||||
<activity android:name=".ui.wateryield.WaterYieldObserveRecordActivity" />
|
||||
<activity android:name=".ui.geologging.GeologicalPointActivity" />
|
||||
<activity android:name=".ui.geologging.AddGeologicalPointActivity" />
|
||||
<activity android:name=".ui.geologging.AddGeoLoggingFaceActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zmkg.coaloperation
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
@@ -11,7 +10,7 @@ import com.zmkg.coaloperation.bottomtab.HomeBottomTabLayout
|
||||
import com.zmkg.coaloperation.databinding.ActivityMainBinding
|
||||
import com.zmkg.coaloperation.ui.home.fragment.HomeFragment
|
||||
import com.zmkg.coaloperation.ui.record.fragment.RecordFragment
|
||||
import com.zmkg.coaloperation.ui.report.fragment.Report2Fragment
|
||||
import com.zmkg.coaloperation.ui.report.fragment.ReportFragment
|
||||
import com.zmkg.coaloperation.ui.user.fragment.UserFragment
|
||||
|
||||
class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layout.activity_main),
|
||||
@@ -57,7 +56,7 @@ class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layou
|
||||
}
|
||||
|
||||
TAG_REPORT -> {
|
||||
return Report2Fragment()
|
||||
return ReportFragment()
|
||||
}
|
||||
|
||||
// TAG_MESSAGE -> {
|
||||
@@ -78,5 +77,4 @@ class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layou
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,8 +73,6 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun initLoginStatusListener() {
|
||||
// TUILogin.addLoginListener(loginStatusListener)
|
||||
}
|
||||
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.AddMiningFaceItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemAddMiningFaceBinding
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class AddMiningFaceAdapter(list: MutableList<AddMiningFaceItem>):
|
||||
BaseQuickAdapter<AddMiningFaceItem, AddMiningFaceAdapter.VH>(R.layout.list_item_add_mining_face, list){
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemAddMiningFaceBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: AddMiningFaceItem
|
||||
) {
|
||||
holder.binding.let {
|
||||
val index = holder.layoutPosition
|
||||
it.imgExpand.run {
|
||||
if (item.isShowArrowDown) visible() else gone()
|
||||
}
|
||||
it.tvFuncName.text = item.funcName
|
||||
if (item.funcType == 0) {
|
||||
it.etInputValue.run {
|
||||
visible()
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.funcValue = text.toString().trim()
|
||||
})
|
||||
setText(item.funcValue)
|
||||
}
|
||||
it.tvSelectValue.gone()
|
||||
} else {
|
||||
it.etInputValue.gone()
|
||||
it.tvSelectValue.run {
|
||||
visible()
|
||||
text = item.funcValue
|
||||
tag = item.funcId
|
||||
}
|
||||
}
|
||||
it.divider.run {
|
||||
if (index == data.size - 1) gone() else visible()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemAddMiningFaceBinding): BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.BuoyBottomItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemBuoyBottomBinding
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class BuoyBottomAdapter(list: MutableList<BuoyBottomItem>) :
|
||||
BaseQuickAdapter<BuoyBottomItem, BuoyBottomAdapter.VH>(R.layout.list_item_buoy_bottom, list) {
|
||||
inner class VH(var binding: ListItemBuoyBottomBinding) : BaseViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemBuoyBottomBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(holder: VH, item: BuoyBottomItem) {
|
||||
holder.binding.let {
|
||||
val position = holder.layoutPosition
|
||||
if (position > 0) {
|
||||
item.name = "断面${position}到断面${position + 1}的水流时间(s)"
|
||||
}
|
||||
it.tvShowName.text = item.name
|
||||
it.etShowValue.run {
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.value = text.toString().trim()
|
||||
})
|
||||
setText(item.value.formatDecimalString())
|
||||
}
|
||||
it.divider.run {
|
||||
if (position == data.size - 1) gone() else visible()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.BuoyTopItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemBuoyTopBinding
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class BuoyTopAdapter(list: MutableList<BuoyTopItem>) :
|
||||
BaseQuickAdapter<BuoyTopItem, BuoyTopAdapter.VH>(R.layout.list_item_buoy_top, list) {
|
||||
inner class VH(var binding: ListItemBuoyTopBinding) : BaseViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemBuoyTopBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(holder: VH, item: BuoyTopItem) {
|
||||
holder.binding.let {
|
||||
val position = holder.layoutPosition
|
||||
item.faceName = "断面${position + 1}"
|
||||
it.tvFaceName.text = item.faceName
|
||||
it.etDitchWidth.run {
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.ditchWidth = text.toString().trim()
|
||||
})
|
||||
setText(item.ditchWidth.formatDecimalString())
|
||||
}
|
||||
it.etDitchDepth.run {
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.ditchDepth = text.toString().trim()
|
||||
})
|
||||
setText(item.ditchDepth.formatDecimalString())
|
||||
}
|
||||
it.ivDeleteFace.run {
|
||||
if (position > 0) visible() else gone()
|
||||
}
|
||||
it.divider.run {
|
||||
if (position == data.size - 1) gone() else visible()
|
||||
}
|
||||
it.btnAddFace.run {
|
||||
if (position == data.size - 1) visible() else gone()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||
import com.zmkg.coaloperation.databinding.ListItemCommonImageBinding
|
||||
import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
import com.zmkg.coaloperation.utils.load
|
||||
|
||||
class CommonImageAdapter(var list: MutableList<CommonImageBean>, var imageSize: Int = 70.dp):
|
||||
BaseQuickAdapter<CommonImageBean, CommonImageAdapter.VH>(
|
||||
R.layout.list_item_common_image, list
|
||||
){
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemCommonImageBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: CommonImageBean
|
||||
) {
|
||||
holder.binding.ivImage.let {
|
||||
it.updateLayoutParams {
|
||||
width = imageSize
|
||||
height = imageSize
|
||||
}
|
||||
if (item.isAddFlag) {
|
||||
it.load(R.drawable.ic_add_image)
|
||||
} else {
|
||||
it.loadRoundedImage(item.imagePath, 3F)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemCommonImageBinding): BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.DataSyncItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemDataSyncBinding
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class DataSyncAdapter(list: MutableList<DataSyncItem>):
|
||||
BaseQuickAdapter<DataSyncItem, DataSyncAdapter.VH>(R.layout.list_item_data_sync, list) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemDataSyncBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: DataSyncItem
|
||||
) {
|
||||
holder.binding.let {
|
||||
it.tvItemUnit.text = item.funcName
|
||||
// it.divider.run {
|
||||
// if (holder.layoutPosition == data.size - 1) gone() else visible()
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemDataSyncBinding): BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.databinding.ItemGeologicalListBinding
|
||||
import com.zmkg.coaloperation.db.entity.geologging.GeoLoggingFace
|
||||
|
||||
class GeoLoggingFaceAdapter(list: MutableList<GeoLoggingFace>):
|
||||
BaseQuickAdapter<GeoLoggingFace, GeoLoggingFaceAdapter.VH>(
|
||||
R.layout.item_geological_list, list
|
||||
){
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ItemGeologicalListBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: GeoLoggingFace
|
||||
) {
|
||||
holder.binding.tvFaceName.text = item.surfaceName
|
||||
}
|
||||
|
||||
inner class VH(var binding: ItemGeologicalListBinding): BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.graphics.toColorInt
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.GeoPointItem
|
||||
import com.zmkg.coaloperation.databinding.ItemGeologicalPointBinding
|
||||
import com.zmkg.coaloperation.ui.geologging.AddGeologicalPointActivity
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class GeoPointAdapter(list: MutableList<GeoPointItem>) :
|
||||
BaseQuickAdapter<GeoPointItem, GeoPointAdapter.VH>(
|
||||
R.layout.item_geological_point, list
|
||||
) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ItemGeologicalPointBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: GeoPointItem
|
||||
) {
|
||||
val index = holder.layoutPosition
|
||||
val binding = holder.binding
|
||||
binding.tvNum.run {
|
||||
text = "${index+1}"
|
||||
setTextColor(
|
||||
if (item.isLogging) "#A3FEA6".toColorInt() else "#6A6F87".toColorInt()
|
||||
)
|
||||
}
|
||||
binding.tvName.run {
|
||||
text = item.name
|
||||
setTextColor(
|
||||
if (item.isLogging) "#A3FEA6".toColorInt() else "#6A6F87".toColorInt()
|
||||
)
|
||||
}
|
||||
binding.tvDistance.run {
|
||||
text = item.distance
|
||||
setTextColor(
|
||||
if (item.isLogging) "#A3FEA6".toColorInt() else "#6A6F87".toColorInt()
|
||||
)
|
||||
}
|
||||
if (item.isLogging) {
|
||||
binding.ivState.setImageResource(
|
||||
if (item.isChecked) R.drawable.ic_point_green_check
|
||||
else R.drawable.ic_point_green
|
||||
)
|
||||
} else {
|
||||
binding.ivState.setImageResource(R.drawable.ic_point_grey)
|
||||
}
|
||||
binding.horizontalDivider.run {
|
||||
if (item.isLogging) {
|
||||
if (index == data.size-1) gone() else visible()
|
||||
} else {
|
||||
visible()
|
||||
}
|
||||
}
|
||||
binding.btnAddPoint.run {
|
||||
if (!item.isLogging && index == data.size-1) visible() else gone()
|
||||
setOnClickListener {
|
||||
it.context.startActivity(Intent(it.context, AddGeologicalPointActivity::class.java))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
addChildClickViewIds(R.id.btnAddPoint)
|
||||
}
|
||||
|
||||
inner class VH(var binding: ItemGeologicalPointBinding) : BaseViewHolder(binding.root)
|
||||
}
|
||||
-134
@@ -1,134 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zhihu.matisse.Matisse
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseActivity
|
||||
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||
import com.zmkg.coaloperation.bean.GeoPointMultiItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemPointBaseHorizontalBinding
|
||||
import com.zmkg.coaloperation.databinding.ListItemPointBaseVerticalBinding
|
||||
import com.zmkg.coaloperation.utils.GalleryUtils
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class GeoPointMultiAdapter(list: MutableList<GeoPointMultiItem>) :
|
||||
BaseMultiItemQuickAdapter<GeoPointMultiItem, BaseViewHolder>(list) {
|
||||
|
||||
init {
|
||||
addItemType(GeoPointMultiItem.TYPE_BASE_INFO, R.layout.list_item_point_base_info)
|
||||
addItemType(GeoPointMultiItem.TYPE_LOGGING_INFO, R.layout.list_item_point_logging_info)
|
||||
addItemType(GeoPointMultiItem.TYPE_CALCULATE_INFO, R.layout.list_item_point_calculate_info)
|
||||
addItemType(GeoPointMultiItem.TYPE_UPLOAD_IMAGE, R.layout.list_item_point_upload_image)
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: BaseViewHolder,
|
||||
item: GeoPointMultiItem
|
||||
) {
|
||||
when (holder.itemViewType) {
|
||||
GeoPointMultiItem.TYPE_BASE_INFO -> {
|
||||
loadBaseInfo(holder, item)
|
||||
}
|
||||
|
||||
GeoPointMultiItem.TYPE_LOGGING_INFO -> {
|
||||
loadLoggingInfo(holder, item)
|
||||
}
|
||||
|
||||
GeoPointMultiItem.TYPE_CALCULATE_INFO -> {
|
||||
loadCalculateInfo(holder, item)
|
||||
}
|
||||
|
||||
GeoPointMultiItem.TYPE_UPLOAD_IMAGE -> {
|
||||
loadUploadImage(holder, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadUploadImage(holder: BaseViewHolder, item: GeoPointMultiItem) {
|
||||
val rvImageList = holder.itemView.findViewById<RecyclerView>(R.id.rvImageList)
|
||||
if (item.images == null) {
|
||||
item.images = mutableListOf()
|
||||
}
|
||||
val images = item.images!!
|
||||
rvImageList.let { rv ->
|
||||
rv.layoutManager = GridLayoutManager(rv.context, 4, GridLayoutManager.VERTICAL, false)
|
||||
rv.adapter = CommonImageAdapter(images).also {
|
||||
it.setOnItemClickListener { adapter, view, position ->
|
||||
if (it.data[position].isAddFlag.not()) {
|
||||
return@setOnItemClickListener
|
||||
}
|
||||
openGallery(context as BaseActivity, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadCalculateInfo(holder: BaseViewHolder, item: GeoPointMultiItem) {}
|
||||
|
||||
private fun loadLoggingInfo(holder: BaseViewHolder, item: GeoPointMultiItem) {
|
||||
|
||||
}
|
||||
|
||||
private fun loadBaseInfo(holder: BaseViewHolder, item: GeoPointMultiItem) {
|
||||
val llBaseTop = holder.itemView.findViewById<LinearLayout>(R.id.llBaseTop)
|
||||
llBaseTop.removeAllViews()
|
||||
item.baseTopList?.forEach {
|
||||
val itemBinding = ListItemPointBaseHorizontalBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
llBaseTop,
|
||||
false
|
||||
)
|
||||
itemBinding.run {
|
||||
tvItemName.text = it.name
|
||||
etInputValue.setText(it.value)
|
||||
}
|
||||
llBaseTop.addView(itemBinding.root)
|
||||
}
|
||||
|
||||
val llBaseBottom = holder.itemView.findViewById<LinearLayout>(R.id.llBaseBottom)
|
||||
llBaseBottom.removeAllViews()
|
||||
item.baseBottomList?.forEachIndexed { index, it ->
|
||||
val itemBinding = ListItemPointBaseVerticalBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
llBaseBottom,
|
||||
false
|
||||
)
|
||||
itemBinding.run {
|
||||
tvItemName.text = it.name
|
||||
etInputValue.setText(it.value)
|
||||
dividerVertical.run {
|
||||
if (index == item.baseBottomList!!.size - 1) gone() else visible()
|
||||
}
|
||||
}
|
||||
itemBinding.root.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
width = 0
|
||||
height = LinearLayout.LayoutParams.MATCH_PARENT
|
||||
weight = if (index == item.baseBottomList!!.size - 1) 1.24F else 1.0F
|
||||
}
|
||||
llBaseBottom.addView(itemBinding.root)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun openGallery(activity: BaseActivity, adapter: CommonImageAdapter) {
|
||||
StorageUtils.requestPermission(activity) {
|
||||
GalleryUtils.openGallery(activity) { data ->
|
||||
val paths = Matisse.obtainPathResult(data) // 获取文件路径列表
|
||||
paths?.forEach { path ->
|
||||
val size = adapter.list.size
|
||||
adapter.list.add(size - 1, CommonImageBean(imagePath = path))
|
||||
}
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.GeoPointItem
|
||||
import com.zmkg.coaloperation.bean.GeoPointParent
|
||||
import com.zmkg.coaloperation.databinding.ItemGeologicalHeaderBinding
|
||||
import com.zmkg.coaloperation.databinding.ListItemGeologicalPointParentBinding
|
||||
|
||||
class GeoPointParentAdapter(list: MutableList<GeoPointParent>) :
|
||||
BaseQuickAdapter<GeoPointParent, GeoPointParentAdapter.VH>(
|
||||
R.layout.list_item_geological_point_parent, list
|
||||
) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemGeologicalPointParentBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: GeoPointParent
|
||||
) {
|
||||
val binding = holder.binding
|
||||
binding.tvPointFlag.run {
|
||||
text = item.name
|
||||
}
|
||||
binding.rvPointList.let { rv ->
|
||||
rv.layoutManager = LinearLayoutManager(context)
|
||||
if (item.list == null) {
|
||||
item.list = mutableListOf()
|
||||
}
|
||||
val geoPointAdapter = GeoPointAdapter(item.list!!)
|
||||
rv.adapter = geoPointAdapter
|
||||
// val headerBinding =
|
||||
// ItemGeologicalHeaderBinding.inflate(LayoutInflater.from(context))
|
||||
// geoPointAdapter.addHeaderView(headerBinding.root)
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemGeologicalPointParentBinding) : BaseViewHolder(binding.root)
|
||||
}
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.AddMiningFaceItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemMiningRecordBaseDataBinding
|
||||
|
||||
class MiningRecordBaseDataAdapter(list: MutableList<AddMiningFaceItem>) :
|
||||
BaseQuickAdapter<AddMiningFaceItem, MiningRecordBaseDataAdapter.VH>(
|
||||
R.layout.list_item_mining_record_base_data,
|
||||
list
|
||||
) {
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): VH {
|
||||
val binding = ListItemMiningRecordBaseDataBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: AddMiningFaceItem
|
||||
) {
|
||||
val binding = holder.binding
|
||||
binding.tvItemName.run {
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.funcName = text.toString().trim()
|
||||
})
|
||||
text = item.funcName
|
||||
}
|
||||
binding.etItemValue.run {
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.funcValue = text.toString().trim()
|
||||
})
|
||||
setText(item.funcValue)
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemMiningRecordBaseDataBinding) : BaseViewHolder(binding.root)
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.text.Html
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.CoalThicknessItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemMiningRecordCoalThicknessBinding
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class MiningRecordCoalThicknessAdapter(list: MutableList<CoalThicknessItem>):
|
||||
BaseQuickAdapter<CoalThicknessItem,MiningRecordCoalThicknessAdapter.VH>(R.layout.list_item_mining_record_coal_thickness,list){
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemMiningRecordCoalThicknessBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(holder: VH, item: CoalThicknessItem) {
|
||||
val position = holder.layoutPosition
|
||||
val binding = holder.binding
|
||||
binding.divider.run {
|
||||
if (position == data.size - 1) gone() else visible()
|
||||
}
|
||||
binding.btnAddPoint.run {
|
||||
if (position == data.size - 1) visible() else gone()
|
||||
}
|
||||
binding.tvNameUnit.text = Html.fromHtml("<sup>#</sup>架", Html.FROM_HTML_MODE_LEGACY)
|
||||
binding.etItemName.run {
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.supportNo = text.toString().trim()
|
||||
})
|
||||
setText(item.supportNo)
|
||||
}
|
||||
binding.etItemValue.run {
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.thicknessValue = text.toString().trim()
|
||||
})
|
||||
setText(item.thicknessValue)
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemMiningRecordCoalThicknessBinding): BaseViewHolder(binding.root)
|
||||
}
|
||||
-113
@@ -1,113 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingFaceBinding
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.ui.mining.activity.MiningActivity
|
||||
import com.zmkg.coaloperation.ui.mining.activity.MiningFaceRecordActivity
|
||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.toJsonString
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class MiningWorkingFaceAdapter(var list: MutableList<MiningWorkingFaceEntity>) :
|
||||
BaseQuickAdapter<MiningWorkingFaceEntity, MiningWorkingFaceAdapter.VH>(
|
||||
R.layout.list_item_tunnel_working_face, list
|
||||
) {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "TunnelWorkingFaceAdapter"
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val inflater = LayoutInflater.from(context)
|
||||
val binding = ListItemTunnelWorkingFaceBinding.inflate(inflater, parent, false)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: MiningWorkingFaceEntity
|
||||
) {
|
||||
holder.binding.let { binding ->
|
||||
binding.includeHeader.root.isEnabled = false
|
||||
binding.tvWorkingFaceName.text = item.surfaceName
|
||||
binding.llFaceRecord.let {
|
||||
if (item.isExpandRecord) it.visible() else it.gone()
|
||||
}
|
||||
binding.ivFlagEdit.let {
|
||||
if (item.dataState == "1") it.visible() else it.gone()
|
||||
}
|
||||
binding.ivExpandRecord.setImageResource(
|
||||
if (item.isExpandRecord) R.drawable.ic_arrow_down_white else R.drawable.ic_arrow_right_gray
|
||||
)
|
||||
binding.ivExpandRecord.tag = item.isExpandRecord.toString()
|
||||
binding.rvFaceRecord.let { rv ->
|
||||
rv.layoutManager = LinearLayoutManager(context)
|
||||
if (item.records == null) {
|
||||
item.records = mutableListOf()
|
||||
}
|
||||
val size = item.records!!.size
|
||||
binding.includeHeader.root.let { header ->
|
||||
if (size > 0) header.visible()
|
||||
else header.gone()
|
||||
}
|
||||
rv.updateLayoutParams {
|
||||
height = if (size >= 3)
|
||||
ScreenUtil.dp2px(150F)
|
||||
else
|
||||
RecyclerView.LayoutParams.WRAP_CONTENT
|
||||
}
|
||||
rv.isVerticalScrollBarEnabled = size >= 3
|
||||
rv.isVerticalFadingEdgeEnabled = size < 3
|
||||
rv.overScrollMode = if (size >= 3) View.OVER_SCROLL_IF_CONTENT_SCROLLS else View.OVER_SCROLL_NEVER
|
||||
rv.adapter = MiningWorkingFaceRecordAdapter(item.records!!).apply {
|
||||
setOnItemClickListener { adapter, view, recordPosition ->
|
||||
// if (recordPosition == 0) {
|
||||
// //0为头部表示,不需要点击操作
|
||||
// return@setOnItemClickListener
|
||||
// }
|
||||
Log.d(TAG, "convert: ${item.records!![recordPosition].toJsonString()}")
|
||||
context.let { ctx ->
|
||||
if (ctx is MiningActivity) {
|
||||
ctx.toActivity(MiningFaceRecordActivity::class.java, Bundle().apply {
|
||||
putString(MiningFaceRecordActivity.WORK_RECORD_TYPE, MiningFaceRecordActivity.WorkRecordType.SEE.name)
|
||||
putString(MiningFaceRecordActivity.FACE_NAME, item.surfaceName)
|
||||
putParcelable(
|
||||
MiningFaceRecordActivity.FACE_RECORD,
|
||||
item.records!![recordPosition]
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemTunnelWorkingFaceBinding) : BaseViewHolder(binding.root)
|
||||
|
||||
init {
|
||||
addChildClickViewIds(
|
||||
R.id.start_record,
|
||||
R.id.ivExpandRecord,
|
||||
R.id.llWorkingFace
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import androidx.core.graphics.toColorInt
|
||||
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingFaceRecordBinding
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class MiningWorkingFaceRecordAdapter(var list: MutableList<MiningWorkingFaceRecordEntity>) :
|
||||
BaseQuickAdapter<MiningWorkingFaceRecordEntity, MiningWorkingFaceRecordAdapter.VH>(
|
||||
R.layout.list_item_tunnel_working_face_record, list
|
||||
) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val inflater = LayoutInflater.from(context)
|
||||
val binding = ListItemTunnelWorkingFaceRecordBinding.inflate(inflater, parent, false)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: MiningWorkingFaceRecordEntity
|
||||
) {
|
||||
val position = holder.layoutPosition
|
||||
holder.binding.let {
|
||||
// if (position == 0) {
|
||||
// it.time.setTextColor(Color.WHITE)
|
||||
// it.time.textSize = 14f
|
||||
// it.record.setTextColor(Color.WHITE)
|
||||
// it.record.textSize = 14f
|
||||
// it.operation.setTextColor(Color.WHITE)
|
||||
// it.operation.textSize = 14f
|
||||
// } else {
|
||||
it.time.setTextColor("#FF6A6F87".toColorInt())
|
||||
it.time.textSize = 12f
|
||||
it.record.setTextColor("#FF6A6F87".toColorInt())
|
||||
it.record.textSize = 12f
|
||||
it.operation.setTextColor("#FFA3FEA6".toColorInt())
|
||||
it.operation.textSize = 12f
|
||||
// }
|
||||
it.time.text = item.workingDate
|
||||
it.record.text = item.recordPerson
|
||||
it.operation.text = if (item.operationType == "1") "查看" else "操作"
|
||||
it.divider.visibility =
|
||||
if (position == list.size - 1) View.GONE else View.VISIBLE
|
||||
|
||||
|
||||
it.ivFlagEdit.let {
|
||||
if (item.dataState == "1") it.visible() else it.gone()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemTunnelWorkingFaceRecordBinding) :
|
||||
BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zhihu.matisse.Matisse
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseActivity
|
||||
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||
import com.zmkg.coaloperation.bean.ReportItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemReportBinding
|
||||
import com.zmkg.coaloperation.utils.GalleryUtils
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class ReportAdapter(list: MutableList<ReportItem>) :
|
||||
BaseQuickAdapter<ReportItem, ReportAdapter.VH>(R.layout.list_item_report, list) {
|
||||
|
||||
inner class VH(var binding: ListItemReportBinding) : BaseViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemReportBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(holder: VH, item: ReportItem) {
|
||||
val binding = holder.binding
|
||||
val position = holder.layoutPosition
|
||||
binding.tvItemName.run {
|
||||
text = item.name
|
||||
gravity = Gravity.CENTER_VERTICAL
|
||||
updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
gravity = if (item.viewType == 4) Gravity.CENTER_VERTICAL else Gravity.TOP
|
||||
}
|
||||
}
|
||||
binding.divider.run {
|
||||
if (position == data.size - 1) gone() else visible()
|
||||
}
|
||||
when (item.viewType) {
|
||||
1 -> {
|
||||
binding.tvItemValue.gone()
|
||||
binding.rvReportImage.gone()
|
||||
binding.etInputValue.let { et ->
|
||||
et.visible()
|
||||
et.setText(item.value)
|
||||
et.hint = item.inputHint
|
||||
et.isSingleLine = item.isSingleLine
|
||||
if (item.isSingleLine) {
|
||||
et.gravity = Gravity.CENTER_VERTICAL
|
||||
et.setLines(1)
|
||||
et.updateLayoutParams<LinearLayout.LayoutParams> { height = 50.dp }
|
||||
} else {
|
||||
et.gravity = Gravity.TOP
|
||||
et.setLines(item.inputShowLines)
|
||||
et.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
height = LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
topMargin = 15.dp
|
||||
bottomMargin = 15.dp
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2 -> {
|
||||
binding.rvReportImage.gone()
|
||||
binding.etInputValue.gone()
|
||||
binding.tvItemValue.let { tv ->
|
||||
tv.visible()
|
||||
tv.text = item.value
|
||||
tv.setCompoundDrawablesWithIntrinsicBounds(
|
||||
0,
|
||||
0,
|
||||
R.drawable.ic_arrow_down_gray,
|
||||
0
|
||||
)
|
||||
tv.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
width = LinearLayout.LayoutParams.MATCH_PARENT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3 -> {
|
||||
binding.rvReportImage.gone()
|
||||
binding.etInputValue.gone()
|
||||
binding.tvItemValue.let { tv ->
|
||||
tv.visible()
|
||||
tv.text = item.value
|
||||
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_select_time, 0)
|
||||
tv.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||
width = LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4 -> {
|
||||
binding.tvItemValue.gone()
|
||||
binding.etInputValue.gone()
|
||||
if (item.images == null) {
|
||||
item.images = mutableListOf()
|
||||
}
|
||||
binding.rvReportImage.let { rv ->
|
||||
rv.visible()
|
||||
rv.layoutManager = GridLayoutManager(rv.context, 2)
|
||||
rv.adapter = CommonImageAdapter(item.images!!, 80.dp).also {
|
||||
it.setOnItemClickListener { adapter, view, position ->
|
||||
if (it.data[position].isAddFlag.not()) {
|
||||
return@setOnItemClickListener
|
||||
}
|
||||
openGallery(context as BaseActivity, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun openGallery(activity: BaseActivity, adapter: CommonImageAdapter) {
|
||||
StorageUtils.requestPermission(activity) {
|
||||
GalleryUtils.openGallery(activity) { data ->
|
||||
val paths = Matisse.obtainPathResult(data) // 获取文件路径列表
|
||||
paths?.forEach { path ->
|
||||
val size = adapter.list.size
|
||||
adapter.list.add(size - 1, CommonImageBean(imagePath = path))
|
||||
}
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+6
-4
@@ -15,8 +15,6 @@ import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingItemBinding
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class TunnelWorkingItemAdapter(data: MutableList<TunnelWorkingItem>) :
|
||||
BaseQuickAdapter<TunnelWorkingItem, TunnelWorkingItemAdapter.VH>(
|
||||
@@ -45,8 +43,12 @@ class TunnelWorkingItemAdapter(data: MutableList<TunnelWorkingItem>) :
|
||||
loadRecordData(holder.binding, item)
|
||||
}
|
||||
val position = holder.layoutPosition
|
||||
holder.binding.divider.run {
|
||||
if (position == data.size - 1) gone() else visible()
|
||||
holder.binding.divider.let {
|
||||
if (position == data.size - 1) {
|
||||
it.visibility = View.GONE
|
||||
} else {
|
||||
it.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.UserMenuBean
|
||||
import com.zmkg.coaloperation.databinding.ListItemUserMenuBinding
|
||||
|
||||
class UserMenuAdapter(list: MutableList<UserMenuBean>) :
|
||||
BaseQuickAdapter<UserMenuBean, UserMenuAdapter.VH>(R.layout.list_item_user_menu, list) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemUserMenuBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: UserMenuBean
|
||||
) {
|
||||
holder.binding.let {
|
||||
it.ivUserMenu.run {
|
||||
setImageResource(item.iconResId)
|
||||
setBackgroundResource(item.iconBgResId)
|
||||
}
|
||||
it.tvUserMenu.text = item.menuName
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemUserMenuBinding) : BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
-60
@@ -1,60 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.databinding.ListItemWaterYieldObserveBinding
|
||||
import com.zmkg.coaloperation.db.entity.water.WaterYieldObserveEntity
|
||||
import com.zmkg.coaloperation.utils.useShapeSetBackground
|
||||
import androidx.core.graphics.toColorInt
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
|
||||
class WaterYieldObserveAdapter(list: MutableList<WaterYieldObserveEntity>):
|
||||
BaseQuickAdapter<WaterYieldObserveEntity, WaterYieldObserveAdapter.VH>(R.layout.list_item_water_yield_observe, list) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemWaterYieldObserveBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: WaterYieldObserveEntity
|
||||
) {
|
||||
holder.binding.let {
|
||||
it.tvObservePoint.text = item.observePoint
|
||||
it.tvObserveTime.text = item.observeTime
|
||||
it.tvObserveState.run {
|
||||
var stateColor = ""
|
||||
if (item.observeState == "1") {
|
||||
text = "已观测"
|
||||
stateColor = "#3ECD88"
|
||||
} else {
|
||||
text = "未观测"
|
||||
stateColor = "#803398"
|
||||
}
|
||||
useShapeSetBackground(
|
||||
shape = GradientDrawable.RECTANGLE,
|
||||
cornerRadius = 20F.dp,
|
||||
solidColor = stateColor.toColorInt(),
|
||||
)
|
||||
}
|
||||
it.root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||
bottomMargin = if (holder.layoutPosition == data.size - 1) 80.dp else 3.dp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemWaterYieldObserveBinding): BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
-129
@@ -1,129 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter
|
||||
|
||||
import android.graphics.Color
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.WaterYieldRecordItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemWaterYieldRecordBinding
|
||||
import com.zmkg.coaloperation.databinding.ListItemWaterYieldRecordInnerBinding
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
import androidx.core.graphics.toColorInt
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
|
||||
class WaterYieldRecordAdapter(data: MutableList<WaterYieldRecordItem>) :
|
||||
BaseQuickAdapter<WaterYieldRecordItem, WaterYieldRecordAdapter.VH>(
|
||||
R.layout.list_item_water_yield_record,
|
||||
data
|
||||
) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemWaterYieldRecordBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: WaterYieldRecordItem
|
||||
) {
|
||||
loadRecordData(holder.binding, item)
|
||||
val position = holder.layoutPosition
|
||||
holder.binding.divider.run {
|
||||
if (position == data.size - 1) gone() else visible()
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadRecordData(
|
||||
binding: ListItemWaterYieldRecordBinding,
|
||||
item: WaterYieldRecordItem
|
||||
) {
|
||||
binding.run {
|
||||
if (item.isHeader) {
|
||||
tvItemName.let {
|
||||
it.textSize = 16F
|
||||
it.setTextColor(Color.WHITE)
|
||||
it.gravity = Gravity.CENTER
|
||||
it.updateLayoutParams {
|
||||
width = ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||
}
|
||||
}
|
||||
verticalDivider.gone()
|
||||
tvItemValue.gone()
|
||||
} else {
|
||||
tvItemName.let {
|
||||
it.textSize = 14F
|
||||
it.setTextColor("#6A6F87".toColorInt())
|
||||
it.gravity = Gravity.CENTER_VERTICAL
|
||||
it.updateLayoutParams {
|
||||
width = 80.dp
|
||||
}
|
||||
}
|
||||
verticalDivider.visible()
|
||||
tvItemValue.visible()
|
||||
}
|
||||
tvItemName.text = item.name
|
||||
if (item.items.isNullOrEmpty()) {
|
||||
// tvItemName.updateLayoutParams { height = ScreenUtil.dp2px(50f) }
|
||||
tvItemValue.let {
|
||||
it.visibility = View.VISIBLE
|
||||
it.text = item.value
|
||||
}
|
||||
llContainer.visibility = View.GONE
|
||||
} else {
|
||||
// tvItemName.updateLayoutParams { height = ScreenUtil.dp2px(60f) }
|
||||
tvItemValue.visibility = View.GONE
|
||||
llContainer.let {
|
||||
it.visibility = View.VISIBLE
|
||||
it.removeAllViews()
|
||||
addChildToContainer(it, item.items!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadItemData(
|
||||
binding: ListItemWaterYieldRecordInnerBinding,
|
||||
isLatest: Boolean,
|
||||
item: WaterYieldRecordItem
|
||||
) {
|
||||
binding.tvItemName.text = "${item.name}:"
|
||||
binding.tvItemValue.text = item.value
|
||||
binding.divider.run {
|
||||
if (isLatest) gone() else visible()
|
||||
}
|
||||
}
|
||||
|
||||
private fun addChildToContainer(
|
||||
container: LinearLayout,
|
||||
list: MutableList<WaterYieldRecordItem>
|
||||
) {
|
||||
list.forEachIndexed { index, item ->
|
||||
val itemBinding = ListItemWaterYieldRecordInnerBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
container,
|
||||
false
|
||||
)
|
||||
itemBinding.run {
|
||||
loadItemData(itemBinding, index == list.size - 1, item)
|
||||
container.addView(root)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inner class VH(var binding: ListItemWaterYieldRecordBinding) : BaseViewHolder(binding.root)
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
package com.zmkg.coaloperation.adapter.common
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemMiningDisasterWarningBinding
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class DisasterAdapter(list: MutableList<TunnelWorkingItem>) :
|
||||
BaseQuickAdapter<TunnelWorkingItem, DisasterAdapter.VH>(
|
||||
R.layout.list_item_mining_disaster_warning,
|
||||
list
|
||||
) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemMiningDisasterWarningBinding.inflate(
|
||||
LayoutInflater.from(context), parent, false
|
||||
)
|
||||
return VH(binding)
|
||||
}
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: TunnelWorkingItem
|
||||
) {
|
||||
holder.binding.let {
|
||||
it.tvDisasterName.text = item.name
|
||||
it.tvDisasterValue.text = item.value
|
||||
it.divider.run {
|
||||
if (holder.layoutPosition == data.size - 1) gone() else visible()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inner class VH(var binding: ListItemMiningDisasterWarningBinding) : BaseViewHolder(binding.root)
|
||||
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.zmkg.coaloperation.base;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.zmkg.coaloperation.bean.IActivityResult;
|
||||
|
||||
public class BaseActivity extends AppCompatActivity {
|
||||
|
||||
// public static final String COLOR_WHITE = "#FFFFFF";
|
||||
//
|
||||
// public void whiteStatusBar(boolean isFits) {
|
||||
// whiteStatusBar(isFits, false);
|
||||
// }
|
||||
//
|
||||
// public void whiteStatusBar(boolean isFits, boolean keyboardEnable) {
|
||||
// hasColorStatusBar(COLOR_WHITE, isFits, true, keyboardEnable);
|
||||
// }
|
||||
//
|
||||
// public void transparentStatusBar(boolean isFits, boolean isDarkFont) {
|
||||
// ImmersionBar.with(this)
|
||||
// .fitsSystemWindows(isFits)
|
||||
// .statusBarDarkFont(isDarkFont)
|
||||
// .transparentStatusBar()
|
||||
// .navigationBarColor(R.color.white)
|
||||
// .navigationBarDarkIcon(true)
|
||||
// .init();
|
||||
// }
|
||||
//
|
||||
// public void hasColorStatusBar(String statusBarColor, boolean isFits, boolean isDarkFont) {
|
||||
// hasColorStatusBar(statusBarColor, isFits, isDarkFont, false);
|
||||
// }
|
||||
//
|
||||
// public void hasColorStatusBar(String statusBarColor, boolean isFits, boolean isDarkFont, boolean keyboardEnable) {
|
||||
// ImmersionBar.with(this)
|
||||
// .fitsSystemWindows(isFits)
|
||||
// .statusBarColor(statusBarColor)
|
||||
// .statusBarDarkFont(isDarkFont)
|
||||
// .keyboardEnable(keyboardEnable)
|
||||
// .navigationBarColor(R.color.white)
|
||||
// .navigationBarDarkIcon(true)
|
||||
// .init();
|
||||
// }
|
||||
|
||||
private final ActivityResultLauncher<Intent> activityLauncher =
|
||||
registerForActivityResult(
|
||||
new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> this.launchActivityCallback.callback(result)
|
||||
);
|
||||
private IActivityResult.LaunchActivityCallback launchActivityCallback;
|
||||
|
||||
public void launchActivityResult(Intent intent, IActivityResult.LaunchActivityCallback activityCallback) {
|
||||
this.launchActivityCallback = activityCallback;
|
||||
activityLauncher.launch(intent);
|
||||
}
|
||||
|
||||
private IActivityResult.LaunchTackPictureCallback launchTackPictureCallback;
|
||||
|
||||
private final ActivityResultLauncher<Uri> tackPictureLauncher =
|
||||
registerForActivityResult(
|
||||
new ActivityResultContracts.TakePicture(),
|
||||
result -> this.launchTackPictureCallback.callback(result)
|
||||
);
|
||||
|
||||
public void launchTackPicture(Uri uri, IActivityResult.LaunchTackPictureCallback callback) {
|
||||
this.launchTackPictureCallback = callback;
|
||||
tackPictureLauncher.launch(uri);
|
||||
}
|
||||
|
||||
private IActivityResult.RequestPermissionCallback launchPermissionCallback;
|
||||
|
||||
public void requestSinglePermissionResult(String permission, IActivityResult.RequestPermissionCallback permissionCallback) {
|
||||
this.launchPermissionCallback = permissionCallback;
|
||||
permissionLauncher.launch(permission);
|
||||
}
|
||||
|
||||
private final ActivityResultLauncher<String> permissionLauncher =
|
||||
registerForActivityResult(
|
||||
new ActivityResultContracts.RequestPermission(),
|
||||
result -> this.launchPermissionCallback.callback(result)
|
||||
);
|
||||
|
||||
private IActivityResult.RequestMultiplePermissionsCallback launchMultiplePermissionsCallback;
|
||||
|
||||
public void requestMultiplePermissionsResult(String[] permissions, IActivityResult.RequestMultiplePermissionsCallback permissionCallback) {
|
||||
this.launchMultiplePermissionsCallback = permissionCallback;
|
||||
multiplePermissionLauncher.launch(permissions);
|
||||
}
|
||||
|
||||
private final ActivityResultLauncher<String[]> multiplePermissionLauncher =
|
||||
registerForActivityResult(
|
||||
new ActivityResultContracts.RequestMultiplePermissions(),
|
||||
result -> this.launchMultiplePermissionsCallback.callback(result)
|
||||
);
|
||||
|
||||
}
|
||||
@@ -34,8 +34,6 @@ import com.zmkg.coaloperation.base.viewmodel.BaseViewModel.Companion.LOADING_STA
|
||||
import com.zmkg.coaloperation.superfuntion.hideLoading
|
||||
import com.zmkg.coaloperation.superfuntion.showLoading
|
||||
import com.zmkg.coaloperation.utils.StatusbarUtil
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import com.zmkg.coaloperation.utils.roundedOneDecimalPlace
|
||||
import com.zmkg.coaloperation.view.CustomToast
|
||||
import com.zmkg.coaloperation.view.LoadingDialog
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -55,7 +53,7 @@ import java.sql.SQLException
|
||||
* 封装了ViewModel和DataBinding的Activity基类
|
||||
*/
|
||||
abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private val contentViewResId: Int) :
|
||||
BaseActivity(), View.OnClickListener {
|
||||
AppCompatActivity(), View.OnClickListener {
|
||||
var mContext: Context? = null
|
||||
var mActivity: Activity? = null
|
||||
lateinit var mViewModel: VM
|
||||
@@ -434,18 +432,4 @@ abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private
|
||||
configuration.fontScale = 1f
|
||||
return context.createConfigurationContext(configuration)
|
||||
}
|
||||
|
||||
fun getShowNum2(num:String?):String {
|
||||
return num?.formatDecimalString()?:""
|
||||
}
|
||||
fun getShowNum(num:String?):String {
|
||||
if (num.isNullOrBlank()) return "0"
|
||||
try {
|
||||
val showNum = num.toDouble().roundedOneDecimalPlace()
|
||||
return "$showNum"
|
||||
} catch (e: Exception) {
|
||||
return "0"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.zmkg.coaloperation.bean;
|
||||
|
||||
import androidx.activity.result.ActivityResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface IActivityResult {
|
||||
|
||||
interface LaunchActivityCallback {
|
||||
void callback(ActivityResult result);
|
||||
}
|
||||
|
||||
interface LaunchTackPictureCallback {
|
||||
void callback(boolean result);
|
||||
}
|
||||
|
||||
interface RequestPermissionCallback {
|
||||
void callback(boolean result);
|
||||
}
|
||||
|
||||
interface RequestMultiplePermissionsCallback {
|
||||
void callback(Map<String,Boolean> result);
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package com.zmkg.coaloperation.bean
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
|
||||
data class UserMenuBean(
|
||||
var menuName: String,
|
||||
var iconResId: Int,
|
||||
var iconBgResId: Int,
|
||||
val click: () -> Unit
|
||||
)
|
||||
|
||||
data class AddMiningFaceItem(
|
||||
//0-输入框,1-选择弹窗, 2-显示文本TextView
|
||||
var funcType: Int = 0,
|
||||
var funcName: String = "",
|
||||
var funcValue: String = "",
|
||||
var funcId: String = "",
|
||||
var isShowArrowDown: Boolean = false,
|
||||
var onClick: () -> Unit = {}
|
||||
)
|
||||
|
||||
data class CoalThicknessItem(
|
||||
var supportNo: String = "",
|
||||
var thicknessValue: String = "",
|
||||
)
|
||||
|
||||
data class DataSyncItem(
|
||||
var funcName: String,
|
||||
var onDataPull: () -> Unit = {},
|
||||
var onDataPush: () -> Unit = {},
|
||||
)
|
||||
|
||||
data class BuoyTopItem(
|
||||
var faceName: String = "",
|
||||
var ditchWidth: String = "",
|
||||
var ditchDepth: String = ""
|
||||
)
|
||||
|
||||
data class BuoyBottomItem(
|
||||
var name: String = "",
|
||||
var value: String = ""
|
||||
)
|
||||
|
||||
data class GeoPointItem(
|
||||
var isChecked: Boolean = false,
|
||||
var isLogging: Boolean = false,
|
||||
var name: String = "",
|
||||
var distance: String = ""
|
||||
)
|
||||
|
||||
data class GeoPointParent(
|
||||
var name: String = "",
|
||||
var list: MutableList<GeoPointItem>? = null
|
||||
)
|
||||
|
||||
data class BaseItem(
|
||||
var name: String = "",
|
||||
var value: String = ""
|
||||
)
|
||||
|
||||
data class GeoPointMultiItem(
|
||||
override val itemType: Int,
|
||||
var pointName: String = "",
|
||||
var pointDistance: String = "",
|
||||
var totalDistance: String = "",
|
||||
var baseTopList: MutableList<BaseItem>? = null,
|
||||
var baseBottomList: MutableList<BaseItem>? = null,
|
||||
var images: MutableList<CommonImageBean>? = null
|
||||
) : MultiItemEntity {
|
||||
companion object {
|
||||
const val TYPE_BASE_INFO = 1
|
||||
const val TYPE_LOGGING_INFO = 2
|
||||
const val TYPE_CALCULATE_INFO = 3
|
||||
const val TYPE_UPLOAD_IMAGE = 4
|
||||
}
|
||||
}
|
||||
|
||||
data class CommonImageBean(
|
||||
var imagePath: String = "",
|
||||
var isAddFlag: Boolean = false
|
||||
)
|
||||
|
||||
data class ReportItem(
|
||||
var name: String = "",
|
||||
var value: String = "",
|
||||
var id: String = "",
|
||||
//1-输入框,2-文本选择弹窗,3-时间选择弹窗,4-上传图片
|
||||
var viewType: Int = 0,
|
||||
var inputHint: String = "",
|
||||
var inputShowLines: Int = 0,
|
||||
var isSingleLine: Boolean = true,
|
||||
var images: MutableList<CommonImageBean>? = null
|
||||
)
|
||||
@@ -8,7 +8,7 @@ data class TunnelWorkingItem(
|
||||
var name: String? = "",
|
||||
var value: String? = "",
|
||||
var items: MutableList<TunnelRoofLithologyEntity>? = null,
|
||||
var pageType: Int = 0
|
||||
var pageType:Int = 0
|
||||
)
|
||||
|
||||
data class RockItem(
|
||||
@@ -18,26 +18,12 @@ data class RockItem(
|
||||
)
|
||||
|
||||
data class WorkOption(
|
||||
var id: String,
|
||||
var id:String,
|
||||
var name: String
|
||||
)
|
||||
|
||||
data class Work3LevelOption(
|
||||
var id: String = "",
|
||||
var name: String = "",
|
||||
|
||||
var list: List<Work3LevelOption>? = null
|
||||
)
|
||||
|
||||
data class TunnelSubmitData(
|
||||
var faceList: MutableList<TunnelWorkingFaceEntity>? = null,
|
||||
var recordList: MutableList<TunnelWorkingFaceRecordEntity>? = null,
|
||||
var lithologyList: MutableList<TunnelRoofLithologyEntity>? = null
|
||||
)
|
||||
|
||||
data class WaterYieldRecordItem(
|
||||
var name: String? = "",
|
||||
var value: String? = "",
|
||||
var isHeader: Boolean = false,
|
||||
var items: MutableList<WaterYieldRecordItem>? = null,
|
||||
var faceList: MutableList<TunnelWorkingFaceEntity>?=null,
|
||||
var recordList: MutableList<TunnelWorkingFaceRecordEntity>?=null,
|
||||
var lithologyList: MutableList<TunnelRoofLithologyEntity>?=null
|
||||
)
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package com.zmkg.coaloperation.data.api
|
||||
|
||||
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||
import com.zmkg.coaloperation.data.bean.ApiResponse
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.retorfit.UrlConfig
|
||||
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
|
||||
/**
|
||||
* 首页
|
||||
@@ -51,7 +48,4 @@ interface HomeApi {
|
||||
@GET("/api/mine/tunnelling/dictionaries")
|
||||
suspend fun getTunnelAllDict(): ApiResponse<Any?>
|
||||
|
||||
@POST("/api/mine/tunnelling/data/push")
|
||||
suspend fun tunnelDataPush(@Body data: TunnelSubmitData): ApiResponse<Any?>
|
||||
|
||||
}
|
||||
+4
-11
@@ -1,7 +1,6 @@
|
||||
package com.zmkg.coaloperation.data.repository
|
||||
|
||||
import com.zmkg.coaloperation.base.repository.BaseRepository
|
||||
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||
import com.zmkg.coaloperation.data.api.HomeApi
|
||||
import com.zmkg.coaloperation.data.bean.ApiResponse
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
@@ -9,7 +8,7 @@ import com.zmkg.coaloperation.retorfit.RetrofitManager
|
||||
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
||||
|
||||
|
||||
object HomeRepository : BaseRepository() {
|
||||
object HomeRepository : BaseRepository(){
|
||||
|
||||
private val service by lazy { RetrofitManager.getService(HomeApi::class.java) }
|
||||
|
||||
@@ -34,7 +33,7 @@ object HomeRepository : BaseRepository() {
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// /**
|
||||
// * 掘进-首页-工作面记录列表
|
||||
// */
|
||||
// suspend fun getTunnelingHomeItemData(surfaceId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>> {
|
||||
@@ -62,22 +61,16 @@ object HomeRepository : BaseRepository() {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
suspend fun getTunnelHomeList(): ApiResponse<MutableList<TunnelWorkingFaceEntity>?> {
|
||||
suspend fun getTunnelHomeList() : ApiResponse<MutableList<TunnelWorkingFaceEntity>?> {
|
||||
return apiCall {
|
||||
service.getTunnelHomeList()
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getTunnelAllDict(): ApiResponse<Any?> {
|
||||
suspend fun getTunnelAllDict() : ApiResponse<Any?> {
|
||||
return apiCall {
|
||||
service.getTunnelAllDict()
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun tunnelDataPush(data: TunnelSubmitData): ApiResponse<Any?> {
|
||||
return apiCall {
|
||||
service.tunnelDataPush(data)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,15 +6,9 @@ import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
import com.zmkg.coaloperation.db.dao.MiningCoalHeightDao
|
||||
import com.zmkg.coaloperation.db.dao.MiningWorkingFaceDao
|
||||
import com.zmkg.coaloperation.db.dao.MiningWorkingFaceRecordDao
|
||||
import com.zmkg.coaloperation.db.dao.TunnelRoofLithologyDao
|
||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceRecordDao
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningCoalHeightEntity
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
@@ -24,9 +18,6 @@ import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
TunnelWorkingFaceEntity::class,
|
||||
TunnelWorkingFaceRecordEntity::class,
|
||||
TunnelRoofLithologyEntity::class,
|
||||
MiningWorkingFaceEntity::class,
|
||||
MiningWorkingFaceRecordEntity::class,
|
||||
MiningCoalHeightEntity::class,
|
||||
],
|
||||
version = 1,
|
||||
exportSchema = true
|
||||
@@ -35,9 +26,6 @@ abstract class AppDatabase : RoomDatabase() {
|
||||
abstract fun tunnelWorkingFaceDao(): TunnelWorkingFaceDao
|
||||
abstract fun tunnelWorkingFaceRecordDao(): TunnelWorkingFaceRecordDao
|
||||
abstract fun tunnelRoofLithologyDao(): TunnelRoofLithologyDao
|
||||
abstract fun miningWorkingFaceDao(): MiningWorkingFaceDao
|
||||
abstract fun miningWorkingFaceRecordDao(): MiningWorkingFaceRecordDao
|
||||
abstract fun miningCoalHeightDao(): MiningCoalHeightDao
|
||||
|
||||
companion object {
|
||||
@Volatile
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import androidx.room.Update
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningCoalHeightEntity
|
||||
|
||||
@Dao
|
||||
interface MiningCoalHeightDao {
|
||||
@Insert
|
||||
fun insert(entity: MiningCoalHeightEntity): Long
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertList(list: MutableList<MiningCoalHeightEntity>): Array<Long>
|
||||
|
||||
@Update
|
||||
fun update(entity: MiningCoalHeightEntity)
|
||||
|
||||
@Query("SELECT * FROM mining_coal_height WHERE recordId = :recordId ORDER BY createTime ASC")
|
||||
fun getEntityList(recordId: Long): MutableList<MiningCoalHeightEntity>?
|
||||
|
||||
@Query("SELECT * FROM mining_coal_height WHERE dataState = :dataState ORDER BY createTime ASC")
|
||||
fun getEntityListByState(dataState: String): MutableList<MiningCoalHeightEntity>?
|
||||
|
||||
@Query("SELECT * FROM mining_coal_height WHERE surfaceId = :surfaceId ORDER BY createTime ASC")
|
||||
fun getEntityListByFaceId(surfaceId: Long): MutableList<MiningCoalHeightEntity>?
|
||||
|
||||
@Query("SELECT * FROM mining_coal_height WHERE surfaceId = :surfaceId AND recordId = :recordId ORDER BY createTime ASC")
|
||||
fun getEntityListByRecordId(
|
||||
surfaceId: Long,
|
||||
recordId: Long
|
||||
): MutableList<MiningCoalHeightEntity>?
|
||||
|
||||
@Query("SELECT * FROM mining_coal_height WHERE coalId = :lithologyId")
|
||||
fun getEntityById(lithologyId: Long): MiningCoalHeightEntity?
|
||||
|
||||
@Query("DELETE FROM mining_coal_height")
|
||||
fun deleteAll(): Int
|
||||
|
||||
@Query("DELETE FROM mining_coal_height WHERE recordId = :recordId")
|
||||
fun deleteList(recordId: Long): Int
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import androidx.room.RawQuery
|
||||
import androidx.room.Update
|
||||
import androidx.sqlite.db.SupportSQLiteQuery
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||
|
||||
//import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
interface MiningWorkingFaceDao {
|
||||
@Insert
|
||||
fun insert(entity: MiningWorkingFaceEntity): Long
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertList(list: MutableList<MiningWorkingFaceEntity>): Array<Long>
|
||||
|
||||
@Update
|
||||
fun update(entity: MiningWorkingFaceEntity)
|
||||
|
||||
@Query("SELECT * FROM mining_working_face ORDER BY createTime DESC")
|
||||
fun getEntityList(): MutableList<MiningWorkingFaceEntity>?
|
||||
|
||||
@RawQuery
|
||||
fun getEntityListBySql(query: SupportSQLiteQuery): MutableList<MiningWorkingFaceEntity>?
|
||||
|
||||
@Query("SELECT * FROM mining_working_face WHERE dataState = :dataState ORDER BY createTime DESC")
|
||||
fun getEntityListByState(dataState: String): MutableList<MiningWorkingFaceEntity>?
|
||||
|
||||
@Query("SELECT * FROM mining_working_face WHERE surfaceId = :surfaceId")
|
||||
fun getEntityById(surfaceId: Long): MiningWorkingFaceEntity?
|
||||
|
||||
@Query("DELETE FROM mining_working_face")
|
||||
fun deleteAll(): Int
|
||||
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import androidx.room.Update
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
interface MiningWorkingFaceRecordDao {
|
||||
@Insert
|
||||
fun insert(entity: MiningWorkingFaceRecordEntity): Long
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertList(list: MutableList<MiningWorkingFaceRecordEntity>): Array<Long>
|
||||
|
||||
@Update
|
||||
fun update(entity: MiningWorkingFaceRecordEntity)
|
||||
|
||||
@Query("SELECT * FROM mining_working_face_record WHERE surfaceId = :surfaceId ORDER BY createTime DESC")
|
||||
fun getEntityList(surfaceId: Long): MutableList<MiningWorkingFaceRecordEntity>?
|
||||
|
||||
@Query("SELECT * FROM mining_working_face_record WHERE dataState = :dataState ORDER BY createTime DESC")
|
||||
fun getEntityListByState(dataState: String): MutableList<MiningWorkingFaceRecordEntity>?
|
||||
|
||||
@Query("SELECT * FROM mining_working_face_record WHERE surfaceId = :recordId")
|
||||
fun getEntityById(recordId: Long): MiningWorkingFaceRecordEntity
|
||||
|
||||
@Query("SELECT * FROM mining_working_face_record WHERE surfaceId = :surfaceId AND latestRecordState = '1' ORDER BY createTime DESC LIMIT 1")
|
||||
fun getLastEntity(surfaceId: Long): MiningWorkingFaceRecordEntity?
|
||||
|
||||
@Query("DELETE FROM mining_working_face_record")
|
||||
fun deleteAll(): Int
|
||||
}
|
||||
@@ -4,9 +4,7 @@ import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import androidx.room.RawQuery
|
||||
import androidx.room.Update
|
||||
import androidx.sqlite.db.SupportSQLiteQuery
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
|
||||
//import kotlinx.coroutines.flow.Flow
|
||||
@@ -25,9 +23,6 @@ interface TunnelWorkingFaceDao {
|
||||
@Query("SELECT * FROM tunnel_working_face ORDER BY createTime DESC")
|
||||
fun getEntityList(): MutableList<TunnelWorkingFaceEntity>?
|
||||
|
||||
@RawQuery
|
||||
fun getEntityListBySql(query: SupportSQLiteQuery): MutableList<TunnelWorkingFaceEntity>?
|
||||
|
||||
@Query("SELECT * FROM tunnel_working_face WHERE dataState = :dataState ORDER BY createTime DESC")
|
||||
fun getEntityListByState(dataState: String): MutableList<TunnelWorkingFaceEntity>?
|
||||
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.entity.geologging
|
||||
|
||||
data class GeoLoggingFace(
|
||||
var surfaceId: Long = 0,
|
||||
|
||||
var userId: String = "",
|
||||
|
||||
/**
|
||||
* 工作面名称
|
||||
*/
|
||||
var surfaceName: String? = "",
|
||||
)
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.entity.mining
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Ignore
|
||||
import androidx.room.PrimaryKey
|
||||
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import java.time.LocalDateTime
|
||||
|
||||
/**
|
||||
* 回采工作面-煤层厚度数据表
|
||||
*/
|
||||
@Parcelize
|
||||
@Entity(tableName = "mining_coal_height")
|
||||
class MiningCoalHeightEntity (
|
||||
|
||||
/**
|
||||
* 煤层Id
|
||||
*/
|
||||
@PrimaryKey
|
||||
var coalId: Long = 0,
|
||||
|
||||
/**
|
||||
* 支架号
|
||||
*/
|
||||
var supportNo: String = "",
|
||||
|
||||
/**
|
||||
* 煤层厚度值
|
||||
*/
|
||||
var coalHeight: String = "",
|
||||
|
||||
/**
|
||||
* 工作面id
|
||||
*/
|
||||
var surfaceId: Long = 0,
|
||||
|
||||
/**
|
||||
* 记录id
|
||||
*/
|
||||
var recordId: Long = 0,
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
var createTime: String? = "",
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
var updateTime: String? = DateTimeUtil.formatDateTime(LocalDateTime.now()),
|
||||
|
||||
/**
|
||||
* 数据状态:0-默认值,原始数据,1-已修改数据
|
||||
*/
|
||||
var dataState: String = "0"
|
||||
): Parcelable {
|
||||
@Ignore
|
||||
constructor():this(coalId = 0)
|
||||
}
|
||||
-150
@@ -1,150 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.entity.mining
|
||||
|
||||
//import androidx.room.ColumnInfo
|
||||
import android.os.Parcelable
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Ignore
|
||||
import androidx.room.PrimaryKey
|
||||
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import java.time.LocalDateTime
|
||||
|
||||
/**
|
||||
* 回采工作面表对应字段
|
||||
*/
|
||||
@Parcelize
|
||||
@Entity(tableName = "mining_working_face")
|
||||
class MiningWorkingFaceEntity(
|
||||
// @PrimaryKey(name = "faceId") val id: Int = 0
|
||||
/**
|
||||
* 工作面id,本地新增数据使用时间戳保证唯一性
|
||||
*/
|
||||
@PrimaryKey
|
||||
var surfaceId: Long = 0,
|
||||
|
||||
var userId: String = "",
|
||||
|
||||
/**
|
||||
* 工作面名称
|
||||
*/
|
||||
var surfaceName: String? = "",
|
||||
|
||||
/**
|
||||
* 总进尺
|
||||
*/
|
||||
var totalFootage: String? = "",
|
||||
|
||||
/**
|
||||
* 累计进尺
|
||||
*/
|
||||
var accumulativeFootage: String? = "",
|
||||
|
||||
/**
|
||||
* 剩余进尺
|
||||
*/
|
||||
var remainingFootage: String? = "",
|
||||
|
||||
/**
|
||||
* 所属煤层编号
|
||||
*/
|
||||
var seamId: Long? = 0,
|
||||
|
||||
/**
|
||||
* 所属煤层名称
|
||||
*/
|
||||
var seamName: String? = "",
|
||||
|
||||
/**
|
||||
* 所属采区域编号
|
||||
*/
|
||||
var areaId: Long? = 0,
|
||||
|
||||
/**
|
||||
* 所属采区域
|
||||
*/
|
||||
var areaName: String? = "",
|
||||
|
||||
/**
|
||||
* 工作面方位角
|
||||
*/
|
||||
var surfaceAzimuth: String? = "",
|
||||
|
||||
/**
|
||||
* 工作面巷高
|
||||
*/
|
||||
var surfaceHeight: String? = "",
|
||||
|
||||
/**
|
||||
* 工作面巷宽
|
||||
*/
|
||||
var surfaceWidth: String? = "",
|
||||
|
||||
/**
|
||||
* 巷道性质
|
||||
*/
|
||||
var tunnelNature: String? = "",
|
||||
|
||||
/**
|
||||
* 计划工期开始日期
|
||||
*/
|
||||
var planStartDate: String? = "",
|
||||
|
||||
/**
|
||||
* 计划工期结束日期
|
||||
*/
|
||||
var planEndDate: String? = "",
|
||||
|
||||
/**
|
||||
* 地质类型
|
||||
*/
|
||||
var geologicalType: String? = "",
|
||||
|
||||
/**
|
||||
* 水文地质类型
|
||||
*/
|
||||
var hydrogeologicalType: String? = "",
|
||||
|
||||
/**
|
||||
* 煤层发火性
|
||||
*/
|
||||
var seamIgnition: String? = "",
|
||||
|
||||
/**
|
||||
* 瓦斯含量
|
||||
*/
|
||||
var seamGas: String? = "",
|
||||
|
||||
/**
|
||||
* 冲击地压危险性
|
||||
*/
|
||||
var seamBumpPressure: String? = "",
|
||||
|
||||
/**
|
||||
* 支护形式
|
||||
*/
|
||||
var surfaceSupportForm: String? = "",
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
var createTime: String? = "",
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
var updateTime: String? = DateTimeUtil.formatDateTime(LocalDateTime.now()),
|
||||
|
||||
/**
|
||||
* 数据状态:0-默认值,原始数据,1-已修改数据
|
||||
*/
|
||||
var dataState: String = "0",
|
||||
|
||||
@Ignore
|
||||
var records: MutableList<MiningWorkingFaceRecordEntity>? = null,
|
||||
|
||||
@Ignore
|
||||
var latestRecord: MiningWorkingFaceRecordEntity? = null,
|
||||
|
||||
@Ignore
|
||||
var isExpandRecord: Boolean = false
|
||||
): Parcelable
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.entity.mining
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Ignore
|
||||
import androidx.room.PrimaryKey
|
||||
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import java.time.LocalDateTime
|
||||
|
||||
@Parcelize
|
||||
@Entity(tableName = "mining_working_face_record")
|
||||
data class MiningWorkingFaceRecordEntity (
|
||||
|
||||
/**
|
||||
* 记录id
|
||||
*/
|
||||
@PrimaryKey
|
||||
var recordId: Long = 0,
|
||||
|
||||
/**
|
||||
* 工作面id
|
||||
*/
|
||||
var surfaceId: Long = 0,
|
||||
|
||||
/**
|
||||
* 施工日期
|
||||
*/
|
||||
var workingDate: String? = null,
|
||||
|
||||
/**
|
||||
* 记录人
|
||||
*/
|
||||
var recordPerson: String? = null,
|
||||
|
||||
/**
|
||||
* 施工班次
|
||||
*/
|
||||
var teamShift: String? = null,
|
||||
|
||||
/**
|
||||
* 施工队伍id
|
||||
*/
|
||||
var teamId: String? = null,
|
||||
|
||||
/**
|
||||
* 施工队伍名称
|
||||
*/
|
||||
var teamName: String? = null,
|
||||
|
||||
/**
|
||||
* 带队班长
|
||||
*/
|
||||
var teamLeader: String? = null,
|
||||
|
||||
/**
|
||||
* 本班进尺
|
||||
*/
|
||||
var workingFootage: String? = null,
|
||||
|
||||
/**
|
||||
* 煤层倾角
|
||||
*/
|
||||
var seamDip: String? = null,
|
||||
|
||||
/**
|
||||
* 煤层高度
|
||||
*/
|
||||
var seamHeight: String? = null,
|
||||
/**
|
||||
* 涌水量
|
||||
*/
|
||||
var waterYield: String? = null,
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
var createTime: String? = "",
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
var updateTime: String? = DateTimeUtil.formatDateTime(LocalDateTime.now()),
|
||||
|
||||
/**
|
||||
* 数据状态:0-默认值,原始数据,1-已修改数据
|
||||
*/
|
||||
var dataState: String = "0",
|
||||
|
||||
/**
|
||||
* 工作面中昨日记录状态:0-默认值,非昨日记录,1-昨日记录
|
||||
*/
|
||||
var latestRecordState: String = "0",
|
||||
|
||||
@Ignore
|
||||
var coalHeightList: MutableList<MiningCoalHeightEntity>? = null,
|
||||
|
||||
@Ignore
|
||||
var operationType: String = "1"
|
||||
): Parcelable
|
||||
-2
@@ -22,8 +22,6 @@ class TunnelWorkingFaceEntity(
|
||||
@PrimaryKey
|
||||
var surfaceId: Long = 0,
|
||||
|
||||
var userId: String = "",
|
||||
|
||||
/**
|
||||
* 工作面名称
|
||||
*/
|
||||
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.entity.water
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Ignore
|
||||
import androidx.room.PrimaryKey
|
||||
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import java.time.LocalDateTime
|
||||
|
||||
@Parcelize
|
||||
@Entity(tableName = "water_yield_observe")
|
||||
data class WaterYieldObserveEntity(
|
||||
@PrimaryKey
|
||||
var observeId: Long = 0,
|
||||
var observePoint: String = "",
|
||||
var observeTime: String = "",
|
||||
var observeState:String = "0",
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
var createTime: String? = "",
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
var updateTime: String? = DateTimeUtil.formatDateTime(LocalDateTime.now()),
|
||||
|
||||
/**
|
||||
* 数据状态:0-默认值,原始数据,1-已修改数据
|
||||
*/
|
||||
var dataState: String = "0"
|
||||
|
||||
) : Parcelable {
|
||||
@Ignore
|
||||
constructor() : this(observeId = 0)
|
||||
}
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.repository
|
||||
|
||||
import com.zmkg.coaloperation.db.dao.MiningCoalHeightDao
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningCoalHeightEntity
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class MiningCoalHeightRepository(private val dao: MiningCoalHeightDao) {
|
||||
suspend fun getEntityList(recordId: Long) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityList(recordId)
|
||||
}
|
||||
|
||||
suspend fun getEntityListByState(dataState: String) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityListByState(dataState)
|
||||
}
|
||||
|
||||
suspend fun insert(entity: MiningCoalHeightEntity) = withContext(Dispatchers.IO) {
|
||||
dao.insert(entity)
|
||||
}
|
||||
|
||||
suspend fun insertList(list: MutableList<MiningCoalHeightEntity>) =
|
||||
withContext(Dispatchers.IO) {
|
||||
dao.insertList(list)
|
||||
}
|
||||
|
||||
suspend fun update(entity: MiningCoalHeightEntity) = withContext(Dispatchers.IO) {
|
||||
dao.update(entity)
|
||||
}
|
||||
|
||||
suspend fun getEntityListByFaceId(surfaceId: Long) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityListByFaceId(surfaceId)
|
||||
}
|
||||
|
||||
suspend fun getEntityListByRecordId(surfaceId: Long, recordId: Long) =
|
||||
withContext(Dispatchers.IO) {
|
||||
dao.getEntityListByRecordId(surfaceId, recordId)
|
||||
}
|
||||
|
||||
suspend fun getEntityById(lithologyId: Long) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityById(lithologyId)
|
||||
}
|
||||
|
||||
suspend fun deleteAll() = withContext(Dispatchers.IO) {
|
||||
dao.deleteAll()
|
||||
}
|
||||
|
||||
suspend fun deleteList(recordId: Long) = withContext(Dispatchers.IO) {
|
||||
dao.deleteList(recordId)
|
||||
}
|
||||
|
||||
}
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.repository
|
||||
|
||||
import com.zmkg.coaloperation.db.dao.MiningWorkingFaceRecordDao
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class MiningWorkingFaceRecordRepository(private val dao: MiningWorkingFaceRecordDao) {
|
||||
suspend fun getEntityList(surfaceId: Long) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityList(surfaceId)
|
||||
}
|
||||
|
||||
suspend fun getEntityListByState(dataState: String) =
|
||||
withContext(Dispatchers.IO) {
|
||||
dao.getEntityListByState(dataState)
|
||||
}
|
||||
|
||||
suspend fun insert(entity: MiningWorkingFaceRecordEntity) = withContext(Dispatchers.IO) {
|
||||
dao.insert(entity)
|
||||
}
|
||||
|
||||
suspend fun insertList(list: MutableList<MiningWorkingFaceRecordEntity>) =
|
||||
withContext(Dispatchers.IO) {
|
||||
dao.insertList(list)
|
||||
}
|
||||
|
||||
suspend fun update(entity: MiningWorkingFaceRecordEntity) = withContext(Dispatchers.IO) {
|
||||
dao.update(entity)
|
||||
}
|
||||
|
||||
suspend fun getEntityById(faceId: Long) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityById(faceId)
|
||||
}
|
||||
|
||||
suspend fun getLastEntity(surfaceId: Long) = withContext(Dispatchers.IO) {
|
||||
dao.getLastEntity(surfaceId)
|
||||
}
|
||||
|
||||
suspend fun deleteAll() = withContext(Dispatchers.IO) {
|
||||
dao.deleteAll()
|
||||
}
|
||||
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.repository
|
||||
|
||||
import androidx.sqlite.db.SupportSQLiteQuery
|
||||
import com.zmkg.coaloperation.db.dao.MiningWorkingFaceDao
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class MiningWorkingFaceRepository(private val dao: MiningWorkingFaceDao) {
|
||||
suspend fun getEntityList() = withContext(Dispatchers.IO) {
|
||||
dao.getEntityList()
|
||||
}
|
||||
|
||||
suspend fun getEntityListBySql(query: SupportSQLiteQuery) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityListBySql(query)
|
||||
}
|
||||
|
||||
suspend fun getEntityListByState(dataState: String) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityListByState(dataState)
|
||||
}
|
||||
|
||||
suspend fun insert(entity: MiningWorkingFaceEntity) = withContext(Dispatchers.IO) {
|
||||
dao.insert(entity)
|
||||
}
|
||||
|
||||
suspend fun insertList(list: MutableList<MiningWorkingFaceEntity>) = withContext(Dispatchers.IO) {
|
||||
dao.insertList(list)
|
||||
}
|
||||
|
||||
suspend fun update(entity: MiningWorkingFaceEntity) = withContext(Dispatchers.IO) {
|
||||
dao.update(entity)
|
||||
}
|
||||
|
||||
suspend fun getEntityById(faceId: Long) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityById(faceId)
|
||||
}
|
||||
suspend fun deleteAll() = withContext(Dispatchers.IO) {
|
||||
dao.deleteAll()
|
||||
}
|
||||
}
|
||||
-5
@@ -1,6 +1,5 @@
|
||||
package com.zmkg.coaloperation.db.repository
|
||||
|
||||
import androidx.sqlite.db.SupportSQLiteQuery
|
||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -11,10 +10,6 @@ class TunnelWorkingFaceRepository(private val dao: TunnelWorkingFaceDao) {
|
||||
dao.getEntityList()
|
||||
}
|
||||
|
||||
suspend fun getEntityListBySql(query: SupportSQLiteQuery) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityListBySql(query)
|
||||
}
|
||||
|
||||
suspend fun getEntityListByState(dataState: String) = withContext(Dispatchers.IO) {
|
||||
dao.getEntityListByState(dataState)
|
||||
}
|
||||
|
||||
-89
@@ -1,89 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.zmkg.coaloperation.db.AppDatabase
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningCoalHeightEntity
|
||||
import com.zmkg.coaloperation.db.repository.MiningCoalHeightRepository
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class MiningCoalHeightViewModel(application: Application) : AndroidViewModel(application) {
|
||||
private val repository: MiningCoalHeightRepository
|
||||
|
||||
init {
|
||||
val dao = AppDatabase.getDatabase(application).miningCoalHeightDao()
|
||||
repository = MiningCoalHeightRepository(dao)
|
||||
}
|
||||
|
||||
fun getEntityList(recordId: Long, action: (MutableList<MiningCoalHeightEntity>?) -> Unit) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<MiningCoalHeightEntity>? = repository.getEntityList(recordId)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByState(
|
||||
dataState: String,
|
||||
action: (MutableList<MiningCoalHeightEntity>?) -> Unit
|
||||
) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<MiningCoalHeightEntity>? =
|
||||
repository.getEntityListByState(dataState)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByFaceId(
|
||||
surfaceId: Long,
|
||||
action: (MutableList<MiningCoalHeightEntity>?) -> Unit
|
||||
) = viewModelScope.launch {
|
||||
val list: MutableList<MiningCoalHeightEntity>? =
|
||||
repository.getEntityListByFaceId(surfaceId)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByRecordId(
|
||||
surfaceId: Long,
|
||||
recordId: Long,
|
||||
action: (MutableList<MiningCoalHeightEntity>?) -> Unit
|
||||
) = viewModelScope.launch {
|
||||
val list: MutableList<MiningCoalHeightEntity>? =
|
||||
repository.getEntityListByRecordId(surfaceId, recordId)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun insertList(list: MutableList<MiningCoalHeightEntity>, action: () -> Unit = {}) =
|
||||
viewModelScope.launch {
|
||||
repository.insertList(list)
|
||||
action()
|
||||
}
|
||||
|
||||
fun insert(entity: MiningCoalHeightEntity, action: () -> Unit) = viewModelScope.launch {
|
||||
repository.insert(entity)
|
||||
action()
|
||||
}
|
||||
|
||||
fun update(entity: MiningCoalHeightEntity, action: () -> Unit) = viewModelScope.launch {
|
||||
repository.update(entity)
|
||||
action()
|
||||
}
|
||||
|
||||
fun getEntityById(faceId: Long, action: (MiningCoalHeightEntity) -> Unit) =
|
||||
viewModelScope.launch {
|
||||
val entity = repository.getEntityById(faceId)
|
||||
entity?.let { action(it) }
|
||||
}
|
||||
|
||||
fun deleteList(recordId: Long, action: () -> Unit = {}) =
|
||||
viewModelScope.launch {
|
||||
repository.deleteList(recordId)
|
||||
action()
|
||||
}
|
||||
|
||||
fun deleteAll(action: () -> Unit = {}) =
|
||||
viewModelScope.launch {
|
||||
repository.deleteAll()
|
||||
action()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-70
@@ -1,70 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.zmkg.coaloperation.db.AppDatabase
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.db.repository.MiningWorkingFaceRecordRepository
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class MiningWorkingFaceRecordViewModel(application: Application) : AndroidViewModel(application) {
|
||||
private val repository: MiningWorkingFaceRecordRepository
|
||||
|
||||
init {
|
||||
val dao = AppDatabase.getDatabase(application).miningWorkingFaceRecordDao()
|
||||
repository = MiningWorkingFaceRecordRepository(dao)
|
||||
}
|
||||
|
||||
fun getEntityList(
|
||||
surfaceId: Long,
|
||||
action: (MutableList<MiningWorkingFaceRecordEntity>?) -> Unit
|
||||
) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<MiningWorkingFaceRecordEntity>? =
|
||||
repository.getEntityList(surfaceId)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByState(
|
||||
dataState: String,
|
||||
action: (MutableList<MiningWorkingFaceRecordEntity>?) -> Unit
|
||||
) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<MiningWorkingFaceRecordEntity>? =
|
||||
repository.getEntityListByState(dataState)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun insert(entity: MiningWorkingFaceRecordEntity, action: () -> Unit) = viewModelScope.launch {
|
||||
repository.insert(entity)
|
||||
action()
|
||||
}
|
||||
|
||||
fun insertList(list: MutableList<MiningWorkingFaceRecordEntity>, action: () -> Unit = {}) =
|
||||
viewModelScope.launch {
|
||||
repository.insertList(list)
|
||||
action()
|
||||
}
|
||||
|
||||
fun update(entity: MiningWorkingFaceRecordEntity, action: () -> Unit) = viewModelScope.launch {
|
||||
repository.update(entity)
|
||||
action()
|
||||
}
|
||||
|
||||
fun getEntityById(recordId: Long) = viewModelScope.launch {
|
||||
repository.getEntityById(recordId)
|
||||
}
|
||||
|
||||
fun getLastEntity(surfaceId: Long, action: (MiningWorkingFaceRecordEntity?) -> Unit) = viewModelScope.launch {
|
||||
val record = repository.getLastEntity(surfaceId)
|
||||
action(record)
|
||||
}
|
||||
|
||||
fun deleteAll(action: () -> Unit={}) = viewModelScope.launch {
|
||||
repository.deleteAll()
|
||||
action()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-91
@@ -1,91 +0,0 @@
|
||||
package com.zmkg.coaloperation.db.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery
|
||||
import androidx.sqlite.db.SupportSQLiteQuery
|
||||
import com.zmkg.coaloperation.db.AppDatabase
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.repository.MiningWorkingFaceRepository
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class MiningWorkingFaceViewModel(application: Application) : AndroidViewModel(application) {
|
||||
private val repository: MiningWorkingFaceRepository
|
||||
|
||||
val faceList = MutableSharedFlow<MutableList<MiningWorkingFaceEntity>?>()
|
||||
val faceListByState = MutableSharedFlow<MutableList<MiningWorkingFaceEntity>?>()
|
||||
val insertOne = MutableSharedFlow<Long>()
|
||||
val updateOne = MutableSharedFlow<Boolean>()
|
||||
val insertArray = MutableSharedFlow<Array<Long>>()
|
||||
val queryOne = MutableSharedFlow<MiningWorkingFaceEntity>()
|
||||
val deleteFinish = MutableSharedFlow<Boolean>()
|
||||
|
||||
init {
|
||||
val dao = AppDatabase.getDatabase(application).miningWorkingFaceDao()
|
||||
repository = MiningWorkingFaceRepository(dao)
|
||||
}
|
||||
|
||||
// fun getEntityList() = viewModelScope.launch {
|
||||
// val list: MutableList<MiningWorkingFaceEntity>? = repository.getEntityList()
|
||||
// faceList.emit(list)
|
||||
// }
|
||||
|
||||
fun getEntityListByUserId(userId:String) =
|
||||
viewModelScope.launch {
|
||||
val sql = buildString {
|
||||
append("SELECT * FROM mining_working_face WHERE 1=1 ")
|
||||
if (userId.isNotBlank()) {
|
||||
append(" AND userId = $userId")
|
||||
}
|
||||
}
|
||||
val query = SimpleSQLiteQuery(sql)
|
||||
val list: MutableList<MiningWorkingFaceEntity>? = repository.getEntityListBySql(query)
|
||||
faceList.emit(list)
|
||||
}
|
||||
|
||||
fun getEntityListBySql(
|
||||
query: SupportSQLiteQuery,
|
||||
action: (MutableList<MiningWorkingFaceEntity>?) -> Unit
|
||||
) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<MiningWorkingFaceEntity>? = repository.getEntityListBySql(query)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByState(dataState: String) = viewModelScope.launch {
|
||||
val list: MutableList<MiningWorkingFaceEntity>? = repository.getEntityListByState(dataState)
|
||||
faceListByState.emit(list)
|
||||
}
|
||||
|
||||
fun insert(entity: MiningWorkingFaceEntity) = viewModelScope.launch {
|
||||
val faceId = repository.insert(entity)
|
||||
insertOne.emit(faceId)
|
||||
}
|
||||
|
||||
fun insertList(list: MutableList<MiningWorkingFaceEntity>) =
|
||||
viewModelScope.launch {
|
||||
val array = repository.insertList(list)
|
||||
insertArray.emit(array)
|
||||
}
|
||||
|
||||
fun update(entity: MiningWorkingFaceEntity) = viewModelScope.launch {
|
||||
repository.update(entity)
|
||||
updateOne.emit(true)
|
||||
}
|
||||
|
||||
fun getEntityById(faceId: Long) =
|
||||
viewModelScope.launch {
|
||||
val entity = repository.getEntityById(faceId)
|
||||
entity?.let {
|
||||
queryOne.emit(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteAll() =
|
||||
viewModelScope.launch {
|
||||
repository.deleteAll()
|
||||
deleteFinish.emit(true)
|
||||
}
|
||||
}
|
||||
-24
@@ -3,8 +3,6 @@ package com.zmkg.coaloperation.db.viewmodel
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery
|
||||
import androidx.sqlite.db.SupportSQLiteQuery
|
||||
import com.zmkg.coaloperation.db.AppDatabase
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.repository.TunnelWorkingFaceRepository
|
||||
@@ -24,28 +22,6 @@ class TunnelWorkingFaceViewModel(application: Application) : AndroidViewModel(ap
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByUserId(userId:String, action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit) =
|
||||
viewModelScope.launch {
|
||||
val sql = buildString {
|
||||
append("SELECT * FROM tunnel_working_face WHERE 1=1 ")
|
||||
if (userId.isNotBlank()) {
|
||||
append(" AND userId = $userId")
|
||||
}
|
||||
}
|
||||
val query = SimpleSQLiteQuery(sql)
|
||||
val list: MutableList<TunnelWorkingFaceEntity>? = repository.getEntityListBySql(query)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListBySql(
|
||||
query: SupportSQLiteQuery,
|
||||
action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit
|
||||
) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<TunnelWorkingFaceEntity>? = repository.getEntityListBySql(query)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByState(
|
||||
dataState: String,
|
||||
action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.zmkg.coaloperation.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import androidx.annotation.StyleRes
|
||||
import com.zmkg.coaloperation.R
|
||||
|
||||
open class BaseDialog(context: Context, @StyleRes dialogTheme: Int) :
|
||||
Dialog(context, dialogTheme) {
|
||||
constructor(context: Context) : this(context, R.style.DialogTheme)
|
||||
|
||||
override fun show() {
|
||||
super.show()
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package com.zmkg.coaloperation.dialog
|
||||
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.allen.library.shape.ShapeButton
|
||||
import com.zmkg.coaloperation.databinding.DialogCommonBinding
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
|
||||
class CustomCenterDialog(
|
||||
var activity: FragmentActivity,
|
||||
var defaultWidth: Int = 300.dp
|
||||
) : BaseDialog(activity) {
|
||||
|
||||
private lateinit var binding: DialogCommonBinding
|
||||
|
||||
var dialogCancelable = false
|
||||
var dialogCanceledOnTouchOutside = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = DialogCommonBinding.inflate(LayoutInflater.from(activity))
|
||||
setContentView(binding.root)
|
||||
|
||||
setCancelable(dialogCancelable)
|
||||
setCanceledOnTouchOutside(dialogCanceledOnTouchOutside)
|
||||
window?.apply {
|
||||
setLayout(defaultWidth, WindowManager.LayoutParams.WRAP_CONTENT)
|
||||
setBackgroundDrawable(ColorDrawable())
|
||||
setGravity(Gravity.CENTER)
|
||||
}
|
||||
binding.btnCancel.setOnClickListener { onLeftClick?.invoke(this) }
|
||||
binding.btnConfirm.setOnClickListener { onRightClick?.invoke(this) }
|
||||
}
|
||||
|
||||
private var dialogTitle: String = ""
|
||||
fun setDialogTitle(title: String) {
|
||||
this.dialogTitle = title
|
||||
}
|
||||
|
||||
private var dialogContent: String = ""
|
||||
fun setDialogContent(content: String) {
|
||||
this.dialogContent = content
|
||||
}
|
||||
|
||||
private var spannableBuilder: SpannableStringBuilder? = null
|
||||
fun setDialogContent(spannableBuilder: SpannableStringBuilder) {
|
||||
this.spannableBuilder = spannableBuilder
|
||||
}
|
||||
|
||||
private var dialogLeftBtnText = ""
|
||||
private var onLeftClick: ((CustomCenterDialog) -> Unit)? = null
|
||||
fun setCancelButton(
|
||||
text: String,
|
||||
onClick: (CustomCenterDialog) -> Unit
|
||||
) {
|
||||
this.dialogLeftBtnText = text
|
||||
this.onLeftClick = onClick
|
||||
}
|
||||
|
||||
private var dialogRightBtnText = ""
|
||||
private var onRightClick: ((CustomCenterDialog) -> Unit)? = null
|
||||
fun setConfirmButton(
|
||||
text: String,
|
||||
onClick: (CustomCenterDialog) -> Unit
|
||||
) {
|
||||
this.dialogRightBtnText = text
|
||||
this.onRightClick = onClick
|
||||
}
|
||||
|
||||
private var showSingleButton = false
|
||||
fun setShowSingleButton(show: Boolean) {
|
||||
this.showSingleButton = show
|
||||
}
|
||||
|
||||
|
||||
var bgLayoutSetting: ((View) -> Unit)? = null
|
||||
var titleSetting: ((TextView) -> Unit)? = null
|
||||
var contentSetting: ((TextView) -> Unit)? = null
|
||||
var leftBtnSetting: ((ShapeButton) -> Unit)? = null
|
||||
var rightBtnSetting: ((ShapeButton) -> Unit)? = null
|
||||
|
||||
override fun show() {
|
||||
super.show()
|
||||
|
||||
binding.tvDialogTitle.apply {
|
||||
text = dialogTitle
|
||||
}
|
||||
binding.tvDialogContent.apply {
|
||||
text = dialogContent
|
||||
}
|
||||
|
||||
bgLayoutSetting?.invoke(binding.root)
|
||||
titleSetting?.invoke(binding.tvDialogTitle)
|
||||
contentSetting?.invoke(binding.tvDialogContent)
|
||||
leftBtnSetting?.invoke(binding.btnCancel)
|
||||
rightBtnSetting?.invoke(binding.btnConfirm)
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ fun ImageView.loadCircle(@DrawableRes resourceId: Int) {
|
||||
* @param imageView View
|
||||
* @param placeholder 占位图
|
||||
*/
|
||||
fun ImageView.loadRoundedImage2(
|
||||
fun ImageView.loadRoundedImage(
|
||||
url: String?,
|
||||
roundingRadius: Float,
|
||||
@DrawableRes defaultResId: Int = 0,
|
||||
@@ -239,32 +239,6 @@ fun ImageView.loadRoundedImage2(
|
||||
.into(this)
|
||||
}
|
||||
|
||||
fun ImageView.loadRoundedImage(
|
||||
any: Any,
|
||||
roundingRadius: Float,
|
||||
@DrawableRes defaultResId: Int = 0,
|
||||
isCenterCrop:Boolean = true
|
||||
) {
|
||||
//设置图片圆角角度
|
||||
val roundedCorners = RoundedCorners(dp2px(roundingRadius))
|
||||
val multiTransformation: MultiTransformation<Bitmap> = MultiTransformation(
|
||||
if (isCenterCrop) CenterCrop() else FitCenter(), roundedCorners
|
||||
)
|
||||
val options = RequestOptions
|
||||
.bitmapTransform(multiTransformation)
|
||||
if (defaultResId == 0) {
|
||||
options.placeholder(R.drawable.ic_default)
|
||||
.error(R.drawable.ic_default)
|
||||
} else {
|
||||
options.placeholder(defaultResId)
|
||||
.error(defaultResId)
|
||||
}
|
||||
Glide.with(context)
|
||||
.load(any)
|
||||
.apply(options)
|
||||
.into(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载图片到ImageView
|
||||
* @param imageUrl 图片地址
|
||||
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.geologging
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.ActivityAddGeoLoggingFaceBinding
|
||||
|
||||
class AddGeoLoggingFaceActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityAddGeoLoggingFaceBinding>(
|
||||
R.layout.activity_add_geo_logging_face
|
||||
) {
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "新增工作面"
|
||||
mBinding.btnAddFace.setOnClickListener {
|
||||
val faceName = mBinding.etWorkfaceName.text.toString().trim()
|
||||
if (faceName.isBlank()) {
|
||||
showToast("请输入工作面名称")
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
-137
@@ -1,137 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.geologging
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.graphics.toColorInt
|
||||
import androidx.core.view.marginLeft
|
||||
import androidx.core.view.marginStart
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.commit
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.ActivityAddGeologicalPointBinding
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
import com.zmkg.coaloperation.utils.useShapeSetBackground
|
||||
import net.lucode.hackware.magicindicator.FragmentContainerHelper
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView
|
||||
|
||||
/**
|
||||
* 地质编录点新增
|
||||
*/
|
||||
class AddGeologicalPointActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityAddGeologicalPointBinding>(
|
||||
R.layout.activity_add_geological_point
|
||||
) {
|
||||
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "编录点"
|
||||
// mBinding.toolbarLay.rightText = "新增工作面"
|
||||
|
||||
initFragments()
|
||||
initMagicIndicator()
|
||||
showFragment(0)
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
|
||||
private val fragments = mutableListOf<AddGeologicalPointFragment>()
|
||||
private fun initFragments() {
|
||||
titles.forEachIndexed { index, string ->
|
||||
val fragment = AddGeologicalPointFragment()
|
||||
fragments.add(fragment)
|
||||
supportFragmentManager.commit {
|
||||
add(R.id.frgContainerView, fragment, "frg_${index}").hide(fragment)
|
||||
// replace(R.id.frgContainerView, fragments[0], "point01")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
fragments[showFrgIndex].onActivityResult(requestCode, resultCode, data)
|
||||
}
|
||||
|
||||
private val titles = listOf("1#", "2#", "3#", "4#", "5#", "6#")
|
||||
private fun initMagicIndicator() {
|
||||
val commonNavigator = CommonNavigator(this).apply {
|
||||
adapter = object : CommonNavigatorAdapter() {
|
||||
override fun getCount() = titles.size
|
||||
override fun getTitleView(context: Context?, index: Int): IPagerTitleView {
|
||||
return ColorTransitionPagerTitleView(context).apply {
|
||||
// setPadding(10.dp, 5.dp,10.dp, 5.dp)
|
||||
width = 65.dp
|
||||
text = titles[index]
|
||||
textSize = 20f
|
||||
normalColor = Color.WHITE
|
||||
selectedColor = "#30E0A1".toColorInt()
|
||||
useShapeSetBackground(
|
||||
cornerRadius = 12.dp.toFloat(),
|
||||
solidColor = "#1430E0A1".toColorInt(),
|
||||
strokeColor = "#0C0D0E".toColorInt(),
|
||||
strokeWidth = 8.dp
|
||||
)
|
||||
setOnClickListener { showFragment(index) }
|
||||
}
|
||||
}
|
||||
|
||||
override fun getIndicator(context: Context?) = LinePagerIndicator(context).apply {
|
||||
// mode = LinePagerIndicator.MODE_WRAP_CONTENT
|
||||
// setColors("#30E0A1".toColorInt())
|
||||
// lineHeight = 1.dp.toFloat()
|
||||
//lineWidth = 10.dp.toFloat()
|
||||
// background = GradientDrawable().also {
|
||||
// it.shape = GradientDrawable.RECTANGLE
|
||||
// it.cornerRadius = 5.dp.toFloat()
|
||||
// it.setColor("#30E0A1".toColorInt())
|
||||
//// it.setStroke(strokeWidth, strokeColor)
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
mBinding.magicIndicator.let {
|
||||
fragmentContainerHelper = FragmentContainerHelper(it)
|
||||
it.navigator = commonNavigator
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var fragmentContainerHelper:FragmentContainerHelper
|
||||
|
||||
private var showFrgIndex = 0
|
||||
private fun showFragment(position: Int) {
|
||||
showFrgIndex = position
|
||||
// supportFragmentManager.beginTransaction()
|
||||
// .replace(R.id.frgContainerView, fragments[position])
|
||||
// .commit()
|
||||
fragmentContainerHelper.handlePageSelected(position)
|
||||
supportFragmentManager.commit {
|
||||
setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
fragments.forEachIndexed { index, fragment ->
|
||||
if (index == position) show(fragment) else hide(fragment)
|
||||
}
|
||||
setReorderingAllowed(true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-73
@@ -1,73 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.geologging
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.GeoPointMultiAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.BaseItem
|
||||
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||
import com.zmkg.coaloperation.bean.GeoPointMultiItem
|
||||
import com.zmkg.coaloperation.databinding.FragmentAddGeologicalPointBinding
|
||||
|
||||
class AddGeologicalPointFragment :
|
||||
BaseVMBFragment<TestViewModel, FragmentAddGeologicalPointBinding>(R.layout.fragment_add_geological_point) {
|
||||
|
||||
companion object {
|
||||
const val IMAGE_REQUEST_CODE = 1000
|
||||
}
|
||||
|
||||
private val geoPointList: MutableList<GeoPointMultiItem> = mutableListOf()
|
||||
private val geoPointAdapter by lazy {
|
||||
GeoPointMultiAdapter(geoPointList)
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
geoPointList.clear()
|
||||
val topList = mutableListOf(
|
||||
BaseItem(name = "点号", value = ""),
|
||||
BaseItem(name = "点距", value = ""),
|
||||
BaseItem(name = "累距", value = ""),
|
||||
)
|
||||
val bottomList = mutableListOf(
|
||||
BaseItem(name = "巷高", value = ""),
|
||||
BaseItem(name = "顶板", value = ""),
|
||||
BaseItem(name = "底板", value = ""),
|
||||
BaseItem(name = "巷顶煤厚", value = ""),
|
||||
)
|
||||
val imageList = mutableListOf<CommonImageBean>()
|
||||
imageList.add(CommonImageBean(isAddFlag = true))
|
||||
geoPointList.run {
|
||||
add(
|
||||
GeoPointMultiItem(
|
||||
itemType = GeoPointMultiItem.TYPE_BASE_INFO,
|
||||
baseTopList = topList,
|
||||
baseBottomList = bottomList
|
||||
)
|
||||
)
|
||||
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_LOGGING_INFO))
|
||||
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_CALCULATE_INFO))
|
||||
add(
|
||||
GeoPointMultiItem(
|
||||
itemType = GeoPointMultiItem.TYPE_UPLOAD_IMAGE,
|
||||
images = imageList
|
||||
)
|
||||
)
|
||||
}
|
||||
mBinding.rvPointList.let {
|
||||
it.layoutManager = LinearLayoutManager(it.context)
|
||||
it.adapter = geoPointAdapter
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
-60
@@ -1,60 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.geologging
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.GeoLoggingFaceAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.ActivityGeologicalBinding
|
||||
import com.zmkg.coaloperation.db.entity.geologging.GeoLoggingFace
|
||||
|
||||
/**
|
||||
* 地质编录
|
||||
*/
|
||||
class GeologicalActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityGeologicalBinding>(R.layout.activity_geological) {
|
||||
|
||||
val faceList: MutableList<GeoLoggingFace> = mutableListOf()
|
||||
val faceAdapter by lazy {
|
||||
GeoLoggingFaceAdapter(faceList).apply {
|
||||
setOnItemClickListener { adapter, view, position ->
|
||||
toActivity(GeologicalPointActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "编录位置选择"
|
||||
mBinding.toolbarLay.rightText = "新增工作面"
|
||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
toActivity(AddGeoLoggingFaceActivity::class.java)
|
||||
}
|
||||
|
||||
faceList.run {
|
||||
add(GeoLoggingFace(surfaceName = "5-20304回风工作面"))
|
||||
add(GeoLoggingFace(surfaceName = "5-20305回风工作面"))
|
||||
add(GeoLoggingFace(surfaceName = "5-20306回风工作面"))
|
||||
add(GeoLoggingFace(surfaceName = "5-20307回风工作面"))
|
||||
add(GeoLoggingFace(surfaceName = "5-20308回风工作面"))
|
||||
add(GeoLoggingFace(surfaceName = "5-20309回风工作面"))
|
||||
add(GeoLoggingFace(surfaceName = "5-20310回风工作面"))
|
||||
add(GeoLoggingFace(surfaceName = "5-20311回风工作面"))
|
||||
}
|
||||
|
||||
mBinding.rvGeoLogging.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = faceAdapter
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
}
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.geologging
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.GeoPointParentAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.GeoPointItem
|
||||
import com.zmkg.coaloperation.bean.GeoPointParent
|
||||
import com.zmkg.coaloperation.databinding.ActivityGeologicalPointBinding
|
||||
|
||||
/**
|
||||
* 地质编录
|
||||
*/
|
||||
class GeologicalPointActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityGeologicalPointBinding>(R.layout.activity_geological_point) {
|
||||
|
||||
private val parentList: MutableList<GeoPointParent> = mutableListOf(
|
||||
GeoPointParent(name = "已编录点"),
|
||||
GeoPointParent(name = "未编录点")
|
||||
)
|
||||
private val parentAdapter by lazy {
|
||||
GeoPointParentAdapter(parentList)
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "编录点"
|
||||
// mBinding.toolbarLay.rightText = "新增工作面"
|
||||
|
||||
val subList = mutableListOf(
|
||||
GeoPointItem(isLogging = true, name = "1#", distance = "0", isChecked = true),
|
||||
GeoPointItem(isLogging = true, name = "2#", distance = "24.252"),
|
||||
GeoPointItem(isLogging = true, name = "3#", distance = "37.859"),
|
||||
GeoPointItem(isLogging = true, name = "4#", distance = "43.123"),
|
||||
GeoPointItem(isLogging = true, name = "5#", distance = "50.567"),
|
||||
GeoPointItem(isLogging = true, name = "6#", distance = "60.567"),
|
||||
GeoPointItem(isLogging = true, name = "7#", distance = "70.567")
|
||||
)
|
||||
val subList2 = mutableListOf(
|
||||
GeoPointItem(name = "1#", distance = "0"),
|
||||
GeoPointItem(name = "2#", distance = "24.252"),
|
||||
GeoPointItem(name = "3#", distance = "37.859"),
|
||||
GeoPointItem(name = "4#", distance = "56.859"),
|
||||
GeoPointItem(name = "5#", distance = "89.859")
|
||||
)
|
||||
parentList[0].list = subList
|
||||
parentList[1].list = subList2
|
||||
mBinding.rvPointParent.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = parentAdapter
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.zmkg.coaloperation.ui.home.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.ActivityGeologicalBinding
|
||||
|
||||
/**
|
||||
* 地质编录
|
||||
*/
|
||||
class GeologicalActivity : BaseVMBActivity<TestViewModel, ActivityGeologicalBinding>(R.layout.activity_geological) {
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
}
|
||||
-4
@@ -1,6 +1,5 @@
|
||||
package com.zmkg.coaloperation.ui.home.adapter
|
||||
|
||||
import android.widget.Toast
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
@@ -31,8 +30,5 @@ class HomeMenuAdapter :
|
||||
R.id.img,
|
||||
getMenuTabImg(item.index!!, holder.itemViewType)
|
||||
)
|
||||
holder.itemView.setOnClickListener {
|
||||
item.onClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,13 @@ package com.zmkg.coaloperation.ui.home.bean
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
|
||||
|
||||
data class HomeMenuBean(
|
||||
var name: String? = null,
|
||||
var index: Int? = null,
|
||||
var type: Int? = null, // 0: 前4个(左右布局),1: 后4个(上下布局)
|
||||
var onClick:()->Unit = {}
|
||||
) : MultiItemEntity {
|
||||
class HomeMenuBean : MultiItemEntity {
|
||||
var name: String? = null
|
||||
var index: Int? = null
|
||||
var type: Int? = null // 0: 前4个(左右布局),1: 后4个(上下布局)
|
||||
|
||||
override val itemType: Int
|
||||
get() = type!!
|
||||
|
||||
|
||||
}
|
||||
|
||||
+43
-28
@@ -1,33 +1,39 @@
|
||||
package com.zmkg.coaloperation.ui.home.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.common.ViewPagerAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.databinding.FragmentHomeBinding
|
||||
import com.zmkg.coaloperation.local.DataStoreManager
|
||||
import com.zmkg.coaloperation.superfuntion.addItemTouchCallback
|
||||
import com.zmkg.coaloperation.superfuntion.init
|
||||
import com.zmkg.coaloperation.superfuntion.onPageChangeCallback
|
||||
import com.zmkg.coaloperation.ui.geologging.GeologicalActivity
|
||||
import com.zmkg.coaloperation.superfuntion.toJson
|
||||
import com.zmkg.coaloperation.ui.home.adapter.HomeMenuAdapter
|
||||
import com.zmkg.coaloperation.ui.home.bean.HomeMenuBean
|
||||
import com.zmkg.coaloperation.ui.home.viewmodel.HomeViewModel
|
||||
import com.zmkg.coaloperation.ui.wateryield.WaterYieldHomeActivity
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
||||
class HomeFragment :
|
||||
BaseVMBFragment<HomeViewModel, FragmentHomeBinding>(R.layout.fragment_home),
|
||||
OnItemClickListener {
|
||||
|
||||
private val homeMenuAdapter: HomeMenuAdapter by lazy {
|
||||
HomeMenuAdapter()
|
||||
}
|
||||
private val homeMenuAdapter: HomeMenuAdapter by lazy { HomeMenuAdapter() }
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
mBinding.apply {
|
||||
@@ -41,7 +47,7 @@ class HomeFragment :
|
||||
rvList.adapter = homeMenuAdapter
|
||||
rvList.addItemTouchCallback {
|
||||
resetItemTypes(homeMenuAdapter.data)
|
||||
// DataStoreManager.setHomeData(homeMenuAdapter.data.toJson())
|
||||
DataStoreManager.setHomeData(homeMenuAdapter.data.toJson())
|
||||
homeMenuAdapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
@@ -74,32 +80,41 @@ class HomeFragment :
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
DictUtils.initData()
|
||||
// mViewModel.getWaterLedgerData()
|
||||
|
||||
val menuList = mutableListOf(
|
||||
HomeMenuBean(index = 1, name = "涌水量观测", type = 0, onClick = {
|
||||
toActivity(WaterYieldHomeActivity::class.java)
|
||||
}),
|
||||
HomeMenuBean(index = 2, name = "导线测量", type = 0),
|
||||
HomeMenuBean(index = 3, name = "瓦斯巡检", type = 0),
|
||||
HomeMenuBean(index = 4, name = "防灭火检查", type = 0),
|
||||
HomeMenuBean(index = 5, name = "通风巡检", type = 1),
|
||||
HomeMenuBean(index = 6, name = "地质编录", type = 1, onClick = {
|
||||
toActivity(GeologicalActivity::class.java)
|
||||
}),
|
||||
HomeMenuBean(index = 7, name = "水文地质编录", type = 1),
|
||||
HomeMenuBean(index = 8, name = "隐蔽致灾", type = 1),
|
||||
HomeMenuBean(index = 9, name = "地物查询", type = 1)
|
||||
val titleNameList = mutableListOf(
|
||||
"涌水量观测",
|
||||
"导线测量",
|
||||
"瓦斯巡检",
|
||||
"防灭火检查",
|
||||
"通风巡检",
|
||||
"地质编录",
|
||||
"水文地质编录",
|
||||
"隐蔽致灾",
|
||||
"地物查询"
|
||||
)
|
||||
var mutableListOf = mutableListOf<HomeMenuBean>()
|
||||
|
||||
// val homeData = DataStoreManager.getHomeData()
|
||||
// if (!TextUtils.isEmpty(homeData)) {
|
||||
// val listType = object : TypeToken<MutableList<HomeMenuBean>?>() {}.type
|
||||
// mutableListOf = Gson().fromJson(homeData, listType)
|
||||
// }
|
||||
val homeData = DataStoreManager.getHomeData()
|
||||
if (TextUtils.isEmpty(homeData)) {
|
||||
|
||||
homeMenuAdapter.setNewInstance(menuList)
|
||||
titleNameList.forEachIndexed { index, s ->
|
||||
val homeMenuBean = HomeMenuBean()
|
||||
homeMenuBean.name = s
|
||||
homeMenuBean.index = index + 1
|
||||
if (index < 4) {
|
||||
homeMenuBean.type = 0
|
||||
} else {
|
||||
homeMenuBean.type = 1
|
||||
}
|
||||
mutableListOf.add(homeMenuBean)
|
||||
}
|
||||
} else {
|
||||
val listType = object : TypeToken<MutableList<HomeMenuBean>?>() {}.getType()
|
||||
mutableListOf = Gson().fromJson(homeData, listType)
|
||||
}
|
||||
|
||||
homeMenuAdapter.setNewInstance(mutableListOf)
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -6,7 +6,6 @@ import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.FragmentPageLeftBinding
|
||||
import com.zmkg.coaloperation.ui.mining.activity.MiningActivity
|
||||
|
||||
class PagerLeftFragment :
|
||||
BaseVMBFragment<TestViewModel, FragmentPageLeftBinding>(R.layout.fragment_page_left) {
|
||||
@@ -25,7 +24,8 @@ class PagerLeftFragment :
|
||||
mBinding.rootView.setOnClickListener {
|
||||
// val pagerViewClickDialog = PagerViewClickDialog(requireContext())
|
||||
// pagerViewClickDialog.show()
|
||||
toActivity(MiningActivity::class.java)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-18
@@ -10,16 +10,14 @@ import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.ActivityLoginBinding
|
||||
import com.zmkg.coaloperation.local.DataStoreManager
|
||||
import com.zmkg.coaloperation.superfuntion.loginIm
|
||||
import com.zmkg.coaloperation.utils.SpTool
|
||||
|
||||
class LoginActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityLoginBinding>(R.layout.activity_login) {
|
||||
class LoginActivity : BaseVMBActivity<TestViewModel,ActivityLoginBinding>(R.layout.activity_login) {
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
if (!TextUtils.isEmpty(DataStoreManager.getUserName())) {
|
||||
loginIm(DataStoreManager.getUserName()) {}
|
||||
toActivity(MainActivity::class.java)
|
||||
finish()
|
||||
loginIm(DataStoreManager.getUserName()){}
|
||||
toActivity(MainActivity::class.java)
|
||||
finish()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,10 +31,10 @@ class LoginActivity :
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
when (v?.id) {
|
||||
R.id.submit -> {
|
||||
val userName = mBinding.loginEtUserName.text.toString()
|
||||
if (TextUtils.isEmpty(userName)) {
|
||||
when(v?.id) {
|
||||
R.id.submit->{
|
||||
val userId = mBinding.loginEtUserName.text.toString()
|
||||
if (TextUtils.isEmpty(userId)) {
|
||||
showToast("请输入用户名")
|
||||
return
|
||||
}
|
||||
@@ -46,21 +44,19 @@ class LoginActivity :
|
||||
return
|
||||
}
|
||||
|
||||
loginIm(userName) {}
|
||||
DataStoreManager.setUserName(userName)
|
||||
|
||||
// TODO: 保存临时生成的用户id
|
||||
SpTool.put(SpTool.USER_ID, "1758266158000")
|
||||
|
||||
loginIm(userId) {}
|
||||
DataStoreManager.setUserName(userId)
|
||||
toActivity(MainActivity::class.java)
|
||||
finish()
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
override fun transparentStatusBar():Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.zmkg.coaloperation.ui.mining
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.ActivityMiningBinding
|
||||
|
||||
class MiningActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityMiningBinding>(R.layout.activity_mining) {
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.mining
|
||||
|
||||
class MiningViewModel {
|
||||
}
|
||||
-276
@@ -1,276 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.mining.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.AddMiningFaceAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.AddMiningFaceItem
|
||||
import com.zmkg.coaloperation.bean.WorkOption
|
||||
import com.zmkg.coaloperation.databinding.ActivityAddMiningFaceBinding
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.viewmodel.MiningWorkingFaceViewModel
|
||||
import com.zmkg.coaloperation.ui.tunneling.activity.AddWorkingFaceActivity
|
||||
import com.zmkg.coaloperation.ui.tunneling.activity.WorkingFaceDetailActivity
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import com.zmkg.coaloperation.utils.PickerUtil
|
||||
import com.zmkg.coaloperation.utils.SpTool
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
/**
|
||||
* 工作面
|
||||
*/
|
||||
class AddMiningFaceActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityAddMiningFaceBinding>(R.layout.activity_add_mining_face) {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AddMiningFaceActivity"
|
||||
const val WORK_FACE_TYPE = "WorkFaceType"
|
||||
const val FACE_WORK_DETAIL_DATA = "faceWorkDetailData"
|
||||
}
|
||||
|
||||
enum class WorkFaceType {
|
||||
ADD,//新增
|
||||
|
||||
EDIT,//修改
|
||||
|
||||
SEE//查看
|
||||
}
|
||||
|
||||
private var currentFaceType = WorkFaceType.ADD
|
||||
|
||||
// private val workingFaceViewModel: TunnelWorkingFaceViewModel by lazy {
|
||||
// ViewModelProvider(this)[TunnelWorkingFaceViewModel::class.java]
|
||||
// }
|
||||
private var faceDetail: MiningWorkingFaceEntity? = null
|
||||
|
||||
private val miningList = mutableListOf<AddMiningFaceItem>()
|
||||
private val workingFaceViewModel: MiningWorkingFaceViewModel by lazy {
|
||||
ViewModelProvider(this)[MiningWorkingFaceViewModel::class.java]
|
||||
}
|
||||
private val addFaceAdapter by lazy {
|
||||
AddMiningFaceAdapter(miningList).apply {
|
||||
addChildClickViewIds(R.id.tvSelectValue, R.id.imgExpand)
|
||||
setOnItemChildClickListener { adapter, view, position ->
|
||||
if (view.id == R.id.tvSelectValue) {
|
||||
miningList[position].onClick()
|
||||
return@setOnItemChildClickListener
|
||||
}
|
||||
if (view.id == R.id.imgExpand) {
|
||||
miningList.clear()
|
||||
initMiningList(false)
|
||||
notifyDataSetChanged()
|
||||
return@setOnItemChildClickListener
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
val stringExtra = intent.getStringExtra(WORK_FACE_TYPE)
|
||||
if (TextUtils.isEmpty(stringExtra)) {
|
||||
stringExtra == WorkFaceType.ADD.name
|
||||
}
|
||||
when (stringExtra) {
|
||||
WorkFaceType.ADD.name -> {
|
||||
currentFaceType = WorkFaceType.ADD
|
||||
mBinding.btnConfirm.text = "确认新增"
|
||||
mBinding.toolbarLay.title = "新增工作面"
|
||||
initMiningList(true)
|
||||
}
|
||||
|
||||
WorkFaceType.EDIT.name -> {
|
||||
currentFaceType = WorkFaceType.EDIT
|
||||
mBinding.btnConfirm.text = "确认修改"
|
||||
mBinding.toolbarLay.title = "修改工作面"
|
||||
faceDetail =
|
||||
intent.getParcelableExtra(WorkingFaceDetailActivity.Companion.FACE_WORK_DETAIL_DATA) as MiningWorkingFaceEntity?
|
||||
if (faceDetail == null) {
|
||||
showToast("未查询到工作面数据")
|
||||
return
|
||||
}
|
||||
faceDetail?.let {
|
||||
loadDetail(it)
|
||||
}
|
||||
initMiningList(false)
|
||||
}
|
||||
|
||||
WorkFaceType.SEE.name -> {
|
||||
currentFaceType = WorkFaceType.SEE
|
||||
}
|
||||
}
|
||||
mBinding.rvFaceList.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = addFaceAdapter
|
||||
}
|
||||
|
||||
// mBinding.tvSeamName.setOnClickListener { v ->
|
||||
|
||||
// }
|
||||
// mBinding.tvAreaName.setOnClickListener { v ->
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
private var seamAreaList: MutableList<WorkOption> = mutableListOf()
|
||||
|
||||
private fun numToString(num: Int): String {
|
||||
return if (num < 10) "0${num}" else num.toString()
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding.btnConfirm.setOnClickListener {
|
||||
if (currentFaceType == WorkFaceType.ADD) {
|
||||
addNewFace()
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (currentFaceType == WorkFaceType.EDIT) {
|
||||
editFace()
|
||||
return@setOnClickListener
|
||||
}
|
||||
}
|
||||
}
|
||||
private var workingFaceEntity: MiningWorkingFaceEntity?=null
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
launch {
|
||||
workingFaceViewModel.insertOne.collectLatest{
|
||||
showToast("工作面新增完成")
|
||||
workingFaceEntity?.let {
|
||||
EventBus.getDefault().post(workingFaceEntity!!)
|
||||
}
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
when (v?.id) {
|
||||
// R.id.imgExpand -> {
|
||||
// if (mBinding.expandLayout.isGone) {
|
||||
// mBinding.expandLayout.visible()
|
||||
// mBinding.imgExpand.setImageResource(R.drawable.ic_arrow_up_white2)
|
||||
// } else {
|
||||
// mBinding.expandLayout.gone()
|
||||
// mBinding.imgExpand.setImageResource(R.drawable.ic_arrow_down_white2)
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadDetail(it: MiningWorkingFaceEntity) {
|
||||
}
|
||||
|
||||
private fun addNewFace() {
|
||||
workingFaceEntity = MiningWorkingFaceEntity().also {
|
||||
it.surfaceId = System.currentTimeMillis()
|
||||
it.surfaceName = miningList[0].funcValue
|
||||
it.userId = SpTool.getString(SpTool.USER_ID)
|
||||
}
|
||||
|
||||
workingFaceViewModel.insert(workingFaceEntity!!)
|
||||
}
|
||||
|
||||
|
||||
private fun editFace() {
|
||||
// workingFaceViewModel.update(workingFaceEntity) {
|
||||
// showToast("工作面修改完成")
|
||||
// EventBus.getDefault().post(workingFaceEntity)
|
||||
// finish()
|
||||
// }
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onWorkingFaceEvent(event: MiningWorkingFaceEntity) {
|
||||
|
||||
}
|
||||
|
||||
private fun string2num(text: String?): Long {
|
||||
return if (text.isNullOrBlank()) 0 else text.toLong()
|
||||
}
|
||||
|
||||
private fun initMiningList(isFirst: Boolean) {
|
||||
miningList.run {
|
||||
if (isFirst) {
|
||||
add(AddMiningFaceItem(funcName = "工作面名称", isShowArrowDown = true))
|
||||
return
|
||||
}
|
||||
add(AddMiningFaceItem(funcName = "工作面名称", isShowArrowDown = false))
|
||||
add(AddMiningFaceItem(funcName = "水平", funcType = 1, onClick = { selectHorizontalPlane() }))
|
||||
add(AddMiningFaceItem(funcName = "煤层", funcType = 1, onClick = { selectSeam() }))
|
||||
add(AddMiningFaceItem(funcName = "采区", funcType = 1, onClick = { selectArea() }))
|
||||
add(AddMiningFaceItem(funcName = "储量"))
|
||||
add(AddMiningFaceItem(funcName = "胶运巷安全出口宽度"))
|
||||
add(AddMiningFaceItem(funcName = "回风巷安全出口宽度"))
|
||||
add(AddMiningFaceItem(funcName = "走向长度"))
|
||||
add(AddMiningFaceItem(funcName = "倾向长度"))
|
||||
add(AddMiningFaceItem(funcName = "胶带巷长度"))
|
||||
add(AddMiningFaceItem(funcName = "回风巷长度"))
|
||||
add(AddMiningFaceItem(funcName = "切眼长度"))
|
||||
add(AddMiningFaceItem(funcName = "平均煤厚"))
|
||||
add(AddMiningFaceItem(funcName = "容积"))
|
||||
}
|
||||
}
|
||||
|
||||
private fun selectArea() {
|
||||
if (seamAreaList.isEmpty()) {
|
||||
showToast("请先选择所属煤层")
|
||||
return
|
||||
}
|
||||
PickerUtil.showOptionPicker(this, "请选择所属采区域", seamAreaList) { option ->
|
||||
miningList[3].let {
|
||||
it.funcValue = option.name
|
||||
it.funcId = option.id
|
||||
}
|
||||
addFaceAdapter.notifyItemChanged(3)
|
||||
}
|
||||
}
|
||||
private fun selectSeam() {
|
||||
PickerUtil.showOptionPicker(this, "请选择所属煤层", DictUtils.seamList) { option ->
|
||||
miningList[2].let {
|
||||
it.funcValue = option.name
|
||||
it.funcId = option.id
|
||||
}
|
||||
addFaceAdapter.notifyItemChanged(2)
|
||||
seamAreaList = DictUtils.areaMap[option.id] ?: mutableListOf()
|
||||
}
|
||||
}
|
||||
|
||||
private fun selectHorizontalPlane() {
|
||||
val list = mutableListOf<WorkOption>()
|
||||
list.add(WorkOption("1","A"))
|
||||
list.add(WorkOption("2","B"))
|
||||
list.add(WorkOption("3","C"))
|
||||
list.add(WorkOption("4","D"))
|
||||
list.add(WorkOption("5","E"))
|
||||
PickerUtil.showOptionPicker(this, "请选择水平", list) { option ->
|
||||
miningList[1].let {
|
||||
it.funcValue = option.name
|
||||
it.funcId = option.id
|
||||
}
|
||||
addFaceAdapter.notifyItemChanged(1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-251
@@ -1,251 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.mining.activity
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.MiningWorkingFaceAdapter
|
||||
import com.zmkg.coaloperation.adapter.MiningWorkingFaceRecordAdapter
|
||||
import com.zmkg.coaloperation.adapter.TunnelWorkingFaceAdapter
|
||||
import com.zmkg.coaloperation.adapter.TunnelWorkingFaceRecordAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.ActivityMiningBinding
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.db.viewmodel.MiningWorkingFaceRecordViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.MiningWorkingFaceViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
||||
import com.zmkg.coaloperation.ui.mining.activity.AddMiningFaceActivity.Companion.WORK_FACE_TYPE
|
||||
import com.zmkg.coaloperation.ui.mining.activity.AddMiningFaceActivity.WorkFaceType
|
||||
import com.zmkg.coaloperation.ui.tunneling.activity.AddWorkingFaceRecordActivity
|
||||
import com.zmkg.coaloperation.ui.tunneling.activity.WorkingFaceStatisticsActivity
|
||||
import com.zmkg.coaloperation.utils.SpTool
|
||||
import com.zmkg.coaloperation.utils.toJsonString
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
/**
|
||||
* 回采首页列表
|
||||
*/
|
||||
class MiningActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityMiningBinding>(R.layout.activity_mining) {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MiningActivity"
|
||||
}
|
||||
|
||||
private val workingFaceViewModel: MiningWorkingFaceViewModel by lazy {
|
||||
ViewModelProvider(this)[MiningWorkingFaceViewModel::class.java]
|
||||
}
|
||||
private val workingFaceRecordViewModel: MiningWorkingFaceRecordViewModel by lazy {
|
||||
ViewModelProvider(this)[MiningWorkingFaceRecordViewModel::class.java]
|
||||
}
|
||||
private val workingFaceList = mutableListOf<MiningWorkingFaceEntity>()
|
||||
|
||||
private val workingFaceAdapter: MiningWorkingFaceAdapter by lazy {
|
||||
MiningWorkingFaceAdapter(workingFaceList).apply {
|
||||
setOnItemChildClickListener { _, view, position ->
|
||||
if (view.id == R.id.llWorkingFace) {
|
||||
toActivity(MiningFaceStatisticsActivity::class.java, Bundle().apply {
|
||||
putParcelable(
|
||||
WorkingFaceStatisticsActivity.FACE_DETAIL,
|
||||
workingFaceList[position]
|
||||
)
|
||||
})
|
||||
return@setOnItemChildClickListener
|
||||
}
|
||||
if (view.id == R.id.ivExpandRecord) {
|
||||
val expandState = view.tag.toString().toBooleanStrictOrNull() ?: false
|
||||
workingFaceList[position].isExpandRecord = expandState.not()
|
||||
if (workingFaceList[position].isExpandRecord) {
|
||||
getFaceRecord(position)
|
||||
} else {
|
||||
notifyItemChanged(position)
|
||||
}
|
||||
return@setOnItemChildClickListener
|
||||
}
|
||||
if (view.id == R.id.start_record) {
|
||||
toActivity(MiningFaceRecordActivity::class.java, Bundle().apply {
|
||||
putString(
|
||||
MiningFaceRecordActivity.WORK_RECORD_TYPE,
|
||||
MiningFaceRecordActivity.WorkRecordType.ADD.name
|
||||
)
|
||||
putLong(
|
||||
MiningFaceRecordActivity.FACE_ID,
|
||||
workingFaceList[position].surfaceId
|
||||
)
|
||||
putString(
|
||||
MiningFaceRecordActivity.FACE_NAME,
|
||||
workingFaceList[position].surfaceName
|
||||
)
|
||||
putInt(AddWorkingFaceRecordActivity.SHOW_TYPE, 0)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "回采上报"
|
||||
mBinding.toolbarLay.rightText = "新增工作面"
|
||||
mBinding.rvMiningList.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = workingFaceAdapter
|
||||
}
|
||||
val surfaceId01 = System.currentTimeMillis()
|
||||
val surfaceId02 = System.currentTimeMillis()
|
||||
val surfaceId03 = System.currentTimeMillis()
|
||||
val recordList = mutableListOf<MiningWorkingFaceRecordEntity>()
|
||||
recordList.add(
|
||||
MiningWorkingFaceRecordEntity(
|
||||
recordId = System.currentTimeMillis(),
|
||||
surfaceId = surfaceId01,
|
||||
recordPerson = "张三",
|
||||
workingDate = "2025-09-19 10:50:15"
|
||||
)
|
||||
)
|
||||
recordList.add(
|
||||
MiningWorkingFaceRecordEntity(
|
||||
recordId = System.currentTimeMillis(),
|
||||
surfaceId = surfaceId01,
|
||||
recordPerson = "李四",
|
||||
workingDate = "2025-09-19 15:10:39"
|
||||
)
|
||||
)
|
||||
workingFaceList.add(
|
||||
MiningWorkingFaceEntity(
|
||||
surfaceId = surfaceId01,
|
||||
surfaceName = "250919回采工作面",
|
||||
totalFootage = "256",
|
||||
createTime = "2025-09-19 10:27:43",
|
||||
records = recordList
|
||||
)
|
||||
)
|
||||
workingFaceList.add(
|
||||
MiningWorkingFaceEntity(
|
||||
surfaceId = surfaceId02,
|
||||
surfaceName = "250901回采工作面",
|
||||
totalFootage = "256",
|
||||
createTime = "2025-09-01 08:20:43"
|
||||
)
|
||||
)
|
||||
workingFaceList.add(
|
||||
MiningWorkingFaceEntity(
|
||||
surfaceId = surfaceId03,
|
||||
surfaceName = "250810回采工作面",
|
||||
totalFootage = "256",
|
||||
createTime = "2025-09-19 09:09:03"
|
||||
)
|
||||
)
|
||||
workingFaceAdapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
val userId = SpTool.getString(SpTool.USER_ID)
|
||||
workingFaceViewModel.getEntityListByUserId(userId)
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
toActivity(AddMiningFaceActivity::class.java, Bundle().apply {
|
||||
putString(WORK_FACE_TYPE, WorkFaceType.ADD.name)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun getFaceRecord(position: Int) {
|
||||
workingFaceAdapter.notifyItemChanged(position)
|
||||
// val surfaceId = workingFaceList[position].surfaceId
|
||||
// workingFaceRecordViewModel.getEntityList(surfaceId) { recordEntities ->
|
||||
// if (recordEntities.isNullOrEmpty()) {
|
||||
// workingFaceAdapter.notifyItemChanged(position)
|
||||
// return@getEntityList
|
||||
// }
|
||||
// val recordAdapter = getRecordAdapter(position)
|
||||
// recordAdapter.apply {
|
||||
// list.clear()
|
||||
//// list.add(FACE_RECORD_HEADER)
|
||||
// list.addAll(recordEntities)
|
||||
// notifyDataSetChanged()
|
||||
// }
|
||||
// workingFaceAdapter.notifyItemChanged(position)
|
||||
// }
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onWorkingFaceEvent(event: MiningWorkingFaceEntity) {
|
||||
val index = workingFaceList.indexOfFirst { it.surfaceId == event.surfaceId }
|
||||
if (index == -1) {
|
||||
//新增工作面
|
||||
val insertIndex = 0
|
||||
workingFaceList.add(0, event)
|
||||
workingFaceAdapter.notifyItemInserted(insertIndex)
|
||||
workingFaceAdapter.notifyItemRangeChanged(insertIndex, insertIndex + 1)
|
||||
return
|
||||
}
|
||||
//修改工作面
|
||||
// workingFaceViewModel.getEntityById(event.surfaceId) { entity ->
|
||||
// workingFaceList[index] = entity
|
||||
// workingFaceAdapter.notifyItemChanged(index)
|
||||
// }
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onFaceRecordEvent(event: MiningWorkingFaceRecordEntity) {
|
||||
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(0, event)
|
||||
} else {
|
||||
records[index] = event
|
||||
}
|
||||
}
|
||||
val recordAdapter = getRecordAdapter(position)
|
||||
recordAdapter.notifyDataSetChanged()
|
||||
|
||||
workingFaceAdapter.notifyItemChanged(position)
|
||||
}
|
||||
|
||||
@SuppressLint("SuspiciousIndentation")
|
||||
private fun getRecordAdapter(position: Int): MiningWorkingFaceRecordAdapter {
|
||||
val viewHolder =
|
||||
mBinding.rvMiningList.findViewHolderForLayoutPosition(position) as MiningWorkingFaceAdapter.VH
|
||||
return viewHolder.binding.rvFaceRecord.adapter as MiningWorkingFaceRecordAdapter
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
launch {
|
||||
workingFaceViewModel.faceList.collectLatest {
|
||||
Log.d(TAG, "createObserve: ${it.toJsonString()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.mining.activity
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.adapter.TunnelWorkingItemAdapter
|
||||
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||
import com.zmkg.coaloperation.databinding.ActivityMiningFaceDetailBinding
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
/**
|
||||
* 工作面详情
|
||||
*/
|
||||
class MiningFaceDetailActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityMiningFaceDetailBinding>(R.layout.activity_mining_face_detail) {
|
||||
companion object {
|
||||
const val FACE_WORK_DETAIL_DATA = "MiningFaceDetailActivity"
|
||||
}
|
||||
|
||||
private val list: MutableList<TunnelWorkingItem> = mutableListOf()
|
||||
|
||||
// private var detail:FaceWorkDetailBean?=null
|
||||
private var detail: MiningWorkingFaceEntity? = null
|
||||
private val adapter by lazy {
|
||||
TunnelWorkingItemAdapter(list)
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.vLine.visibility = View.GONE
|
||||
mBinding.toolbarLay.rightText = "修改"
|
||||
|
||||
mBinding.rvFaceList.let {
|
||||
it.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||
it.adapter = adapter
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
detail = intent.getParcelableExtra(FACE_WORK_DETAIL_DATA)
|
||||
detail?.let {
|
||||
loadFaceDetail(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
toActivity(AddMiningFaceActivity::class.java, Bundle().apply {
|
||||
putString(AddMiningFaceActivity.WORK_FACE_TYPE, AddMiningFaceActivity.WorkFaceType.EDIT.name)
|
||||
putParcelable(AddMiningFaceActivity.FACE_WORK_DETAIL_DATA, detail)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun loadFaceDetail(it: MiningWorkingFaceEntity) {
|
||||
mBinding.toolbarLay.title = it.surfaceName
|
||||
list.clear()
|
||||
list.add(TunnelWorkingItem(name = "工作面名称", value = it.surfaceName))
|
||||
list.add(TunnelWorkingItem(name = "水平", value = "水平"))
|
||||
list.add(TunnelWorkingItem(name = "煤层", value = "煤层"))
|
||||
list.add(TunnelWorkingItem(name = "采区", value = "采区"))
|
||||
list.add(TunnelWorkingItem(name = "储量", value = "储量"))
|
||||
list.add(TunnelWorkingItem(name = "胶带巷安全出口宽度", value = "宽度"))
|
||||
list.add(TunnelWorkingItem(name = "回风巷安全出口宽度", value = "宽度"))
|
||||
list.add(TunnelWorkingItem(name = "走向长度", value = "长度"))
|
||||
list.add(TunnelWorkingItem(name = "倾向长度", value = "长度"))
|
||||
list.add(TunnelWorkingItem(name = "胶带巷长度", value = "长度"))
|
||||
list.add(TunnelWorkingItem(name = "回风巷长度", value = "长度"))
|
||||
list.add(TunnelWorkingItem(name = "切眼长度", value = "长度"))
|
||||
list.add(TunnelWorkingItem(name = "平均煤厚", value = "煤厚"))
|
||||
list.add(TunnelWorkingItem(name = "平均煤厚", value = "容积"))
|
||||
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onWorkingFaceEvent(event: MiningWorkingFaceEntity) {
|
||||
detail = event
|
||||
detail?.let {
|
||||
loadFaceDetail(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
-184
@@ -1,184 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.mining.activity
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.MiningRecordBaseDataAdapter
|
||||
import com.zmkg.coaloperation.adapter.MiningRecordCoalThicknessAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.AddMiningFaceItem
|
||||
import com.zmkg.coaloperation.bean.CoalThicknessItem
|
||||
import com.zmkg.coaloperation.bean.WorkOption
|
||||
import com.zmkg.coaloperation.databinding.ActivityMiningFaceRecordBinding
|
||||
import com.zmkg.coaloperation.utils.PickerUtil
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
class MiningFaceRecordActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityMiningFaceRecordBinding>(R.layout.activity_mining_face_record) {
|
||||
companion object {
|
||||
const val TAG = "MiningFaceRecordActivity"
|
||||
const val SHOW_TYPE = "showType"
|
||||
const val WORK_RECORD_TYPE = "workRecordType"
|
||||
const val FACE_NAME = "faceName"
|
||||
const val FACE_ID = "faceId"
|
||||
const val FACE_RECORD = "faceRecord"
|
||||
}
|
||||
|
||||
enum class WorkRecordType {
|
||||
ADD,//新增
|
||||
|
||||
EDIT,//修改
|
||||
|
||||
SEE//查看
|
||||
}
|
||||
|
||||
private var currentRecordType = WorkRecordType.ADD
|
||||
private val baseDataList: MutableList<AddMiningFaceItem> = mutableListOf()
|
||||
private val coalThicknessList: MutableList<CoalThicknessItem> = mutableListOf()
|
||||
|
||||
private val baseDataAdapter by lazy {
|
||||
MiningRecordBaseDataAdapter(baseDataList)
|
||||
}
|
||||
|
||||
private val coalThicknessAdapter by lazy {
|
||||
MiningRecordCoalThicknessAdapter(coalThicknessList).apply {
|
||||
addChildClickViewIds(R.id.btnAddPoint)
|
||||
setOnItemChildClickListener { adapter, view, position ->
|
||||
if (view.id == R.id.btnAddPoint) {
|
||||
coalThicknessList.add(CoalThicknessItem())
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.rvBaseData.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = baseDataAdapter
|
||||
}
|
||||
mBinding.rvCoalThickness.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = coalThicknessAdapter
|
||||
}
|
||||
val stringExtra = intent.getStringExtra(WORK_RECORD_TYPE)
|
||||
if (TextUtils.isEmpty(stringExtra)) {
|
||||
stringExtra == AddMiningFaceActivity.WorkFaceType.ADD.name
|
||||
}
|
||||
when (stringExtra) {
|
||||
WorkRecordType.ADD.name -> {
|
||||
currentRecordType = WorkRecordType.ADD
|
||||
mBinding.toolbarLay.title = "开始记录"
|
||||
mBinding.btnSaveRecord.text = "保存"
|
||||
mBinding.btnSaveRecord.visible()
|
||||
initAddRecord()
|
||||
}
|
||||
|
||||
WorkRecordType.EDIT.name -> {
|
||||
currentRecordType = WorkRecordType.EDIT
|
||||
mBinding.toolbarLay.title = "修改记录"
|
||||
mBinding.btnSaveRecord.text = "修改"
|
||||
mBinding.btnSaveRecord.visible()
|
||||
// detail =
|
||||
// intent.getParcelableExtra(WorkingFaceDetailActivity.Companion.FACE_WORK_DETAIL_DATA) as MiningWorkingFaceEntity?
|
||||
// if (faceDetail == null) {
|
||||
// showToast("未查询到记录数据")
|
||||
// return
|
||||
// }
|
||||
initEditRecord()
|
||||
}
|
||||
|
||||
WorkRecordType.SEE.name -> {
|
||||
currentRecordType = WorkRecordType.SEE
|
||||
mBinding.toolbarLay.title = "查看详情"
|
||||
mBinding.toolbarLay.rightText = "修改"
|
||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
toActivity(MiningFaceRecordActivity::class.java, Bundle().apply {
|
||||
putString(WORK_RECORD_TYPE, WorkRecordType.EDIT.name)
|
||||
// putParcelable(FACE_RECORD, faceRecord)
|
||||
})
|
||||
}
|
||||
mBinding.btnSaveRecord.gone()
|
||||
initRecordDetail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
val waterOutflowList: MutableList<WorkOption> = mutableListOf()
|
||||
waterOutflowList.add(WorkOption(id = "0", name = "是"))
|
||||
waterOutflowList.add(WorkOption(id = "1", name = "否"))
|
||||
val tvWaterOutflow = mBinding.tvWaterOutflow
|
||||
tvWaterOutflow.setOnClickListener { v ->
|
||||
PickerUtil.showOptionPicker(this, "请选择是否出水", waterOutflowList) { option ->
|
||||
tvWaterOutflow.text = option.name
|
||||
tvWaterOutflow.tag = option.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
|
||||
}
|
||||
|
||||
private fun initAddRecord() {
|
||||
baseDataList.run {
|
||||
add(AddMiningFaceItem(funcName = "当班进尺"))
|
||||
add(AddMiningFaceItem(funcName = "胶运巷回采位置"))
|
||||
add(AddMiningFaceItem(funcName = "回风巷回采位置"))
|
||||
add(AddMiningFaceItem(funcName = "出煤量"))
|
||||
}
|
||||
baseDataAdapter.notifyDataSetChanged()
|
||||
|
||||
coalThicknessList.run {
|
||||
add(CoalThicknessItem())
|
||||
add(CoalThicknessItem())
|
||||
add(CoalThicknessItem())
|
||||
}
|
||||
coalThicknessAdapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
private fun initEditRecord() {
|
||||
baseDataList.run {
|
||||
add(AddMiningFaceItem(funcName = "当班进尺"))
|
||||
add(AddMiningFaceItem(funcName = "胶运巷回采位置"))
|
||||
add(AddMiningFaceItem(funcName = "回风巷回采位置"))
|
||||
add(AddMiningFaceItem(funcName = "出煤量"))
|
||||
}
|
||||
baseDataAdapter.notifyDataSetChanged()
|
||||
|
||||
coalThicknessList.run {
|
||||
add(CoalThicknessItem())
|
||||
add(CoalThicknessItem())
|
||||
add(CoalThicknessItem())
|
||||
}
|
||||
coalThicknessAdapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
private fun initRecordDetail() {
|
||||
baseDataList.run {
|
||||
add(AddMiningFaceItem(funcName = "当班进尺"))
|
||||
add(AddMiningFaceItem(funcName = "胶运巷回采位置"))
|
||||
add(AddMiningFaceItem(funcName = "回风巷回采位置"))
|
||||
add(AddMiningFaceItem(funcName = "出煤量"))
|
||||
}
|
||||
baseDataAdapter.notifyDataSetChanged()
|
||||
|
||||
coalThicknessList.run {
|
||||
add(CoalThicknessItem())
|
||||
add(CoalThicknessItem())
|
||||
add(CoalThicknessItem())
|
||||
}
|
||||
coalThicknessAdapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
-225
@@ -1,225 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.mining.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.graphics.toColorInt
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.TunnelWorkingItemAdapter
|
||||
import com.zmkg.coaloperation.adapter.common.DisasterAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||
import com.zmkg.coaloperation.databinding.ActivityMiningFaceStatisticsBinding
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.roundedOneDecimalPlace
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* 工作面详情
|
||||
*/
|
||||
class MiningFaceStatisticsActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityMiningFaceStatisticsBinding>(R.layout.activity_mining_face_statistics) {
|
||||
|
||||
companion object {
|
||||
const val TAG = "MiningFaceStatisticsActivity"
|
||||
const val FACE_DETAIL = "faceDetail"
|
||||
}
|
||||
|
||||
// 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: MiningWorkingFaceEntity? = null
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.rightText = "查看详情"
|
||||
mBinding.toolbarLay.vLine.visibility = View.GONE
|
||||
// mBinding.rvRockNature.adapter = tunnelingRockNatureAdapter
|
||||
|
||||
mBinding.arcViewGreen.let {
|
||||
it.arcColor = "#30E0A1".toColorInt()
|
||||
it.startAngle = 0f
|
||||
it.sweepAngle = 360f
|
||||
it.strokeWidth = 12f
|
||||
it.radius = ScreenUtil.dp2px(122f - 12f) / 2f
|
||||
}
|
||||
|
||||
mBinding.arcViewRed.let {
|
||||
it.arcColor = "#FA2256".toColorInt()
|
||||
it.startAngle = -90f
|
||||
it.strokeWidth = 10f
|
||||
it.sweepAngle = 0f
|
||||
it.radius = ScreenUtil.dp2px(100f - 10f) / 2f
|
||||
}
|
||||
|
||||
mBinding.arcViewBlue.let {
|
||||
it.arcColor = "#246CF9".toColorInt()
|
||||
it.startAngle = -90f
|
||||
it.strokeWidth = 10f
|
||||
it.sweepAngle = 0f
|
||||
it.radius = ScreenUtil.dp2px(80f - 10f) / 2f
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
// val surfaceId = intent.getStringExtra("surfaceId")
|
||||
// if (TextUtils.isEmpty(surfaceId)) {
|
||||
// finish()
|
||||
// } else {
|
||||
// mViewModel.getTunnelingSurfaceDetail(surfaceId)
|
||||
// }
|
||||
faceDetail = intent.getParcelableExtra(FACE_DETAIL)
|
||||
|
||||
faceDetail?.let { detail ->
|
||||
loadFaceDetail()
|
||||
// workingFaceRecordViewModel.getLastEntity(detail.surfaceId) { record ->
|
||||
// record?.let {
|
||||
// mBinding.tvYesterdayLen.text = "${it.workingFootage?.formatDecimalString()}m"
|
||||
// mBinding.tvWorkingFaceAngle.text = "${it.seamDip?.formatDecimalString()}°"
|
||||
//// mBinding.tvMonthAccumulateLen.text = "${it.monthFootage}m"
|
||||
// mBinding.tvWorkingFaceWater.text = "${it.waterYield?.formatDecimalString()}"
|
||||
//
|
||||
// roofLithologyViewModel.getEntityList(it.recordId) { list ->
|
||||
// list?.let {
|
||||
// lithologyList.addAll(it)
|
||||
// tunnelingRockNatureAdapter.notifyDataSetChanged()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
toActivity(MiningFaceDetailActivity::class.java, Bundle().apply {
|
||||
putParcelable(MiningFaceDetailActivity.FACE_WORK_DETAIL_DATA, faceDetail)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
}
|
||||
|
||||
private fun stringToDouble(numText: String?): Double {
|
||||
if (numText.isNullOrEmpty() || numText.isBlank()) return 0.toDouble()
|
||||
return numText.toDouble()
|
||||
}
|
||||
|
||||
private fun loadFaceDetail() {
|
||||
val bean = faceDetail!!
|
||||
mBinding.apply {
|
||||
toolbarLay.title = bean.surfaceName
|
||||
bean.totalFootage = "6000"
|
||||
bean.accumulativeFootage = "1400.3"
|
||||
|
||||
val total = stringToDouble(bean.totalFootage)
|
||||
val accumulative = stringToDouble(bean.accumulativeFootage)
|
||||
val remaining = total - accumulative
|
||||
// val remaining = stringToDouble(bean.remainingFootage)
|
||||
bean.remainingFootage = "${remaining.roundedOneDecimalPlace()}"
|
||||
|
||||
tvLenTotal.text = "总进尺:${bean.totalFootage?.formatDecimalString()}/吨"
|
||||
tvLenAccumulate.text = "累计进尺:${bean.accumulativeFootage?.formatDecimalString()}/吨"
|
||||
tvLenRemain.text = "剩余进尺:${bean.remainingFootage?.formatDecimalString()}/吨"
|
||||
|
||||
//累计进尺占比
|
||||
var radio = 0
|
||||
|
||||
//累计进尺圆圈占比
|
||||
var arcViewRadio: Float
|
||||
|
||||
if (accumulative >= total) {
|
||||
radio = 100
|
||||
arcViewRadio = 360F
|
||||
} else if (accumulative <= 0) {
|
||||
radio = 0
|
||||
arcViewRadio = 0F
|
||||
} else {
|
||||
arcViewRadio = (accumulative * 100F / total).toFloat()
|
||||
radio = arcViewRadio.roundToInt()
|
||||
}
|
||||
|
||||
arcViewRed.let {
|
||||
it.sweepAngle = arcViewRadio
|
||||
}
|
||||
|
||||
arcViewBlue.let {
|
||||
it.sweepAngle = (360F - arcViewRadio)
|
||||
//* -1F
|
||||
}
|
||||
|
||||
|
||||
mBinding.tvCompleteRate.text = "$radio%"
|
||||
|
||||
// tvYesterdayLen.text = "${bean?.yesterdayFootage}m"
|
||||
// tvWorkingFaceAngle.text = "${bean?.latestRecord?.seamDip.orEmptyDefaultInt()}"
|
||||
// tvMonthAccumulateLen.text = "${bean?.monthFootage}m"
|
||||
// tvWorkingFaceWater.text = "${bean?.latestRecord?.waterYield.orEmptyDefaultInt()}m"
|
||||
|
||||
// val list = bean?.latestRecord?.mineWorkingLithologyList
|
||||
// if (list.isNullOrEmpty()) {
|
||||
// tvYesterdayRockType.visibility = View.GONE
|
||||
// } else {
|
||||
// tvYesterdayRockType.visibility = View.VISIBLE
|
||||
// tunnelingRockNatureAdapter.setNewInstance(list)
|
||||
// }
|
||||
|
||||
}
|
||||
val workingItemList = mutableListOf<TunnelWorkingItem>()
|
||||
workingItemList.add(TunnelWorkingItem(name = "昨日进尺", value = "123"))
|
||||
workingItemList.add(TunnelWorkingItem(name = "出煤量", value = "12"))
|
||||
workingItemList.add(TunnelWorkingItem(name = "胶运巷回采位置", value = "3"))
|
||||
workingItemList.add(TunnelWorkingItem(name = "胶运巷安全出口宽度", value = "23"))
|
||||
workingItemList.add(TunnelWorkingItem(name = "回风巷回采位置", value = "5"))
|
||||
workingItemList.add(TunnelWorkingItem(name = "回风巷安全出口宽度", value = "56"))
|
||||
mBinding.rvBaseList.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = TunnelWorkingItemAdapter(workingItemList)
|
||||
}
|
||||
|
||||
val disasterList = mutableListOf<TunnelWorkingItem>()
|
||||
disasterList.add(TunnelWorkingItem(name = "AAA", value = "80"))
|
||||
disasterList.add(TunnelWorkingItem(name = "BBB", value = "50"))
|
||||
disasterList.add(TunnelWorkingItem(name = "CCC", value = "135"))
|
||||
mBinding.rvDisasterList.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = DisasterAdapter(disasterList)
|
||||
}
|
||||
|
||||
mBinding.included.let {
|
||||
it.tvItemName.text="回采工作面涌水量"
|
||||
it.tvItemValue.text="3.6m³/h"
|
||||
it.divider.gone()
|
||||
it.root.setBackgroundResource(R.drawable.bg_stroke_gray)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onWorkingFaceEvent(event: MiningWorkingFaceEntity) {
|
||||
faceDetail = event
|
||||
loadFaceDetail()
|
||||
}
|
||||
|
||||
}
|
||||
+123
-123
@@ -1,123 +1,123 @@
|
||||
//package com.zmkg.coaloperation.ui.report.adapter
|
||||
//
|
||||
//import android.view.View
|
||||
//import com.chad.library.adapter.base.module.LoadMoreModule
|
||||
//import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
||||
//import com.zmkg.coaloperation.R
|
||||
//import com.zmkg.coaloperation.adapter.common.BaseDataBindingAdapter
|
||||
//import com.zmkg.coaloperation.bean.ImageBean
|
||||
//import com.zmkg.coaloperation.databinding.ItemRecycleImageBinding
|
||||
//import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||
//import java.io.File
|
||||
//
|
||||
//class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter<ImageBean, ItemRecycleImageBinding>(
|
||||
// R.layout.item_recycle_image
|
||||
//), LoadMoreModule {
|
||||
// private var isEditModel = false
|
||||
// private var editImageShow = false
|
||||
// override fun bindViewClickListener(
|
||||
// viewHolder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
// viewType: Int
|
||||
// ) {
|
||||
// addChildClickViewIds(R.id.btn_delete)
|
||||
// super.bindViewClickListener(viewHolder, viewType)
|
||||
// }
|
||||
// override fun convert(
|
||||
// holder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
// item: ImageBean
|
||||
// ) {
|
||||
// val mBinding = holder.dataBinding
|
||||
// mBinding?.let {
|
||||
// if(item.isAddButton){
|
||||
// mBinding.ivImage.setImageResource(R.mipmap.upload)
|
||||
// mBinding.btnDelete.visibility = View.GONE
|
||||
// }else{
|
||||
// if(item.isFilePath){
|
||||
// mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f)
|
||||
// }else{
|
||||
// mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default)
|
||||
// }
|
||||
// if(isEditModel){
|
||||
// mBinding.btnDelete.visibility = View.VISIBLE
|
||||
// }else{
|
||||
// mBinding.btnDelete.visibility = View.GONE
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// fun isEditModel(isEdit: Boolean){
|
||||
// isEditModel = isEdit
|
||||
// notifyDataSetChanged()
|
||||
// if(isEditModel && !editImageShow){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun setList(list: Collection<ImageBean>?) {
|
||||
// super.setList(list)
|
||||
// if(isEditModel){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
// override fun setNewInstance(list: MutableList<ImageBean>?) {
|
||||
// super.setNewInstance(list)
|
||||
// if(isEditModel){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun addData(newData: Collection<ImageBean>) {
|
||||
// if(isEditModel){
|
||||
// if(editImageShow){
|
||||
// var lastPosition = data.size - 1
|
||||
// if(lastPosition < 0){
|
||||
// lastPosition = 0
|
||||
// }
|
||||
// addData(lastPosition, newData)
|
||||
// }else{
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// if(data.size > maxNum){
|
||||
// showAddButton(false)
|
||||
// }
|
||||
// }else{
|
||||
// super.addData(newData)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun removeAt(position: Int) {
|
||||
// super.removeAt(position)
|
||||
// if(isEditModel && !editImageShow){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
// fun getImageList(): MutableList<ImageBean>{
|
||||
// var list = mutableListOf<ImageBean>()
|
||||
// data.forEach { imageBean ->
|
||||
// if(!imageBean.isAddButton){
|
||||
// list.add(imageBean)
|
||||
// }
|
||||
// }
|
||||
// return list
|
||||
// }
|
||||
// fun getImageSize(): Int {
|
||||
// if(isEditModel && editImageShow){
|
||||
// return getDefItemCount() - 1
|
||||
// }
|
||||
// return getDefItemCount()
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 显示添加图片按钮
|
||||
// * @param isShow true为显示 false为隐藏
|
||||
// */
|
||||
// private fun showAddButton(isShow: Boolean){
|
||||
// editImageShow = if(isShow){
|
||||
// addData(ImageBean(isAddButton = true))
|
||||
// true
|
||||
// }else{
|
||||
// removeAt(data.size-1)
|
||||
// false
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
package com.zmkg.coaloperation.ui.report.adapter
|
||||
|
||||
import android.view.View
|
||||
import com.chad.library.adapter.base.module.LoadMoreModule
|
||||
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.common.BaseDataBindingAdapter
|
||||
import com.zmkg.coaloperation.bean.ImageBean
|
||||
import com.zmkg.coaloperation.databinding.ItemRecycleImageBinding
|
||||
import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||
import java.io.File
|
||||
|
||||
class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter<ImageBean, ItemRecycleImageBinding>(
|
||||
R.layout.item_recycle_image
|
||||
), LoadMoreModule {
|
||||
private var isEditModel = false
|
||||
private var editImageShow = false
|
||||
override fun bindViewClickListener(
|
||||
viewHolder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
viewType: Int
|
||||
) {
|
||||
addChildClickViewIds(R.id.btn_delete)
|
||||
super.bindViewClickListener(viewHolder, viewType)
|
||||
}
|
||||
override fun convert(
|
||||
holder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
item: ImageBean
|
||||
) {
|
||||
val mBinding = holder.dataBinding
|
||||
mBinding?.let {
|
||||
if(item.isAddButton){
|
||||
mBinding.ivImage.setImageResource(R.mipmap.upload)
|
||||
mBinding.btnDelete.visibility = View.GONE
|
||||
}else{
|
||||
if(item.isFilePath){
|
||||
mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f)
|
||||
}else{
|
||||
mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default)
|
||||
}
|
||||
if(isEditModel){
|
||||
mBinding.btnDelete.visibility = View.VISIBLE
|
||||
}else{
|
||||
mBinding.btnDelete.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun isEditModel(isEdit: Boolean){
|
||||
isEditModel = isEdit
|
||||
notifyDataSetChanged()
|
||||
if(isEditModel && !editImageShow){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setList(list: Collection<ImageBean>?) {
|
||||
super.setList(list)
|
||||
if(isEditModel){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
override fun setNewInstance(list: MutableList<ImageBean>?) {
|
||||
super.setNewInstance(list)
|
||||
if(isEditModel){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun addData(newData: Collection<ImageBean>) {
|
||||
if(isEditModel){
|
||||
if(editImageShow){
|
||||
var lastPosition = data.size - 1
|
||||
if(lastPosition < 0){
|
||||
lastPosition = 0
|
||||
}
|
||||
addData(lastPosition, newData)
|
||||
}else{
|
||||
showAddButton(true)
|
||||
}
|
||||
if(data.size > maxNum){
|
||||
showAddButton(false)
|
||||
}
|
||||
}else{
|
||||
super.addData(newData)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeAt(position: Int) {
|
||||
super.removeAt(position)
|
||||
if(isEditModel && !editImageShow){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
fun getImageList(): MutableList<ImageBean>{
|
||||
var list = mutableListOf<ImageBean>()
|
||||
data.forEach { imageBean ->
|
||||
if(!imageBean.isAddButton){
|
||||
list.add(imageBean)
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
fun getImageSize(): Int {
|
||||
if(isEditModel && editImageShow){
|
||||
return getDefItemCount() - 1
|
||||
}
|
||||
return getDefItemCount()
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示添加图片按钮
|
||||
* @param isShow true为显示 false为隐藏
|
||||
*/
|
||||
private fun showAddButton(isShow: Boolean){
|
||||
editImageShow = if(isShow){
|
||||
addData(ImageBean(isAddButton = true))
|
||||
true
|
||||
}else{
|
||||
removeAt(data.size-1)
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
-79
@@ -1,79 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.report.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.ReportAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.bean.CommonImageBean
|
||||
import com.zmkg.coaloperation.bean.ReportItem
|
||||
import com.zmkg.coaloperation.databinding.FragmentReport2Binding
|
||||
import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
|
||||
class Report2Fragment :
|
||||
BaseVMBFragment<ReportViewModel, FragmentReport2Binding>(R.layout.fragment_report2) {
|
||||
|
||||
lateinit var pageStatus: PageStatus
|
||||
|
||||
enum class PageStatus(val status: Int) {
|
||||
ADD(1),
|
||||
EDIT(2),
|
||||
SEE(3),
|
||||
NO_EDIT(4)
|
||||
}
|
||||
|
||||
private val reportItemList = mutableListOf(
|
||||
ReportItem(viewType = 2, name = "上报类型"),
|
||||
ReportItem(viewType = 2, name = "上报区域"),
|
||||
ReportItem(viewType = 1, name = "上报地点", isSingleLine = true, inputHint = "请输入"),
|
||||
ReportItem(viewType = 1, name = "上报描述", isSingleLine = true, inputHint = "请输入"),
|
||||
ReportItem(viewType = 3, name = "上报时间"),
|
||||
ReportItem(viewType = 2, name = "处理状态"),
|
||||
ReportItem(viewType = 2, name = "上报人"),
|
||||
ReportItem(viewType = 2, name = "处理人"),
|
||||
ReportItem(viewType = 1, name = "处理策略", isSingleLine = false, inputShowLines = 4, inputHint = "请输入"),
|
||||
ReportItem(viewType = 1, name = "处理结果", isSingleLine = false, inputShowLines = 4, inputHint = "请输入"),
|
||||
ReportItem(viewType = 3, name = "处理时间"),
|
||||
ReportItem(viewType = 4, name = "上传图片", images = mutableListOf(
|
||||
CommonImageBean(isAddFlag = true)
|
||||
)),
|
||||
ReportItem(viewType = 1, name = "备注", isSingleLine = false, inputShowLines = 6 ,inputHint = "请输入备注信息,120字以内"),
|
||||
)
|
||||
private val reportAdapter by lazy {
|
||||
ReportAdapter(reportItemList)
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "新增临时上报"
|
||||
mBinding.toolbarLay.rightText = "查看记录"
|
||||
mBinding.toolbarLay.titleIvBack.gone()
|
||||
mBinding.toolbarLay.titleTvName.updateLayoutParams<RelativeLayout.LayoutParams> {
|
||||
leftMargin = 20.dp
|
||||
}
|
||||
mBinding.rvReport.let {
|
||||
it.layoutManager = LinearLayoutManager(it.context)
|
||||
it.adapter = reportAdapter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
}
|
||||
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
}
|
||||
|
||||
}
|
||||
+200
-204
@@ -1,204 +1,200 @@
|
||||
//package com.zmkg.coaloperation.ui.report.fragment
|
||||
//
|
||||
//import android.os.Bundle
|
||||
//import android.view.View
|
||||
//import androidx.core.view.ViewCompat
|
||||
//import androidx.lifecycle.Lifecycle
|
||||
//import androidx.lifecycle.lifecycleScope
|
||||
//import androidx.lifecycle.repeatOnLifecycle
|
||||
//import androidx.recyclerview.widget.GridLayoutManager
|
||||
//import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
//import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||
//import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
//import com.luck.picture.lib.basic.PictureSelectionModel
|
||||
//import com.luck.picture.lib.basic.PictureSelector
|
||||
//import com.luck.picture.lib.config.SelectMimeType
|
||||
//import com.luck.picture.lib.config.SelectModeConfig
|
||||
//import com.luck.picture.lib.entity.LocalMedia
|
||||
//import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
||||
//import com.luck.picture.lib.utils.SandboxTransformUtils
|
||||
//import com.zmkg.coaloperation.utils.pictureSelector.ImageFileCompressEngine
|
||||
//import com.zmkg.coaloperation.R
|
||||
//import com.zmkg.coaloperation.base.BaseActivity
|
||||
//import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
//import com.zmkg.coaloperation.bean.ImageBean
|
||||
//import com.zmkg.coaloperation.databinding.FragmentReportBinding
|
||||
//import com.zmkg.coaloperation.ui.report.adapter.ImageAdapter
|
||||
//import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||
//import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||
//import com.zmkg.coaloperation.utils.pictureSelector.GlideEngine
|
||||
//import kotlinx.coroutines.flow.collectLatest
|
||||
//import kotlinx.coroutines.launch
|
||||
//
|
||||
//class ReportFragment :
|
||||
// BaseVMBFragment<ReportViewModel, FragmentReportBinding>(R.layout.fragment_report),
|
||||
// OnItemClickListener, OnItemChildClickListener {
|
||||
//
|
||||
// private val imageAdapter by lazy { ImageAdapter(maxImageNum) }
|
||||
// lateinit var pageStatus: PageStatus
|
||||
//
|
||||
// companion object {
|
||||
// const val maxImageNum = 5
|
||||
// }
|
||||
//
|
||||
// override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
//
|
||||
// mBinding.apply {
|
||||
// val gridLayoutManager = GridLayoutManager(context, 3)
|
||||
// layInspectionReport.rvList.layoutManager = gridLayoutManager
|
||||
// imageAdapter.setOnItemClickListener(this@ReportFragment)
|
||||
// imageAdapter.setOnItemChildClickListener(this@ReportFragment)
|
||||
// mBinding.layInspectionReport.rvList.adapter = imageAdapter
|
||||
// ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
||||
// }
|
||||
//
|
||||
// setPageModel(PageStatus.ADD)
|
||||
//
|
||||
// }
|
||||
//
|
||||
// enum class PageStatus(val status: Int) {
|
||||
// ADD(1),
|
||||
// EDIT(2),
|
||||
// SEE(3),
|
||||
// NO_EDIT(4)
|
||||
// }
|
||||
//
|
||||
// private fun setPageModel(status: PageStatus) {
|
||||
// this.pageStatus = status
|
||||
// mBinding?.apply {
|
||||
// when (status) {
|
||||
// PageStatus.ADD -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(false)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PageStatus.EDIT -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(false)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// PageStatus.SEE -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PageStatus.NO_EDIT -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(true)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// override fun bindEvent() {
|
||||
// }
|
||||
//
|
||||
// override fun onClick(v: View?) {
|
||||
// }
|
||||
//
|
||||
// override fun transparentStatusBar(): Boolean {
|
||||
// return true
|
||||
// }
|
||||
//
|
||||
// override fun createObserve() {
|
||||
// super.createObserve()
|
||||
// lifecycleScope.launch {
|
||||
// repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
// mViewModel.noEdit.collectLatest { noEdit ->
|
||||
// mBinding.apply {
|
||||
// imageAdapter.isEditModel(!noEdit)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
// val imageBean: ImageBean = adapter.getItem(position) as ImageBean
|
||||
// imageBean?.let { it ->
|
||||
// if (it.isAddButton) {
|
||||
// StorageUtils.requestPermission(context as BaseActivity) {
|
||||
// initPictureSelectorModel()
|
||||
// .forResult(object : OnResultCallbackListener<LocalMedia?> {
|
||||
// override fun onResult(result: ArrayList<LocalMedia?>?) {
|
||||
// result?.let { list ->
|
||||
// var resultList = localMediaToImageList(list)
|
||||
// imageAdapter.addData(resultList)
|
||||
// setImageNum(imageAdapter.getImageSize())
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onCancel() {}
|
||||
// })
|
||||
// }
|
||||
// } else {
|
||||
//// startFullScreenImageActivity(
|
||||
//// it.isFilePath,
|
||||
//// it.imageUrl
|
||||
//// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fun setImageNum(size: Int) {
|
||||
// mBinding.layInspectionReport.tvImageNum.text = getString(
|
||||
// R.string.image_list_num,
|
||||
// size,
|
||||
// maxImageNum
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// private fun initPictureSelectorModel(): PictureSelectionModel {
|
||||
// return PictureSelector.create(this)
|
||||
// .openGallery(SelectMimeType.TYPE_IMAGE)
|
||||
// .setSelectionMode(SelectModeConfig.MULTIPLE)
|
||||
// .setMaxSelectNum(maxImageNum - imageAdapter.getImageSize())
|
||||
// .setCompressEngine(ImageFileCompressEngine())
|
||||
// .setImageEngine(GlideEngine.createGlideEngine())
|
||||
// .setSandboxFileEngine { context, srcPath, mineType, call ->
|
||||
// if (call != null) {
|
||||
// var sandboxPath =
|
||||
// SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType)
|
||||
// call.onCallback(srcPath, sandboxPath)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
// adapter.removeAt(position)
|
||||
// }
|
||||
//
|
||||
// fun localMediaToImageList(result: ArrayList<LocalMedia?>): MutableList<ImageBean> {
|
||||
// var imageList = mutableListOf<ImageBean>()
|
||||
// var imageBean: ImageBean
|
||||
// result.forEach {
|
||||
// it?.let {
|
||||
// imageBean = ImageBean(getImagePath(it), true)
|
||||
// imageList.add(imageBean)
|
||||
// }
|
||||
// }
|
||||
// return imageList
|
||||
// }
|
||||
//
|
||||
// private fun getImagePath(localMedia: LocalMedia): String {
|
||||
// if (!localMedia.cutPath.isNullOrEmpty()) {
|
||||
// return localMedia.cutPath
|
||||
// }
|
||||
// if (!localMedia.compressPath.isNullOrEmpty()) {
|
||||
// return localMedia.compressPath
|
||||
// }
|
||||
// if (!localMedia.sandboxPath.isNullOrEmpty()) {
|
||||
// return localMedia.sandboxPath
|
||||
// }
|
||||
// return localMedia.path
|
||||
// }
|
||||
//}
|
||||
package com.zmkg.coaloperation.ui.report.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
import com.luck.picture.lib.basic.PictureSelectionModel
|
||||
import com.luck.picture.lib.basic.PictureSelector
|
||||
import com.luck.picture.lib.config.SelectMimeType
|
||||
import com.luck.picture.lib.config.SelectModeConfig
|
||||
import com.luck.picture.lib.entity.LocalMedia
|
||||
import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
||||
import com.luck.picture.lib.utils.SandboxTransformUtils
|
||||
import com.zmkg.coaloperation.utils.pictureSelector.ImageFileCompressEngine
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.bean.ImageBean
|
||||
import com.zmkg.coaloperation.databinding.FragmentReportBinding
|
||||
import com.zmkg.coaloperation.ui.report.adapter.ImageAdapter
|
||||
import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||
import com.zmkg.coaloperation.utils.pictureSelector.GlideEngine
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class ReportFragment :
|
||||
BaseVMBFragment<ReportViewModel, FragmentReportBinding>(R.layout.fragment_report),
|
||||
OnItemClickListener, OnItemChildClickListener {
|
||||
|
||||
private val imageAdapter by lazy { ImageAdapter(maxImageNum) }
|
||||
lateinit var pageStatus: PageStatus
|
||||
|
||||
companion object {
|
||||
const val maxImageNum = 5
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
|
||||
mBinding.apply {
|
||||
val gridLayoutManager = GridLayoutManager(context, 3)
|
||||
layInspectionReport.rvList.layoutManager = gridLayoutManager
|
||||
imageAdapter.setOnItemClickListener(this@ReportFragment)
|
||||
imageAdapter.setOnItemChildClickListener(this@ReportFragment)
|
||||
mBinding.layInspectionReport.rvList.adapter = imageAdapter
|
||||
ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
||||
}
|
||||
|
||||
setPageModel(PageStatus.ADD)
|
||||
|
||||
}
|
||||
|
||||
enum class PageStatus(val status: Int) {
|
||||
ADD(1),
|
||||
EDIT(2),
|
||||
SEE(3),
|
||||
NO_EDIT(4)
|
||||
}
|
||||
|
||||
private fun setPageModel(status: PageStatus) {
|
||||
this.pageStatus = status
|
||||
mBinding?.apply {
|
||||
when (status) {
|
||||
PageStatus.ADD -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(false)
|
||||
}
|
||||
}
|
||||
|
||||
PageStatus.EDIT -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PageStatus.SEE -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(true)
|
||||
}
|
||||
}
|
||||
|
||||
PageStatus.NO_EDIT -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
}
|
||||
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.noEdit.collectLatest { noEdit ->
|
||||
mBinding.apply {
|
||||
imageAdapter.isEditModel(!noEdit)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
val imageBean: ImageBean = adapter.getItem(position) as ImageBean
|
||||
imageBean?.let { it ->
|
||||
if (it.isAddButton) {
|
||||
initPictureSelectorModel()
|
||||
.forResult(object : OnResultCallbackListener<LocalMedia?> {
|
||||
override fun onResult(result: ArrayList<LocalMedia?>?) {
|
||||
result?.let { list ->
|
||||
var resultList = localMediaToImageList(list)
|
||||
imageAdapter.addData(resultList)
|
||||
setImageNum(imageAdapter.getImageSize())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancel() {}
|
||||
})
|
||||
} else {
|
||||
// startFullScreenImageActivity(
|
||||
// it.isFilePath,
|
||||
// it.imageUrl
|
||||
// )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setImageNum(size: Int) {
|
||||
mBinding.layInspectionReport.tvImageNum.text = getString(
|
||||
R.string.image_list_num,
|
||||
size,
|
||||
maxImageNum
|
||||
)
|
||||
}
|
||||
|
||||
private fun initPictureSelectorModel(): PictureSelectionModel {
|
||||
return PictureSelector.create(this)
|
||||
.openGallery(SelectMimeType.TYPE_IMAGE)
|
||||
.setSelectionMode(SelectModeConfig.MULTIPLE)
|
||||
.setMaxSelectNum(maxImageNum - imageAdapter.getImageSize())
|
||||
.setCompressEngine(ImageFileCompressEngine())
|
||||
.setImageEngine(GlideEngine.createGlideEngine())
|
||||
.setSandboxFileEngine { context, srcPath, mineType, call ->
|
||||
if (call != null) {
|
||||
var sandboxPath =
|
||||
SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType)
|
||||
call.onCallback(srcPath, sandboxPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
adapter.removeAt(position)
|
||||
}
|
||||
|
||||
fun localMediaToImageList(result: ArrayList<LocalMedia?>): MutableList<ImageBean> {
|
||||
var imageList = mutableListOf<ImageBean>()
|
||||
var imageBean: ImageBean
|
||||
result.forEach {
|
||||
it?.let {
|
||||
imageBean = ImageBean(getImagePath(it), true)
|
||||
imageList.add(imageBean)
|
||||
}
|
||||
}
|
||||
return imageList
|
||||
}
|
||||
|
||||
private fun getImagePath(localMedia: LocalMedia): String {
|
||||
if (!localMedia.cutPath.isNullOrEmpty()) {
|
||||
return localMedia.cutPath
|
||||
}
|
||||
if (!localMedia.compressPath.isNullOrEmpty()) {
|
||||
return localMedia.compressPath
|
||||
}
|
||||
if (!localMedia.sandboxPath.isNullOrEmpty()) {
|
||||
return localMedia.sandboxPath
|
||||
}
|
||||
return localMedia.path
|
||||
}
|
||||
}
|
||||
|
||||
+3
-13
@@ -193,7 +193,6 @@ class AddWorkingFaceRecordActivity :
|
||||
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
||||
it.seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
||||
it.seamHeight = mBinding.etSeamHeight.text.toString().trim().formatDecimalString()
|
||||
it.waterYield = mBinding.etWaterYield.text.toString().trim().formatDecimalString()
|
||||
it.recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||
|
||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||
@@ -219,10 +218,9 @@ class AddWorkingFaceRecordActivity :
|
||||
mBinding.tvWorkTeam.tag = it.teamId
|
||||
|
||||
mBinding.etTeamLeader.setText(it.teamLeader)
|
||||
mBinding.etWorkingFootage.setText(getShowNum2(it.workingFootage))
|
||||
mBinding.etSeamDip.setText(getShowNum2(it.seamDip))
|
||||
mBinding.etSeamHeight.setText(getShowNum2(it.seamHeight))
|
||||
mBinding.etWaterYield.setText(getShowNum2(it.waterYield))
|
||||
mBinding.etWorkingFootage.setText(it.workingFootage)
|
||||
mBinding.etSeamDip.setText(it.seamDip)
|
||||
mBinding.etSeamHeight.setText(it.seamHeight)
|
||||
mBinding.etRecordPerson.setText(it.recordPerson)
|
||||
}
|
||||
}
|
||||
@@ -240,7 +238,6 @@ class AddWorkingFaceRecordActivity :
|
||||
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
||||
it.seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
||||
it.seamHeight = mBinding.etSeamHeight.text.toString().trim().formatDecimalString()
|
||||
it.waterYield = mBinding.etWaterYield.text.toString().trim().formatDecimalString()
|
||||
it.recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||
|
||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||
@@ -314,13 +311,6 @@ class AddWorkingFaceRecordActivity :
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "煤层高", value = seamHeight))
|
||||
|
||||
val waterYield = mBinding.etWaterYield.text.toString().trim().formatDecimalString()
|
||||
if (waterYield.isBlank()) {
|
||||
showToast("请输入涌水量")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "涌水量", value = waterYield))
|
||||
|
||||
val recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||
if (recordPerson.isBlank()) {
|
||||
showToast("请输入填写人")
|
||||
|
||||
+6
-6
@@ -16,7 +16,6 @@ import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import com.zmkg.coaloperation.utils.SpTool
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
@@ -78,7 +77,7 @@ class TunnelingActivity :
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.rightText = "新增工作面"
|
||||
mBinding.rvTunnelingList.let {
|
||||
mBinding.rvList.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = workingFaceAdapter
|
||||
}
|
||||
@@ -86,10 +85,10 @@ class TunnelingActivity :
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
override fun initData() {
|
||||
val userId = SpTool.getString(SpTool.USER_ID)
|
||||
workingFaceViewModel.getEntityListByUserId(userId) { it ->
|
||||
DictUtils.initData()
|
||||
workingFaceViewModel.getEntityList { it ->
|
||||
if (it.isNullOrEmpty()) {
|
||||
return@getEntityListByUserId
|
||||
return@getEntityList
|
||||
}
|
||||
workingFaceList.clear()
|
||||
workingFaceList.addAll(it)
|
||||
@@ -100,6 +99,7 @@ class TunnelingActivity :
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ class TunnelingActivity :
|
||||
@SuppressLint("SuspiciousIndentation")
|
||||
private fun getRecordAdapter(position:Int):TunnelWorkingFaceRecordAdapter {
|
||||
val viewHolder =
|
||||
mBinding.rvTunnelingList.findViewHolderForLayoutPosition(position) as TunnelWorkingFaceAdapter.VH
|
||||
mBinding.rvList.findViewHolderForLayoutPosition(position) as TunnelWorkingFaceAdapter.VH
|
||||
return viewHolder.binding.rvFaceRecord.adapter as TunnelWorkingFaceRecordAdapter
|
||||
}
|
||||
|
||||
|
||||
+3
-6
@@ -16,7 +16,6 @@ import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import com.zmkg.coaloperation.utils.roundedOneDecimalPlace
|
||||
import com.zmkg.coaloperation.utils.toJsonString
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -84,15 +83,14 @@ class WorkingFaceRecordActivity :
|
||||
)
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "施工队伍", value = it.teamName))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "带班队长", value = it.teamLeader))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "本班进尺", value = "${getShowNum2(it.workingFootage)}m"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "本班进尺", value = "${it.workingFootage?.formatDecimalString()}m"))
|
||||
|
||||
// val rockList = mutableListOf<TunnelRoofLithologyEntity>()
|
||||
// rockList.add(RockItem(startLen = 0, endLen = 1, rockType = "泥"))
|
||||
// rockList.add(RockItem(startLen = 0, endLen = 1, rockType = "砂"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "顶板岩性", value = "", items = null))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "煤层倾角", value = "${getShowNum2(it.seamDip)}°"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "煤层高", value = "${getShowNum2(it.seamHeight)}m"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "涌水量", value = "${getShowNum2(it.waterYield)}m³/h"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "煤层倾角", value = "${it.seamDip?.formatDecimalString()}°"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "煤层高", value = "${it.seamHeight?.formatDecimalString()}m"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "记录人", value = it.recordPerson))
|
||||
|
||||
adapter.notifyDataSetChanged()
|
||||
@@ -104,7 +102,6 @@ class WorkingFaceRecordActivity :
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ class WorkingFaceStatisticsActivity :
|
||||
it.startAngle = -90f
|
||||
it.strokeWidth = 10f
|
||||
it.sweepAngle = 0f
|
||||
it.radius = ScreenUtil.dp2px(80f - 10f) / 2f
|
||||
it.radius = ScreenUtil.dp2px(100f - 10f) / 2f
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-15
@@ -1,7 +1,6 @@
|
||||
package com.zmkg.coaloperation.ui.tunneling.viewmodel
|
||||
|
||||
import com.zmkg.coaloperation.base.viewmodel.BaseViewModel
|
||||
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||
import com.zmkg.coaloperation.data.repository.HomeRepository
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.superfuntion.handleRequest
|
||||
@@ -105,18 +104,4 @@ class TunnelingViewModel : BaseViewModel() {
|
||||
)
|
||||
}
|
||||
|
||||
var tunnelDataPush = MutableSharedFlow<Any?>()
|
||||
|
||||
fun tunnelDataPush(data:TunnelSubmitData) {
|
||||
launch(
|
||||
{
|
||||
handleRequest(
|
||||
HomeRepository.tunnelDataPush(data),
|
||||
successBlock = {
|
||||
tunnelDataPush.emit(it.data)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -23,4 +23,5 @@ class AboutUsActivity : BaseVMBActivity<TestViewModel,ActivityAboutUsBinding>(R.
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-229
@@ -1,229 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.user.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.DataSyncAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.bean.DataSyncItem
|
||||
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||
import com.zmkg.coaloperation.databinding.ActivityDataSyncBinding
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
||||
import com.zmkg.coaloperation.superfuntion.hideLoading
|
||||
import com.zmkg.coaloperation.superfuntion.showLoading
|
||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import com.zmkg.coaloperation.utils.SpTool
|
||||
import com.zmkg.coaloperation.utils.toJsonString
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.collections.isNotEmpty
|
||||
|
||||
/**
|
||||
* 关于我们
|
||||
*/
|
||||
class DataSyncActivity :
|
||||
BaseVMBActivity<TunnelingViewModel, ActivityDataSyncBinding>(R.layout.activity_data_sync) {
|
||||
|
||||
private val TAG = "DataSyncActivity"
|
||||
|
||||
private val workingFaceViewModel: TunnelWorkingFaceViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelWorkingFaceViewModel::class.java]
|
||||
}
|
||||
|
||||
private val workingFaceRecordViewModel: TunnelWorkingFaceRecordViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelWorkingFaceRecordViewModel::class.java]
|
||||
}
|
||||
|
||||
private val roofLithologyViewModel: TunnelRoofLithologyViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelRoofLithologyViewModel::class.java]
|
||||
}
|
||||
private val list = mutableListOf(
|
||||
DataSyncItem("涌水量观测"),
|
||||
DataSyncItem("导线测量"),
|
||||
DataSyncItem("瓦斯巡检"),
|
||||
DataSyncItem("防灭火检查"),
|
||||
DataSyncItem("通风巡检"),
|
||||
DataSyncItem("地质编录"),
|
||||
DataSyncItem("水文地质编录"),
|
||||
DataSyncItem("隐蔽致灾"),
|
||||
DataSyncItem("地物查询"),
|
||||
DataSyncItem("回采"),
|
||||
DataSyncItem(funcName = "掘进", onDataPull = { tunnelDataPull() }, onDataPush = { tunnelDataPush() })
|
||||
)
|
||||
private val adapter by lazy {
|
||||
DataSyncAdapter(list).apply {
|
||||
addChildClickViewIds(R.id.btnDataPull, R.id.btnDataPush)
|
||||
setOnItemChildClickListener { _, view, position ->
|
||||
if (view.id == R.id.btnDataPull) {
|
||||
list[position].onDataPull()
|
||||
return@setOnItemChildClickListener
|
||||
}
|
||||
if (view.id == R.id.btnDataPush) {
|
||||
list[position].onDataPush()
|
||||
return@setOnItemChildClickListener
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "数据同步"
|
||||
mBinding.rvFuncList.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = adapter
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
launch {
|
||||
getFaceAndRecordList()
|
||||
}
|
||||
launch {
|
||||
getTunnelAllDict()
|
||||
}
|
||||
launch {
|
||||
dataPushSuccess()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun dataPushSuccess() {
|
||||
mViewModel.tunnelDataPush.collectLatest {
|
||||
showToast("数据推送成功")
|
||||
// TODO: 清除本地所有数据,并从接口拉取最新数据
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun getFaceAndRecordList() {
|
||||
mViewModel.tunnelFaceAndRecordList.collectLatest { dataList ->
|
||||
Log.d(TAG, "getFaceAndRecordList: ${dataList.toJsonString()}")
|
||||
dataList?.let { list ->
|
||||
//保存工作面数据
|
||||
list.forEach { it.userId = SpTool.getString(SpTool.USER_ID) }
|
||||
workingFaceViewModel.insertList(list) {}
|
||||
list.forEach { faceEntity ->
|
||||
faceEntity.records?.let { recordList ->
|
||||
val lastRecordId = faceEntity.latestRecord?.recordId
|
||||
val record = recordList.firstOrNull { it.recordId == lastRecordId }
|
||||
record?.latestRecordState = "1"
|
||||
|
||||
//保存工作面记录数据
|
||||
workingFaceRecordViewModel.insertList(recordList)
|
||||
recordList.forEach { recordEntity ->
|
||||
recordEntity.mineWorkingLithologyList?.let { lithologyList ->
|
||||
//保存工作面记录顶板岩性数据
|
||||
roofLithologyViewModel.insertList(lithologyList)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun getTunnelAllDict() {
|
||||
mViewModel.tunnelAllDict.collectLatest {
|
||||
val dictJson = it.toJsonString()
|
||||
Log.d(TAG, "getTunnelAllDict: $dictJson")
|
||||
SpTool.put(SpTool.DICT_JSON, dictJson)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查数据状态
|
||||
* @param block 入参true-有待提交数据,false-无待提交数据
|
||||
*/
|
||||
private fun checkDataState(block: (Boolean) -> Unit) {
|
||||
workingFaceViewModel.getEntityListByState("1") { faceList ->
|
||||
if (faceList != null && faceList.isNotEmpty()) {
|
||||
block(true)
|
||||
return@getEntityListByState
|
||||
}
|
||||
workingFaceRecordViewModel.getEntityListByState("1") { recordList ->
|
||||
if (recordList != null && recordList.isNotEmpty()) {
|
||||
block(true)
|
||||
return@getEntityListByState
|
||||
}
|
||||
roofLithologyViewModel.getEntityListByState("1") { lithologyList ->
|
||||
if (lithologyList != null && lithologyList.isNotEmpty()) {
|
||||
block(true)
|
||||
return@getEntityListByState
|
||||
}
|
||||
block(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun tunnelDataPull() {
|
||||
checkDataState { state ->
|
||||
if (state) {
|
||||
showToast("本地存在待提交的数据")
|
||||
return@checkDataState
|
||||
}
|
||||
showLoading("加载中")
|
||||
workingFaceViewModel.deleteAll {
|
||||
workingFaceRecordViewModel.deleteAll {
|
||||
roofLithologyViewModel.deleteAll {
|
||||
mViewModel.getTunnelFaceAndRecordList()
|
||||
mViewModel.getTunnelAllDict()
|
||||
mBinding.root.postDelayed({
|
||||
hideLoading()
|
||||
}, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun tunnelDataPush() {
|
||||
showLoading()
|
||||
val submitData = TunnelSubmitData()
|
||||
workingFaceViewModel.getEntityListByState("1") { faceList ->
|
||||
submitData.faceList = faceList
|
||||
workingFaceRecordViewModel.getEntityListByState("1") { recordList ->
|
||||
submitData.recordList = recordList
|
||||
roofLithologyViewModel.getEntityListByState("1") { lithologyList ->
|
||||
hideLoading()
|
||||
submitData.lithologyList = lithologyList
|
||||
if (submitData.faceList.isNullOrEmpty() ||
|
||||
submitData.recordList.isNullOrEmpty() ||
|
||||
submitData.lithologyList.isNullOrEmpty()
|
||||
) {
|
||||
showToast("暂无推送数据")
|
||||
return@getEntityListByState
|
||||
}
|
||||
submitData.recordList?.forEach { entity ->
|
||||
entity.teamShift = DictUtils.getTeamShiftId(entity.teamShift)
|
||||
}
|
||||
Log.d(TAG, "dataPush: ${submitData.toJsonString()}")
|
||||
mViewModel.tunnelDataPush(submitData)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+187
-75
@@ -7,12 +7,9 @@ import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.UserMenuAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||
import com.zmkg.coaloperation.bean.UserMenuBean
|
||||
import com.zmkg.coaloperation.databinding.FragmentUserBinding
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||
@@ -24,9 +21,7 @@ import com.zmkg.coaloperation.superfuntion.startLoginActivity
|
||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||
import com.zmkg.coaloperation.ui.user.activity.AboutUsActivity
|
||||
import com.zmkg.coaloperation.ui.user.activity.CacheManageActivity
|
||||
import com.zmkg.coaloperation.ui.user.activity.DataSyncActivity
|
||||
import com.zmkg.coaloperation.ui.user.activity.NetworkConfigActivity
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import com.zmkg.coaloperation.utils.SpTool
|
||||
import com.zmkg.coaloperation.utils.toJsonString
|
||||
import com.zmkg.coaloperation.view.CommonDialog
|
||||
@@ -40,6 +35,18 @@ class UserFragment :
|
||||
const val TAG = "UserFragment"
|
||||
}
|
||||
|
||||
private val workingFaceViewModel: TunnelWorkingFaceViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelWorkingFaceViewModel::class.java]
|
||||
}
|
||||
|
||||
private val workingFaceRecordViewModel: TunnelWorkingFaceRecordViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelWorkingFaceRecordViewModel::class.java]
|
||||
}
|
||||
|
||||
private val roofLithologyViewModel: TunnelRoofLithologyViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelRoofLithologyViewModel::class.java]
|
||||
}
|
||||
|
||||
private val updateDialog: CommonDialog by lazy {
|
||||
CommonDialog(requireContext(), R.layout.dialog_common_view) {
|
||||
|
||||
@@ -55,97 +62,202 @@ class UserFragment :
|
||||
}
|
||||
}
|
||||
|
||||
private var userMenuList: MutableList<UserMenuBean> = mutableListOf()
|
||||
private val userMenuAdapter: UserMenuAdapter by lazy {
|
||||
UserMenuAdapter(userMenuList).apply {
|
||||
setOnItemClickListener { adapter, view, position ->
|
||||
userMenuList[position].click()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
initMenuList()
|
||||
mBinding.rvMenuList.let {
|
||||
it.layoutManager = LinearLayoutManager(it.context)
|
||||
it.adapter = userMenuAdapter
|
||||
mBinding.apply {
|
||||
networkConfig.setOrderStateInfo(
|
||||
"网络配置",
|
||||
R.mipmap.network,
|
||||
R.drawable.bg_icon_network_config
|
||||
)
|
||||
dataPull.setOrderStateInfo(
|
||||
"数据拉取",
|
||||
R.drawable.ic_data_pull,
|
||||
R.drawable.bg_icon_data_pull
|
||||
)
|
||||
dataPush.setOrderStateInfo(
|
||||
"数据推送",
|
||||
R.drawable.ic_data_push,
|
||||
R.drawable.bg_icon_data_push
|
||||
)
|
||||
cacheManage.setOrderStateInfo(
|
||||
"缓存管理",
|
||||
R.mipmap.buffer,
|
||||
R.drawable.bg_icon_cache_manage
|
||||
)
|
||||
checkUpdate.setOrderStateInfo(
|
||||
"检查更新",
|
||||
R.mipmap.checkupdate,
|
||||
R.drawable.bg_icon_check_update
|
||||
)
|
||||
systemExit.setOrderStateInfo(
|
||||
"系统退出",
|
||||
R.mipmap.systemexit,
|
||||
R.drawable.bg_icon_system_exit
|
||||
)
|
||||
aboutUs.setOrderStateInfo("关于我们", R.mipmap.about_us, R.drawable.bg_icon_about_us)
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding.apply {
|
||||
addClickViews(
|
||||
networkConfig,
|
||||
dataPull,
|
||||
dataPush,
|
||||
cacheManage,
|
||||
checkUpdate,
|
||||
systemExit,
|
||||
aboutUs
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
when (v?.id) {
|
||||
R.id.network_config -> {
|
||||
toActivity(NetworkConfigActivity::class.java)
|
||||
}
|
||||
|
||||
R.id.data_pull -> {
|
||||
checkDataState { state ->
|
||||
if (state) {
|
||||
showToast("本地存在待提交的数据")
|
||||
return@checkDataState
|
||||
}
|
||||
showLoading("加载中")
|
||||
workingFaceViewModel.deleteAll {
|
||||
workingFaceRecordViewModel.deleteAll {
|
||||
roofLithologyViewModel.deleteAll {
|
||||
mViewModel.getTunnelFaceAndRecordList()
|
||||
mViewModel.getTunnelAllDict()
|
||||
mBinding.dataPull.postDelayed({
|
||||
hideLoading()
|
||||
}, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
R.id.data_push -> {
|
||||
dataPush()
|
||||
}
|
||||
|
||||
R.id.cache_manage -> {
|
||||
toActivity(CacheManageActivity::class.java)
|
||||
}
|
||||
|
||||
R.id.check_update -> {
|
||||
updateDialog.show("提示", "已经是最新版本了")
|
||||
}
|
||||
|
||||
R.id.system_exit -> {
|
||||
exitDialog.show("退出", "确定要退出当前用户?")
|
||||
}
|
||||
|
||||
R.id.about_us -> {
|
||||
toActivity(AboutUsActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
launch {
|
||||
getFaceAndRecordList()
|
||||
}
|
||||
launch {
|
||||
getTunnelAllDict()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initMenuList() {
|
||||
userMenuList.clear()
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "网络配置",
|
||||
iconResId = R.mipmap.network,
|
||||
iconBgResId = R.drawable.bg_icon_network_config,
|
||||
click = {
|
||||
toActivity(NetworkConfigActivity::class.java)
|
||||
private suspend fun getFaceAndRecordList() {
|
||||
mViewModel.tunnelFaceAndRecordList.collectLatest {
|
||||
Log.d(TAG, "getFaceAndRecordList: ${it.toJsonString()}")
|
||||
it?.let { list ->
|
||||
//保存工作面数据
|
||||
workingFaceViewModel.insertList(list) {}
|
||||
list.forEach { faceEntity ->
|
||||
faceEntity.records?.let { recordList ->
|
||||
val lastRecordId = faceEntity.latestRecord?.recordId
|
||||
val record = recordList.firstOrNull { it.recordId == lastRecordId }
|
||||
record?.latestRecordState = "1"
|
||||
|
||||
//保存工作面记录数据
|
||||
workingFaceRecordViewModel.insertList(recordList)
|
||||
recordList.forEach { recordEntity ->
|
||||
recordEntity.mineWorkingLithologyList?.let { lithologyList ->
|
||||
//保存工作面记录顶板岩性数据
|
||||
roofLithologyViewModel.insertList(lithologyList)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "数据同步",
|
||||
iconResId = R.drawable.ic_data_sync,
|
||||
iconBgResId = R.drawable.bg_icon_data_pull,
|
||||
click = {
|
||||
toActivity(DataSyncActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun getTunnelAllDict() {
|
||||
mViewModel.tunnelAllDict.collectLatest {
|
||||
val dictJson = it.toJsonString()
|
||||
Log.d(TAG, "getTunnelAllDict: $dictJson")
|
||||
SpTool.put(SpTool.DICT_JSON, dictJson)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查数据状态
|
||||
* @param block 入参true-有待提交数据,false-无待提交数据
|
||||
*/
|
||||
private fun checkDataState(block: (Boolean) -> Unit) {
|
||||
workingFaceViewModel.getEntityListByState("1") { faceList ->
|
||||
if (faceList != null && faceList.isNotEmpty()) {
|
||||
block(true)
|
||||
return@getEntityListByState
|
||||
}
|
||||
workingFaceRecordViewModel.getEntityListByState("1") { recordList ->
|
||||
if (recordList != null && recordList.isNotEmpty()) {
|
||||
block(true)
|
||||
return@getEntityListByState
|
||||
}
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "缓存管理",
|
||||
iconResId = R.mipmap.buffer,
|
||||
iconBgResId = R.drawable.bg_icon_cache_manage,
|
||||
click = {
|
||||
toActivity(CacheManageActivity::class.java)
|
||||
roofLithologyViewModel.getEntityListByState("1") { lithologyList ->
|
||||
if (lithologyList != null && lithologyList.isNotEmpty()) {
|
||||
block(true)
|
||||
return@getEntityListByState
|
||||
}
|
||||
block(false)
|
||||
}
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "检查更新",
|
||||
iconResId = R.mipmap.checkupdate,
|
||||
iconBgResId = R.drawable.bg_icon_check_update,
|
||||
click = {
|
||||
updateDialog.show("提示", "已经是最新版本了")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun dataPush() {
|
||||
showLoading()
|
||||
val submitData = TunnelSubmitData()
|
||||
workingFaceViewModel.getEntityListByState("1") { faceList ->
|
||||
submitData.faceList = faceList
|
||||
workingFaceRecordViewModel.getEntityListByState("1") { recordList ->
|
||||
submitData.recordList = recordList
|
||||
roofLithologyViewModel.getEntityListByState("1") { lithologyList ->
|
||||
hideLoading()
|
||||
submitData.lithologyList = lithologyList
|
||||
if (submitData.faceList.isNullOrEmpty() ||
|
||||
submitData.recordList.isNullOrEmpty() ||
|
||||
submitData.lithologyList.isNullOrEmpty()
|
||||
) {
|
||||
showToast("暂无推送数据")
|
||||
return@getEntityListByState
|
||||
}
|
||||
Log.d(TAG, "dataPush: ${submitData.toJsonString()}")
|
||||
}
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "系统退出",
|
||||
iconResId = R.mipmap.systemexit,
|
||||
iconBgResId = R.drawable.bg_icon_system_exit,
|
||||
click = {
|
||||
exitDialog.show("退出", "确定要退出当前用户?")
|
||||
}
|
||||
)
|
||||
)
|
||||
userMenuList.add(
|
||||
UserMenuBean(
|
||||
menuName = "关于我们",
|
||||
iconResId = R.mipmap.about_us,
|
||||
iconBgResId = R.drawable.bg_icon_about_us,
|
||||
click = {
|
||||
toActivity(AboutUsActivity::class.java)
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.wateryield
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.BuoyBottomAdapter
|
||||
import com.zmkg.coaloperation.adapter.BuoyTopAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.BuoyBottomItem
|
||||
import com.zmkg.coaloperation.bean.BuoyTopItem
|
||||
import com.zmkg.coaloperation.databinding.FragmentBuoyMethodBinding
|
||||
|
||||
class BuoyMethodFragment :
|
||||
BaseVMBFragment<TestViewModel, FragmentBuoyMethodBinding>(R.layout.fragment_buoy_method) {
|
||||
|
||||
private val buoyTopList: MutableList<BuoyTopItem> = mutableListOf()
|
||||
private val buoyBottomList: MutableList<BuoyBottomItem> = mutableListOf()
|
||||
private val buoyTopAdapter by lazy {
|
||||
BuoyTopAdapter(buoyTopList).apply {
|
||||
addChildClickViewIds(R.id.ivDeleteFace, R.id.btnAddFace)
|
||||
setOnItemChildClickListener { adapter, view, position ->
|
||||
if (view.id == R.id.ivDeleteFace) {
|
||||
try {
|
||||
if (position == 0) {
|
||||
return@setOnItemChildClickListener
|
||||
}
|
||||
buoyTopList.removeAt(position)
|
||||
notifyDataSetChanged()
|
||||
buoyBottomList.removeAt(position)
|
||||
buoyBottomAdapter.notifyDataSetChanged()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return@setOnItemChildClickListener
|
||||
}
|
||||
if (view.id == R.id.btnAddFace) {
|
||||
try {
|
||||
buoyTopList.add(BuoyTopItem())
|
||||
notifyDataSetChanged()
|
||||
//val topSize = buoyTopList.size
|
||||
//name = "断面${topSize-1}到断面${topSize}的水流时间(s)"
|
||||
buoyBottomList.add(BuoyBottomItem())
|
||||
buoyBottomAdapter.notifyDataSetChanged()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
return@setOnItemChildClickListener
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private val buoyBottomAdapter by lazy {
|
||||
BuoyBottomAdapter(buoyBottomList)
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
buoyTopList.add(BuoyTopItem())
|
||||
mBinding.rvBuoyTop.let {
|
||||
it.layoutManager = LinearLayoutManager(it.context)
|
||||
it.adapter = buoyTopAdapter
|
||||
it.requestDisallowInterceptTouchEvent(true)
|
||||
}
|
||||
buoyBottomList.run {
|
||||
add(BuoyBottomItem(name = "水沟长(m)"))
|
||||
}
|
||||
mBinding.rvBuoyBottom.let {
|
||||
it.layoutManager = LinearLayoutManager(it.context)
|
||||
it.adapter = buoyBottomAdapter
|
||||
it.requestDisallowInterceptTouchEvent(true)
|
||||
}
|
||||
mBinding.btnRecord.setOnClickListener {
|
||||
toActivity(WaterYieldObserveRecordActivity::class.java)
|
||||
}
|
||||
mBinding.btnSubmit.setOnClickListener {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun onClick(p0: View?) {
|
||||
}
|
||||
|
||||
}
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.wateryield
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.FragmentVolumeMethodBinding
|
||||
|
||||
class VolumeMethodFragment:
|
||||
BaseVMBFragment<TestViewModel, FragmentVolumeMethodBinding>(R.layout.fragment_volume_method) {
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
mBinding.btnRecord.setOnClickListener {
|
||||
toActivity(WaterYieldObserveRecordActivity::class.java)
|
||||
}
|
||||
mBinding.btnSubmit.setOnClickListener {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun onClick(p0: View?) {
|
||||
}
|
||||
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.wateryield
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.ActivityWaterYieldAddObservePointBinding
|
||||
|
||||
/**
|
||||
* 涌水量添加观测点
|
||||
*/
|
||||
class WaterYieldAddObservePointActivity : BaseVMBActivity<TestViewModel, ActivityWaterYieldAddObservePointBinding>(R.layout.activity_water_yield_add_observe_point) {
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "添加观测点"
|
||||
// mBinding.toolbarLay.rightText = "添加观测点"
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
}
|
||||
-103
@@ -1,103 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.wateryield
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.WaterYieldObserveAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.WorkOption
|
||||
import com.zmkg.coaloperation.databinding.ActivityWaterYieldHomeBinding
|
||||
import com.zmkg.coaloperation.db.entity.water.WaterYieldObserveEntity
|
||||
import com.zmkg.coaloperation.utils.PickerUtil
|
||||
|
||||
/**
|
||||
* 涌水量观察首页
|
||||
*/
|
||||
class WaterYieldHomeActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityWaterYieldHomeBinding>(R.layout.activity_water_yield_home) {
|
||||
|
||||
val observeList: MutableList<WaterYieldObserveEntity> = mutableListOf()
|
||||
val observeAdapter by lazy {
|
||||
WaterYieldObserveAdapter(observeList).apply {
|
||||
setOnItemClickListener { adapter, view, position ->
|
||||
toActivity(WaterYieldObserveActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "涌水量观测"
|
||||
mBinding.toolbarLay.rightText = "添加观测点"
|
||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
toActivity(WaterYieldAddObservePointActivity::class.java)
|
||||
}
|
||||
initTestObserveData()
|
||||
mBinding.rvWaterYield.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = observeAdapter
|
||||
}
|
||||
}
|
||||
|
||||
private fun initTestObserveData() {
|
||||
observeList.run {
|
||||
add(WaterYieldObserveEntity(
|
||||
observeId = 1, observePoint = "观测点A", observeTime = "2024-09-01 15:15:00", observeState = "0"
|
||||
))
|
||||
add(WaterYieldObserveEntity(
|
||||
observeId = 1, observePoint = "观测点B", observeTime = "2024-10-09 10:36:00", observeState = "0"
|
||||
))
|
||||
add(WaterYieldObserveEntity(
|
||||
observeId = 1, observePoint = "观测点C", observeTime = "2024-11-13 16:56:00", observeState = "0"
|
||||
))
|
||||
add(WaterYieldObserveEntity(
|
||||
observeId = 1, observePoint = "观测点D", observeTime = "2024-12-19 12:13:00", observeState = "0"
|
||||
))
|
||||
add(WaterYieldObserveEntity(
|
||||
observeId = 1, observePoint = "观测点E", observeTime = "2025-01-09 08:36:00", observeState = "1"
|
||||
))
|
||||
add(WaterYieldObserveEntity(
|
||||
observeId = 1, observePoint = "观测点F", observeTime = "2025-02-20 18:20:00", observeState = "1"
|
||||
))
|
||||
add(WaterYieldObserveEntity(
|
||||
observeId = 1, observePoint = "观测点G", observeTime = "2025-03-09 11:25:00", observeState = "1"
|
||||
))
|
||||
add(WaterYieldObserveEntity(
|
||||
observeId = 1, observePoint = "观测点H", observeTime = "2025-04-30 13:30:00", observeState = "1"
|
||||
))
|
||||
add(WaterYieldObserveEntity(
|
||||
observeId = 1, observePoint = "观测点I", observeTime = "2025-05-06 07:55:00", observeState = "1"
|
||||
))
|
||||
add(WaterYieldObserveEntity(
|
||||
observeId = 1, observePoint = "观测点J", observeTime = "2025-06-08 14:13:00", observeState = "1"
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
val list = mutableListOf<WorkOption>()
|
||||
list.add(WorkOption("1", "观测点A"))
|
||||
list.add(WorkOption("2", "观测点B"))
|
||||
list.add(WorkOption("3", "观测点C"))
|
||||
list.add(WorkOption("4", "观测点D"))
|
||||
list.add(WorkOption("5", "观测点E"))
|
||||
list.add(WorkOption("6", "观测点F"))
|
||||
list.add(WorkOption("7", "观测点G"))
|
||||
list.add(WorkOption("8", "观测点H"))
|
||||
mBinding.llSelectObservePoint.setOnClickListener {
|
||||
PickerUtil.showOptionPicker(this, "请选择观测点", list) { option ->
|
||||
mBinding.tvObservePoint.let {
|
||||
it.text = option.name
|
||||
it.tag = option.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
}
|
||||
-98
@@ -1,98 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.wateryield
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.commit
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.WaterYieldObserveAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.WorkOption
|
||||
import com.zmkg.coaloperation.databinding.ActivityWaterYieldObserveBinding
|
||||
import com.zmkg.coaloperation.db.entity.water.WaterYieldObserveEntity
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import com.zmkg.coaloperation.utils.PickerUtil
|
||||
|
||||
/**
|
||||
* 观测页面
|
||||
*/
|
||||
class WaterYieldObserveActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityWaterYieldObserveBinding>(R.layout.activity_water_yield_observe) {
|
||||
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "涌水量观测"
|
||||
// mBinding.toolbarLay.rightText = "添加观测点"
|
||||
// mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
// toActivity(WaterYieldAddObservePointActivity::class.java)
|
||||
// }
|
||||
initFragments()
|
||||
}
|
||||
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
val methodList = mutableListOf(
|
||||
WorkOption(id = "1", name = "浮标法"),
|
||||
WorkOption(id = "2", name = "容积法")
|
||||
)
|
||||
mBinding.tvObserveMethod.setOnClickListener {
|
||||
PickerUtil.showOptionPicker(this, "请选择观测方法", methodList) { option ->
|
||||
mBinding.tvObserveMethod.let {
|
||||
it.text = option.name
|
||||
it.tag = option.id
|
||||
}
|
||||
if (option.id == "1") {
|
||||
switchFragment(1)
|
||||
} else {
|
||||
switchFragment(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val personList = mutableListOf(
|
||||
WorkOption(id = "1", name = "张三"),
|
||||
WorkOption(id = "2", name = "李四"),
|
||||
WorkOption(id = "3", name = "王五"),
|
||||
WorkOption(id = "4", name = "赵六"),
|
||||
WorkOption(id = "5", name = "刘七")
|
||||
)
|
||||
mBinding.tvObservePerson.setOnClickListener {
|
||||
PickerUtil.showOptionPicker(this, "请选择观测人", personList) { option ->
|
||||
mBinding.tvObservePerson.let {
|
||||
it.text = option.name
|
||||
it.tag = option.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
private val fragments = mutableListOf<Fragment>()
|
||||
private fun initFragments() {
|
||||
fragments.apply {
|
||||
add(VolumeMethodFragment())
|
||||
add(BuoyMethodFragment())
|
||||
}
|
||||
supportFragmentManager.commit {
|
||||
add(R.id.fragment_container, fragments[0], "volume").hide(fragments[0])
|
||||
add(R.id.fragment_container, fragments[1], "buoy").hide(fragments[1])
|
||||
}
|
||||
}
|
||||
|
||||
private fun switchFragment(position: Int) {
|
||||
supportFragmentManager.commit {
|
||||
setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
||||
fragments.forEachIndexed { index, fragment ->
|
||||
if (index == position) show(fragment) else hide(fragment)
|
||||
}
|
||||
setReorderingAllowed(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
-105
@@ -1,105 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.wateryield
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.core.view.marginEnd
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.WaterYieldRecordAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.WaterYieldRecordItem
|
||||
import com.zmkg.coaloperation.databinding.ActivityWaterYieldObserveRecordBinding
|
||||
import com.zmkg.coaloperation.utils.dp
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
import org.checkerframework.checker.units.qual.h
|
||||
|
||||
/**
|
||||
* 观测历史记录页面
|
||||
*/
|
||||
class WaterYieldObserveRecordActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityWaterYieldObserveRecordBinding>(R.layout.activity_water_yield_observe_record) {
|
||||
|
||||
private val recordList: MutableList<WaterYieldRecordItem> = mutableListOf()
|
||||
private val recordAdapter by lazy {
|
||||
WaterYieldRecordAdapter(recordList)
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.title = "历史记录"
|
||||
// mBinding.toolbarLay.rightText = "添加观测点"
|
||||
mBinding.toolbarLay.titleIvRight.run {
|
||||
updateLayoutParams<RelativeLayout.LayoutParams> {
|
||||
rightMargin = 10.dp
|
||||
topMargin = 6.dp
|
||||
width = 36.dp
|
||||
height = 36.dp
|
||||
}
|
||||
setImageResource(R.drawable.ic_func_edit)
|
||||
mBinding.toolbarLay.rightImageSrc = drawable
|
||||
visible()
|
||||
setOnClickListener {
|
||||
//toActivity(WaterYieldAddObservePointActivity::class.java)
|
||||
}
|
||||
}
|
||||
mBinding.toolbarLay.titleIvRight2.run {
|
||||
updateLayoutParams<RelativeLayout.LayoutParams> {
|
||||
topMargin = 6.dp
|
||||
width = 36.dp
|
||||
height = 36.dp
|
||||
}
|
||||
setImageResource(R.drawable.ic_func_delete)
|
||||
visible()
|
||||
setOnClickListener {
|
||||
//toActivity(WaterYieldAddObservePointActivity::class.java)
|
||||
}
|
||||
}
|
||||
mBinding.rvObserveRecord.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = recordAdapter
|
||||
}
|
||||
initBuoyMethodData()
|
||||
recordList.run {
|
||||
add(WaterYieldRecordItem(name = "水文观测原始记录", isHeader = true))
|
||||
add(WaterYieldRecordItem(name = "观测时间", value = "2025-09-12 16:40:00"))
|
||||
add(WaterYieldRecordItem(name = "观测地点", value = "观测点011"))
|
||||
add(WaterYieldRecordItem(name = "观测人", value = "方一强"))
|
||||
add(WaterYieldRecordItem(name = "观测方法", value = "浮标法"))
|
||||
add(WaterYieldRecordItem(name = "观测参数", items = subList))
|
||||
add(WaterYieldRecordItem(name = "观测结果", value = "1178400m³/h"))
|
||||
add(WaterYieldRecordItem(name = "备注", value = ""))
|
||||
}
|
||||
recordAdapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
val subList = mutableListOf<WaterYieldRecordItem>()
|
||||
fun initBuoyMethodData() {
|
||||
subList.run {
|
||||
add(WaterYieldRecordItem(name = "断面1水沟宽", value = "15m"))
|
||||
add(WaterYieldRecordItem(name = "断面1水沟深", value = "15m"))
|
||||
add(WaterYieldRecordItem(name = "断面2水沟宽", value = "15m"))
|
||||
add(WaterYieldRecordItem(name = "断面2水沟深", value = "15m"))
|
||||
add(WaterYieldRecordItem(name = "水沟长", value = "15m"))
|
||||
add(WaterYieldRecordItem(name = "断面1到断面2水流速度", value = "3m/s"))
|
||||
}
|
||||
}
|
||||
|
||||
fun initVolumeMethodData() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,7 +46,7 @@ object DictUtils {
|
||||
areaMap.put(it.key, tempList)
|
||||
}
|
||||
val seamId: LazilyParsedNumber = it.value?.get("seamId") as LazilyParsedNumber
|
||||
//Log.d("DictUtils", "initData: idType= ${seamId?.javaClass?.name}, id=${seamId.toInt(aa)},name=${it.value?.get("areaName")}")
|
||||
//Log.d("DictUtils", "initData: idType= ${seamId?.javaClass?.name}, id=${seamId.toInt()},name=${it.value?.get("areaName")}")
|
||||
tempList?.add(WorkOption(id = ""+ seamId.toInt(), ""+ it.value?.get("areaName")))
|
||||
}
|
||||
}
|
||||
@@ -55,8 +55,5 @@ object DictUtils {
|
||||
if (shift == null) return ""
|
||||
return workShiftList.firstOrNull { it.id == shift }?.name ?: shift
|
||||
}
|
||||
fun getTeamShiftId(shift: String?): String {
|
||||
if (shift == null) return ""
|
||||
return workShiftList.firstOrNull { it.name == shift }?.id ?: shift
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,8 +26,7 @@ object ExcelExportUtils {
|
||||
subTitleList.forEachIndexed { index, subTitle ->
|
||||
subHeader.createCell(list.size - 1 + index).setCellValue(subTitle)
|
||||
}
|
||||
// sheet.addMergedRegion(CellRangeAddress(0, 0, 9, 11))
|
||||
sheet.addMergedRegion(CellRangeAddress(0, 0, 10, 12))
|
||||
sheet.addMergedRegion(CellRangeAddress(0, 0, 9, 11))
|
||||
for (i in 0 until list.size - 1) {
|
||||
sheet.addMergedRegion(CellRangeAddress(0, 1, i, i))
|
||||
}
|
||||
|
||||
@@ -2,20 +2,12 @@ package com.zmkg.coaloperation.utils
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.SharedPreferences
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.util.TypedValue
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import com.bumptech.glide.Glide
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import java.math.BigDecimal
|
||||
import java.math.RoundingMode
|
||||
|
||||
fun View.clickWithDebounce(delay: Long = 300, action: () -> Unit) {
|
||||
var job: Job? = null
|
||||
@@ -90,46 +82,4 @@ fun String.formatDecimalString(): String {
|
||||
}
|
||||
}
|
||||
|
||||
fun Double.roundedOneDecimalPlace(): Double {
|
||||
return BigDecimal(this).setScale(1, RoundingMode.HALF_UP).toDouble()
|
||||
}
|
||||
val Float.sp: Float
|
||||
get() = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_SP,
|
||||
this,
|
||||
Resources.getSystem().displayMetrics
|
||||
)
|
||||
|
||||
val Int.sp: Int
|
||||
get() = this.toFloat().sp.toInt()
|
||||
val Float.dp: Float
|
||||
get() = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
this,
|
||||
Resources.getSystem().displayMetrics
|
||||
)
|
||||
|
||||
val Int.dp: Int
|
||||
get() = this.toFloat().dp.toInt()
|
||||
|
||||
fun View.useShapeSetBackground(
|
||||
shape: Int = GradientDrawable.RECTANGLE,
|
||||
cornerRadius: Float = 0F,
|
||||
solidColor: Int = Color.TRANSPARENT,
|
||||
strokeWidth: Int = 0,
|
||||
strokeColor: Int = Color.TRANSPARENT,
|
||||
) {
|
||||
val shape = GradientDrawable().also {
|
||||
it.shape = shape
|
||||
it.cornerRadius = cornerRadius
|
||||
it.setColor(solidColor)
|
||||
it.setStroke(strokeWidth, strokeColor)
|
||||
}
|
||||
this.background = shape
|
||||
}
|
||||
|
||||
fun ImageView.load(any:Any) {
|
||||
Glide.with(this.context).load(any).into(this)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.zmkg.coaloperation.utils
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.pm.ActivityInfo
|
||||
import com.zhihu.matisse.Matisse
|
||||
import com.zhihu.matisse.MimeType
|
||||
import com.zhihu.matisse.R
|
||||
import com.zhihu.matisse.engine.impl.GlideEngine
|
||||
import com.zhihu.matisse.internal.entity.CaptureStrategy
|
||||
import com.zmkg.coaloperation.base.BaseActivity
|
||||
|
||||
object GalleryUtils {
|
||||
|
||||
fun openGallery(activity: BaseActivity, action:(Intent)-> Unit) {
|
||||
Matisse.from(activity)
|
||||
.choose(MimeType.ofImage(), false) // 只选图片
|
||||
.capture(true)
|
||||
.captureStrategy(
|
||||
CaptureStrategy(
|
||||
true,
|
||||
"${activity.packageName}.fileprovider",
|
||||
"coalImage"
|
||||
)
|
||||
)
|
||||
.countable(true) // 显示选中数量
|
||||
.maxSelectable(9) // 最多选9张
|
||||
.gridExpectedSize(120.dp)
|
||||
.restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
|
||||
.thumbnailScale(0.8f)
|
||||
.theme(R.style.Matisse_Dracula)
|
||||
.imageEngine(GlideEngine()) // 必须设置引擎
|
||||
.forResultLaunch { intent ->
|
||||
activity.launchActivityResult(intent) { result ->
|
||||
result.data?.let {
|
||||
action(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,11 +2,8 @@ package com.zmkg.coaloperation.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.bigkoo.pickerview.builder.OptionsPickerBuilder
|
||||
import com.bigkoo.pickerview.builder.TimePickerBuilder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.bean.Work3LevelOption
|
||||
import com.zmkg.coaloperation.bean.WorkOption
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
@@ -45,37 +42,10 @@ object PickerUtil {
|
||||
}
|
||||
|
||||
// 三级联动选择器示例
|
||||
// fun show3LevelOptionPicker(context: Context, title:String, options: List<Work3LevelOption>, action: (Work3LevelOption, Work3LevelOption, Work3LevelOption) -> Unit) {
|
||||
// OptionsPickerBuilder(context) { idx1, idx2, idx3, _ ->
|
||||
// val option1 = options[idx1]
|
||||
// val option2 = option1.list!![idx2]
|
||||
// val option3 = option2.list!![idx3]
|
||||
// action(option1, option2, option3)
|
||||
// }.apply {
|
||||
// setTitleText(title)
|
||||
// setContentTextSize(18)
|
||||
// setOutSideCancelable(true)
|
||||
// }.build<String>().apply {
|
||||
// val items1: MutableList<String> = mutableListOf()
|
||||
// val items2: MutableList<MutableList<String>> = mutableListOf()
|
||||
// val items3: MutableList<MutableList<MutableList<String>>> = mutableListOf()
|
||||
// options.forEach {
|
||||
// items1.add(it.name)
|
||||
//
|
||||
// }
|
||||
// setPicker( options.map { it.name } , null, null)
|
||||
// show()
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
fun showOptionPicker(context: Context, title:String, options: List<WorkOption>, action: (WorkOption) -> Unit) {
|
||||
OptionsPickerBuilder(context) { opt1, _, _, _ ->
|
||||
action(options[opt1])
|
||||
}.apply {
|
||||
// setOutSideColor(ContextCompat.getColor(context, R.color.black_bg))
|
||||
// setDividerColor(ContextCompat.getColor(context,R.color.divider))
|
||||
|
||||
setTitleText(title)
|
||||
setContentTextSize(18)
|
||||
setOutSideCancelable(true)
|
||||
@@ -84,7 +54,6 @@ object PickerUtil {
|
||||
show()
|
||||
}
|
||||
}
|
||||
|
||||
fun showTextPicker(context: Context, title:String, options: List<String>, action: (String) -> Unit) {
|
||||
OptionsPickerBuilder(context) { opt1, _, _, _ ->
|
||||
action(options[opt1])
|
||||
|
||||
@@ -6,9 +6,6 @@ import kotlin.to
|
||||
object SpTool {
|
||||
|
||||
const val DICT_JSON = "dictJson"
|
||||
const val USER_ID = "userId"
|
||||
const val USER_JSON = "userJson"
|
||||
const val USER_ACCOUNT = "userAccount"
|
||||
|
||||
val pref = MyApplication.getSharedPref()!!
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
//package com.zmkg.coaloperation.utils
|
||||
//
|
||||
//import com.zmkg.coaloperation.local.DataStoreManager
|
||||
//import com.zmkg.coaloperation.local.DataStoreUtils
|
||||
//
|
||||
//object UserUtils {
|
||||
//
|
||||
// const val USER_DATA = "userData"
|
||||
//
|
||||
// fun saveUserData(userName: String) {
|
||||
// var userData = DataStoreUtils.getSyncData(USER_DATA, "")
|
||||
// var userMap: MutableMap<String, String?> = mutableMapOf()
|
||||
// if (userData.isBlank()) {
|
||||
// userMap.put(userName, System.currentTimeMillis().toString())
|
||||
// } else {
|
||||
// userMap = userData.toObject<MutableMap<String, String?>>()
|
||||
// val userId = userMap[userName]
|
||||
// if (userId.isNullOrBlank()) {
|
||||
// userMap.put(userName, System.currentTimeMillis().toString())
|
||||
// }
|
||||
// }
|
||||
// userData = userMap.toJsonString()
|
||||
// DataStoreUtils.putSyncData(USER_DATA, userData)
|
||||
// }
|
||||
//
|
||||
// fun getUserName() = DataStoreManager.getUserName()
|
||||
//
|
||||
// fun getUserId(userName: String = getUserName()): String? {
|
||||
// val userData = DataStoreUtils.getSyncData(USER_DATA, "")
|
||||
// if (userData.isBlank()) {
|
||||
// return null
|
||||
// }
|
||||
// val userMap = userData.toObject<MutableMap<String, String?>>()
|
||||
// return userMap[userName]
|
||||
// }
|
||||
//
|
||||
//}
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
package com.zmkg.coaloperation.utils.permission//package com.dheaven.mscapp.SIGFFCNFN.permission
|
||||
//
|
||||
//import androidx.activity.result.contract.ActivityResultContracts
|
||||
//import androidx.fragment.app.Fragment
|
||||
//
|
||||
//class InvisibleFragment : Fragment() {
|
||||
//
|
||||
// private var singlePermissionAction: ((Boolean) -> Unit)? = null
|
||||
// private var multiplePermissionAction: ((MutableMap<String,Boolean>) -> Unit)? = null
|
||||
//
|
||||
// private val singlePermissionLauncher = registerForActivityResult(
|
||||
// ActivityResultContracts.RequestPermission()
|
||||
// ) {
|
||||
// singlePermissionAction?.invoke(it)
|
||||
// }
|
||||
// private val multiplePermissionLauncher = registerForActivityResult(
|
||||
// ActivityResultContracts.RequestMultiplePermissions()
|
||||
// ) {
|
||||
// multiplePermissionAction?.invoke(it)
|
||||
// }
|
||||
//
|
||||
// private fun requestSinglePermission(permission: String, action: (Boolean) -> Unit) {
|
||||
// singlePermissionAction = action
|
||||
// singlePermissionLauncher.launch(permission)
|
||||
// }
|
||||
// private fun requestMultiplePermission(permission: Array<String>, action: (MutableMap<String,Boolean>) -> Unit) {
|
||||
// multiplePermissionAction = action
|
||||
// multiplePermissionLauncher.launch(permission)
|
||||
// }
|
||||
// fun requestNow(
|
||||
// callback: (granted: Boolean, deniedList: List<String>) -> Unit,
|
||||
// args: Array<String>
|
||||
// ) {
|
||||
// permissionCallback = callback
|
||||
//// requestPermissions(args, 1)
|
||||
//
|
||||
// if (args.size == 1) {
|
||||
// requestSinglePermission(args[0]) {
|
||||
// val deniedList = mutableListOf<String>()
|
||||
// if (it.not()) {
|
||||
// deniedList.add(args[0])
|
||||
// }
|
||||
// callback(it, deniedList)
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
// requestMultiplePermission(args){
|
||||
// val deniedList = mutableListOf<String>()
|
||||
// it.entries.forEach { entry ->
|
||||
// entry.apply {
|
||||
// if (value.not()) {
|
||||
// deniedList.add(key)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// val granted = deniedList.isEmpty()
|
||||
// callback(granted, deniedList)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//// override fun onRequestPermissionsResult(
|
||||
//// requestCode: Int,
|
||||
//// permissions: Array<String>,
|
||||
//// grantResults: IntArray
|
||||
//// ) {
|
||||
//// super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
//// if (requestCode == 1) {
|
||||
//// val deniedList: MutableList<String> = ArrayList()
|
||||
//// for (i in grantResults.indices) {
|
||||
//// if (grantResults[i] != PackageManager.PERMISSION_GRANTED) {
|
||||
//// deniedList.add(permissions[i])
|
||||
//// }
|
||||
//// }
|
||||
//// val allGranted = deniedList.isEmpty()
|
||||
//// permissionCallback?.invoke(allGranted, deniedList)
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
// private var permissionCallback: ((granted: Boolean, deniedList: List<String>) -> Unit)? = null
|
||||
//}
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
package com.dheaven.mscapp.SIGFFCNFN.permission
|
||||
|
||||
import com.zmkg.coaloperation.base.BaseActivity
|
||||
|
||||
object PermissionUtils {
|
||||
// private const val TAG = "InvisibleFragment"
|
||||
fun request(
|
||||
activity: BaseActivity,
|
||||
permissions: Array<String>,
|
||||
callback: (granted: Boolean, deniedList: List<String>) -> Unit
|
||||
) {
|
||||
if (permissions.isEmpty()) {
|
||||
return
|
||||
}
|
||||
// val fragmentManager = activity.supportFragmentManager
|
||||
// val fragment = fragmentManager.findFragmentByTag(TAG)
|
||||
// var invisibleFragment: InvisibleFragment? = null
|
||||
// if (invisibleFragment == null) {
|
||||
// invisibleFragment = InvisibleFragment()
|
||||
// fragmentManager.beginTransaction().add(invisibleFragment, TAG).commitNow()
|
||||
// } else {
|
||||
// invisibleFragment = fragment as InvisibleFragment
|
||||
// }
|
||||
// invisibleFragment.requestNow(callback, permissions)
|
||||
//单权限请求
|
||||
if (permissions.size == 1) {
|
||||
val permission = permissions[0]
|
||||
activity.requestSinglePermissionResult(permission) {
|
||||
val deniedList = mutableListOf<String>()
|
||||
if (it.not()) {
|
||||
deniedList.add(permission)
|
||||
}
|
||||
callback(it, deniedList)
|
||||
}
|
||||
return
|
||||
}
|
||||
//多权限请求
|
||||
activity.requestMultiplePermissionsResult(permissions) {
|
||||
val deniedList = mutableListOf<String>()
|
||||
it.entries.forEach { entry ->
|
||||
entry.apply {
|
||||
if (value.not()) {
|
||||
deniedList.add(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
val granted = deniedList.isEmpty()
|
||||
callback(granted, deniedList)
|
||||
}
|
||||
}
|
||||
}
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
package com.zmkg.coaloperation.utils.permission
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.provider.Settings
|
||||
import com.zmkg.coaloperation.base.BaseActivity
|
||||
|
||||
object StorageUtils {
|
||||
|
||||
fun requestPermission(activity: BaseActivity, callback: () -> Unit) {
|
||||
activity.requestSinglePermissionResult(Manifest.permission.CAMERA) {
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// if (Environment.isExternalStorageManager()) {
|
||||
// callback()
|
||||
// } else {
|
||||
// val intent = Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION)
|
||||
//// activity.startActivityForResult(intent, MANAGE_REQUEST_CODE)
|
||||
// activity.launchActivityResult(intent) {
|
||||
// callback()
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
activity.requestSinglePermissionResult(Manifest.permission.WRITE_EXTERNAL_STORAGE) {
|
||||
callback()
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 699 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.8 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user