Compare commits
22
Commits
main
...
dev_lvmeng
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bc6d2f2c5 | ||
|
|
3dea103e27 | ||
|
|
5a4f136dba | ||
|
|
4973236469 | ||
|
|
c02a2ff08c | ||
|
|
8839320484 | ||
|
|
0a837a98b8 | ||
|
|
91271fbf8c | ||
|
|
bb09bc304f | ||
|
|
117c5fa3ad | ||
|
|
4ed44b5e4a | ||
|
|
79c0855976 | ||
|
|
71ca3a6081 | ||
|
|
d65f72e3c4 | ||
|
|
87da63bec7 | ||
|
|
58798fcbfb | ||
|
|
6e75007bd1 | ||
|
|
e712fa230a | ||
|
|
1ffae2737e | ||
|
|
f9f800bef3 | ||
|
|
6f2a47ad3f | ||
|
|
e34d925a83 |
@@ -78,7 +78,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||||||
api rootProject.ext.androidxLibs
|
api rootProject.ext.androidxLibs
|
||||||
// ViewModel and LiveData
|
// ViewModel and LiveData
|
||||||
api rootProject.ext.jetpackLibs
|
api rootProject.ext.jetpackLibs
|
||||||
@@ -110,4 +110,9 @@ dependencies {
|
|||||||
implementation("org.apache.poi:poi:5.2.3")
|
implementation("org.apache.poi:poi:5.2.3")
|
||||||
implementation("org.apache.poi:poi-ooxml: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,6 +4,7 @@
|
|||||||
package="com.zmkg.coaloperation">
|
package="com.zmkg.coaloperation">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<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.WRITE_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.AppTheme"
|
android:theme="@style/Theme.AppTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
android:networkSecurityConfig="@xml/network_security_config"
|
android:networkSecurityConfig="@xml/network_security_config"
|
||||||
tools:replace="android:allowBackup">
|
tools:replace="android:allowBackup">
|
||||||
|
|
||||||
@@ -45,7 +47,7 @@
|
|||||||
<activity android:name=".ui.user.activity.NetworkConfigActivity" />
|
<activity android:name=".ui.user.activity.NetworkConfigActivity" />
|
||||||
<activity android:name=".ui.user.activity.CacheManageActivity" />
|
<activity android:name=".ui.user.activity.CacheManageActivity" />
|
||||||
<activity android:name=".ui.user.activity.AboutUsActivity" />
|
<activity android:name=".ui.user.activity.AboutUsActivity" />
|
||||||
<activity android:name=".ui.home.activity.GeologicalActivity" />
|
<activity android:name=".ui.geologging.GeologicalActivity" />
|
||||||
<activity android:name=".ui.tunneling.activity.WorkingFaceStatisticsActivity" />
|
<activity android:name=".ui.tunneling.activity.WorkingFaceStatisticsActivity" />
|
||||||
<activity android:name=".ui.tunneling.activity.WorkingFaceRecordActivity" />
|
<activity android:name=".ui.tunneling.activity.WorkingFaceRecordActivity" />
|
||||||
<activity android:name=".ui.tunneling.activity.WorkingFaceDetailActivity" />
|
<activity android:name=".ui.tunneling.activity.WorkingFaceDetailActivity" />
|
||||||
@@ -54,6 +56,22 @@
|
|||||||
<activity android:name=".ui.tunneling.activity.TunnelingActivity" />
|
<activity android:name=".ui.tunneling.activity.TunnelingActivity" />
|
||||||
<activity android:name=".ui.tunneling.activity.AddWorkingFaceActivity"
|
<activity android:name=".ui.tunneling.activity.AddWorkingFaceActivity"
|
||||||
android:windowSoftInputMode="adjustPan" />
|
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>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zmkg.coaloperation
|
package com.zmkg.coaloperation
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
@@ -10,7 +11,7 @@ import com.zmkg.coaloperation.bottomtab.HomeBottomTabLayout
|
|||||||
import com.zmkg.coaloperation.databinding.ActivityMainBinding
|
import com.zmkg.coaloperation.databinding.ActivityMainBinding
|
||||||
import com.zmkg.coaloperation.ui.home.fragment.HomeFragment
|
import com.zmkg.coaloperation.ui.home.fragment.HomeFragment
|
||||||
import com.zmkg.coaloperation.ui.record.fragment.RecordFragment
|
import com.zmkg.coaloperation.ui.record.fragment.RecordFragment
|
||||||
import com.zmkg.coaloperation.ui.report.fragment.ReportFragment
|
import com.zmkg.coaloperation.ui.report.fragment.Report2Fragment
|
||||||
import com.zmkg.coaloperation.ui.user.fragment.UserFragment
|
import com.zmkg.coaloperation.ui.user.fragment.UserFragment
|
||||||
|
|
||||||
class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layout.activity_main),
|
class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layout.activity_main),
|
||||||
@@ -56,7 +57,7 @@ class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layou
|
|||||||
}
|
}
|
||||||
|
|
||||||
TAG_REPORT -> {
|
TAG_REPORT -> {
|
||||||
return ReportFragment()
|
return Report2Fragment()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TAG_MESSAGE -> {
|
// TAG_MESSAGE -> {
|
||||||
@@ -77,4 +78,5 @@ class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layou
|
|||||||
override fun transparentStatusBar(): Boolean {
|
override fun transparentStatusBar(): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,8 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun initLoginStatusListener() {
|
fun initLoginStatusListener() {
|
||||||
// TUILogin.addLoginListener(loginStatusListener)
|
// TUILogin.addLoginListener(loginStatusListener)
|
||||||
}
|
}
|
||||||
|
|||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
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
@@ -0,0 +1,32 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
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
@@ -0,0 +1,134 @@
|
|||||||
|
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
@@ -0,0 +1,50 @@
|
|||||||
|
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
@@ -0,0 +1,50 @@
|
|||||||
|
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
@@ -0,0 +1,52 @@
|
|||||||
|
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
@@ -0,0 +1,113 @@
|
|||||||
|
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
@@ -0,0 +1,66 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+4
-6
@@ -15,6 +15,8 @@ import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingItemBinding
|
|||||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
import com.zmkg.coaloperation.utils.gone
|
||||||
|
import com.zmkg.coaloperation.utils.visible
|
||||||
|
|
||||||
class TunnelWorkingItemAdapter(data: MutableList<TunnelWorkingItem>) :
|
class TunnelWorkingItemAdapter(data: MutableList<TunnelWorkingItem>) :
|
||||||
BaseQuickAdapter<TunnelWorkingItem, TunnelWorkingItemAdapter.VH>(
|
BaseQuickAdapter<TunnelWorkingItem, TunnelWorkingItemAdapter.VH>(
|
||||||
@@ -43,12 +45,8 @@ class TunnelWorkingItemAdapter(data: MutableList<TunnelWorkingItem>) :
|
|||||||
loadRecordData(holder.binding, item)
|
loadRecordData(holder.binding, item)
|
||||||
}
|
}
|
||||||
val position = holder.layoutPosition
|
val position = holder.layoutPosition
|
||||||
holder.binding.divider.let {
|
holder.binding.divider.run {
|
||||||
if (position == data.size - 1) {
|
if (position == data.size - 1) gone() else visible()
|
||||||
it.visibility = View.GONE
|
|
||||||
} else {
|
|
||||||
it.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
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
@@ -0,0 +1,60 @@
|
|||||||
|
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
@@ -0,0 +1,129 @@
|
|||||||
|
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
@@ -0,0 +1,40 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
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,6 +34,8 @@ import com.zmkg.coaloperation.base.viewmodel.BaseViewModel.Companion.LOADING_STA
|
|||||||
import com.zmkg.coaloperation.superfuntion.hideLoading
|
import com.zmkg.coaloperation.superfuntion.hideLoading
|
||||||
import com.zmkg.coaloperation.superfuntion.showLoading
|
import com.zmkg.coaloperation.superfuntion.showLoading
|
||||||
import com.zmkg.coaloperation.utils.StatusbarUtil
|
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.CustomToast
|
||||||
import com.zmkg.coaloperation.view.LoadingDialog
|
import com.zmkg.coaloperation.view.LoadingDialog
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -53,7 +55,7 @@ import java.sql.SQLException
|
|||||||
* 封装了ViewModel和DataBinding的Activity基类
|
* 封装了ViewModel和DataBinding的Activity基类
|
||||||
*/
|
*/
|
||||||
abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private val contentViewResId: Int) :
|
abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private val contentViewResId: Int) :
|
||||||
AppCompatActivity(), View.OnClickListener {
|
BaseActivity(), View.OnClickListener {
|
||||||
var mContext: Context? = null
|
var mContext: Context? = null
|
||||||
var mActivity: Activity? = null
|
var mActivity: Activity? = null
|
||||||
lateinit var mViewModel: VM
|
lateinit var mViewModel: VM
|
||||||
@@ -432,4 +434,18 @@ abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private
|
|||||||
configuration.fontScale = 1f
|
configuration.fontScale = 1f
|
||||||
return context.createConfigurationContext(configuration)
|
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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
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 name: String? = "",
|
||||||
var value: String? = "",
|
var value: String? = "",
|
||||||
var items: MutableList<TunnelRoofLithologyEntity>? = null,
|
var items: MutableList<TunnelRoofLithologyEntity>? = null,
|
||||||
var pageType:Int = 0
|
var pageType: Int = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
data class RockItem(
|
data class RockItem(
|
||||||
@@ -18,12 +18,26 @@ data class RockItem(
|
|||||||
)
|
)
|
||||||
|
|
||||||
data class WorkOption(
|
data class WorkOption(
|
||||||
var id:String,
|
var id: String,
|
||||||
var name: String
|
var name: String
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class Work3LevelOption(
|
||||||
|
var id: String = "",
|
||||||
|
var name: String = "",
|
||||||
|
|
||||||
|
var list: List<Work3LevelOption>? = null
|
||||||
|
)
|
||||||
|
|
||||||
data class TunnelSubmitData(
|
data class TunnelSubmitData(
|
||||||
var faceList: MutableList<TunnelWorkingFaceEntity>?=null,
|
var faceList: MutableList<TunnelWorkingFaceEntity>? = null,
|
||||||
var recordList: MutableList<TunnelWorkingFaceRecordEntity>?=null,
|
var recordList: MutableList<TunnelWorkingFaceRecordEntity>? = null,
|
||||||
var lithologyList: MutableList<TunnelRoofLithologyEntity>?=null
|
var lithologyList: MutableList<TunnelRoofLithologyEntity>? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
data class WaterYieldRecordItem(
|
||||||
|
var name: String? = "",
|
||||||
|
var value: String? = "",
|
||||||
|
var isHeader: Boolean = false,
|
||||||
|
var items: MutableList<WaterYieldRecordItem>? = null,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.zmkg.coaloperation.data.api
|
package com.zmkg.coaloperation.data.api
|
||||||
|
|
||||||
|
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||||
import com.zmkg.coaloperation.data.bean.ApiResponse
|
import com.zmkg.coaloperation.data.bean.ApiResponse
|
||||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.retorfit.UrlConfig
|
import com.zmkg.coaloperation.retorfit.UrlConfig
|
||||||
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
||||||
|
import retrofit2.http.Body
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.POST
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页
|
* 首页
|
||||||
@@ -48,4 +51,7 @@ interface HomeApi {
|
|||||||
@GET("/api/mine/tunnelling/dictionaries")
|
@GET("/api/mine/tunnelling/dictionaries")
|
||||||
suspend fun getTunnelAllDict(): ApiResponse<Any?>
|
suspend fun getTunnelAllDict(): ApiResponse<Any?>
|
||||||
|
|
||||||
|
@POST("/api/mine/tunnelling/data/push")
|
||||||
|
suspend fun tunnelDataPush(@Body data: TunnelSubmitData): ApiResponse<Any?>
|
||||||
|
|
||||||
}
|
}
|
||||||
+11
-4
@@ -1,6 +1,7 @@
|
|||||||
package com.zmkg.coaloperation.data.repository
|
package com.zmkg.coaloperation.data.repository
|
||||||
|
|
||||||
import com.zmkg.coaloperation.base.repository.BaseRepository
|
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.api.HomeApi
|
||||||
import com.zmkg.coaloperation.data.bean.ApiResponse
|
import com.zmkg.coaloperation.data.bean.ApiResponse
|
||||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
@@ -8,7 +9,7 @@ import com.zmkg.coaloperation.retorfit.RetrofitManager
|
|||||||
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
||||||
|
|
||||||
|
|
||||||
object HomeRepository : BaseRepository(){
|
object HomeRepository : BaseRepository() {
|
||||||
|
|
||||||
private val service by lazy { RetrofitManager.getService(HomeApi::class.java) }
|
private val service by lazy { RetrofitManager.getService(HomeApi::class.java) }
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ object HomeRepository : BaseRepository(){
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 掘进-首页-工作面记录列表
|
// * 掘进-首页-工作面记录列表
|
||||||
// */
|
// */
|
||||||
// suspend fun getTunnelingHomeItemData(surfaceId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>> {
|
// suspend fun getTunnelingHomeItemData(surfaceId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>> {
|
||||||
@@ -61,16 +62,22 @@ object HomeRepository : BaseRepository(){
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
suspend fun getTunnelHomeList() : ApiResponse<MutableList<TunnelWorkingFaceEntity>?> {
|
suspend fun getTunnelHomeList(): ApiResponse<MutableList<TunnelWorkingFaceEntity>?> {
|
||||||
return apiCall {
|
return apiCall {
|
||||||
service.getTunnelHomeList()
|
service.getTunnelHomeList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getTunnelAllDict() : ApiResponse<Any?> {
|
suspend fun getTunnelAllDict(): ApiResponse<Any?> {
|
||||||
return apiCall {
|
return apiCall {
|
||||||
service.getTunnelAllDict()
|
service.getTunnelAllDict()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun tunnelDataPush(data: TunnelSubmitData): ApiResponse<Any?> {
|
||||||
|
return apiCall {
|
||||||
|
service.tunnelDataPush(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,9 +6,15 @@ import androidx.room.Room
|
|||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import androidx.room.migration.Migration
|
import androidx.room.migration.Migration
|
||||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
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.TunnelRoofLithologyDao
|
||||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
||||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceRecordDao
|
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.TunnelRoofLithologyEntity
|
||||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||||
@@ -18,6 +24,9 @@ import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
|||||||
TunnelWorkingFaceEntity::class,
|
TunnelWorkingFaceEntity::class,
|
||||||
TunnelWorkingFaceRecordEntity::class,
|
TunnelWorkingFaceRecordEntity::class,
|
||||||
TunnelRoofLithologyEntity::class,
|
TunnelRoofLithologyEntity::class,
|
||||||
|
MiningWorkingFaceEntity::class,
|
||||||
|
MiningWorkingFaceRecordEntity::class,
|
||||||
|
MiningCoalHeightEntity::class,
|
||||||
],
|
],
|
||||||
version = 1,
|
version = 1,
|
||||||
exportSchema = true
|
exportSchema = true
|
||||||
@@ -26,6 +35,9 @@ abstract class AppDatabase : RoomDatabase() {
|
|||||||
abstract fun tunnelWorkingFaceDao(): TunnelWorkingFaceDao
|
abstract fun tunnelWorkingFaceDao(): TunnelWorkingFaceDao
|
||||||
abstract fun tunnelWorkingFaceRecordDao(): TunnelWorkingFaceRecordDao
|
abstract fun tunnelWorkingFaceRecordDao(): TunnelWorkingFaceRecordDao
|
||||||
abstract fun tunnelRoofLithologyDao(): TunnelRoofLithologyDao
|
abstract fun tunnelRoofLithologyDao(): TunnelRoofLithologyDao
|
||||||
|
abstract fun miningWorkingFaceDao(): MiningWorkingFaceDao
|
||||||
|
abstract fun miningWorkingFaceRecordDao(): MiningWorkingFaceRecordDao
|
||||||
|
abstract fun miningCoalHeightDao(): MiningCoalHeightDao
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@Volatile
|
@Volatile
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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
@@ -0,0 +1,37 @@
|
|||||||
|
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,7 +4,9 @@ import androidx.room.Dao
|
|||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
|
import androidx.room.RawQuery
|
||||||
import androidx.room.Update
|
import androidx.room.Update
|
||||||
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
|
|
||||||
//import kotlinx.coroutines.flow.Flow
|
//import kotlinx.coroutines.flow.Flow
|
||||||
@@ -23,6 +25,9 @@ interface TunnelWorkingFaceDao {
|
|||||||
@Query("SELECT * FROM tunnel_working_face ORDER BY createTime DESC")
|
@Query("SELECT * FROM tunnel_working_face ORDER BY createTime DESC")
|
||||||
fun getEntityList(): MutableList<TunnelWorkingFaceEntity>?
|
fun getEntityList(): MutableList<TunnelWorkingFaceEntity>?
|
||||||
|
|
||||||
|
@RawQuery
|
||||||
|
fun getEntityListBySql(query: SupportSQLiteQuery): MutableList<TunnelWorkingFaceEntity>?
|
||||||
|
|
||||||
@Query("SELECT * FROM tunnel_working_face WHERE dataState = :dataState ORDER BY createTime DESC")
|
@Query("SELECT * FROM tunnel_working_face WHERE dataState = :dataState ORDER BY createTime DESC")
|
||||||
fun getEntityListByState(dataState: String): MutableList<TunnelWorkingFaceEntity>?
|
fun getEntityListByState(dataState: String): MutableList<TunnelWorkingFaceEntity>?
|
||||||
|
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package com.zmkg.coaloperation.db.entity.geologging
|
||||||
|
|
||||||
|
data class GeoLoggingFace(
|
||||||
|
var surfaceId: Long = 0,
|
||||||
|
|
||||||
|
var userId: String = "",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作面名称
|
||||||
|
*/
|
||||||
|
var surfaceName: String? = "",
|
||||||
|
)
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
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
@@ -0,0 +1,150 @@
|
|||||||
|
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
@@ -0,0 +1,100 @@
|
|||||||
|
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,6 +22,8 @@ class TunnelWorkingFaceEntity(
|
|||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
var surfaceId: Long = 0,
|
var surfaceId: Long = 0,
|
||||||
|
|
||||||
|
var userId: String = "",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工作面名称
|
* 工作面名称
|
||||||
*/
|
*/
|
||||||
|
|||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
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
@@ -0,0 +1,51 @@
|
|||||||
|
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
@@ -0,0 +1,43 @@
|
|||||||
|
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
@@ -0,0 +1,40 @@
|
|||||||
|
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,5 +1,6 @@
|
|||||||
package com.zmkg.coaloperation.db.repository
|
package com.zmkg.coaloperation.db.repository
|
||||||
|
|
||||||
|
import androidx.sqlite.db.SupportSQLiteQuery
|
||||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
||||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@@ -10,6 +11,10 @@ class TunnelWorkingFaceRepository(private val dao: TunnelWorkingFaceDao) {
|
|||||||
dao.getEntityList()
|
dao.getEntityList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getEntityListBySql(query: SupportSQLiteQuery) = withContext(Dispatchers.IO) {
|
||||||
|
dao.getEntityListBySql(query)
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun getEntityListByState(dataState: String) = withContext(Dispatchers.IO) {
|
suspend fun getEntityListByState(dataState: String) = withContext(Dispatchers.IO) {
|
||||||
dao.getEntityListByState(dataState)
|
dao.getEntityListByState(dataState)
|
||||||
}
|
}
|
||||||
|
|||||||
+89
@@ -0,0 +1,89 @@
|
|||||||
|
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
@@ -0,0 +1,70 @@
|
|||||||
|
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
@@ -0,0 +1,91 @@
|
|||||||
|
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,6 +3,8 @@ package com.zmkg.coaloperation.db.viewmodel
|
|||||||
import android.app.Application
|
import android.app.Application
|
||||||
import androidx.lifecycle.AndroidViewModel
|
import androidx.lifecycle.AndroidViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
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.AppDatabase
|
||||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.db.repository.TunnelWorkingFaceRepository
|
import com.zmkg.coaloperation.db.repository.TunnelWorkingFaceRepository
|
||||||
@@ -22,6 +24,28 @@ class TunnelWorkingFaceViewModel(application: Application) : AndroidViewModel(ap
|
|||||||
action(list)
|
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(
|
fun getEntityListByState(
|
||||||
dataState: String,
|
dataState: String,
|
||||||
action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit
|
action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
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 imageView View
|
||||||
* @param placeholder 占位图
|
* @param placeholder 占位图
|
||||||
*/
|
*/
|
||||||
fun ImageView.loadRoundedImage(
|
fun ImageView.loadRoundedImage2(
|
||||||
url: String?,
|
url: String?,
|
||||||
roundingRadius: Float,
|
roundingRadius: Float,
|
||||||
@DrawableRes defaultResId: Int = 0,
|
@DrawableRes defaultResId: Int = 0,
|
||||||
@@ -239,6 +239,32 @@ fun ImageView.loadRoundedImage(
|
|||||||
.into(this)
|
.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
|
* 加载图片到ImageView
|
||||||
* @param imageUrl 图片地址
|
* @param imageUrl 图片地址
|
||||||
|
|||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
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
@@ -0,0 +1,137 @@
|
|||||||
|
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
@@ -0,0 +1,73 @@
|
|||||||
|
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
@@ -0,0 +1,60 @@
|
|||||||
|
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
@@ -0,0 +1,64 @@
|
|||||||
|
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
@@ -1,27 +0,0 @@
|
|||||||
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,5 +1,6 @@
|
|||||||
package com.zmkg.coaloperation.ui.home.adapter
|
package com.zmkg.coaloperation.ui.home.adapter
|
||||||
|
|
||||||
|
import android.widget.Toast
|
||||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
@@ -30,5 +31,8 @@ class HomeMenuAdapter :
|
|||||||
R.id.img,
|
R.id.img,
|
||||||
getMenuTabImg(item.index!!, holder.itemViewType)
|
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
|
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||||
|
|
||||||
|
|
||||||
class HomeMenuBean : MultiItemEntity {
|
data class HomeMenuBean(
|
||||||
var name: String? = null
|
var name: String? = null,
|
||||||
var index: Int? = null
|
var index: Int? = null,
|
||||||
var type: Int? = null // 0: 前4个(左右布局),1: 后4个(上下布局)
|
var type: Int? = null, // 0: 前4个(左右布局),1: 后4个(上下布局)
|
||||||
|
var onClick:()->Unit = {}
|
||||||
|
) : MultiItemEntity {
|
||||||
override val itemType: Int
|
override val itemType: Int
|
||||||
get() = type!!
|
get() = type!!
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+28
-43
@@ -1,39 +1,33 @@
|
|||||||
package com.zmkg.coaloperation.ui.home.fragment
|
package com.zmkg.coaloperation.ui.home.fragment
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.TextUtils
|
|
||||||
import android.util.Log
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.Lifecycle
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
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.R
|
||||||
import com.zmkg.coaloperation.adapter.common.ViewPagerAdapter
|
import com.zmkg.coaloperation.adapter.common.ViewPagerAdapter
|
||||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||||
import com.zmkg.coaloperation.databinding.FragmentHomeBinding
|
import com.zmkg.coaloperation.databinding.FragmentHomeBinding
|
||||||
import com.zmkg.coaloperation.local.DataStoreManager
|
|
||||||
import com.zmkg.coaloperation.superfuntion.addItemTouchCallback
|
import com.zmkg.coaloperation.superfuntion.addItemTouchCallback
|
||||||
import com.zmkg.coaloperation.superfuntion.init
|
import com.zmkg.coaloperation.superfuntion.init
|
||||||
import com.zmkg.coaloperation.superfuntion.onPageChangeCallback
|
import com.zmkg.coaloperation.superfuntion.onPageChangeCallback
|
||||||
import com.zmkg.coaloperation.superfuntion.toJson
|
import com.zmkg.coaloperation.ui.geologging.GeologicalActivity
|
||||||
import com.zmkg.coaloperation.ui.home.adapter.HomeMenuAdapter
|
import com.zmkg.coaloperation.ui.home.adapter.HomeMenuAdapter
|
||||||
import com.zmkg.coaloperation.ui.home.bean.HomeMenuBean
|
import com.zmkg.coaloperation.ui.home.bean.HomeMenuBean
|
||||||
import com.zmkg.coaloperation.ui.home.viewmodel.HomeViewModel
|
import com.zmkg.coaloperation.ui.home.viewmodel.HomeViewModel
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import com.zmkg.coaloperation.ui.wateryield.WaterYieldHomeActivity
|
||||||
import kotlinx.coroutines.launch
|
import com.zmkg.coaloperation.utils.DictUtils
|
||||||
|
|
||||||
|
|
||||||
class HomeFragment :
|
class HomeFragment :
|
||||||
BaseVMBFragment<HomeViewModel, FragmentHomeBinding>(R.layout.fragment_home),
|
BaseVMBFragment<HomeViewModel, FragmentHomeBinding>(R.layout.fragment_home),
|
||||||
OnItemClickListener {
|
OnItemClickListener {
|
||||||
|
|
||||||
private val homeMenuAdapter: HomeMenuAdapter by lazy { HomeMenuAdapter() }
|
private val homeMenuAdapter: HomeMenuAdapter by lazy {
|
||||||
|
HomeMenuAdapter()
|
||||||
|
}
|
||||||
|
|
||||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||||
mBinding.apply {
|
mBinding.apply {
|
||||||
@@ -47,7 +41,7 @@ class HomeFragment :
|
|||||||
rvList.adapter = homeMenuAdapter
|
rvList.adapter = homeMenuAdapter
|
||||||
rvList.addItemTouchCallback {
|
rvList.addItemTouchCallback {
|
||||||
resetItemTypes(homeMenuAdapter.data)
|
resetItemTypes(homeMenuAdapter.data)
|
||||||
DataStoreManager.setHomeData(homeMenuAdapter.data.toJson())
|
// DataStoreManager.setHomeData(homeMenuAdapter.data.toJson())
|
||||||
homeMenuAdapter.notifyDataSetChanged()
|
homeMenuAdapter.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,41 +74,32 @@ class HomeFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
|
DictUtils.initData()
|
||||||
// mViewModel.getWaterLedgerData()
|
// mViewModel.getWaterLedgerData()
|
||||||
|
|
||||||
val titleNameList = mutableListOf(
|
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)
|
||||||
)
|
)
|
||||||
var mutableListOf = mutableListOf<HomeMenuBean>()
|
|
||||||
|
|
||||||
val homeData = DataStoreManager.getHomeData()
|
// val homeData = DataStoreManager.getHomeData()
|
||||||
if (TextUtils.isEmpty(homeData)) {
|
// if (!TextUtils.isEmpty(homeData)) {
|
||||||
|
// val listType = object : TypeToken<MutableList<HomeMenuBean>?>() {}.type
|
||||||
|
// mutableListOf = Gson().fromJson(homeData, listType)
|
||||||
|
// }
|
||||||
|
|
||||||
titleNameList.forEachIndexed { index, s ->
|
homeMenuAdapter.setNewInstance(menuList)
|
||||||
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,6 +6,7 @@ import com.zmkg.coaloperation.R
|
|||||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
import com.zmkg.coaloperation.databinding.FragmentPageLeftBinding
|
import com.zmkg.coaloperation.databinding.FragmentPageLeftBinding
|
||||||
|
import com.zmkg.coaloperation.ui.mining.activity.MiningActivity
|
||||||
|
|
||||||
class PagerLeftFragment :
|
class PagerLeftFragment :
|
||||||
BaseVMBFragment<TestViewModel, FragmentPageLeftBinding>(R.layout.fragment_page_left) {
|
BaseVMBFragment<TestViewModel, FragmentPageLeftBinding>(R.layout.fragment_page_left) {
|
||||||
@@ -24,8 +25,7 @@ class PagerLeftFragment :
|
|||||||
mBinding.rootView.setOnClickListener {
|
mBinding.rootView.setOnClickListener {
|
||||||
// val pagerViewClickDialog = PagerViewClickDialog(requireContext())
|
// val pagerViewClickDialog = PagerViewClickDialog(requireContext())
|
||||||
// pagerViewClickDialog.show()
|
// pagerViewClickDialog.show()
|
||||||
|
toActivity(MiningActivity::class.java)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+18
-14
@@ -10,14 +10,16 @@ import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
|||||||
import com.zmkg.coaloperation.databinding.ActivityLoginBinding
|
import com.zmkg.coaloperation.databinding.ActivityLoginBinding
|
||||||
import com.zmkg.coaloperation.local.DataStoreManager
|
import com.zmkg.coaloperation.local.DataStoreManager
|
||||||
import com.zmkg.coaloperation.superfuntion.loginIm
|
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?) {
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
if (!TextUtils.isEmpty(DataStoreManager.getUserName())) {
|
if (!TextUtils.isEmpty(DataStoreManager.getUserName())) {
|
||||||
loginIm(DataStoreManager.getUserName()){}
|
loginIm(DataStoreManager.getUserName()) {}
|
||||||
toActivity(MainActivity::class.java)
|
toActivity(MainActivity::class.java)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -31,10 +33,10 @@ class LoginActivity : BaseVMBActivity<TestViewModel,ActivityLoginBinding>(R.layo
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun processClick(v: View?) {
|
override fun processClick(v: View?) {
|
||||||
when(v?.id) {
|
when (v?.id) {
|
||||||
R.id.submit->{
|
R.id.submit -> {
|
||||||
val userId = mBinding.loginEtUserName.text.toString()
|
val userName = mBinding.loginEtUserName.text.toString()
|
||||||
if (TextUtils.isEmpty(userId)) {
|
if (TextUtils.isEmpty(userName)) {
|
||||||
showToast("请输入用户名")
|
showToast("请输入用户名")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -44,19 +46,21 @@ class LoginActivity : BaseVMBActivity<TestViewModel,ActivityLoginBinding>(R.layo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
loginIm(userId) {}
|
loginIm(userName) {}
|
||||||
DataStoreManager.setUserName(userId)
|
DataStoreManager.setUserName(userName)
|
||||||
|
|
||||||
|
// TODO: 保存临时生成的用户id
|
||||||
|
SpTool.put(SpTool.USER_ID, "1758266158000")
|
||||||
|
|
||||||
toActivity(MainActivity::class.java)
|
toActivity(MainActivity::class.java)
|
||||||
finish()
|
finish()
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun transparentStatusBar():Boolean {
|
override fun transparentStatusBar(): Boolean {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
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")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.zmkg.coaloperation.ui.mining
|
||||||
|
|
||||||
|
class MiningViewModel {
|
||||||
|
}
|
||||||
+276
@@ -0,0 +1,276 @@
|
|||||||
|
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
@@ -0,0 +1,251 @@
|
|||||||
|
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
@@ -0,0 +1,93 @@
|
|||||||
|
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
@@ -0,0 +1,184 @@
|
|||||||
|
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
@@ -0,0 +1,225 @@
|
|||||||
|
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
|
//package com.zmkg.coaloperation.ui.report.adapter
|
||||||
|
//
|
||||||
import android.view.View
|
//import android.view.View
|
||||||
import com.chad.library.adapter.base.module.LoadMoreModule
|
//import com.chad.library.adapter.base.module.LoadMoreModule
|
||||||
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
//import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
||||||
import com.zmkg.coaloperation.R
|
//import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.adapter.common.BaseDataBindingAdapter
|
//import com.zmkg.coaloperation.adapter.common.BaseDataBindingAdapter
|
||||||
import com.zmkg.coaloperation.bean.ImageBean
|
//import com.zmkg.coaloperation.bean.ImageBean
|
||||||
import com.zmkg.coaloperation.databinding.ItemRecycleImageBinding
|
//import com.zmkg.coaloperation.databinding.ItemRecycleImageBinding
|
||||||
import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
//import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||||
import java.io.File
|
//import java.io.File
|
||||||
|
//
|
||||||
class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter<ImageBean, ItemRecycleImageBinding>(
|
//class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter<ImageBean, ItemRecycleImageBinding>(
|
||||||
R.layout.item_recycle_image
|
// R.layout.item_recycle_image
|
||||||
), LoadMoreModule {
|
//), LoadMoreModule {
|
||||||
private var isEditModel = false
|
// private var isEditModel = false
|
||||||
private var editImageShow = false
|
// private var editImageShow = false
|
||||||
override fun bindViewClickListener(
|
// override fun bindViewClickListener(
|
||||||
viewHolder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
// viewHolder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||||
viewType: Int
|
// viewType: Int
|
||||||
) {
|
// ) {
|
||||||
addChildClickViewIds(R.id.btn_delete)
|
// addChildClickViewIds(R.id.btn_delete)
|
||||||
super.bindViewClickListener(viewHolder, viewType)
|
// super.bindViewClickListener(viewHolder, viewType)
|
||||||
}
|
// }
|
||||||
override fun convert(
|
// override fun convert(
|
||||||
holder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
// holder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||||
item: ImageBean
|
// item: ImageBean
|
||||||
) {
|
// ) {
|
||||||
val mBinding = holder.dataBinding
|
// val mBinding = holder.dataBinding
|
||||||
mBinding?.let {
|
// mBinding?.let {
|
||||||
if(item.isAddButton){
|
// if(item.isAddButton){
|
||||||
mBinding.ivImage.setImageResource(R.mipmap.upload)
|
// mBinding.ivImage.setImageResource(R.mipmap.upload)
|
||||||
mBinding.btnDelete.visibility = View.GONE
|
// mBinding.btnDelete.visibility = View.GONE
|
||||||
}else{
|
// }else{
|
||||||
if(item.isFilePath){
|
// if(item.isFilePath){
|
||||||
mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f)
|
// mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f)
|
||||||
}else{
|
// }else{
|
||||||
mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default)
|
// mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default)
|
||||||
}
|
// }
|
||||||
if(isEditModel){
|
// if(isEditModel){
|
||||||
mBinding.btnDelete.visibility = View.VISIBLE
|
// mBinding.btnDelete.visibility = View.VISIBLE
|
||||||
}else{
|
// }else{
|
||||||
mBinding.btnDelete.visibility = View.GONE
|
// mBinding.btnDelete.visibility = View.GONE
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
fun isEditModel(isEdit: Boolean){
|
// fun isEditModel(isEdit: Boolean){
|
||||||
isEditModel = isEdit
|
// isEditModel = isEdit
|
||||||
notifyDataSetChanged()
|
// notifyDataSetChanged()
|
||||||
if(isEditModel && !editImageShow){
|
// if(isEditModel && !editImageShow){
|
||||||
showAddButton(true)
|
// showAddButton(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun setList(list: Collection<ImageBean>?) {
|
// override fun setList(list: Collection<ImageBean>?) {
|
||||||
super.setList(list)
|
// super.setList(list)
|
||||||
if(isEditModel){
|
// if(isEditModel){
|
||||||
showAddButton(true)
|
// showAddButton(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
override fun setNewInstance(list: MutableList<ImageBean>?) {
|
// override fun setNewInstance(list: MutableList<ImageBean>?) {
|
||||||
super.setNewInstance(list)
|
// super.setNewInstance(list)
|
||||||
if(isEditModel){
|
// if(isEditModel){
|
||||||
showAddButton(true)
|
// showAddButton(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun addData(newData: Collection<ImageBean>) {
|
// override fun addData(newData: Collection<ImageBean>) {
|
||||||
if(isEditModel){
|
// if(isEditModel){
|
||||||
if(editImageShow){
|
// if(editImageShow){
|
||||||
var lastPosition = data.size - 1
|
// var lastPosition = data.size - 1
|
||||||
if(lastPosition < 0){
|
// if(lastPosition < 0){
|
||||||
lastPosition = 0
|
// lastPosition = 0
|
||||||
}
|
// }
|
||||||
addData(lastPosition, newData)
|
// addData(lastPosition, newData)
|
||||||
}else{
|
// }else{
|
||||||
showAddButton(true)
|
// showAddButton(true)
|
||||||
}
|
// }
|
||||||
if(data.size > maxNum){
|
// if(data.size > maxNum){
|
||||||
showAddButton(false)
|
// showAddButton(false)
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
super.addData(newData)
|
// super.addData(newData)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
override fun removeAt(position: Int) {
|
// override fun removeAt(position: Int) {
|
||||||
super.removeAt(position)
|
// super.removeAt(position)
|
||||||
if(isEditModel && !editImageShow){
|
// if(isEditModel && !editImageShow){
|
||||||
showAddButton(true)
|
// showAddButton(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
fun getImageList(): MutableList<ImageBean>{
|
// fun getImageList(): MutableList<ImageBean>{
|
||||||
var list = mutableListOf<ImageBean>()
|
// var list = mutableListOf<ImageBean>()
|
||||||
data.forEach { imageBean ->
|
// data.forEach { imageBean ->
|
||||||
if(!imageBean.isAddButton){
|
// if(!imageBean.isAddButton){
|
||||||
list.add(imageBean)
|
// list.add(imageBean)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return list
|
// return list
|
||||||
}
|
// }
|
||||||
fun getImageSize(): Int {
|
// fun getImageSize(): Int {
|
||||||
if(isEditModel && editImageShow){
|
// if(isEditModel && editImageShow){
|
||||||
return getDefItemCount() - 1
|
// return getDefItemCount() - 1
|
||||||
}
|
// }
|
||||||
return getDefItemCount()
|
// return getDefItemCount()
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 显示添加图片按钮
|
// * 显示添加图片按钮
|
||||||
* @param isShow true为显示 false为隐藏
|
// * @param isShow true为显示 false为隐藏
|
||||||
*/
|
// */
|
||||||
private fun showAddButton(isShow: Boolean){
|
// private fun showAddButton(isShow: Boolean){
|
||||||
editImageShow = if(isShow){
|
// editImageShow = if(isShow){
|
||||||
addData(ImageBean(isAddButton = true))
|
// addData(ImageBean(isAddButton = true))
|
||||||
true
|
// true
|
||||||
}else{
|
// }else{
|
||||||
removeAt(data.size-1)
|
// removeAt(data.size-1)
|
||||||
false
|
// false
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
+79
@@ -0,0 +1,79 @@
|
|||||||
|
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()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+204
-200
@@ -1,200 +1,204 @@
|
|||||||
package com.zmkg.coaloperation.ui.report.fragment
|
//package com.zmkg.coaloperation.ui.report.fragment
|
||||||
|
//
|
||||||
import android.os.Bundle
|
//import android.os.Bundle
|
||||||
import android.view.View
|
//import android.view.View
|
||||||
import androidx.core.view.ViewCompat
|
//import androidx.core.view.ViewCompat
|
||||||
import androidx.lifecycle.Lifecycle
|
//import androidx.lifecycle.Lifecycle
|
||||||
import androidx.lifecycle.lifecycleScope
|
//import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
//import androidx.lifecycle.repeatOnLifecycle
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
//import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
//import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
//import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
//import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||||
import com.luck.picture.lib.basic.PictureSelectionModel
|
//import com.luck.picture.lib.basic.PictureSelectionModel
|
||||||
import com.luck.picture.lib.basic.PictureSelector
|
//import com.luck.picture.lib.basic.PictureSelector
|
||||||
import com.luck.picture.lib.config.SelectMimeType
|
//import com.luck.picture.lib.config.SelectMimeType
|
||||||
import com.luck.picture.lib.config.SelectModeConfig
|
//import com.luck.picture.lib.config.SelectModeConfig
|
||||||
import com.luck.picture.lib.entity.LocalMedia
|
//import com.luck.picture.lib.entity.LocalMedia
|
||||||
import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
//import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
||||||
import com.luck.picture.lib.utils.SandboxTransformUtils
|
//import com.luck.picture.lib.utils.SandboxTransformUtils
|
||||||
import com.zmkg.coaloperation.utils.pictureSelector.ImageFileCompressEngine
|
//import com.zmkg.coaloperation.utils.pictureSelector.ImageFileCompressEngine
|
||||||
import com.zmkg.coaloperation.R
|
//import com.zmkg.coaloperation.R
|
||||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
//import com.zmkg.coaloperation.base.BaseActivity
|
||||||
import com.zmkg.coaloperation.bean.ImageBean
|
//import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||||
import com.zmkg.coaloperation.databinding.FragmentReportBinding
|
//import com.zmkg.coaloperation.bean.ImageBean
|
||||||
import com.zmkg.coaloperation.ui.report.adapter.ImageAdapter
|
//import com.zmkg.coaloperation.databinding.FragmentReportBinding
|
||||||
import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
//import com.zmkg.coaloperation.ui.report.adapter.ImageAdapter
|
||||||
import com.zmkg.coaloperation.utils.pictureSelector.GlideEngine
|
//import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
//import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||||
import kotlinx.coroutines.launch
|
//import com.zmkg.coaloperation.utils.pictureSelector.GlideEngine
|
||||||
|
//import kotlinx.coroutines.flow.collectLatest
|
||||||
class ReportFragment :
|
//import kotlinx.coroutines.launch
|
||||||
BaseVMBFragment<ReportViewModel, FragmentReportBinding>(R.layout.fragment_report),
|
//
|
||||||
OnItemClickListener, OnItemChildClickListener {
|
//class ReportFragment :
|
||||||
|
// BaseVMBFragment<ReportViewModel, FragmentReportBinding>(R.layout.fragment_report),
|
||||||
private val imageAdapter by lazy { ImageAdapter(maxImageNum) }
|
// OnItemClickListener, OnItemChildClickListener {
|
||||||
lateinit var pageStatus: PageStatus
|
//
|
||||||
|
// private val imageAdapter by lazy { ImageAdapter(maxImageNum) }
|
||||||
companion object {
|
// lateinit var pageStatus: PageStatus
|
||||||
const val maxImageNum = 5
|
//
|
||||||
}
|
// companion object {
|
||||||
|
// const val maxImageNum = 5
|
||||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
// }
|
||||||
|
//
|
||||||
mBinding.apply {
|
// override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||||
val gridLayoutManager = GridLayoutManager(context, 3)
|
//
|
||||||
layInspectionReport.rvList.layoutManager = gridLayoutManager
|
// mBinding.apply {
|
||||||
imageAdapter.setOnItemClickListener(this@ReportFragment)
|
// val gridLayoutManager = GridLayoutManager(context, 3)
|
||||||
imageAdapter.setOnItemChildClickListener(this@ReportFragment)
|
// layInspectionReport.rvList.layoutManager = gridLayoutManager
|
||||||
mBinding.layInspectionReport.rvList.adapter = imageAdapter
|
// imageAdapter.setOnItemClickListener(this@ReportFragment)
|
||||||
ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
// imageAdapter.setOnItemChildClickListener(this@ReportFragment)
|
||||||
}
|
// mBinding.layInspectionReport.rvList.adapter = imageAdapter
|
||||||
|
// ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
||||||
setPageModel(PageStatus.ADD)
|
// }
|
||||||
|
//
|
||||||
}
|
// setPageModel(PageStatus.ADD)
|
||||||
|
//
|
||||||
enum class PageStatus(val status: Int) {
|
// }
|
||||||
ADD(1),
|
//
|
||||||
EDIT(2),
|
// enum class PageStatus(val status: Int) {
|
||||||
SEE(3),
|
// ADD(1),
|
||||||
NO_EDIT(4)
|
// EDIT(2),
|
||||||
}
|
// SEE(3),
|
||||||
|
// NO_EDIT(4)
|
||||||
private fun setPageModel(status: PageStatus) {
|
// }
|
||||||
this.pageStatus = status
|
//
|
||||||
mBinding?.apply {
|
// private fun setPageModel(status: PageStatus) {
|
||||||
when (status) {
|
// this.pageStatus = status
|
||||||
PageStatus.ADD -> {
|
// mBinding?.apply {
|
||||||
lifecycleScope.launch {
|
// when (status) {
|
||||||
mViewModel.noEdit.emit(false)
|
// PageStatus.ADD -> {
|
||||||
}
|
// lifecycleScope.launch {
|
||||||
}
|
// mViewModel.noEdit.emit(false)
|
||||||
|
// }
|
||||||
PageStatus.EDIT -> {
|
// }
|
||||||
lifecycleScope.launch {
|
//
|
||||||
mViewModel.noEdit.emit(false)
|
// PageStatus.EDIT -> {
|
||||||
}
|
// lifecycleScope.launch {
|
||||||
|
// mViewModel.noEdit.emit(false)
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
PageStatus.SEE -> {
|
// }
|
||||||
lifecycleScope.launch {
|
//
|
||||||
mViewModel.noEdit.emit(true)
|
// PageStatus.SEE -> {
|
||||||
}
|
// lifecycleScope.launch {
|
||||||
}
|
// mViewModel.noEdit.emit(true)
|
||||||
|
// }
|
||||||
PageStatus.NO_EDIT -> {
|
// }
|
||||||
lifecycleScope.launch {
|
//
|
||||||
mViewModel.noEdit.emit(true)
|
// PageStatus.NO_EDIT -> {
|
||||||
}
|
// lifecycleScope.launch {
|
||||||
}
|
// mViewModel.noEdit.emit(true)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
override fun bindEvent() {
|
//
|
||||||
}
|
//
|
||||||
|
// override fun bindEvent() {
|
||||||
override fun onClick(v: View?) {
|
// }
|
||||||
}
|
//
|
||||||
|
// override fun onClick(v: View?) {
|
||||||
override fun transparentStatusBar(): Boolean {
|
// }
|
||||||
return true
|
//
|
||||||
}
|
// override fun transparentStatusBar(): Boolean {
|
||||||
|
// return true
|
||||||
override fun createObserve() {
|
// }
|
||||||
super.createObserve()
|
//
|
||||||
lifecycleScope.launch {
|
// override fun createObserve() {
|
||||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
// super.createObserve()
|
||||||
mViewModel.noEdit.collectLatest { noEdit ->
|
// lifecycleScope.launch {
|
||||||
mBinding.apply {
|
// repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||||
imageAdapter.isEditModel(!noEdit)
|
// 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 ->
|
// override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||||
if (it.isAddButton) {
|
// val imageBean: ImageBean = adapter.getItem(position) as ImageBean
|
||||||
initPictureSelectorModel()
|
// imageBean?.let { it ->
|
||||||
.forResult(object : OnResultCallbackListener<LocalMedia?> {
|
// if (it.isAddButton) {
|
||||||
override fun onResult(result: ArrayList<LocalMedia?>?) {
|
// StorageUtils.requestPermission(context as BaseActivity) {
|
||||||
result?.let { list ->
|
// initPictureSelectorModel()
|
||||||
var resultList = localMediaToImageList(list)
|
// .forResult(object : OnResultCallbackListener<LocalMedia?> {
|
||||||
imageAdapter.addData(resultList)
|
// override fun onResult(result: ArrayList<LocalMedia?>?) {
|
||||||
setImageNum(imageAdapter.getImageSize())
|
// result?.let { list ->
|
||||||
}
|
// var resultList = localMediaToImageList(list)
|
||||||
}
|
// imageAdapter.addData(resultList)
|
||||||
|
// setImageNum(imageAdapter.getImageSize())
|
||||||
override fun onCancel() {}
|
// }
|
||||||
})
|
// }
|
||||||
} else {
|
//
|
||||||
// startFullScreenImageActivity(
|
// override fun onCancel() {}
|
||||||
// it.isFilePath,
|
// })
|
||||||
// it.imageUrl
|
// }
|
||||||
// )
|
// } else {
|
||||||
}
|
//// startFullScreenImageActivity(
|
||||||
}
|
//// it.isFilePath,
|
||||||
}
|
//// it.imageUrl
|
||||||
|
//// )
|
||||||
fun setImageNum(size: Int) {
|
// }
|
||||||
mBinding.layInspectionReport.tvImageNum.text = getString(
|
// }
|
||||||
R.string.image_list_num,
|
// }
|
||||||
size,
|
//
|
||||||
maxImageNum
|
// fun setImageNum(size: Int) {
|
||||||
)
|
// mBinding.layInspectionReport.tvImageNum.text = getString(
|
||||||
}
|
// R.string.image_list_num,
|
||||||
|
// size,
|
||||||
private fun initPictureSelectorModel(): PictureSelectionModel {
|
// maxImageNum
|
||||||
return PictureSelector.create(this)
|
// )
|
||||||
.openGallery(SelectMimeType.TYPE_IMAGE)
|
// }
|
||||||
.setSelectionMode(SelectModeConfig.MULTIPLE)
|
//
|
||||||
.setMaxSelectNum(maxImageNum - imageAdapter.getImageSize())
|
// private fun initPictureSelectorModel(): PictureSelectionModel {
|
||||||
.setCompressEngine(ImageFileCompressEngine())
|
// return PictureSelector.create(this)
|
||||||
.setImageEngine(GlideEngine.createGlideEngine())
|
// .openGallery(SelectMimeType.TYPE_IMAGE)
|
||||||
.setSandboxFileEngine { context, srcPath, mineType, call ->
|
// .setSelectionMode(SelectModeConfig.MULTIPLE)
|
||||||
if (call != null) {
|
// .setMaxSelectNum(maxImageNum - imageAdapter.getImageSize())
|
||||||
var sandboxPath =
|
// .setCompressEngine(ImageFileCompressEngine())
|
||||||
SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType)
|
// .setImageEngine(GlideEngine.createGlideEngine())
|
||||||
call.onCallback(srcPath, sandboxPath)
|
// .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> {
|
// override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||||
var imageList = mutableListOf<ImageBean>()
|
// adapter.removeAt(position)
|
||||||
var imageBean: ImageBean
|
// }
|
||||||
result.forEach {
|
//
|
||||||
it?.let {
|
// fun localMediaToImageList(result: ArrayList<LocalMedia?>): MutableList<ImageBean> {
|
||||||
imageBean = ImageBean(getImagePath(it), true)
|
// var imageList = mutableListOf<ImageBean>()
|
||||||
imageList.add(imageBean)
|
// var imageBean: ImageBean
|
||||||
}
|
// result.forEach {
|
||||||
}
|
// it?.let {
|
||||||
return imageList
|
// imageBean = ImageBean(getImagePath(it), true)
|
||||||
}
|
// imageList.add(imageBean)
|
||||||
|
// }
|
||||||
private fun getImagePath(localMedia: LocalMedia): String {
|
// }
|
||||||
if (!localMedia.cutPath.isNullOrEmpty()) {
|
// return imageList
|
||||||
return localMedia.cutPath
|
// }
|
||||||
}
|
//
|
||||||
if (!localMedia.compressPath.isNullOrEmpty()) {
|
// private fun getImagePath(localMedia: LocalMedia): String {
|
||||||
return localMedia.compressPath
|
// if (!localMedia.cutPath.isNullOrEmpty()) {
|
||||||
}
|
// return localMedia.cutPath
|
||||||
if (!localMedia.sandboxPath.isNullOrEmpty()) {
|
// }
|
||||||
return localMedia.sandboxPath
|
// if (!localMedia.compressPath.isNullOrEmpty()) {
|
||||||
}
|
// return localMedia.compressPath
|
||||||
return localMedia.path
|
// }
|
||||||
}
|
// if (!localMedia.sandboxPath.isNullOrEmpty()) {
|
||||||
}
|
// return localMedia.sandboxPath
|
||||||
|
// }
|
||||||
|
// return localMedia.path
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|||||||
+13
-3
@@ -193,6 +193,7 @@ class AddWorkingFaceRecordActivity :
|
|||||||
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
||||||
it.seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
it.seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
||||||
it.seamHeight = mBinding.etSeamHeight.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.recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||||
|
|
||||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||||
@@ -218,9 +219,10 @@ class AddWorkingFaceRecordActivity :
|
|||||||
mBinding.tvWorkTeam.tag = it.teamId
|
mBinding.tvWorkTeam.tag = it.teamId
|
||||||
|
|
||||||
mBinding.etTeamLeader.setText(it.teamLeader)
|
mBinding.etTeamLeader.setText(it.teamLeader)
|
||||||
mBinding.etWorkingFootage.setText(it.workingFootage)
|
mBinding.etWorkingFootage.setText(getShowNum2(it.workingFootage))
|
||||||
mBinding.etSeamDip.setText(it.seamDip)
|
mBinding.etSeamDip.setText(getShowNum2(it.seamDip))
|
||||||
mBinding.etSeamHeight.setText(it.seamHeight)
|
mBinding.etSeamHeight.setText(getShowNum2(it.seamHeight))
|
||||||
|
mBinding.etWaterYield.setText(getShowNum2(it.waterYield))
|
||||||
mBinding.etRecordPerson.setText(it.recordPerson)
|
mBinding.etRecordPerson.setText(it.recordPerson)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,6 +240,7 @@ class AddWorkingFaceRecordActivity :
|
|||||||
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
||||||
it.seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
it.seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
||||||
it.seamHeight = mBinding.etSeamHeight.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.recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||||
|
|
||||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||||
@@ -311,6 +314,13 @@ class AddWorkingFaceRecordActivity :
|
|||||||
}
|
}
|
||||||
list.add(TunnelWorkingItem(name = "煤层高", value = seamHeight))
|
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()
|
val recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||||
if (recordPerson.isBlank()) {
|
if (recordPerson.isBlank()) {
|
||||||
showToast("请输入填写人")
|
showToast("请输入填写人")
|
||||||
|
|||||||
+6
-6
@@ -16,6 +16,7 @@ import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
|||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
||||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||||
import com.zmkg.coaloperation.utils.DictUtils
|
import com.zmkg.coaloperation.utils.DictUtils
|
||||||
|
import com.zmkg.coaloperation.utils.SpTool
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
|
||||||
@@ -77,7 +78,7 @@ class TunnelingActivity :
|
|||||||
|
|
||||||
override fun initView(savedInstanceState: Bundle?) {
|
override fun initView(savedInstanceState: Bundle?) {
|
||||||
mBinding.toolbarLay.rightText = "新增工作面"
|
mBinding.toolbarLay.rightText = "新增工作面"
|
||||||
mBinding.rvList.let {
|
mBinding.rvTunnelingList.let {
|
||||||
it.layoutManager = LinearLayoutManager(this)
|
it.layoutManager = LinearLayoutManager(this)
|
||||||
it.adapter = workingFaceAdapter
|
it.adapter = workingFaceAdapter
|
||||||
}
|
}
|
||||||
@@ -85,10 +86,10 @@ class TunnelingActivity :
|
|||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
DictUtils.initData()
|
val userId = SpTool.getString(SpTool.USER_ID)
|
||||||
workingFaceViewModel.getEntityList { it ->
|
workingFaceViewModel.getEntityListByUserId(userId) { it ->
|
||||||
if (it.isNullOrEmpty()) {
|
if (it.isNullOrEmpty()) {
|
||||||
return@getEntityList
|
return@getEntityListByUserId
|
||||||
}
|
}
|
||||||
workingFaceList.clear()
|
workingFaceList.clear()
|
||||||
workingFaceList.addAll(it)
|
workingFaceList.addAll(it)
|
||||||
@@ -99,7 +100,6 @@ class TunnelingActivity :
|
|||||||
|
|
||||||
override fun createObserve() {
|
override fun createObserve() {
|
||||||
super.createObserve()
|
super.createObserve()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ class TunnelingActivity :
|
|||||||
@SuppressLint("SuspiciousIndentation")
|
@SuppressLint("SuspiciousIndentation")
|
||||||
private fun getRecordAdapter(position:Int):TunnelWorkingFaceRecordAdapter {
|
private fun getRecordAdapter(position:Int):TunnelWorkingFaceRecordAdapter {
|
||||||
val viewHolder =
|
val viewHolder =
|
||||||
mBinding.rvList.findViewHolderForLayoutPosition(position) as TunnelWorkingFaceAdapter.VH
|
mBinding.rvTunnelingList.findViewHolderForLayoutPosition(position) as TunnelWorkingFaceAdapter.VH
|
||||||
return viewHolder.binding.rvFaceRecord.adapter as TunnelWorkingFaceRecordAdapter
|
return viewHolder.binding.rvFaceRecord.adapter as TunnelWorkingFaceRecordAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-3
@@ -16,6 +16,7 @@ import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
|||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||||
import com.zmkg.coaloperation.utils.DictUtils
|
import com.zmkg.coaloperation.utils.DictUtils
|
||||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||||
|
import com.zmkg.coaloperation.utils.roundedOneDecimalPlace
|
||||||
import com.zmkg.coaloperation.utils.toJsonString
|
import com.zmkg.coaloperation.utils.toJsonString
|
||||||
import org.greenrobot.eventbus.Subscribe
|
import org.greenrobot.eventbus.Subscribe
|
||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
@@ -83,14 +84,15 @@ class WorkingFaceRecordActivity :
|
|||||||
)
|
)
|
||||||
list.add(TunnelWorkingItem(pageType = 1, name = "施工队伍", value = it.teamName))
|
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 = it.teamLeader))
|
||||||
list.add(TunnelWorkingItem(pageType = 1, name = "本班进尺", value = "${it.workingFootage?.formatDecimalString()}m"))
|
list.add(TunnelWorkingItem(pageType = 1, name = "本班进尺", value = "${getShowNum2(it.workingFootage)}m"))
|
||||||
|
|
||||||
// val rockList = mutableListOf<TunnelRoofLithologyEntity>()
|
// val rockList = mutableListOf<TunnelRoofLithologyEntity>()
|
||||||
// rockList.add(RockItem(startLen = 0, endLen = 1, rockType = "泥"))
|
// rockList.add(RockItem(startLen = 0, endLen = 1, rockType = "泥"))
|
||||||
// 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 = "", items = null))
|
||||||
list.add(TunnelWorkingItem(pageType = 1, name = "煤层倾角", value = "${it.seamDip?.formatDecimalString()}°"))
|
list.add(TunnelWorkingItem(pageType = 1, name = "煤层倾角", value = "${getShowNum2(it.seamDip)}°"))
|
||||||
list.add(TunnelWorkingItem(pageType = 1, name = "煤层高", value = "${it.seamHeight?.formatDecimalString()}m"))
|
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.recordPerson))
|
list.add(TunnelWorkingItem(pageType = 1, name = "记录人", value = it.recordPerson))
|
||||||
|
|
||||||
adapter.notifyDataSetChanged()
|
adapter.notifyDataSetChanged()
|
||||||
@@ -102,6 +104,7 @@ class WorkingFaceRecordActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun bindEvent() {
|
override fun bindEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -71,7 +71,7 @@ class WorkingFaceStatisticsActivity :
|
|||||||
it.startAngle = -90f
|
it.startAngle = -90f
|
||||||
it.strokeWidth = 10f
|
it.strokeWidth = 10f
|
||||||
it.sweepAngle = 0f
|
it.sweepAngle = 0f
|
||||||
it.radius = ScreenUtil.dp2px(100f - 10f) / 2f
|
it.radius = ScreenUtil.dp2px(80f - 10f) / 2f
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+15
@@ -1,6 +1,7 @@
|
|||||||
package com.zmkg.coaloperation.ui.tunneling.viewmodel
|
package com.zmkg.coaloperation.ui.tunneling.viewmodel
|
||||||
|
|
||||||
import com.zmkg.coaloperation.base.viewmodel.BaseViewModel
|
import com.zmkg.coaloperation.base.viewmodel.BaseViewModel
|
||||||
|
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||||
import com.zmkg.coaloperation.data.repository.HomeRepository
|
import com.zmkg.coaloperation.data.repository.HomeRepository
|
||||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||||
import com.zmkg.coaloperation.superfuntion.handleRequest
|
import com.zmkg.coaloperation.superfuntion.handleRequest
|
||||||
@@ -104,4 +105,18 @@ class TunnelingViewModel : BaseViewModel() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var tunnelDataPush = MutableSharedFlow<Any?>()
|
||||||
|
|
||||||
|
fun tunnelDataPush(data:TunnelSubmitData) {
|
||||||
|
launch(
|
||||||
|
{
|
||||||
|
handleRequest(
|
||||||
|
HomeRepository.tunnelDataPush(data),
|
||||||
|
successBlock = {
|
||||||
|
tunnelDataPush.emit(it.data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
-1
@@ -23,5 +23,4 @@ class AboutUsActivity : BaseVMBActivity<TestViewModel,ActivityAboutUsBinding>(R.
|
|||||||
override fun processClick(v: View?) {
|
override fun processClick(v: View?) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+229
@@ -0,0 +1,229 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+75
-187
@@ -7,9 +7,12 @@ import androidx.lifecycle.Lifecycle
|
|||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.lifecycle.repeatOnLifecycle
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import com.zmkg.coaloperation.R
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.adapter.UserMenuAdapter
|
||||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||||
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||||
|
import com.zmkg.coaloperation.bean.UserMenuBean
|
||||||
import com.zmkg.coaloperation.databinding.FragmentUserBinding
|
import com.zmkg.coaloperation.databinding.FragmentUserBinding
|
||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||||
@@ -21,7 +24,9 @@ import com.zmkg.coaloperation.superfuntion.startLoginActivity
|
|||||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||||
import com.zmkg.coaloperation.ui.user.activity.AboutUsActivity
|
import com.zmkg.coaloperation.ui.user.activity.AboutUsActivity
|
||||||
import com.zmkg.coaloperation.ui.user.activity.CacheManageActivity
|
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.ui.user.activity.NetworkConfigActivity
|
||||||
|
import com.zmkg.coaloperation.utils.DictUtils
|
||||||
import com.zmkg.coaloperation.utils.SpTool
|
import com.zmkg.coaloperation.utils.SpTool
|
||||||
import com.zmkg.coaloperation.utils.toJsonString
|
import com.zmkg.coaloperation.utils.toJsonString
|
||||||
import com.zmkg.coaloperation.view.CommonDialog
|
import com.zmkg.coaloperation.view.CommonDialog
|
||||||
@@ -35,18 +40,6 @@ class UserFragment :
|
|||||||
const val TAG = "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 {
|
private val updateDialog: CommonDialog by lazy {
|
||||||
CommonDialog(requireContext(), R.layout.dialog_common_view) {
|
CommonDialog(requireContext(), R.layout.dialog_common_view) {
|
||||||
|
|
||||||
@@ -62,202 +55,97 @@ 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?) {
|
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||||
mBinding.apply {
|
initMenuList()
|
||||||
networkConfig.setOrderStateInfo(
|
mBinding.rvMenuList.let {
|
||||||
"网络配置",
|
it.layoutManager = LinearLayoutManager(it.context)
|
||||||
R.mipmap.network,
|
it.adapter = userMenuAdapter
|
||||||
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() {
|
override fun bindEvent() {
|
||||||
mBinding.apply {
|
|
||||||
addClickViews(
|
|
||||||
networkConfig,
|
|
||||||
dataPull,
|
|
||||||
dataPush,
|
|
||||||
cacheManage,
|
|
||||||
checkUpdate,
|
|
||||||
systemExit,
|
|
||||||
aboutUs
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(v: View?) {
|
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() {
|
override fun createObserve() {
|
||||||
super.createObserve()
|
super.createObserve()
|
||||||
lifecycleScope.launch {
|
|
||||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
|
||||||
launch {
|
|
||||||
getFaceAndRecordList()
|
|
||||||
}
|
|
||||||
launch {
|
|
||||||
getTunnelAllDict()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun getFaceAndRecordList() {
|
private fun initMenuList() {
|
||||||
mViewModel.tunnelFaceAndRecordList.collectLatest {
|
userMenuList.clear()
|
||||||
Log.d(TAG, "getFaceAndRecordList: ${it.toJsonString()}")
|
userMenuList.add(
|
||||||
it?.let { list ->
|
UserMenuBean(
|
||||||
//保存工作面数据
|
menuName = "网络配置",
|
||||||
workingFaceViewModel.insertList(list) {}
|
iconResId = R.mipmap.network,
|
||||||
list.forEach { faceEntity ->
|
iconBgResId = R.drawable.bg_icon_network_config,
|
||||||
faceEntity.records?.let { recordList ->
|
click = {
|
||||||
val lastRecordId = faceEntity.latestRecord?.recordId
|
toActivity(NetworkConfigActivity::class.java)
|
||||||
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(
|
||||||
private suspend fun getTunnelAllDict() {
|
menuName = "数据同步",
|
||||||
mViewModel.tunnelAllDict.collectLatest {
|
iconResId = R.drawable.ic_data_sync,
|
||||||
val dictJson = it.toJsonString()
|
iconBgResId = R.drawable.bg_icon_data_pull,
|
||||||
Log.d(TAG, "getTunnelAllDict: $dictJson")
|
click = {
|
||||||
SpTool.put(SpTool.DICT_JSON, dictJson)
|
toActivity(DataSyncActivity::class.java)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查数据状态
|
|
||||||
* @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)
|
userMenuList.add(
|
||||||
return@getEntityListByState
|
UserMenuBean(
|
||||||
}
|
menuName = "缓存管理",
|
||||||
block(false)
|
iconResId = R.mipmap.buffer,
|
||||||
|
iconBgResId = R.drawable.bg_icon_cache_manage,
|
||||||
|
click = {
|
||||||
|
toActivity(CacheManageActivity::class.java)
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
userMenuList.add(
|
||||||
|
UserMenuBean(
|
||||||
private fun dataPush() {
|
menuName = "检查更新",
|
||||||
showLoading()
|
iconResId = R.mipmap.checkupdate,
|
||||||
val submitData = TunnelSubmitData()
|
iconBgResId = R.drawable.bg_icon_check_update,
|
||||||
workingFaceViewModel.getEntityListByState("1") { faceList ->
|
click = {
|
||||||
submitData.faceList = faceList
|
updateDialog.show("提示", "已经是最新版本了")
|
||||||
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
@@ -0,0 +1,87 @@
|
|||||||
|
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
@@ -0,0 +1,27 @@
|
|||||||
|
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
@@ -0,0 +1,29 @@
|
|||||||
|
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
@@ -0,0 +1,103 @@
|
|||||||
|
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
@@ -0,0 +1,98 @@
|
|||||||
|
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
@@ -0,0 +1,105 @@
|
|||||||
|
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)
|
areaMap.put(it.key, tempList)
|
||||||
}
|
}
|
||||||
val seamId: LazilyParsedNumber = it.value?.get("seamId") as LazilyParsedNumber
|
val seamId: LazilyParsedNumber = it.value?.get("seamId") as LazilyParsedNumber
|
||||||
//Log.d("DictUtils", "initData: idType= ${seamId?.javaClass?.name}, id=${seamId.toInt()},name=${it.value?.get("areaName")}")
|
//Log.d("DictUtils", "initData: idType= ${seamId?.javaClass?.name}, id=${seamId.toInt(aa)},name=${it.value?.get("areaName")}")
|
||||||
tempList?.add(WorkOption(id = ""+ seamId.toInt(), ""+ it.value?.get("areaName")))
|
tempList?.add(WorkOption(id = ""+ seamId.toInt(), ""+ it.value?.get("areaName")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,5 +55,8 @@ object DictUtils {
|
|||||||
if (shift == null) return ""
|
if (shift == null) return ""
|
||||||
return workShiftList.firstOrNull { it.id == shift }?.name ?: shift
|
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,7 +26,8 @@ object ExcelExportUtils {
|
|||||||
subTitleList.forEachIndexed { index, subTitle ->
|
subTitleList.forEachIndexed { index, subTitle ->
|
||||||
subHeader.createCell(list.size - 1 + index).setCellValue(subTitle)
|
subHeader.createCell(list.size - 1 + index).setCellValue(subTitle)
|
||||||
}
|
}
|
||||||
sheet.addMergedRegion(CellRangeAddress(0, 0, 9, 11))
|
// sheet.addMergedRegion(CellRangeAddress(0, 0, 9, 11))
|
||||||
|
sheet.addMergedRegion(CellRangeAddress(0, 0, 10, 12))
|
||||||
for (i in 0 until list.size - 1) {
|
for (i in 0 until list.size - 1) {
|
||||||
sheet.addMergedRegion(CellRangeAddress(0, 1, i, i))
|
sheet.addMergedRegion(CellRangeAddress(0, 1, i, i))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,20 @@ package com.zmkg.coaloperation.utils
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.SharedPreferences
|
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.view.View
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import java.math.BigDecimal
|
||||||
|
import java.math.RoundingMode
|
||||||
|
|
||||||
fun View.clickWithDebounce(delay: Long = 300, action: () -> Unit) {
|
fun View.clickWithDebounce(delay: Long = 300, action: () -> Unit) {
|
||||||
var job: Job? = null
|
var job: Job? = null
|
||||||
@@ -82,4 +90,46 @@ 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)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
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,8 +2,11 @@ package com.zmkg.coaloperation.utils
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import com.bigkoo.pickerview.builder.OptionsPickerBuilder
|
import com.bigkoo.pickerview.builder.OptionsPickerBuilder
|
||||||
import com.bigkoo.pickerview.builder.TimePickerBuilder
|
import com.bigkoo.pickerview.builder.TimePickerBuilder
|
||||||
|
import com.zmkg.coaloperation.R
|
||||||
|
import com.zmkg.coaloperation.bean.Work3LevelOption
|
||||||
import com.zmkg.coaloperation.bean.WorkOption
|
import com.zmkg.coaloperation.bean.WorkOption
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
@@ -42,10 +45,37 @@ 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) {
|
fun showOptionPicker(context: Context, title:String, options: List<WorkOption>, action: (WorkOption) -> Unit) {
|
||||||
OptionsPickerBuilder(context) { opt1, _, _, _ ->
|
OptionsPickerBuilder(context) { opt1, _, _, _ ->
|
||||||
action(options[opt1])
|
action(options[opt1])
|
||||||
}.apply {
|
}.apply {
|
||||||
|
// setOutSideColor(ContextCompat.getColor(context, R.color.black_bg))
|
||||||
|
// setDividerColor(ContextCompat.getColor(context,R.color.divider))
|
||||||
|
|
||||||
setTitleText(title)
|
setTitleText(title)
|
||||||
setContentTextSize(18)
|
setContentTextSize(18)
|
||||||
setOutSideCancelable(true)
|
setOutSideCancelable(true)
|
||||||
@@ -54,6 +84,7 @@ object PickerUtil {
|
|||||||
show()
|
show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showTextPicker(context: Context, title:String, options: List<String>, action: (String) -> Unit) {
|
fun showTextPicker(context: Context, title:String, options: List<String>, action: (String) -> Unit) {
|
||||||
OptionsPickerBuilder(context) { opt1, _, _, _ ->
|
OptionsPickerBuilder(context) { opt1, _, _, _ ->
|
||||||
action(options[opt1])
|
action(options[opt1])
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import kotlin.to
|
|||||||
object SpTool {
|
object SpTool {
|
||||||
|
|
||||||
const val DICT_JSON = "dictJson"
|
const val DICT_JSON = "dictJson"
|
||||||
|
const val USER_ID = "userId"
|
||||||
|
const val USER_JSON = "userJson"
|
||||||
|
const val USER_ACCOUNT = "userAccount"
|
||||||
|
|
||||||
val pref = MyApplication.getSharedPref()!!
|
val pref = MyApplication.getSharedPref()!!
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
//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
@@ -0,0 +1,80 @@
|
|||||||
|
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
@@ -0,0 +1,51 @@
|
|||||||
|
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
@@ -0,0 +1,31 @@
|
|||||||
|
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.
|
After Width: | Height: | Size: 699 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After 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