Compare commits
32
Commits
8ff2ff1a7f
...
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 | ||
|
|
b03a1bae8c | ||
|
|
201a0779bf | ||
|
|
be579ea7e4 | ||
|
|
fa2672d6d7 | ||
|
|
87278949d1 | ||
|
|
4867c14581 | ||
|
|
587139fd91 | ||
|
|
0c3898c8af | ||
|
|
b743bf566b | ||
|
|
cc5ea0f2c6 |
@@ -20,6 +20,14 @@ android {
|
||||
// 选择实际需要的cpu架构
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a'//,'armeabi'//, 'x86', 'x86_64'
|
||||
}
|
||||
// Kotlin项目配置
|
||||
kapt {
|
||||
arguments {
|
||||
arg("room.schemaLocation", "$projectDir/schemas")
|
||||
}
|
||||
}
|
||||
// 设置输出APK文件名格式
|
||||
setProperty("archivesBaseName", "煤矿数采终端v${versionName}")
|
||||
}
|
||||
|
||||
signingConfigs{
|
||||
@@ -70,7 +78,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
|
||||
api rootProject.ext.androidxLibs
|
||||
// ViewModel and LiveData
|
||||
api rootProject.ext.jetpackLibs
|
||||
@@ -86,25 +94,25 @@ dependencies {
|
||||
api rootProject.ext.commonLibs
|
||||
|
||||
|
||||
api project(':tuichat')
|
||||
api project(':tuicontact')
|
||||
api project(':tuiconversation')
|
||||
api project(':tuicallkit')
|
||||
// api project(':tuichat')
|
||||
// api project(':tuicontact')
|
||||
// api project(':tuiconversation')
|
||||
// api project(':tuicallkit')
|
||||
// annotationProcessor 'com.google.auto.service:auto-service:1.1.1'
|
||||
|
||||
implementation 'com.contrarywind:Android-PickerView:4.1.9'
|
||||
|
||||
// ViewModel
|
||||
// implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0"
|
||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1"
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1"
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
|
||||
// Retrofit
|
||||
// implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
||||
// implementation "com.squareup.retrofit2:converter-gson:2.9.0"
|
||||
implementation("org.apache.poi:poi:5.2.3")
|
||||
implementation("org.apache.poi:poi-ooxml:5.2.3")
|
||||
|
||||
// OkHttp
|
||||
// implementation "com.squareup.okhttp3:okhttp:4.11.0"
|
||||
// implementation "com.squareup.okhttp3:logging-interceptor:4.11.0"
|
||||
implementation 'androidx.fragment:fragment-ktx:1.6.0'
|
||||
|
||||
// Coroutines
|
||||
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1"
|
||||
// implementation 'com.zhihu.android:matisse:0.6.0'
|
||||
implementation project(':matisse')
|
||||
implementation 'com.github.hackware1993:MagicIndicator:1.7.0'
|
||||
}
|
||||
Binary file not shown.
@@ -3,7 +3,12 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
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.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||
tools:ignore="ScopedStorage"/>
|
||||
|
||||
<application
|
||||
android:name=".MyApplication"
|
||||
@@ -13,8 +18,20 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AppTheme"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
tools:replace="android:allowBackup">
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths"/>
|
||||
</provider>
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="false" />
|
||||
@@ -30,14 +47,31 @@
|
||||
<activity android:name=".ui.user.activity.NetworkConfigActivity" />
|
||||
<activity android:name=".ui.user.activity.CacheManageActivity" />
|
||||
<activity android:name=".ui.user.activity.AboutUsActivity" />
|
||||
<activity android:name=".ui.home.activity.GeologicalActivity" />
|
||||
<activity android:name=".ui.geologging.GeologicalActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.WorkingFaceStatisticsActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.WorkingFaceRecordActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.WorkingFaceDetailActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.WorkingPointActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.WorkingFaceDetail2Activity" />
|
||||
<activity android:name=".ui.tunneling.activity.AddWorkingPointActivity"
|
||||
<activity android:name=".ui.tunneling.activity.AddWorkingFaceRecordActivity"
|
||||
android:windowSoftInputMode="adjustPan"/>
|
||||
<activity android:name=".ui.tunneling.activity.TunnelingActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.WorkFaceActivity" />
|
||||
<activity android:name=".ui.tunneling.activity.AddWorkingFaceActivity"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity android:name=".ui.mining.activity.MiningActivity" />
|
||||
<activity android:name=".ui.mining.activity.MiningFaceStatisticsActivity" />
|
||||
<activity android:name=".ui.mining.activity.MiningFaceDetailActivity" />
|
||||
<activity android:name=".ui.mining.activity.AddMiningFaceActivity"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity android:name=".ui.mining.activity.MiningFaceRecordActivity"
|
||||
android:windowSoftInputMode="adjustPan" />
|
||||
<activity android:name=".ui.user.activity.DataSyncActivity" />
|
||||
<activity android:name=".ui.wateryield.WaterYieldObserveActivity" />
|
||||
<activity android:name=".ui.wateryield.WaterYieldAddObservePointActivity"
|
||||
android:windowSoftInputMode="adjustPan"/>
|
||||
<activity android:name=".ui.wateryield.WaterYieldHomeActivity" />
|
||||
<activity android:name=".ui.wateryield.WaterYieldObserveRecordActivity" />
|
||||
<activity android:name=".ui.geologging.GeologicalPointActivity" />
|
||||
<activity android:name=".ui.geologging.AddGeologicalPointActivity" />
|
||||
<activity android:name=".ui.geologging.AddGeoLoggingFaceActivity" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -25,12 +25,6 @@
|
||||
"iconNormal": "report_tab",
|
||||
"iconSelected": "report_select_tab"
|
||||
},
|
||||
{
|
||||
"tabName": "消息",
|
||||
"tabTag": "key_message_fragment",
|
||||
"iconNormal": "message_tab",
|
||||
"iconSelected": "message_select_tab"
|
||||
},
|
||||
{
|
||||
"tabName": "我的",
|
||||
"tabTag": "key_my_fragment",
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
package com.zmkg.coaloperation
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragmentContainer
|
||||
//import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragmentContainer
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bottomtab.HomeBottomTabLayout
|
||||
import com.zmkg.coaloperation.databinding.ActivityMainBinding
|
||||
import com.zmkg.coaloperation.ui.home.fragment.HomeFragment
|
||||
import com.zmkg.coaloperation.ui.record.fragment.RecordFragment
|
||||
import com.zmkg.coaloperation.ui.report.fragment.ReportFragment
|
||||
import com.zmkg.coaloperation.ui.report.fragment.Report2Fragment
|
||||
import com.zmkg.coaloperation.ui.user.fragment.UserFragment
|
||||
|
||||
class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layout.activity_main),
|
||||
@@ -56,12 +57,12 @@ class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layou
|
||||
}
|
||||
|
||||
TAG_REPORT -> {
|
||||
return ReportFragment()
|
||||
return Report2Fragment()
|
||||
}
|
||||
|
||||
TAG_MESSAGE -> {
|
||||
return TUIConversationFragmentContainer()
|
||||
}
|
||||
// TAG_MESSAGE -> {
|
||||
// return TUIConversationFragmentContainer()
|
||||
// }
|
||||
|
||||
TAG_MY -> {
|
||||
return UserFragment()
|
||||
@@ -77,4 +78,5 @@ class MainActivity : BaseVMBActivity<TestViewModel, ActivityMainBinding>(R.layou
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.zmkg.coaloperation
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Bundle
|
||||
import android.os.StrictMode
|
||||
import android.text.TextUtils
|
||||
@@ -12,8 +13,8 @@ import androidx.lifecycle.ViewModelStoreOwner
|
||||
import androidx.multidex.MultiDex
|
||||
import com.orhanobut.logger.AndroidLogAdapter
|
||||
import com.orhanobut.logger.Logger
|
||||
import com.tencent.qcloud.tuicore.TUILogin
|
||||
import com.tencent.qcloud.tuicore.interfaces.TUILoginListener
|
||||
//import com.tencent.qcloud.tuicore.TUILogin
|
||||
//import com.tencent.qcloud.tuicore.interfaces.TUILoginListener
|
||||
import com.zmkg.coaloperation.local.DataStoreManager
|
||||
import com.zmkg.coaloperation.retorfit.UrlConfig
|
||||
import com.zmkg.coaloperation.superfuntion.loginIm
|
||||
@@ -36,6 +37,16 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
||||
@JvmStatic
|
||||
lateinit var appViewModel: AppViewModel
|
||||
val TAG = MyApplication::class.java.simpleName
|
||||
|
||||
@Volatile
|
||||
private var sharedPref: SharedPreferences? = null
|
||||
fun getSharedPref(): SharedPreferences? {
|
||||
if (sharedPref != null) {
|
||||
return sharedPref
|
||||
}
|
||||
sharedPref = appContext.getSharedPreferences("sp_digital_coal_mining", Context.MODE_PRIVATE)
|
||||
return sharedPref
|
||||
}
|
||||
}
|
||||
|
||||
override fun attachBaseContext(base: Context?) {
|
||||
@@ -62,25 +73,27 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun initLoginStatusListener() {
|
||||
TUILogin.addLoginListener(loginStatusListener)
|
||||
// TUILogin.addLoginListener(loginStatusListener)
|
||||
}
|
||||
|
||||
private val loginStatusListener: TUILoginListener = object : TUILoginListener() {
|
||||
override fun onKickedOffline() {
|
||||
if (UrlConfig.isOpenIm){
|
||||
startLoginActivity(CustomActivityManager.getInstance().currentActivity())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUserSigExpired() {
|
||||
if (TextUtils.isEmpty(DataStoreManager.getUserName())) {
|
||||
startLoginActivity(appContext)
|
||||
} else {
|
||||
loginIm(DataStoreManager.getUserName()){ }
|
||||
}
|
||||
}
|
||||
}
|
||||
// private val loginStatusListener: TUILoginListener = object : TUILoginListener() {
|
||||
// override fun onKickedOffline() {
|
||||
// if (UrlConfig.isOpenIm){
|
||||
// startLoginActivity(CustomActivityManager.getInstance().currentActivity())
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onUserSigExpired() {
|
||||
// if (TextUtils.isEmpty(DataStoreManager.getUserName())) {
|
||||
// startLoginActivity(appContext)
|
||||
// } else {
|
||||
// loginIm(DataStoreManager.getUserName()){ }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/** 获取一个全局的ViewModel */
|
||||
@@ -201,9 +214,11 @@ class MyApplication : Application(), ViewModelStoreOwner {
|
||||
// }
|
||||
// }
|
||||
|
||||
override val viewModelStore: ViewModelStore
|
||||
get() = mAppViewModelStore!!
|
||||
|
||||
override fun getViewModelStore(): ViewModelStore {
|
||||
return mAppViewModelStore!!
|
||||
}
|
||||
// override fun getViewModelStore(): ViewModelStore {
|
||||
// return mAppViewModelStore!!
|
||||
// }
|
||||
|
||||
}
|
||||
+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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
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.databinding.ListItemRockBinding
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
|
||||
class TunnelRoofLithologyAdapter(var list: MutableList<TunnelRoofLithologyEntity>) :
|
||||
BaseQuickAdapter<TunnelRoofLithologyEntity, TunnelRoofLithologyAdapter.VH>(
|
||||
R.layout.list_item_rock, list
|
||||
) {
|
||||
|
||||
inner class VH(var binding: ListItemRockBinding) : BaseViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemRockBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(holder: VH, item: TunnelRoofLithologyEntity) {
|
||||
holder.binding.let {
|
||||
it.root.tag = item.lithologyId
|
||||
it.tvRockStartLen.run {
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.positionStart = text.toString().trim()
|
||||
})
|
||||
setText(item.positionStart.formatDecimalString())
|
||||
}
|
||||
it.tvRockEndLen.run {
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.positionEnd = text.toString().trim()
|
||||
})
|
||||
setText(item.positionEnd.formatDecimalString())
|
||||
}
|
||||
it.tvRockType.run {
|
||||
addTextChangedListener(onTextChanged = { text, start, before, count ->
|
||||
item.lithologyType = text.toString().trim()
|
||||
})
|
||||
setText(item.lithologyType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
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.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.ui.tunneling.activity.TunnelingActivity
|
||||
import com.zmkg.coaloperation.ui.tunneling.activity.WorkingFaceRecordActivity
|
||||
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 TunnelWorkingFaceAdapter(var list: MutableList<TunnelWorkingFaceEntity>) :
|
||||
BaseQuickAdapter<TunnelWorkingFaceEntity, TunnelWorkingFaceAdapter.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: TunnelWorkingFaceEntity
|
||||
) {
|
||||
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 = TunnelWorkingFaceRecordAdapter(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 TunnelingActivity) {
|
||||
ctx.toActivity(WorkingFaceRecordActivity::class.java, Bundle().apply {
|
||||
putString(WorkingFaceRecordActivity.FACE_NAME, item.surfaceName)
|
||||
putParcelable(
|
||||
WorkingFaceRecordActivity.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 com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
import androidx.core.graphics.toColorInt
|
||||
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingFaceRecordBinding
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class TunnelWorkingFaceRecordAdapter(var list: MutableList<TunnelWorkingFaceRecordEntity>) :
|
||||
BaseQuickAdapter<TunnelWorkingFaceRecordEntity, TunnelWorkingFaceRecordAdapter.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: TunnelWorkingFaceRecordEntity
|
||||
) {
|
||||
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)
|
||||
|
||||
}
|
||||
+24
-23
@@ -9,47 +9,48 @@ 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.RockItem
|
||||
import com.zmkg.coaloperation.bean.WorkingFaceItem
|
||||
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||
import com.zmkg.coaloperation.databinding.ListItemRockBinding
|
||||
import com.zmkg.coaloperation.databinding.ListItemWorkingFaceBinding
|
||||
import com.zmkg.coaloperation.databinding.ListItemTunnelWorkingItemBinding
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
|
||||
class WorkingItemAdapter(data: MutableList<WorkingFaceItem>) :
|
||||
BaseQuickAdapter<WorkingFaceItem, WorkingItemAdapter.VH>(
|
||||
R.layout.list_item_working_face,
|
||||
class TunnelWorkingItemAdapter(data: MutableList<TunnelWorkingItem>) :
|
||||
BaseQuickAdapter<TunnelWorkingItem, TunnelWorkingItemAdapter.VH>(
|
||||
R.layout.list_item_tunnel_working_item,
|
||||
data
|
||||
) {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ListItemWorkingFaceBinding.inflate(
|
||||
val binding = ListItemTunnelWorkingItemBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
return VH(binding)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(
|
||||
holder: VH,
|
||||
item: WorkingFaceItem
|
||||
item: TunnelWorkingItem
|
||||
) {
|
||||
if (item.pageType == 0) {
|
||||
loadFaceData(holder.binding, item)
|
||||
} else if (item.pageType == 1) {
|
||||
loadPointData(holder.binding, item)
|
||||
loadRecordData(holder.binding, item)
|
||||
}
|
||||
val position = holder.layoutPosition
|
||||
holder.binding.divider.let {
|
||||
if (position == data.size - 1) {
|
||||
it.visibility = View.GONE
|
||||
} else {
|
||||
it.visibility = View.VISIBLE
|
||||
}
|
||||
holder.binding.divider.run {
|
||||
if (position == data.size - 1) gone() else visible()
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadPointData(binding: ListItemWorkingFaceBinding, item: WorkingFaceItem) {
|
||||
private fun loadRecordData(binding: ListItemTunnelWorkingItemBinding, item: TunnelWorkingItem) {
|
||||
binding.run {
|
||||
tvItemName.text = item.name
|
||||
if (item.items.isNullOrEmpty()) {
|
||||
@@ -70,7 +71,7 @@ class WorkingItemAdapter(data: MutableList<WorkingFaceItem>) :
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun loadFaceData(binding: ListItemWorkingFaceBinding, item: WorkingFaceItem) {
|
||||
private fun loadFaceData(binding: ListItemTunnelWorkingItemBinding, item: TunnelWorkingItem) {
|
||||
binding.tvItemName.let {
|
||||
it.updateLayoutParams { height = ScreenUtil.dp2px(50f) }
|
||||
it.text = item.name
|
||||
@@ -82,7 +83,7 @@ class WorkingItemAdapter(data: MutableList<WorkingFaceItem>) :
|
||||
binding.llContainer.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun addChildToContainer(container: LinearLayout, list: MutableList<RockItem>?) {
|
||||
private fun addChildToContainer(container: LinearLayout, list: MutableList<TunnelRoofLithologyEntity>?) {
|
||||
list?.forEach { item ->
|
||||
val itemBinding = ListItemRockBinding.inflate(
|
||||
LayoutInflater.from(context),
|
||||
@@ -93,17 +94,17 @@ class WorkingItemAdapter(data: MutableList<WorkingFaceItem>) :
|
||||
tvRockStartLen.let {
|
||||
it.focusable = EditText.NOT_FOCUSABLE
|
||||
it.setOnKeyListener(null)
|
||||
it.setText("${item.startLen}")
|
||||
it.setText(item.positionStart.formatDecimalString())
|
||||
}
|
||||
tvRockEndLen.let {
|
||||
it.focusable = EditText.NOT_FOCUSABLE
|
||||
it.setOnKeyListener(null)
|
||||
it.setText("${item.endLen}")
|
||||
it.setText(item.positionEnd.formatDecimalString())
|
||||
}
|
||||
tvRockType.let {
|
||||
it.focusable = EditText.NOT_FOCUSABLE
|
||||
it.setOnKeyListener(null)
|
||||
it.setText(item.rockType)
|
||||
it.setText(item.lithologyType)
|
||||
}
|
||||
container.addView(root)
|
||||
}
|
||||
@@ -111,5 +112,5 @@ class WorkingItemAdapter(data: MutableList<WorkingFaceItem>) :
|
||||
}
|
||||
|
||||
|
||||
inner class VH(var binding: ListItemWorkingFaceBinding) : BaseViewHolder(binding.root)
|
||||
inner class VH(var binding: ListItemTunnelWorkingItemBinding) : BaseViewHolder(binding.root)
|
||||
}
|
||||
+39
@@ -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.databinding.ItemRockNatureBinding
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
|
||||
|
||||
/**
|
||||
* 顶板岩性
|
||||
*/
|
||||
|
||||
class TunnelingRockNatureAdapter(list: MutableList<TunnelRoofLithologyEntity>) :
|
||||
BaseQuickAdapter<TunnelRoofLithologyEntity, TunnelingRockNatureAdapter.VH>(R.layout.item_rock_nature, list) {
|
||||
|
||||
inner class VH(var binding: ItemRockNatureBinding):BaseViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): VH {
|
||||
val binding = ItemRockNatureBinding.inflate(
|
||||
LayoutInflater.from(context),parent, false
|
||||
)
|
||||
return VH(binding).also {
|
||||
bindViewClickListener(it, viewType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun convert(holder: VH, item: TunnelRoofLithologyEntity) {
|
||||
holder.binding.let {
|
||||
it.tvRock1Start.text = item.positionStart.formatDecimalString()
|
||||
it.tvRock1End.text = item.positionEnd.formatDecimalString()
|
||||
it.tvRock1Name.text = item.lithologyType
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.showLoading
|
||||
import com.zmkg.coaloperation.utils.StatusbarUtil
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import com.zmkg.coaloperation.utils.roundedOneDecimalPlace
|
||||
import com.zmkg.coaloperation.view.CustomToast
|
||||
import com.zmkg.coaloperation.view.LoadingDialog
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -53,7 +55,7 @@ import java.sql.SQLException
|
||||
* 封装了ViewModel和DataBinding的Activity基类
|
||||
*/
|
||||
abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private val contentViewResId: Int) :
|
||||
AppCompatActivity(), View.OnClickListener {
|
||||
BaseActivity(), View.OnClickListener {
|
||||
var mContext: Context? = null
|
||||
var mActivity: Activity? = null
|
||||
lateinit var mViewModel: VM
|
||||
@@ -432,4 +434,18 @@ abstract class BaseVMBActivity<VM : BaseViewModel, B : ViewDataBinding>(private
|
||||
configuration.fontScale = 1f
|
||||
return context.createConfigurationContext(configuration)
|
||||
}
|
||||
|
||||
fun getShowNum2(num:String?):String {
|
||||
return num?.formatDecimalString()?:""
|
||||
}
|
||||
fun getShowNum(num:String?):String {
|
||||
if (num.isNullOrBlank()) return "0"
|
||||
try {
|
||||
val showNum = num.toDouble().roundedOneDecimalPlace()
|
||||
return "$showNum"
|
||||
} catch (e: Exception) {
|
||||
return "0"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.zmkg.coaloperation.bean
|
||||
|
||||
data class DictBean(
|
||||
var seam_list: Map<String, String>?,
|
||||
var team_list: Map<String, String>?,
|
||||
var mine_team_shift: Map<String, String>?,
|
||||
var mine_tunnel_nature: Map<String, String>?,
|
||||
var surface_list: Map<String, String>?,
|
||||
var area_list:Map<String, Map<String, Any>?>?
|
||||
)
|
||||
@@ -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
|
||||
)
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.zmkg.coaloperation.bean
|
||||
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
|
||||
data class TunnelWorkingItem(
|
||||
var name: String? = "",
|
||||
var value: String? = "",
|
||||
var items: MutableList<TunnelRoofLithologyEntity>? = null,
|
||||
var pageType: Int = 0
|
||||
)
|
||||
|
||||
data class RockItem(
|
||||
var startLen: Int = 0,
|
||||
var endLen: Int = 0,
|
||||
val rockType: String = ""
|
||||
)
|
||||
|
||||
data class WorkOption(
|
||||
var id: String,
|
||||
var name: String
|
||||
)
|
||||
|
||||
data class Work3LevelOption(
|
||||
var id: String = "",
|
||||
var name: String = "",
|
||||
|
||||
var list: List<Work3LevelOption>? = null
|
||||
)
|
||||
|
||||
data class TunnelSubmitData(
|
||||
var faceList: MutableList<TunnelWorkingFaceEntity>? = null,
|
||||
var recordList: MutableList<TunnelWorkingFaceRecordEntity>? = null,
|
||||
var lithologyList: MutableList<TunnelRoofLithologyEntity>? = null
|
||||
)
|
||||
|
||||
data class WaterYieldRecordItem(
|
||||
var name: String? = "",
|
||||
var value: String? = "",
|
||||
var isHeader: Boolean = false,
|
||||
var items: MutableList<WaterYieldRecordItem>? = null,
|
||||
)
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.zmkg.coaloperation.bean
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
/**
|
||||
* 掘进
|
||||
*/
|
||||
//data class TunnelingHomeBean(
|
||||
// var contentList: MutableList<TunnelingHomeItemBean>?,
|
||||
// val createBy: String?,
|
||||
// val createTime: String?,
|
||||
// val updateBy: String?,
|
||||
// val updateTime: String?,
|
||||
// val remark: String?,
|
||||
// val surfaceId: String?,
|
||||
// val totalFootage: String?,
|
||||
// val seamId: String?,
|
||||
// val areaId: String?,
|
||||
// val seamName: String?,
|
||||
// val surfaceName: String?,
|
||||
// val areaName: String?,
|
||||
// val surfaceAzimuth: String?,
|
||||
// val surfaceHeight: String?,
|
||||
// val surfaceWidth: String?,
|
||||
// val tunnelNature: String?,
|
||||
// val planStartDate: String?,
|
||||
// val planEndDate: String?,
|
||||
// val geologicalType: String?,
|
||||
// val hydrogeologicalType: String?,
|
||||
// val seamIgnition: String?,
|
||||
// val seamGas: String?,
|
||||
// val seamBumpPressure: String?,
|
||||
// val surfaceSupportForm: String?
|
||||
//)
|
||||
//
|
||||
//class TunnelingHomeItemBean {
|
||||
// var createBy: String? = null
|
||||
// var createTime: String? = null
|
||||
// var updateBy: String? = null
|
||||
// var updateTime: String? = null
|
||||
// var remark: String? = null
|
||||
// var recordId: String? = null
|
||||
// var surfaceId: String? = null
|
||||
// var workingDate: String? = null
|
||||
// var teamShift: String? = null
|
||||
// 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 recordPerson: String? = null
|
||||
// var mineWorkingLith: String? = null
|
||||
//}
|
||||
//
|
||||
///**
|
||||
// * 新增工作面 给接口的数据
|
||||
// */
|
||||
//data class TunnelingFaceAddBean(
|
||||
//
|
||||
// val surfaceName: String? = null,
|
||||
// val totalFootage: String? = null,
|
||||
//
|
||||
// val areaId: Int? = null,
|
||||
// val areaName: String? = null,
|
||||
// val createBy: String? = null,
|
||||
// val createTime: String? = null,
|
||||
// val geologicalType: String? = null,
|
||||
// val hydrogeologicalType: String? = null,
|
||||
// val params: Params? = null,
|
||||
// val planEndDate: String? = null,
|
||||
// val planStartDate: String? = null,
|
||||
// val remark: String? = null,
|
||||
// val seamBumpPressure: String? = null,
|
||||
// val seamGas: String? = null,
|
||||
// val seamId: Int? = null,
|
||||
// val seamIgnition: String? = null,
|
||||
// val seamName: String? = null,
|
||||
// val surfaceAzimuth: String? = null,
|
||||
// val surfaceHeight: String? = null,
|
||||
// val surfaceId: Int? = null,
|
||||
// val surfaceSupportForm: String? = null,
|
||||
// val surfaceWidth: String? = null,
|
||||
// val tunnelNature: String? = null,
|
||||
// val updateBy: String? = null,
|
||||
// val updateTime: String? = null
|
||||
//)
|
||||
|
||||
data class Params(
|
||||
val additionalProp1: String? = null,
|
||||
val additionalProp2: String? = null,
|
||||
val additionalProp3: String? = null
|
||||
):Serializable
|
||||
|
||||
|
||||
/**
|
||||
* 工作面详情
|
||||
*/
|
||||
//data class FaceWorkDetailBean(
|
||||
// val accumulativeFootage: Int,
|
||||
// val areaId: Int,
|
||||
// val areaName: String,
|
||||
// val createBy: String,
|
||||
// val createTime: String,
|
||||
// val geologicalType: String,
|
||||
// val hydrogeologicalType: String,
|
||||
// val latestRecord: LatestRecord,
|
||||
// val params: Params,
|
||||
// val planEndDate: String,
|
||||
// val planStartDate: String,
|
||||
// val remainingFootage: Int,
|
||||
// val remark: String,
|
||||
// val seamBumpPressure: String,
|
||||
// val seamGas: String,
|
||||
// val seamId: Int,
|
||||
// val seamIgnition: String,
|
||||
// val seamName: String,
|
||||
// val surfaceAzimuth: String,
|
||||
// val surfaceHeight: String,
|
||||
// val surfaceId: Int,
|
||||
// val surfaceName: String,
|
||||
// val surfaceSupportForm: String,
|
||||
// val surfaceWidth: String,
|
||||
// val totalFootage: Int,
|
||||
// val tunnelNature: String,
|
||||
// val updateBy: String,
|
||||
// val updateTime: String,
|
||||
// val yesterdayFootage: String,
|
||||
// val monthFootage: String
|
||||
//): Serializable
|
||||
|
||||
//data class LatestRecord(
|
||||
// val createBy: String,
|
||||
// val createTime: String,
|
||||
// val mineWorkingLithologyList: MutableList<MineWorkingLithology>,
|
||||
// val params: Params,
|
||||
// val recordId: Int,
|
||||
// val recordPerson: String,
|
||||
// val remark: String,
|
||||
// val seamDip: Int,
|
||||
// val seamHeight: Int,
|
||||
// val surfaceId: Int,
|
||||
// val surfaceName: String,
|
||||
// val teamId: Int,
|
||||
// val teamLeader: String,
|
||||
// val teamName: String,
|
||||
// val teamShift: Int,
|
||||
// val updateBy: String,
|
||||
// val updateTime: String,
|
||||
// val waterYield: Int,
|
||||
// val workingDate: String,
|
||||
// val workingFootage: Int
|
||||
//):Serializable
|
||||
|
||||
//
|
||||
//data class MineWorkingLithology(
|
||||
// val createBy: String,
|
||||
// val createTime: String,
|
||||
// val lithologyId: Int,
|
||||
// val lithologyType: String,
|
||||
// val params: Params,
|
||||
// val positionEnd: Int,
|
||||
// val positionStart: Int,
|
||||
// val recordId: Int,
|
||||
// val remark: String,
|
||||
// val updateBy: String,
|
||||
// val updateTime: String
|
||||
//):Serializable
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.zmkg.coaloperation.bean
|
||||
|
||||
data class WorkingFaceItem(
|
||||
var name: String = "",
|
||||
var value: String = "",
|
||||
var items: MutableList<RockItem>? = null,
|
||||
var pageType:Int = 0
|
||||
)
|
||||
|
||||
data class RockItem(
|
||||
var startLen: Int = 0,
|
||||
var endLen: Int = 0,
|
||||
val rockType: String = ""
|
||||
)
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.zmkg.coaloperation.data.api
|
||||
|
||||
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||
import com.zmkg.coaloperation.data.bean.ApiResponse
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.retorfit.UrlConfig
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeBean
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeItemBean
|
||||
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
||||
import okhttp3.RequestBody
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Path
|
||||
|
||||
/**
|
||||
* 首页
|
||||
@@ -27,25 +24,34 @@ interface HomeApi {
|
||||
/**
|
||||
* 掘进-首页-工作面列表
|
||||
*/
|
||||
@GET("/api/mine/tunnelling/surface/list")
|
||||
suspend fun getTunnelingHomeData(): ApiResponse<MutableList<TunnelingHomeBean>>
|
||||
// @GET("/api/mine/tunnelling/surface/list")
|
||||
// suspend fun getTunnelingHomeData(): ApiResponse<MutableList<TunnelingHomeBean>>
|
||||
|
||||
/**
|
||||
* 掘进-首页-工作面记录列表
|
||||
*/
|
||||
@GET("/api/mine/tunnelling/surface/record/{recordId}")
|
||||
suspend fun getTunnelingHomeItemData(@Path("recordId") recordId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>>
|
||||
// /**
|
||||
// * 掘进-首页-工作面记录列表
|
||||
// */
|
||||
// @GET("/api/mine/tunnelling/surface/record/{recordId}")
|
||||
// suspend fun getTunnelingHomeItemData(@Path("recordId") recordId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>>
|
||||
|
||||
/**
|
||||
* 掘进-工作面详情
|
||||
*/
|
||||
@GET("/api/mine/tunnelling/surface/detail/{surfaceId}")
|
||||
suspend fun getTunnelingSurfaceDetail(@Path("surfaceId") surfaceId: String?): ApiResponse<FaceWorkDetailBean>
|
||||
// /**
|
||||
// * 掘进-工作面详情
|
||||
// */
|
||||
// @GET("/api/mine/tunnelling/surface/detail/{surfaceId}")
|
||||
// suspend fun getTunnelingSurfaceDetail(@Path("surfaceId") surfaceId: String?): ApiResponse<FaceWorkDetailBean>
|
||||
|
||||
/**
|
||||
* 掘进-新增工作面
|
||||
*/
|
||||
@POST("/api/mine/tunnelling/surface/add")
|
||||
suspend fun postTunnellingSurfaceAdd(@Body requestBody: RequestBody): ApiResponse<String>
|
||||
// @POST("/api/mine/tunnelling/surface/add")
|
||||
// suspend fun postTunnellingSurfaceAdd(@Body requestBody: RequestBody): ApiResponse<String>
|
||||
|
||||
@GET("/api/mine/tunnelling/surface/detailList")
|
||||
suspend fun getTunnelHomeList(): ApiResponse<MutableList<TunnelWorkingFaceEntity>?>
|
||||
|
||||
@GET("/api/mine/tunnelling/dictionaries")
|
||||
suspend fun getTunnelAllDict(): ApiResponse<Any?>
|
||||
|
||||
@POST("/api/mine/tunnelling/data/push")
|
||||
suspend fun tunnelDataPush(@Body data: TunnelSubmitData): ApiResponse<Any?>
|
||||
|
||||
}
|
||||
+47
-34
@@ -1,19 +1,15 @@
|
||||
package com.zmkg.coaloperation.data.repository
|
||||
|
||||
import com.zmkg.coaloperation.base.repository.BaseRepository
|
||||
import com.zmkg.coaloperation.bean.TunnelSubmitData
|
||||
import com.zmkg.coaloperation.data.api.HomeApi
|
||||
import com.zmkg.coaloperation.data.bean.ApiResponse
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.retorfit.RetrofitManager
|
||||
import com.zmkg.coaloperation.retorfit.RetrofitManager.toRequestBody
|
||||
import com.zmkg.coaloperation.superfuntion.toJson
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingFaceAddBean
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeBean
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeItemBean
|
||||
import com.zmkg.coaloperation.ui.home.bean.WaterLedgerBean
|
||||
|
||||
|
||||
object HomeRepository : BaseRepository(){
|
||||
object HomeRepository : BaseRepository() {
|
||||
|
||||
private val service by lazy { RetrofitManager.getService(HomeApi::class.java) }
|
||||
|
||||
@@ -28,43 +24,60 @@ object HomeRepository : BaseRepository(){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 掘进-首页-工作面列表
|
||||
*/
|
||||
suspend fun getTunnelingHomeData(): ApiResponse<MutableList<TunnelingHomeBean>> {
|
||||
// /**
|
||||
// * 掘进-首页-工作面列表
|
||||
// */
|
||||
// suspend fun getTunnelingHomeData(): ApiResponse<MutableList<TunnelingHomeBean>> {
|
||||
// return apiCall {
|
||||
// val map = mutableMapOf<String, Any?>()
|
||||
// service.getTunnelingHomeData()
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 掘进-首页-工作面记录列表
|
||||
// */
|
||||
// suspend fun getTunnelingHomeItemData(surfaceId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>> {
|
||||
// return apiCall {
|
||||
// val map = mutableMapOf<String, Any?>()
|
||||
// service.getTunnelingHomeItemData(surfaceId)
|
||||
// }
|
||||
// }
|
||||
// /**
|
||||
// * 掘进-工作面详情
|
||||
// */
|
||||
// suspend fun getTunnelingSurfaceDetail(surfaceId: String?): ApiResponse<FaceWorkDetailBean> {
|
||||
// return apiCall {
|
||||
// val map = mutableMapOf<String, Any?>()
|
||||
// service.getTunnelingSurfaceDetail(surfaceId)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 掘进-新增工作面
|
||||
// */
|
||||
// suspend fun postTunnellingSurfaceAdd(tunnelingFaceAddBean: TunnelingFaceAddBean): ApiResponse<String> {
|
||||
// return apiCall {
|
||||
// service.postTunnellingSurfaceAdd(tunnelingFaceAddBean.toJson().toRequestBody())
|
||||
// }
|
||||
// }
|
||||
//
|
||||
suspend fun getTunnelHomeList(): ApiResponse<MutableList<TunnelWorkingFaceEntity>?> {
|
||||
return apiCall {
|
||||
val map = mutableMapOf<String, Any?>()
|
||||
service.getTunnelingHomeData()
|
||||
service.getTunnelHomeList()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 掘进-首页-工作面记录列表
|
||||
*/
|
||||
suspend fun getTunnelingHomeItemData(surfaceId: String?): ApiResponse<MutableList<TunnelingHomeItemBean>> {
|
||||
suspend fun getTunnelAllDict(): ApiResponse<Any?> {
|
||||
return apiCall {
|
||||
val map = mutableMapOf<String, Any?>()
|
||||
service.getTunnelingHomeItemData(surfaceId)
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 掘进-工作面详情
|
||||
*/
|
||||
suspend fun getTunnelingSurfaceDetail(surfaceId: String?): ApiResponse<FaceWorkDetailBean> {
|
||||
return apiCall {
|
||||
val map = mutableMapOf<String, Any?>()
|
||||
service.getTunnelingSurfaceDetail(surfaceId)
|
||||
service.getTunnelAllDict()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 掘进-新增工作面
|
||||
*/
|
||||
suspend fun postTunnellingSurfaceAdd(tunnelingFaceAddBean: TunnelingFaceAddBean): ApiResponse<String> {
|
||||
suspend fun tunnelDataPush(data: TunnelSubmitData): ApiResponse<Any?> {
|
||||
return apiCall {
|
||||
service.postTunnellingSurfaceAdd(tunnelingFaceAddBean.toJson().toRequestBody())
|
||||
service.tunnelDataPush(data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.zmkg.coaloperation.db
|
||||
|
||||
import android.content.Context
|
||||
import androidx.room.Database
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
import com.zmkg.coaloperation.db.dao.MiningCoalHeightDao
|
||||
import com.zmkg.coaloperation.db.dao.MiningWorkingFaceDao
|
||||
import com.zmkg.coaloperation.db.dao.MiningWorkingFaceRecordDao
|
||||
import com.zmkg.coaloperation.db.dao.TunnelRoofLithologyDao
|
||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceDao
|
||||
import com.zmkg.coaloperation.db.dao.TunnelWorkingFaceRecordDao
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningCoalHeightEntity
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.entity.mining.MiningWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
|
||||
@Database(
|
||||
entities = [
|
||||
TunnelWorkingFaceEntity::class,
|
||||
TunnelWorkingFaceRecordEntity::class,
|
||||
TunnelRoofLithologyEntity::class,
|
||||
MiningWorkingFaceEntity::class,
|
||||
MiningWorkingFaceRecordEntity::class,
|
||||
MiningCoalHeightEntity::class,
|
||||
],
|
||||
version = 1,
|
||||
exportSchema = true
|
||||
)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
abstract fun tunnelWorkingFaceDao(): TunnelWorkingFaceDao
|
||||
abstract fun tunnelWorkingFaceRecordDao(): TunnelWorkingFaceRecordDao
|
||||
abstract fun tunnelRoofLithologyDao(): TunnelRoofLithologyDao
|
||||
abstract fun miningWorkingFaceDao(): MiningWorkingFaceDao
|
||||
abstract fun miningWorkingFaceRecordDao(): MiningWorkingFaceRecordDao
|
||||
abstract fun miningCoalHeightDao(): MiningCoalHeightDao
|
||||
|
||||
companion object {
|
||||
@Volatile
|
||||
private var INSTANCE: AppDatabase? = null
|
||||
|
||||
fun getDatabase(context: Context): AppDatabase {
|
||||
return INSTANCE ?: synchronized(this) {
|
||||
val instance = Room.databaseBuilder(
|
||||
context.applicationContext,
|
||||
AppDatabase::class.java,
|
||||
"digitalCoalMiningPlatform.db"
|
||||
)
|
||||
.addCallback(object : Callback() {
|
||||
override fun onCreate(db: SupportSQLiteDatabase) {
|
||||
// 数据库首次创建时初始化数据
|
||||
}
|
||||
})
|
||||
// .addMigrations(MIGRATION_1_2)
|
||||
// .addMigrations(MIGRATION_2_3)
|
||||
.build()
|
||||
INSTANCE = instance
|
||||
instance
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val MIGRATION_1_2 = MigrationImpl(1, 2) { db ->
|
||||
db.execSQL("""
|
||||
CREATE TABLE IF NOT EXISTS `tunnel_roof_lithology` (
|
||||
`lithologyId` INTEGER PRIMARY KEY NOT NULL,
|
||||
`surfaceId` INTEGER NOT NULL,
|
||||
`recordId` INTEGER NOT NULL,
|
||||
`positionStart` INTEGER NOT NULL,
|
||||
`positionEnd` INTEGER NOT NULL,
|
||||
`lithologyType` TEXT NOT NULL,
|
||||
`createTime` TEXT NOT NULL
|
||||
)
|
||||
""".trimIndent())
|
||||
}
|
||||
val MIGRATION_2_3 = MigrationImpl(2, 3) { db ->
|
||||
db.execSQL("ALTER TABLE tunnel_roof_lithology RENAME TO tunnel_roof_lithology2")
|
||||
db.execSQL("""
|
||||
CREATE TABLE IF NOT EXISTS `tunnel_roof_lithology` (
|
||||
`lithologyId` INTEGER PRIMARY KEY NOT NULL,
|
||||
`surfaceId` INTEGER NOT NULL,
|
||||
`recordId` INTEGER NOT NULL,
|
||||
`positionStart` TEXT NOT NULL,
|
||||
`positionEnd` TEXT NOT NULL,
|
||||
`lithologyType` TEXT NOT NULL,
|
||||
`createTime` TEXT NOT NULL
|
||||
)
|
||||
""".trimIndent())
|
||||
db.execSQL("""
|
||||
INSERT INTO tunnel_roof_lithology
|
||||
SELECT lithologyId,surfaceId,recordId,CAST(positionStart AS TEXT),CAST(positionEnd AS TEXT),lithologyType,createTime
|
||||
FROM tunnel_roof_lithology2
|
||||
""".trimIndent())
|
||||
db.execSQL("DROP TABLE tunnel_roof_lithology2");
|
||||
}
|
||||
|
||||
class MigrationImpl(
|
||||
startVersion: Int,
|
||||
endVersion: Int,
|
||||
private val block: (db: SupportSQLiteDatabase) -> Unit
|
||||
) : Migration(startVersion, endVersion) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
block(database)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
+44
@@ -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.tunnel.TunnelRoofLithologyEntity
|
||||
|
||||
@Dao
|
||||
interface TunnelRoofLithologyDao {
|
||||
@Insert
|
||||
fun insert(entity: TunnelRoofLithologyEntity): Long
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertList(list: MutableList<TunnelRoofLithologyEntity>): Array<Long>
|
||||
|
||||
@Update
|
||||
fun update(entity: TunnelRoofLithologyEntity)
|
||||
|
||||
@Query("SELECT * FROM tunnel_roof_lithology WHERE recordId = :recordId ORDER BY createTime ASC")
|
||||
fun getEntityList(recordId: Long): MutableList<TunnelRoofLithologyEntity>?
|
||||
|
||||
@Query("SELECT * FROM tunnel_roof_lithology WHERE dataState = :dataState ORDER BY createTime ASC")
|
||||
fun getEntityListByState(dataState: String): MutableList<TunnelRoofLithologyEntity>?
|
||||
|
||||
@Query("SELECT * FROM tunnel_roof_lithology WHERE surfaceId = :surfaceId ORDER BY createTime ASC")
|
||||
fun getEntityListByFaceId(surfaceId: Long): MutableList<TunnelRoofLithologyEntity>?
|
||||
|
||||
@Query("SELECT * FROM tunnel_roof_lithology WHERE surfaceId = :surfaceId AND recordId = :recordId ORDER BY createTime ASC")
|
||||
fun getEntityListByRecordId(
|
||||
surfaceId: Long,
|
||||
recordId: Long
|
||||
): MutableList<TunnelRoofLithologyEntity>?
|
||||
|
||||
@Query("SELECT * FROM tunnel_roof_lithology WHERE lithologyId = :lithologyId")
|
||||
fun getEntityById(lithologyId: Long): TunnelRoofLithologyEntity?
|
||||
|
||||
@Query("DELETE FROM tunnel_roof_lithology")
|
||||
fun deleteAll(): Int
|
||||
|
||||
@Query("DELETE FROM tunnel_roof_lithology WHERE recordId = :recordId")
|
||||
fun deleteList(recordId: Long): Int
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
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.tunnel.TunnelWorkingFaceEntity
|
||||
|
||||
//import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
interface TunnelWorkingFaceDao {
|
||||
@Insert
|
||||
fun insert(entity: TunnelWorkingFaceEntity): Long
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertList(list: MutableList<TunnelWorkingFaceEntity>): Array<Long>
|
||||
|
||||
@Update
|
||||
fun update(entity: TunnelWorkingFaceEntity)
|
||||
|
||||
@Query("SELECT * FROM tunnel_working_face ORDER BY createTime DESC")
|
||||
fun getEntityList(): MutableList<TunnelWorkingFaceEntity>?
|
||||
|
||||
@RawQuery
|
||||
fun getEntityListBySql(query: SupportSQLiteQuery): MutableList<TunnelWorkingFaceEntity>?
|
||||
|
||||
@Query("SELECT * FROM tunnel_working_face WHERE dataState = :dataState ORDER BY createTime DESC")
|
||||
fun getEntityListByState(dataState: String): MutableList<TunnelWorkingFaceEntity>?
|
||||
|
||||
@Query("SELECT * FROM tunnel_working_face WHERE surfaceId = :surfaceId")
|
||||
fun getEntityById(surfaceId: Long): TunnelWorkingFaceEntity?
|
||||
|
||||
@Query("DELETE FROM tunnel_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.tunnel.TunnelWorkingFaceRecordEntity
|
||||
|
||||
//import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
interface TunnelWorkingFaceRecordDao {
|
||||
@Insert
|
||||
fun insert(entity: TunnelWorkingFaceRecordEntity): Long
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertList(list: MutableList<TunnelWorkingFaceRecordEntity>): Array<Long>
|
||||
|
||||
@Update
|
||||
fun update(entity: TunnelWorkingFaceRecordEntity)
|
||||
|
||||
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :surfaceId ORDER BY createTime DESC")
|
||||
fun getEntityList(surfaceId: Long): MutableList<TunnelWorkingFaceRecordEntity>?
|
||||
|
||||
@Query("SELECT * FROM tunnel_working_face_record WHERE dataState = :dataState ORDER BY createTime DESC")
|
||||
fun getEntityListByState(dataState: String): MutableList<TunnelWorkingFaceRecordEntity>?
|
||||
|
||||
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :recordId")
|
||||
fun getEntityById(recordId: Long): TunnelWorkingFaceRecordEntity
|
||||
|
||||
@Query("SELECT * FROM tunnel_working_face_record WHERE surfaceId = :surfaceId AND latestRecordState = '1' ORDER BY createTime DESC LIMIT 1")
|
||||
fun getLastEntity(surfaceId: Long): TunnelWorkingFaceRecordEntity?
|
||||
|
||||
@Query("DELETE FROM tunnel_working_face_record")
|
||||
fun deleteAll(): Int
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.zmkg.coaloperation.db.entity
|
||||
|
||||
class OtherEntity {
|
||||
}
|
||||
+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
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.zmkg.coaloperation.db.entity.tunnel
|
||||
|
||||
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 = "tunnel_roof_lithology")
|
||||
class TunnelRoofLithologyEntity (
|
||||
|
||||
/**
|
||||
* 岩性Id
|
||||
*/
|
||||
@PrimaryKey
|
||||
var lithologyId: Long = 0,
|
||||
|
||||
/**
|
||||
* 岩性类型名称
|
||||
*/
|
||||
var lithologyType: String = "",
|
||||
|
||||
/**
|
||||
* 岩性值结束
|
||||
*/
|
||||
var positionEnd: String = "",
|
||||
|
||||
/**
|
||||
* 岩性值起始
|
||||
*/
|
||||
var positionStart: 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(lithologyId = 0)
|
||||
}
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
package com.zmkg.coaloperation.db.entity.tunnel
|
||||
|
||||
//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 = "tunnel_working_face")
|
||||
class TunnelWorkingFaceEntity(
|
||||
// @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<TunnelWorkingFaceRecordEntity>? = null,
|
||||
|
||||
@Ignore
|
||||
var latestRecord: TunnelWorkingFaceRecordEntity? = null,
|
||||
|
||||
@Ignore
|
||||
var isExpandRecord: Boolean = false
|
||||
): Parcelable
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
package com.zmkg.coaloperation.db.entity.tunnel
|
||||
|
||||
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 = "tunnel_working_face_record")
|
||||
data class TunnelWorkingFaceRecordEntity (
|
||||
|
||||
/**
|
||||
* 记录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 mineWorkingLithologyList: MutableList<TunnelRoofLithologyEntity>? = null,
|
||||
|
||||
@Ignore
|
||||
var operationType: String = "1"
|
||||
): Parcelable
|
||||
+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()
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.zmkg.coaloperation.db.repository
|
||||
|
||||
import com.zmkg.coaloperation.db.dao.TunnelRoofLithologyDao
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class TunnelRoofLithologyRepository(private val dao: TunnelRoofLithologyDao) {
|
||||
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: TunnelRoofLithologyEntity) = withContext(Dispatchers.IO) {
|
||||
dao.insert(entity)
|
||||
}
|
||||
|
||||
suspend fun insertList(list: MutableList<TunnelRoofLithologyEntity>) =
|
||||
withContext(Dispatchers.IO) {
|
||||
dao.insertList(list)
|
||||
}
|
||||
|
||||
suspend fun update(entity: TunnelRoofLithologyEntity) = 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.TunnelWorkingFaceRecordDao
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class TunnelWorkingFaceRecordRepository(private val dao: TunnelWorkingFaceRecordDao) {
|
||||
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: TunnelWorkingFaceRecordEntity) = withContext(Dispatchers.IO) {
|
||||
dao.insert(entity)
|
||||
}
|
||||
|
||||
suspend fun insertList(list: MutableList<TunnelWorkingFaceRecordEntity>) =
|
||||
withContext(Dispatchers.IO) {
|
||||
dao.insertList(list)
|
||||
}
|
||||
|
||||
suspend fun update(entity: TunnelWorkingFaceRecordEntity) = 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.TunnelWorkingFaceDao
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class TunnelWorkingFaceRepository(private val dao: TunnelWorkingFaceDao) {
|
||||
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: TunnelWorkingFaceEntity) = withContext(Dispatchers.IO) {
|
||||
dao.insert(entity)
|
||||
}
|
||||
|
||||
suspend fun insertList(list: MutableList<TunnelWorkingFaceEntity>) = withContext(Dispatchers.IO) {
|
||||
dao.insertList(list)
|
||||
}
|
||||
|
||||
suspend fun update(entity: TunnelWorkingFaceEntity) = 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()
|
||||
}
|
||||
}
|
||||
+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)
|
||||
}
|
||||
}
|
||||
+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.tunnel.TunnelRoofLithologyEntity
|
||||
import com.zmkg.coaloperation.db.repository.TunnelRoofLithologyRepository
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class TunnelRoofLithologyViewModel(application: Application) : AndroidViewModel(application) {
|
||||
private val repository: TunnelRoofLithologyRepository
|
||||
|
||||
init {
|
||||
val dao = AppDatabase.getDatabase(application).tunnelRoofLithologyDao()
|
||||
repository = TunnelRoofLithologyRepository(dao)
|
||||
}
|
||||
|
||||
fun getEntityList(recordId: Long, action: (MutableList<TunnelRoofLithologyEntity>?) -> Unit) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<TunnelRoofLithologyEntity>? = repository.getEntityList(recordId)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByState(
|
||||
dataState: String,
|
||||
action: (MutableList<TunnelRoofLithologyEntity>?) -> Unit
|
||||
) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<TunnelRoofLithologyEntity>? =
|
||||
repository.getEntityListByState(dataState)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByFaceId(
|
||||
surfaceId: Long,
|
||||
action: (MutableList<TunnelRoofLithologyEntity>?) -> Unit
|
||||
) = viewModelScope.launch {
|
||||
val list: MutableList<TunnelRoofLithologyEntity>? =
|
||||
repository.getEntityListByFaceId(surfaceId)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByRecordId(
|
||||
surfaceId: Long,
|
||||
recordId: Long,
|
||||
action: (MutableList<TunnelRoofLithologyEntity>?) -> Unit
|
||||
) = viewModelScope.launch {
|
||||
val list: MutableList<TunnelRoofLithologyEntity>? =
|
||||
repository.getEntityListByRecordId(surfaceId, recordId)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun insertList(list: MutableList<TunnelRoofLithologyEntity>, action: () -> Unit = {}) =
|
||||
viewModelScope.launch {
|
||||
repository.insertList(list)
|
||||
action()
|
||||
}
|
||||
|
||||
fun insert(entity: TunnelRoofLithologyEntity, action: () -> Unit) = viewModelScope.launch {
|
||||
repository.insert(entity)
|
||||
action()
|
||||
}
|
||||
|
||||
fun update(entity: TunnelRoofLithologyEntity, action: () -> Unit) = viewModelScope.launch {
|
||||
repository.update(entity)
|
||||
action()
|
||||
}
|
||||
|
||||
fun getEntityById(faceId: Long, action: (TunnelRoofLithologyEntity) -> 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.tunnel.TunnelWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.db.repository.TunnelWorkingFaceRecordRepository
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class TunnelWorkingFaceRecordViewModel(application: Application) : AndroidViewModel(application) {
|
||||
private val repository: TunnelWorkingFaceRecordRepository
|
||||
|
||||
init {
|
||||
val dao = AppDatabase.getDatabase(application).tunnelWorkingFaceRecordDao()
|
||||
repository = TunnelWorkingFaceRecordRepository(dao)
|
||||
}
|
||||
|
||||
fun getEntityList(
|
||||
surfaceId: Long,
|
||||
action: (MutableList<TunnelWorkingFaceRecordEntity>?) -> Unit
|
||||
) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<TunnelWorkingFaceRecordEntity>? =
|
||||
repository.getEntityList(surfaceId)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByState(
|
||||
dataState: String,
|
||||
action: (MutableList<TunnelWorkingFaceRecordEntity>?) -> Unit
|
||||
) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<TunnelWorkingFaceRecordEntity>? =
|
||||
repository.getEntityListByState(dataState)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun insert(entity: TunnelWorkingFaceRecordEntity, action: () -> Unit) = viewModelScope.launch {
|
||||
repository.insert(entity)
|
||||
action()
|
||||
}
|
||||
|
||||
fun insertList(list: MutableList<TunnelWorkingFaceRecordEntity>, action: () -> Unit = {}) =
|
||||
viewModelScope.launch {
|
||||
repository.insertList(list)
|
||||
action()
|
||||
}
|
||||
|
||||
fun update(entity: TunnelWorkingFaceRecordEntity, action: () -> Unit) = viewModelScope.launch {
|
||||
repository.update(entity)
|
||||
action()
|
||||
}
|
||||
|
||||
fun getEntityById(recordId: Long) = viewModelScope.launch {
|
||||
repository.getEntityById(recordId)
|
||||
}
|
||||
|
||||
fun getLastEntity(surfaceId: Long, action: (TunnelWorkingFaceRecordEntity?) -> Unit) = viewModelScope.launch {
|
||||
val record = repository.getLastEntity(surfaceId)
|
||||
action(record)
|
||||
}
|
||||
|
||||
fun deleteAll(action: () -> Unit={}) = viewModelScope.launch {
|
||||
repository.deleteAll()
|
||||
action()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package com.zmkg.coaloperation.db.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import androidx.sqlite.db.SimpleSQLiteQuery
|
||||
import androidx.sqlite.db.SupportSQLiteQuery
|
||||
import com.zmkg.coaloperation.db.AppDatabase
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.repository.TunnelWorkingFaceRepository
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class TunnelWorkingFaceViewModel(application: Application) : AndroidViewModel(application) {
|
||||
private val repository: TunnelWorkingFaceRepository
|
||||
|
||||
init {
|
||||
val dao = AppDatabase.getDatabase(application).tunnelWorkingFaceDao()
|
||||
repository = TunnelWorkingFaceRepository(dao)
|
||||
}
|
||||
|
||||
fun getEntityList(action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<TunnelWorkingFaceEntity>? = repository.getEntityList()
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByUserId(userId:String, action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit) =
|
||||
viewModelScope.launch {
|
||||
val sql = buildString {
|
||||
append("SELECT * FROM tunnel_working_face WHERE 1=1 ")
|
||||
if (userId.isNotBlank()) {
|
||||
append(" AND userId = $userId")
|
||||
}
|
||||
}
|
||||
val query = SimpleSQLiteQuery(sql)
|
||||
val list: MutableList<TunnelWorkingFaceEntity>? = repository.getEntityListBySql(query)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListBySql(
|
||||
query: SupportSQLiteQuery,
|
||||
action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit
|
||||
) =
|
||||
viewModelScope.launch {
|
||||
val list: MutableList<TunnelWorkingFaceEntity>? = repository.getEntityListBySql(query)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun getEntityListByState(
|
||||
dataState: String,
|
||||
action: (MutableList<TunnelWorkingFaceEntity>?) -> Unit
|
||||
) = viewModelScope.launch {
|
||||
val list: MutableList<TunnelWorkingFaceEntity>? = repository.getEntityListByState(dataState)
|
||||
action(list)
|
||||
}
|
||||
|
||||
fun insert(entity: TunnelWorkingFaceEntity, action: () -> Unit) = viewModelScope.launch {
|
||||
repository.insert(entity)
|
||||
action()
|
||||
}
|
||||
|
||||
fun insertList(list: MutableList<TunnelWorkingFaceEntity>, action: () -> Unit = {}) =
|
||||
viewModelScope.launch {
|
||||
repository.insertList(list)
|
||||
action()
|
||||
}
|
||||
|
||||
fun update(entity: TunnelWorkingFaceEntity, action: () -> Unit) = viewModelScope.launch {
|
||||
repository.update(entity)
|
||||
action()
|
||||
}
|
||||
|
||||
fun getEntityById(faceId: Long, action: (TunnelWorkingFaceEntity) -> Unit) =
|
||||
viewModelScope.launch {
|
||||
val entity = repository.getEntityById(faceId)
|
||||
entity?.let { action(it) }
|
||||
}
|
||||
|
||||
fun deleteAll(action: () -> Unit = {}) =
|
||||
viewModelScope.launch {
|
||||
repository.deleteAll()
|
||||
action()
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
+46
-46
@@ -2,10 +2,10 @@ package com.zmkg.coaloperation.superfuntion
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.tencent.imsdk.BaseConstants
|
||||
import com.tencent.qcloud.tuicore.TUILogin
|
||||
import com.tencent.qcloud.tuicore.interfaces.TUICallback
|
||||
import com.tencent.qcloud.tuicore.interfaces.TUILoginConfig
|
||||
//import com.tencent.imsdk.BaseConstants
|
||||
//import com.tencent.qcloud.tuicore.TUILogin
|
||||
//import com.tencent.qcloud.tuicore.interfaces.TUICallback
|
||||
//import com.tencent.qcloud.tuicore.interfaces.TUILoginConfig
|
||||
import com.zmkg.coaloperation.MyApplication
|
||||
import com.zmkg.coaloperation.im.signature.GenerateTestUserSig
|
||||
import com.zmkg.coaloperation.local.DataStoreManager
|
||||
@@ -25,54 +25,54 @@ fun Context.loginIm(userId: String,successCall: () -> Unit = {}) {
|
||||
// successCall.invoke()
|
||||
return
|
||||
}
|
||||
if (TUILogin.isUserLogined() && userId == TUILogin.getUserId()) {
|
||||
// successCall.invoke()
|
||||
return
|
||||
}
|
||||
// if (TUILogin.isUserLogined() && userId == TUILogin.getUserId()) {
|
||||
//// successCall.invoke()
|
||||
// return
|
||||
// }
|
||||
|
||||
TUILogin.login(
|
||||
this,
|
||||
GenerateTestUserSig.SDKAPPID,
|
||||
userId,
|
||||
userSig,
|
||||
TUILoginConfig(),
|
||||
object : TUICallback() {
|
||||
override fun onError(code: Int, desc: String) {
|
||||
// successCall.invoke()
|
||||
when (code) {
|
||||
BaseConstants.ERR_SVR_ACCOUNT_USERSIG_EXPIRED,
|
||||
BaseConstants.ERR_USER_SIG_EXPIRED -> {//UserSig过期
|
||||
// CustomToast.makeText(this@loginIm,"im登录失败", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
Log.i(MyApplication.TAG, "imLogin errorCode = $code, errorInfo = $desc")
|
||||
}
|
||||
|
||||
override fun onSuccess() {
|
||||
// successCall.invoke()
|
||||
Log.i(MyApplication.TAG, "imLogin onSuccess ")
|
||||
}
|
||||
})
|
||||
// TUILogin.login(
|
||||
// this,
|
||||
// GenerateTestUserSig.SDKAPPID,
|
||||
// userId,
|
||||
// userSig,
|
||||
// TUILoginConfig(),
|
||||
// object : TUICallback() {
|
||||
// override fun onError(code: Int, desc: String) {
|
||||
//// successCall.invoke()
|
||||
// when (code) {
|
||||
// BaseConstants.ERR_SVR_ACCOUNT_USERSIG_EXPIRED,
|
||||
// BaseConstants.ERR_USER_SIG_EXPIRED -> {//UserSig过期
|
||||
//// CustomToast.makeText(this@loginIm,"im登录失败", Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
// }
|
||||
// Log.i(MyApplication.TAG, "imLogin errorCode = $code, errorInfo = $desc")
|
||||
// }
|
||||
//
|
||||
// override fun onSuccess() {
|
||||
//// successCall.invoke()
|
||||
// Log.i(MyApplication.TAG, "imLogin onSuccess ")
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fun logout(successCall: () -> Unit = {}){
|
||||
if (!TUILogin.isUserLogined()){
|
||||
return
|
||||
}
|
||||
CoroutineScope(Dispatchers.Main).launch{
|
||||
DataStoreManager.setUserName("")
|
||||
}
|
||||
TUILogin.logout(object : TUICallback(){
|
||||
override fun onSuccess() {
|
||||
successCall.invoke()
|
||||
}
|
||||
|
||||
override fun onError(errorCode: Int, errorMessage: String?) {
|
||||
Log.i("","IM logout errorCode = $errorCode, errorInfo = $errorMessage")
|
||||
}
|
||||
})
|
||||
// if (!TUILogin.isUserLogined()){
|
||||
// return
|
||||
// }
|
||||
// CoroutineScope(Dispatchers.Main).launch{
|
||||
// DataStoreManager.setUserName("")
|
||||
// }
|
||||
// TUILogin.logout(object : TUICallback(){
|
||||
// override fun onSuccess() {
|
||||
// successCall.invoke()
|
||||
// }
|
||||
//
|
||||
// override fun onError(errorCode: Int, errorMessage: String?) {
|
||||
// Log.i("","IM logout errorCode = $errorCode, errorInfo = $errorMessage")
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ fun ImageView.loadCircle(@DrawableRes resourceId: Int) {
|
||||
* @param imageView View
|
||||
* @param placeholder 占位图
|
||||
*/
|
||||
fun ImageView.loadRoundedImage(
|
||||
fun ImageView.loadRoundedImage2(
|
||||
url: String?,
|
||||
roundingRadius: Float,
|
||||
@DrawableRes defaultResId: Int = 0,
|
||||
@@ -239,6 +239,32 @@ fun ImageView.loadRoundedImage(
|
||||
.into(this)
|
||||
}
|
||||
|
||||
fun ImageView.loadRoundedImage(
|
||||
any: Any,
|
||||
roundingRadius: Float,
|
||||
@DrawableRes defaultResId: Int = 0,
|
||||
isCenterCrop:Boolean = true
|
||||
) {
|
||||
//设置图片圆角角度
|
||||
val roundedCorners = RoundedCorners(dp2px(roundingRadius))
|
||||
val multiTransformation: MultiTransformation<Bitmap> = MultiTransformation(
|
||||
if (isCenterCrop) CenterCrop() else FitCenter(), roundedCorners
|
||||
)
|
||||
val options = RequestOptions
|
||||
.bitmapTransform(multiTransformation)
|
||||
if (defaultResId == 0) {
|
||||
options.placeholder(R.drawable.ic_default)
|
||||
.error(R.drawable.ic_default)
|
||||
} else {
|
||||
options.placeholder(defaultResId)
|
||||
.error(defaultResId)
|
||||
}
|
||||
Glide.with(context)
|
||||
.load(any)
|
||||
.apply(options)
|
||||
.into(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载图片到ImageView
|
||||
* @param imageUrl 图片地址
|
||||
|
||||
+39
@@ -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
|
||||
|
||||
import android.widget.Toast
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
@@ -30,5 +31,8 @@ class HomeMenuAdapter :
|
||||
R.id.img,
|
||||
getMenuTabImg(item.index!!, holder.itemViewType)
|
||||
)
|
||||
holder.itemView.setOnClickListener {
|
||||
item.onClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,13 +3,13 @@ package com.zmkg.coaloperation.ui.home.bean
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||
|
||||
|
||||
class HomeMenuBean : MultiItemEntity {
|
||||
var name: String? = null
|
||||
var index: Int? = null
|
||||
var type: Int? = null // 0: 前4个(左右布局),1: 后4个(上下布局)
|
||||
|
||||
data class HomeMenuBean(
|
||||
var name: String? = null,
|
||||
var index: Int? = null,
|
||||
var type: Int? = null, // 0: 前4个(左右布局),1: 后4个(上下布局)
|
||||
var onClick:()->Unit = {}
|
||||
) : MultiItemEntity {
|
||||
override val itemType: Int
|
||||
get() = type!!
|
||||
|
||||
|
||||
}
|
||||
|
||||
+28
-43
@@ -1,39 +1,33 @@
|
||||
package com.zmkg.coaloperation.ui.home.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.common.ViewPagerAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.databinding.FragmentHomeBinding
|
||||
import com.zmkg.coaloperation.local.DataStoreManager
|
||||
import com.zmkg.coaloperation.superfuntion.addItemTouchCallback
|
||||
import com.zmkg.coaloperation.superfuntion.init
|
||||
import com.zmkg.coaloperation.superfuntion.onPageChangeCallback
|
||||
import com.zmkg.coaloperation.superfuntion.toJson
|
||||
import com.zmkg.coaloperation.ui.geologging.GeologicalActivity
|
||||
import com.zmkg.coaloperation.ui.home.adapter.HomeMenuAdapter
|
||||
import com.zmkg.coaloperation.ui.home.bean.HomeMenuBean
|
||||
import com.zmkg.coaloperation.ui.home.viewmodel.HomeViewModel
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import com.zmkg.coaloperation.ui.wateryield.WaterYieldHomeActivity
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
|
||||
|
||||
class HomeFragment :
|
||||
BaseVMBFragment<HomeViewModel, FragmentHomeBinding>(R.layout.fragment_home),
|
||||
OnItemClickListener {
|
||||
|
||||
private val homeMenuAdapter: HomeMenuAdapter by lazy { HomeMenuAdapter() }
|
||||
private val homeMenuAdapter: HomeMenuAdapter by lazy {
|
||||
HomeMenuAdapter()
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
mBinding.apply {
|
||||
@@ -47,7 +41,7 @@ class HomeFragment :
|
||||
rvList.adapter = homeMenuAdapter
|
||||
rvList.addItemTouchCallback {
|
||||
resetItemTypes(homeMenuAdapter.data)
|
||||
DataStoreManager.setHomeData(homeMenuAdapter.data.toJson())
|
||||
// DataStoreManager.setHomeData(homeMenuAdapter.data.toJson())
|
||||
homeMenuAdapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
@@ -80,41 +74,32 @@ class HomeFragment :
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
DictUtils.initData()
|
||||
// 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()
|
||||
if (TextUtils.isEmpty(homeData)) {
|
||||
// val homeData = DataStoreManager.getHomeData()
|
||||
// if (!TextUtils.isEmpty(homeData)) {
|
||||
// val listType = object : TypeToken<MutableList<HomeMenuBean>?>() {}.type
|
||||
// mutableListOf = Gson().fromJson(homeData, listType)
|
||||
// }
|
||||
|
||||
titleNameList.forEachIndexed { index, s ->
|
||||
val homeMenuBean = HomeMenuBean()
|
||||
homeMenuBean.name = s
|
||||
homeMenuBean.index = index + 1
|
||||
if (index < 4) {
|
||||
homeMenuBean.type = 0
|
||||
} else {
|
||||
homeMenuBean.type = 1
|
||||
}
|
||||
mutableListOf.add(homeMenuBean)
|
||||
}
|
||||
} else {
|
||||
val listType = object : TypeToken<MutableList<HomeMenuBean>?>() {}.getType()
|
||||
mutableListOf = Gson().fromJson(homeData, listType)
|
||||
}
|
||||
|
||||
homeMenuAdapter.setNewInstance(mutableListOf)
|
||||
homeMenuAdapter.setNewInstance(menuList)
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -6,6 +6,7 @@ import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.FragmentPageLeftBinding
|
||||
import com.zmkg.coaloperation.ui.mining.activity.MiningActivity
|
||||
|
||||
class PagerLeftFragment :
|
||||
BaseVMBFragment<TestViewModel, FragmentPageLeftBinding>(R.layout.fragment_page_left) {
|
||||
@@ -24,8 +25,7 @@ class PagerLeftFragment :
|
||||
mBinding.rootView.setOnClickListener {
|
||||
// val pagerViewClickDialog = PagerViewClickDialog(requireContext())
|
||||
// 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.local.DataStoreManager
|
||||
import com.zmkg.coaloperation.superfuntion.loginIm
|
||||
import com.zmkg.coaloperation.utils.SpTool
|
||||
|
||||
class LoginActivity : BaseVMBActivity<TestViewModel,ActivityLoginBinding>(R.layout.activity_login) {
|
||||
class LoginActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityLoginBinding>(R.layout.activity_login) {
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
if (!TextUtils.isEmpty(DataStoreManager.getUserName())) {
|
||||
loginIm(DataStoreManager.getUserName()){}
|
||||
toActivity(MainActivity::class.java)
|
||||
finish()
|
||||
loginIm(DataStoreManager.getUserName()) {}
|
||||
toActivity(MainActivity::class.java)
|
||||
finish()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,10 +33,10 @@ class LoginActivity : BaseVMBActivity<TestViewModel,ActivityLoginBinding>(R.layo
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
when(v?.id) {
|
||||
R.id.submit->{
|
||||
val userId = mBinding.loginEtUserName.text.toString()
|
||||
if (TextUtils.isEmpty(userId)) {
|
||||
when (v?.id) {
|
||||
R.id.submit -> {
|
||||
val userName = mBinding.loginEtUserName.text.toString()
|
||||
if (TextUtils.isEmpty(userName)) {
|
||||
showToast("请输入用户名")
|
||||
return
|
||||
}
|
||||
@@ -44,19 +46,21 @@ class LoginActivity : BaseVMBActivity<TestViewModel,ActivityLoginBinding>(R.layo
|
||||
return
|
||||
}
|
||||
|
||||
loginIm(userId) {}
|
||||
DataStoreManager.setUserName(userId)
|
||||
loginIm(userName) {}
|
||||
DataStoreManager.setUserName(userName)
|
||||
|
||||
// TODO: 保存临时生成的用户id
|
||||
SpTool.put(SpTool.USER_ID, "1758266158000")
|
||||
|
||||
toActivity(MainActivity::class.java)
|
||||
finish()
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun transparentStatusBar():Boolean {
|
||||
return true
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
import android.view.View
|
||||
import com.chad.library.adapter.base.module.LoadMoreModule
|
||||
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.common.BaseDataBindingAdapter
|
||||
import com.zmkg.coaloperation.bean.ImageBean
|
||||
import com.zmkg.coaloperation.databinding.ItemRecycleImageBinding
|
||||
import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||
import java.io.File
|
||||
|
||||
class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter<ImageBean, ItemRecycleImageBinding>(
|
||||
R.layout.item_recycle_image
|
||||
), LoadMoreModule {
|
||||
private var isEditModel = false
|
||||
private var editImageShow = false
|
||||
override fun bindViewClickListener(
|
||||
viewHolder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
viewType: Int
|
||||
) {
|
||||
addChildClickViewIds(R.id.btn_delete)
|
||||
super.bindViewClickListener(viewHolder, viewType)
|
||||
}
|
||||
override fun convert(
|
||||
holder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
item: ImageBean
|
||||
) {
|
||||
val mBinding = holder.dataBinding
|
||||
mBinding?.let {
|
||||
if(item.isAddButton){
|
||||
mBinding.ivImage.setImageResource(R.mipmap.upload)
|
||||
mBinding.btnDelete.visibility = View.GONE
|
||||
}else{
|
||||
if(item.isFilePath){
|
||||
mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f)
|
||||
}else{
|
||||
mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default)
|
||||
}
|
||||
if(isEditModel){
|
||||
mBinding.btnDelete.visibility = View.VISIBLE
|
||||
}else{
|
||||
mBinding.btnDelete.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun isEditModel(isEdit: Boolean){
|
||||
isEditModel = isEdit
|
||||
notifyDataSetChanged()
|
||||
if(isEditModel && !editImageShow){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setList(list: Collection<ImageBean>?) {
|
||||
super.setList(list)
|
||||
if(isEditModel){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
override fun setNewInstance(list: MutableList<ImageBean>?) {
|
||||
super.setNewInstance(list)
|
||||
if(isEditModel){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun addData(newData: Collection<ImageBean>) {
|
||||
if(isEditModel){
|
||||
if(editImageShow){
|
||||
var lastPosition = data.size - 1
|
||||
if(lastPosition < 0){
|
||||
lastPosition = 0
|
||||
}
|
||||
addData(lastPosition, newData)
|
||||
}else{
|
||||
showAddButton(true)
|
||||
}
|
||||
if(data.size > maxNum){
|
||||
showAddButton(false)
|
||||
}
|
||||
}else{
|
||||
super.addData(newData)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeAt(position: Int) {
|
||||
super.removeAt(position)
|
||||
if(isEditModel && !editImageShow){
|
||||
showAddButton(true)
|
||||
}
|
||||
}
|
||||
fun getImageList(): MutableList<ImageBean>{
|
||||
var list = mutableListOf<ImageBean>()
|
||||
data.forEach { imageBean ->
|
||||
if(!imageBean.isAddButton){
|
||||
list.add(imageBean)
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
fun getImageSize(): Int {
|
||||
if(isEditModel && editImageShow){
|
||||
return getDefItemCount() - 1
|
||||
}
|
||||
return getDefItemCount()
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示添加图片按钮
|
||||
* @param isShow true为显示 false为隐藏
|
||||
*/
|
||||
private fun showAddButton(isShow: Boolean){
|
||||
editImageShow = if(isShow){
|
||||
addData(ImageBean(isAddButton = true))
|
||||
true
|
||||
}else{
|
||||
removeAt(data.size-1)
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.zmkg.coaloperation.ui.report.adapter
|
||||
//
|
||||
//import android.view.View
|
||||
//import com.chad.library.adapter.base.module.LoadMoreModule
|
||||
//import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
|
||||
//import com.zmkg.coaloperation.R
|
||||
//import com.zmkg.coaloperation.adapter.common.BaseDataBindingAdapter
|
||||
//import com.zmkg.coaloperation.bean.ImageBean
|
||||
//import com.zmkg.coaloperation.databinding.ItemRecycleImageBinding
|
||||
//import com.zmkg.coaloperation.superfuntion.loadRoundedImage
|
||||
//import java.io.File
|
||||
//
|
||||
//class ImageAdapter(var maxNum: Int): BaseDataBindingAdapter<ImageBean, ItemRecycleImageBinding>(
|
||||
// R.layout.item_recycle_image
|
||||
//), LoadMoreModule {
|
||||
// private var isEditModel = false
|
||||
// private var editImageShow = false
|
||||
// override fun bindViewClickListener(
|
||||
// viewHolder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
// viewType: Int
|
||||
// ) {
|
||||
// addChildClickViewIds(R.id.btn_delete)
|
||||
// super.bindViewClickListener(viewHolder, viewType)
|
||||
// }
|
||||
// override fun convert(
|
||||
// holder: BaseDataBindingHolder<ItemRecycleImageBinding>,
|
||||
// item: ImageBean
|
||||
// ) {
|
||||
// val mBinding = holder.dataBinding
|
||||
// mBinding?.let {
|
||||
// if(item.isAddButton){
|
||||
// mBinding.ivImage.setImageResource(R.mipmap.upload)
|
||||
// mBinding.btnDelete.visibility = View.GONE
|
||||
// }else{
|
||||
// if(item.isFilePath){
|
||||
// mBinding.ivImage.loadRoundedImage(File(item.imageUrl), 5f)
|
||||
// }else{
|
||||
// mBinding.ivImage.loadRoundedImage(item.imageUrl, 5f, R.drawable.ic_default)
|
||||
// }
|
||||
// if(isEditModel){
|
||||
// mBinding.btnDelete.visibility = View.VISIBLE
|
||||
// }else{
|
||||
// mBinding.btnDelete.visibility = View.GONE
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// fun isEditModel(isEdit: Boolean){
|
||||
// isEditModel = isEdit
|
||||
// notifyDataSetChanged()
|
||||
// if(isEditModel && !editImageShow){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun setList(list: Collection<ImageBean>?) {
|
||||
// super.setList(list)
|
||||
// if(isEditModel){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
// override fun setNewInstance(list: MutableList<ImageBean>?) {
|
||||
// super.setNewInstance(list)
|
||||
// if(isEditModel){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun addData(newData: Collection<ImageBean>) {
|
||||
// if(isEditModel){
|
||||
// if(editImageShow){
|
||||
// var lastPosition = data.size - 1
|
||||
// if(lastPosition < 0){
|
||||
// lastPosition = 0
|
||||
// }
|
||||
// addData(lastPosition, newData)
|
||||
// }else{
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// if(data.size > maxNum){
|
||||
// showAddButton(false)
|
||||
// }
|
||||
// }else{
|
||||
// super.addData(newData)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun removeAt(position: Int) {
|
||||
// super.removeAt(position)
|
||||
// if(isEditModel && !editImageShow){
|
||||
// showAddButton(true)
|
||||
// }
|
||||
// }
|
||||
// fun getImageList(): MutableList<ImageBean>{
|
||||
// var list = mutableListOf<ImageBean>()
|
||||
// data.forEach { imageBean ->
|
||||
// if(!imageBean.isAddButton){
|
||||
// list.add(imageBean)
|
||||
// }
|
||||
// }
|
||||
// return list
|
||||
// }
|
||||
// fun getImageSize(): Int {
|
||||
// if(isEditModel && editImageShow){
|
||||
// return getDefItemCount() - 1
|
||||
// }
|
||||
// return getDefItemCount()
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 显示添加图片按钮
|
||||
// * @param isShow true为显示 false为隐藏
|
||||
// */
|
||||
// private fun showAddButton(isShow: Boolean){
|
||||
// editImageShow = if(isShow){
|
||||
// addData(ImageBean(isAddButton = true))
|
||||
// true
|
||||
// }else{
|
||||
// removeAt(data.size-1)
|
||||
// false
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
+79
@@ -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
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
import com.luck.picture.lib.basic.PictureSelectionModel
|
||||
import com.luck.picture.lib.basic.PictureSelector
|
||||
import com.luck.picture.lib.config.SelectMimeType
|
||||
import com.luck.picture.lib.config.SelectModeConfig
|
||||
import com.luck.picture.lib.entity.LocalMedia
|
||||
import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
||||
import com.luck.picture.lib.utils.SandboxTransformUtils
|
||||
import com.zmkg.coaloperation.utils.pictureSelector.ImageFileCompressEngine
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
import com.zmkg.coaloperation.bean.ImageBean
|
||||
import com.zmkg.coaloperation.databinding.FragmentReportBinding
|
||||
import com.zmkg.coaloperation.ui.report.adapter.ImageAdapter
|
||||
import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||
import com.zmkg.coaloperation.utils.pictureSelector.GlideEngine
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class ReportFragment :
|
||||
BaseVMBFragment<ReportViewModel, FragmentReportBinding>(R.layout.fragment_report),
|
||||
OnItemClickListener, OnItemChildClickListener {
|
||||
|
||||
private val imageAdapter by lazy { ImageAdapter(maxImageNum) }
|
||||
lateinit var pageStatus: PageStatus
|
||||
|
||||
companion object {
|
||||
const val maxImageNum = 5
|
||||
}
|
||||
|
||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
|
||||
mBinding.apply {
|
||||
val gridLayoutManager = GridLayoutManager(context, 3)
|
||||
layInspectionReport.rvList.layoutManager = gridLayoutManager
|
||||
imageAdapter.setOnItemClickListener(this@ReportFragment)
|
||||
imageAdapter.setOnItemChildClickListener(this@ReportFragment)
|
||||
mBinding.layInspectionReport.rvList.adapter = imageAdapter
|
||||
ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
||||
}
|
||||
|
||||
setPageModel(PageStatus.ADD)
|
||||
|
||||
}
|
||||
|
||||
enum class PageStatus(val status: Int) {
|
||||
ADD(1),
|
||||
EDIT(2),
|
||||
SEE(3),
|
||||
NO_EDIT(4)
|
||||
}
|
||||
|
||||
private fun setPageModel(status: PageStatus) {
|
||||
this.pageStatus = status
|
||||
mBinding?.apply {
|
||||
when (status) {
|
||||
PageStatus.ADD -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(false)
|
||||
}
|
||||
}
|
||||
|
||||
PageStatus.EDIT -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PageStatus.SEE -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(true)
|
||||
}
|
||||
}
|
||||
|
||||
PageStatus.NO_EDIT -> {
|
||||
lifecycleScope.launch {
|
||||
mViewModel.noEdit.emit(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
}
|
||||
|
||||
override fun transparentStatusBar(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.noEdit.collectLatest { noEdit ->
|
||||
mBinding.apply {
|
||||
imageAdapter.isEditModel(!noEdit)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
val imageBean: ImageBean = adapter.getItem(position) as ImageBean
|
||||
imageBean?.let { it ->
|
||||
if (it.isAddButton) {
|
||||
initPictureSelectorModel()
|
||||
.forResult(object : OnResultCallbackListener<LocalMedia?> {
|
||||
override fun onResult(result: ArrayList<LocalMedia?>?) {
|
||||
result?.let { list ->
|
||||
var resultList = localMediaToImageList(list)
|
||||
imageAdapter.addData(resultList)
|
||||
setImageNum(imageAdapter.getImageSize())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCancel() {}
|
||||
})
|
||||
} else {
|
||||
// startFullScreenImageActivity(
|
||||
// it.isFilePath,
|
||||
// it.imageUrl
|
||||
// )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setImageNum(size: Int) {
|
||||
mBinding.layInspectionReport.tvImageNum.text = getString(
|
||||
R.string.image_list_num,
|
||||
size,
|
||||
maxImageNum
|
||||
)
|
||||
}
|
||||
|
||||
private fun initPictureSelectorModel(): PictureSelectionModel {
|
||||
return PictureSelector.create(this)
|
||||
.openGallery(SelectMimeType.TYPE_IMAGE)
|
||||
.setSelectionMode(SelectModeConfig.MULTIPLE)
|
||||
.setMaxSelectNum(maxImageNum - imageAdapter.getImageSize())
|
||||
.setCompressEngine(ImageFileCompressEngine())
|
||||
.setImageEngine(GlideEngine.createGlideEngine())
|
||||
.setSandboxFileEngine { context, srcPath, mineType, call ->
|
||||
if (call != null) {
|
||||
var sandboxPath =
|
||||
SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType)
|
||||
call.onCallback(srcPath, sandboxPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
adapter.removeAt(position)
|
||||
}
|
||||
|
||||
fun localMediaToImageList(result: ArrayList<LocalMedia?>): MutableList<ImageBean> {
|
||||
var imageList = mutableListOf<ImageBean>()
|
||||
var imageBean: ImageBean
|
||||
result.forEach {
|
||||
it?.let {
|
||||
imageBean = ImageBean(getImagePath(it), true)
|
||||
imageList.add(imageBean)
|
||||
}
|
||||
}
|
||||
return imageList
|
||||
}
|
||||
|
||||
private fun getImagePath(localMedia: LocalMedia): String {
|
||||
if (!localMedia.cutPath.isNullOrEmpty()) {
|
||||
return localMedia.cutPath
|
||||
}
|
||||
if (!localMedia.compressPath.isNullOrEmpty()) {
|
||||
return localMedia.compressPath
|
||||
}
|
||||
if (!localMedia.sandboxPath.isNullOrEmpty()) {
|
||||
return localMedia.sandboxPath
|
||||
}
|
||||
return localMedia.path
|
||||
}
|
||||
}
|
||||
//package com.zmkg.coaloperation.ui.report.fragment
|
||||
//
|
||||
//import android.os.Bundle
|
||||
//import android.view.View
|
||||
//import androidx.core.view.ViewCompat
|
||||
//import androidx.lifecycle.Lifecycle
|
||||
//import androidx.lifecycle.lifecycleScope
|
||||
//import androidx.lifecycle.repeatOnLifecycle
|
||||
//import androidx.recyclerview.widget.GridLayoutManager
|
||||
//import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
//import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||
//import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
//import com.luck.picture.lib.basic.PictureSelectionModel
|
||||
//import com.luck.picture.lib.basic.PictureSelector
|
||||
//import com.luck.picture.lib.config.SelectMimeType
|
||||
//import com.luck.picture.lib.config.SelectModeConfig
|
||||
//import com.luck.picture.lib.entity.LocalMedia
|
||||
//import com.luck.picture.lib.interfaces.OnResultCallbackListener
|
||||
//import com.luck.picture.lib.utils.SandboxTransformUtils
|
||||
//import com.zmkg.coaloperation.utils.pictureSelector.ImageFileCompressEngine
|
||||
//import com.zmkg.coaloperation.R
|
||||
//import com.zmkg.coaloperation.base.BaseActivity
|
||||
//import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||
//import com.zmkg.coaloperation.bean.ImageBean
|
||||
//import com.zmkg.coaloperation.databinding.FragmentReportBinding
|
||||
//import com.zmkg.coaloperation.ui.report.adapter.ImageAdapter
|
||||
//import com.zmkg.coaloperation.ui.report.viewmodel.ReportViewModel
|
||||
//import com.zmkg.coaloperation.utils.permission.StorageUtils
|
||||
//import com.zmkg.coaloperation.utils.pictureSelector.GlideEngine
|
||||
//import kotlinx.coroutines.flow.collectLatest
|
||||
//import kotlinx.coroutines.launch
|
||||
//
|
||||
//class ReportFragment :
|
||||
// BaseVMBFragment<ReportViewModel, FragmentReportBinding>(R.layout.fragment_report),
|
||||
// OnItemClickListener, OnItemChildClickListener {
|
||||
//
|
||||
// private val imageAdapter by lazy { ImageAdapter(maxImageNum) }
|
||||
// lateinit var pageStatus: PageStatus
|
||||
//
|
||||
// companion object {
|
||||
// const val maxImageNum = 5
|
||||
// }
|
||||
//
|
||||
// override fun initView(root: View?, savedInstanceState: Bundle?) {
|
||||
//
|
||||
// mBinding.apply {
|
||||
// val gridLayoutManager = GridLayoutManager(context, 3)
|
||||
// layInspectionReport.rvList.layoutManager = gridLayoutManager
|
||||
// imageAdapter.setOnItemClickListener(this@ReportFragment)
|
||||
// imageAdapter.setOnItemChildClickListener(this@ReportFragment)
|
||||
// mBinding.layInspectionReport.rvList.adapter = imageAdapter
|
||||
// ViewCompat.setNestedScrollingEnabled(layInspectionReport.rvList, false)
|
||||
// }
|
||||
//
|
||||
// setPageModel(PageStatus.ADD)
|
||||
//
|
||||
// }
|
||||
//
|
||||
// enum class PageStatus(val status: Int) {
|
||||
// ADD(1),
|
||||
// EDIT(2),
|
||||
// SEE(3),
|
||||
// NO_EDIT(4)
|
||||
// }
|
||||
//
|
||||
// private fun setPageModel(status: PageStatus) {
|
||||
// this.pageStatus = status
|
||||
// mBinding?.apply {
|
||||
// when (status) {
|
||||
// PageStatus.ADD -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(false)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PageStatus.EDIT -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(false)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// PageStatus.SEE -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// PageStatus.NO_EDIT -> {
|
||||
// lifecycleScope.launch {
|
||||
// mViewModel.noEdit.emit(true)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// override fun bindEvent() {
|
||||
// }
|
||||
//
|
||||
// override fun onClick(v: View?) {
|
||||
// }
|
||||
//
|
||||
// override fun transparentStatusBar(): Boolean {
|
||||
// return true
|
||||
// }
|
||||
//
|
||||
// override fun createObserve() {
|
||||
// super.createObserve()
|
||||
// lifecycleScope.launch {
|
||||
// repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
// mViewModel.noEdit.collectLatest { noEdit ->
|
||||
// mBinding.apply {
|
||||
// imageAdapter.isEditModel(!noEdit)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onItemClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
// val imageBean: ImageBean = adapter.getItem(position) as ImageBean
|
||||
// imageBean?.let { it ->
|
||||
// if (it.isAddButton) {
|
||||
// StorageUtils.requestPermission(context as BaseActivity) {
|
||||
// initPictureSelectorModel()
|
||||
// .forResult(object : OnResultCallbackListener<LocalMedia?> {
|
||||
// override fun onResult(result: ArrayList<LocalMedia?>?) {
|
||||
// result?.let { list ->
|
||||
// var resultList = localMediaToImageList(list)
|
||||
// imageAdapter.addData(resultList)
|
||||
// setImageNum(imageAdapter.getImageSize())
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onCancel() {}
|
||||
// })
|
||||
// }
|
||||
// } else {
|
||||
//// startFullScreenImageActivity(
|
||||
//// it.isFilePath,
|
||||
//// it.imageUrl
|
||||
//// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// fun setImageNum(size: Int) {
|
||||
// mBinding.layInspectionReport.tvImageNum.text = getString(
|
||||
// R.string.image_list_num,
|
||||
// size,
|
||||
// maxImageNum
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// private fun initPictureSelectorModel(): PictureSelectionModel {
|
||||
// return PictureSelector.create(this)
|
||||
// .openGallery(SelectMimeType.TYPE_IMAGE)
|
||||
// .setSelectionMode(SelectModeConfig.MULTIPLE)
|
||||
// .setMaxSelectNum(maxImageNum - imageAdapter.getImageSize())
|
||||
// .setCompressEngine(ImageFileCompressEngine())
|
||||
// .setImageEngine(GlideEngine.createGlideEngine())
|
||||
// .setSandboxFileEngine { context, srcPath, mineType, call ->
|
||||
// if (call != null) {
|
||||
// var sandboxPath =
|
||||
// SandboxTransformUtils.copyPathToSandbox(context, srcPath, mineType)
|
||||
// call.onCallback(srcPath, sandboxPath)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>, view: View, position: Int) {
|
||||
// adapter.removeAt(position)
|
||||
// }
|
||||
//
|
||||
// fun localMediaToImageList(result: ArrayList<LocalMedia?>): MutableList<ImageBean> {
|
||||
// var imageList = mutableListOf<ImageBean>()
|
||||
// var imageBean: ImageBean
|
||||
// result.forEach {
|
||||
// it?.let {
|
||||
// imageBean = ImageBean(getImagePath(it), true)
|
||||
// imageList.add(imageBean)
|
||||
// }
|
||||
// }
|
||||
// return imageList
|
||||
// }
|
||||
//
|
||||
// private fun getImagePath(localMedia: LocalMedia): String {
|
||||
// if (!localMedia.cutPath.isNullOrEmpty()) {
|
||||
// return localMedia.cutPath
|
||||
// }
|
||||
// if (!localMedia.compressPath.isNullOrEmpty()) {
|
||||
// return localMedia.compressPath
|
||||
// }
|
||||
// if (!localMedia.sandboxPath.isNullOrEmpty()) {
|
||||
// return localMedia.sandboxPath
|
||||
// }
|
||||
// return localMedia.path
|
||||
// }
|
||||
//}
|
||||
|
||||
+342
@@ -0,0 +1,342 @@
|
||||
package com.zmkg.coaloperation.ui.tunneling.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.core.view.isGone
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.bean.WorkOption
|
||||
import com.zmkg.coaloperation.databinding.ActivityAddWorkingFaceBinding
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import com.zmkg.coaloperation.utils.PickerUtil
|
||||
import com.zmkg.coaloperation.utils.gone
|
||||
import com.zmkg.coaloperation.utils.visible
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
import java.time.LocalDateTime
|
||||
|
||||
/**
|
||||
* 工作面
|
||||
*/
|
||||
class AddWorkingFaceActivity :
|
||||
BaseVMBActivity<TunnelingViewModel, ActivityAddWorkingFaceBinding>(R.layout.activity_add_working_face) {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "WorkFaceActivity"
|
||||
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: TunnelWorkingFaceEntity? = null
|
||||
|
||||
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.confirm.text = "确认新增"
|
||||
// mBinding.toolbarLay.titleTvName.text = "新增工作面"
|
||||
mBinding.toolbarLay.title = "新增工作面"
|
||||
mBinding.expandLayout.gone()
|
||||
mBinding.imgExpand.visible()
|
||||
}
|
||||
|
||||
WorkFaceType.EDIT.name -> {
|
||||
currentFaceType = WorkFaceType.EDIT
|
||||
mBinding.confirm.text = "确认修改"
|
||||
// mBinding.toolbarLay.titleTvName.text = "修改工作面"
|
||||
mBinding.toolbarLay.title = "修改工作面"
|
||||
mBinding.expandLayout.visible()
|
||||
mBinding.imgExpand.gone()
|
||||
faceDetail =
|
||||
intent.getParcelableExtra(WorkingFaceDetailActivity.FACE_WORK_DETAIL_DATA) as TunnelWorkingFaceEntity?
|
||||
if (faceDetail == null) {
|
||||
showToast("未查询到工作面数据")
|
||||
return
|
||||
}
|
||||
faceDetail?.let {
|
||||
loadDetail(it)
|
||||
}
|
||||
}
|
||||
|
||||
WorkFaceType.SEE.name -> {
|
||||
currentFaceType = WorkFaceType.SEE
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.etPlanStartDate.let {
|
||||
it.setOnClickListener { _ ->
|
||||
showDatePicker(it)
|
||||
}
|
||||
}
|
||||
mBinding.etPlannEndDate.let {
|
||||
it.setOnClickListener { _ ->
|
||||
showDatePicker(it)
|
||||
}
|
||||
}
|
||||
mBinding.tvSeamName.setOnClickListener { v ->
|
||||
PickerUtil.showOptionPicker(this, "请选择所属煤层", DictUtils.seamList) { option ->
|
||||
mBinding.tvSeamName.text = option.name
|
||||
mBinding.tvSeamName.tag = option.id
|
||||
seamAreaList = DictUtils.areaMap[option.id] ?: mutableListOf()
|
||||
}
|
||||
}
|
||||
mBinding.tvAreaName.setOnClickListener { v ->
|
||||
if (seamAreaList.isEmpty()) {
|
||||
showToast("请先选择所属煤层")
|
||||
return@setOnClickListener
|
||||
}
|
||||
PickerUtil.showOptionPicker(this, "请选择所属采区域", seamAreaList) { option ->
|
||||
mBinding.tvAreaName.text = option.name
|
||||
mBinding.tvAreaName.tag = option.id
|
||||
}
|
||||
}
|
||||
mBinding.tvTunnelNature.setOnClickListener { v ->
|
||||
PickerUtil.showOptionPicker(
|
||||
this,
|
||||
"请选择巷道性质",
|
||||
DictUtils.seamRoadWayList
|
||||
) { option ->
|
||||
mBinding.tvTunnelNature.text = option.name
|
||||
mBinding.tvTunnelNature.tag = option.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var seamAreaList: MutableList<WorkOption> = mutableListOf()
|
||||
|
||||
private fun showDatePicker(tv: TextView) {
|
||||
tv.setOnClickListener {
|
||||
PickerUtil.showTimePicker(this, tv.text.toString().trim()) { date ->
|
||||
tv.text = date
|
||||
}
|
||||
}
|
||||
// val cal = Calendar.getInstance()
|
||||
// DatePickerDialog(
|
||||
// this,
|
||||
// { view, year, month, day ->
|
||||
// textView.text = "$year-${numToString(month + 1)}-${numToString(day)}"
|
||||
// },
|
||||
// cal.get(Calendar.YEAR),
|
||||
// cal.get(Calendar.MONTH),
|
||||
// cal.get(Calendar.DAY_OF_MONTH)
|
||||
// )
|
||||
// .show()
|
||||
}
|
||||
|
||||
private fun numToString(num: Int): String {
|
||||
return if (num < 10) "0${num}" else num.toString()
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding.apply {
|
||||
addClickViews(imgExpand, confirm)
|
||||
}
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
R.id.confirm -> {
|
||||
if (currentFaceType == WorkFaceType.ADD) {
|
||||
addNewFace()
|
||||
return
|
||||
}
|
||||
if (currentFaceType == WorkFaceType.EDIT) {
|
||||
editFace()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadDetail(it: TunnelWorkingFaceEntity) {
|
||||
mBinding.etWorkfaceName.setText(it.surfaceName)
|
||||
mBinding.etTotalFootage.setText("${it.totalFootage}")
|
||||
mBinding.tvSeamName.tag = it.seamId
|
||||
mBinding.tvSeamName.text = it.seamName
|
||||
mBinding.tvAreaName.tag = it.areaId
|
||||
mBinding.tvAreaName.text = it.areaName
|
||||
mBinding.etSurfaceAzimuth.setText(it.surfaceAzimuth)
|
||||
mBinding.etSurfaceHeight.setText(it.surfaceHeight)
|
||||
mBinding.etSurfaceWidth.setText(it.surfaceWidth)
|
||||
mBinding.tvTunnelNature.text = it.tunnelNature
|
||||
|
||||
mBinding.etPlanStartDate.text = it.planStartDate
|
||||
mBinding.etPlannEndDate.text = it.planEndDate
|
||||
|
||||
mBinding.etGeologicalType.setText(it.geologicalType)
|
||||
mBinding.etHydrogeologicalType.setText(it.hydrogeologicalType)
|
||||
mBinding.etSeamIgnition.setText(it.seamIgnition)
|
||||
mBinding.etSeamGas.setText(it.seamGas)
|
||||
mBinding.etSeamBumpPressure.setText(it.seamBumpPressure)
|
||||
mBinding.etSurfaceSupportForm.setText(it.surfaceSupportForm)
|
||||
}
|
||||
|
||||
private fun addNewFace() {
|
||||
val workingFaceName = mBinding.etWorkfaceName.text.toString().trim()
|
||||
if (TextUtils.isEmpty(workingFaceName)) {
|
||||
showToast("请输入工作面名称")
|
||||
return
|
||||
}
|
||||
val totalFootageStr = mBinding.etTotalFootage.text.toString().trim()
|
||||
if (TextUtils.isEmpty(totalFootageStr)) {
|
||||
showToast("请输入总进尺")
|
||||
return
|
||||
}
|
||||
try {
|
||||
totalFootageStr.toDouble()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
showToast("总进尺数据非数字格式,请确认")
|
||||
return
|
||||
}
|
||||
// mViewModel.postTunnellingSurfaceAdd(
|
||||
// TunnelingFaceAddBean(
|
||||
// surfaceName = mBinding.etWorkfaceName.text.toString(),
|
||||
// totalFootage = mBinding.etTotalFootage.text.toString()
|
||||
// )
|
||||
// )
|
||||
val workingFaceEntity = TunnelWorkingFaceEntity().also {
|
||||
it.surfaceId = System.currentTimeMillis()
|
||||
it.surfaceName = workingFaceName
|
||||
it.totalFootage = totalFootageStr
|
||||
|
||||
it.seamName = mBinding.tvSeamName.text.toString().trim()
|
||||
if (it.seamName!!.isNotBlank()) {
|
||||
it.seamId = mBinding.tvSeamName.tag.toString().toLong()
|
||||
}
|
||||
it.areaName = mBinding.tvAreaName.text.toString().trim()
|
||||
if (it.areaName!!.isNotBlank()) {
|
||||
it.areaId = mBinding.tvAreaName.tag.toString().toLong()
|
||||
}
|
||||
|
||||
it.surfaceAzimuth = mBinding.etSurfaceAzimuth.text.toString().trim()
|
||||
it.surfaceHeight = mBinding.etSurfaceHeight.text.toString().trim()
|
||||
it.surfaceWidth = mBinding.etSurfaceWidth.text.toString().trim()
|
||||
it.tunnelNature = mBinding.tvTunnelNature.text.toString().trim()
|
||||
it.planStartDate = mBinding.etPlanStartDate.text.toString().trim()
|
||||
it.planEndDate = mBinding.etPlannEndDate.text.toString().trim()
|
||||
it.geologicalType = mBinding.etGeologicalType.text.toString().trim()
|
||||
it.hydrogeologicalType = mBinding.etHydrogeologicalType.text.toString().trim()
|
||||
it.seamIgnition = mBinding.etSeamIgnition.text.toString().trim()
|
||||
it.seamGas = mBinding.etSeamGas.text.toString().trim()
|
||||
it.seamBumpPressure = mBinding.etSeamBumpPressure.text.toString().trim()
|
||||
it.surfaceSupportForm = mBinding.etSurfaceSupportForm.text.toString().trim()
|
||||
|
||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||
it.dataState = "1"
|
||||
}
|
||||
workingFaceViewModel.insert(workingFaceEntity) {
|
||||
showToast("工作面新增完成")
|
||||
EventBus.getDefault().post(workingFaceEntity)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
private fun editFace() {
|
||||
val workingFaceName = mBinding.etWorkfaceName.text.toString().trim()
|
||||
if (TextUtils.isEmpty(workingFaceName)) {
|
||||
showToast("请输入工作面名称")
|
||||
return
|
||||
}
|
||||
val totalFootageStr = mBinding.etTotalFootage.text.toString().trim()
|
||||
if (TextUtils.isEmpty(totalFootageStr)) {
|
||||
showToast("请输入总进尺")
|
||||
return
|
||||
}
|
||||
try {
|
||||
totalFootageStr.toDouble()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
showToast("总进尺数据非数字格式,请确认")
|
||||
return
|
||||
}
|
||||
val workingFaceEntity = TunnelWorkingFaceEntity().also {
|
||||
it.surfaceId = faceDetail!!.surfaceId
|
||||
it.surfaceName = workingFaceName
|
||||
it.totalFootage = totalFootageStr
|
||||
|
||||
it.seamName = mBinding.tvSeamName.text.toString().trim()
|
||||
if (it.seamName!!.isNotBlank()) {
|
||||
it.seamId = string2num(mBinding.tvSeamName.tag.toString())
|
||||
}
|
||||
it.areaName = mBinding.tvAreaName.text.toString().trim()
|
||||
if (it.areaName!!.isNotBlank()) {
|
||||
it.areaId = string2num(mBinding.tvAreaName.tag.toString())
|
||||
}
|
||||
|
||||
it.surfaceAzimuth = mBinding.etSurfaceAzimuth.text.toString().trim()
|
||||
it.surfaceHeight = mBinding.etSurfaceHeight.text.toString().trim()
|
||||
it.surfaceWidth = mBinding.etSurfaceWidth.text.toString().trim()
|
||||
it.tunnelNature = mBinding.tvTunnelNature.text.toString().trim()
|
||||
it.planStartDate = mBinding.etPlanStartDate.text.toString().trim()
|
||||
it.planEndDate = mBinding.etPlannEndDate.text.toString().trim()
|
||||
it.geologicalType = mBinding.etGeologicalType.text.toString().trim()
|
||||
it.hydrogeologicalType = mBinding.etHydrogeologicalType.text.toString().trim()
|
||||
it.seamIgnition = mBinding.etSeamIgnition.text.toString().trim()
|
||||
it.seamGas = mBinding.etSeamGas.text.toString().trim()
|
||||
it.seamBumpPressure = mBinding.etSeamBumpPressure.text.toString().trim()
|
||||
it.surfaceSupportForm = mBinding.etSurfaceSupportForm.text.toString().trim()
|
||||
|
||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||
it.dataState = "1"
|
||||
}
|
||||
workingFaceViewModel.update(workingFaceEntity) {
|
||||
showToast("工作面修改完成")
|
||||
EventBus.getDefault().post(workingFaceEntity)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onWorkingFaceEvent(event: TunnelWorkingFaceEntity) {
|
||||
|
||||
}
|
||||
|
||||
private fun string2num(text: String?): Long {
|
||||
return if (text.isNullOrBlank()) 0 else text.toLong()
|
||||
}
|
||||
|
||||
}
|
||||
+356
@@ -0,0 +1,356 @@
|
||||
package com.zmkg.coaloperation.ui.tunneling.activity
|
||||
|
||||
//import com.tencent.qcloud.tuikit.timcommon.util.SoftKeyBoardUtil
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.TunnelRoofLithologyAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||
import com.zmkg.coaloperation.databinding.ActivityAddWorkingFaceRecordBinding
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||
import com.zmkg.coaloperation.superfuntion.hideLoading
|
||||
import com.zmkg.coaloperation.superfuntion.showLoading
|
||||
import com.zmkg.coaloperation.superfuntion.toJson
|
||||
import com.zmkg.coaloperation.utils.DateTimeUtil
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import com.zmkg.coaloperation.utils.ExcelExportUtils
|
||||
import com.zmkg.coaloperation.utils.FileUtils
|
||||
import com.zmkg.coaloperation.utils.KeyboardUtil
|
||||
import com.zmkg.coaloperation.utils.PickerUtil
|
||||
import com.zmkg.coaloperation.utils.clickWithDebounce
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
import java.time.LocalDateTime
|
||||
|
||||
/**
|
||||
* 开始记录
|
||||
*/
|
||||
class AddWorkingFaceRecordActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityAddWorkingFaceRecordBinding>(R.layout.activity_add_working_face_record) {
|
||||
|
||||
companion object {
|
||||
const val TAG = "AddWorkingPointActivity"
|
||||
const val SHOW_TYPE = "showType"
|
||||
const val FACE_NAME = "faceName"
|
||||
const val FACE_ID = "faceId"
|
||||
const val FACE_RECORD = "faceRecord"
|
||||
}
|
||||
|
||||
private var showType = 0
|
||||
private var surfaceId: Long = 0
|
||||
private var recordId: Long = 0
|
||||
|
||||
private var faceName: String? = null
|
||||
private var faceRecord: TunnelWorkingFaceRecordEntity? = null
|
||||
|
||||
private val workingFaceRecordViewModel: TunnelWorkingFaceRecordViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelWorkingFaceRecordViewModel::class.java]
|
||||
}
|
||||
|
||||
private val roofLithologyViewModel: TunnelRoofLithologyViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelRoofLithologyViewModel::class.java]
|
||||
}
|
||||
|
||||
private val roofLithologyList: MutableList<TunnelRoofLithologyEntity> = mutableListOf()
|
||||
|
||||
private val roofLithologyAdapter: TunnelRoofLithologyAdapter by lazy {
|
||||
TunnelRoofLithologyAdapter(roofLithologyList)
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.vLine.visibility = View.GONE
|
||||
showType = intent.extras?.getInt(SHOW_TYPE) ?: 0
|
||||
mBinding.toolbarLay.title = if (showType == 0) "开始记录" else "修改记录"
|
||||
mBinding.btnSave.text = if (showType == 0) "保存" else "修改"
|
||||
// mBinding.toolbarLay.rightText = ""
|
||||
|
||||
mBinding.root.setOnClickListener { v ->
|
||||
window?.let {
|
||||
// SoftKeyBoardUtil.hideKeyBoard(window)
|
||||
KeyboardUtil.hideKeyboard(v)
|
||||
}
|
||||
}
|
||||
mBinding.tvWorkingDate.let {
|
||||
it.setOnClickListener { v ->
|
||||
PickerUtil.showTimePicker(this, it.text.toString().trim()) { date ->
|
||||
it.text = date
|
||||
}
|
||||
}
|
||||
}
|
||||
faceName = intent.getStringExtra(FACE_NAME)
|
||||
if (showType == 0) {
|
||||
surfaceId = intent.getLongExtra(FACE_ID, 0L)
|
||||
recordId = System.currentTimeMillis()
|
||||
} else if (showType == 1) {
|
||||
faceRecord = intent.getParcelableExtra(FACE_RECORD)
|
||||
if (faceRecord == null) {
|
||||
showToast("未查询到当前记录")
|
||||
return
|
||||
}
|
||||
surfaceId = faceRecord!!.surfaceId
|
||||
recordId = faceRecord!!.recordId
|
||||
loadFaceRecord()
|
||||
}
|
||||
mBinding.tvFaceName.text = faceName
|
||||
|
||||
mBinding.tvWorkTeam.setOnClickListener { v ->
|
||||
PickerUtil.showOptionPicker(this, "选择施工队伍", DictUtils.workTeamList) { option ->
|
||||
mBinding.tvWorkTeam.text = option.name
|
||||
mBinding.tvWorkTeam.tag = option.id
|
||||
}
|
||||
}
|
||||
mBinding.tvTeamShift.setOnClickListener { v ->
|
||||
PickerUtil.showOptionPicker(this, "请选择施工班次", DictUtils.workShiftList) { option ->
|
||||
mBinding.tvTeamShift.text = option.name
|
||||
mBinding.tvTeamShift.tag = option.id
|
||||
}
|
||||
}
|
||||
mBinding.btnAddPoint.clickWithDebounce {
|
||||
addRockPoint()
|
||||
}
|
||||
|
||||
mBinding.btnSave.clickWithDebounce {
|
||||
if (showType == 0) {
|
||||
judgeInputParam {
|
||||
saveFaceRecord()
|
||||
}
|
||||
return@clickWithDebounce
|
||||
}
|
||||
judgeInputParam {
|
||||
updateFaceRecord()
|
||||
}
|
||||
}
|
||||
mBinding.btnExport.clickWithDebounce {
|
||||
judgeInputParam {
|
||||
exportExcelFile()
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.rvLithology.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = roofLithologyAdapter
|
||||
}
|
||||
if (showType == 0) {
|
||||
addRockPoint()
|
||||
} else {
|
||||
roofLithologyViewModel.getEntityList(recordId) {
|
||||
if (it != null && it.isNotEmpty()) {
|
||||
roofLithologyList.addAll(it)
|
||||
roofLithologyAdapter.notifyDataSetChanged()
|
||||
} else {
|
||||
addRockPoint()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: 新增记录添加岩性数据,如果是修改,应该合并数据,后续处理
|
||||
private fun addRockPoint() {
|
||||
roofLithologyList.add(TunnelRoofLithologyEntity().also {
|
||||
it.lithologyId = System.currentTimeMillis()
|
||||
it.surfaceId = surfaceId
|
||||
it.recordId = recordId
|
||||
|
||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||
it.dataState = "1"
|
||||
})
|
||||
// roofLithologyAdapter.notifyDataSetChanged()
|
||||
val pos = roofLithologyList.size
|
||||
roofLithologyAdapter.notifyItemInserted(pos)
|
||||
roofLithologyAdapter.notifyItemRangeChanged(pos, pos + 1)
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
private fun saveFaceRecord() {
|
||||
val faceRecord = TunnelWorkingFaceRecordEntity().also {
|
||||
it.recordId = recordId
|
||||
it.surfaceId = surfaceId
|
||||
it.workingDate = mBinding.tvWorkingDate.text.toString()
|
||||
it.teamShift = mBinding.tvTeamShift.text.toString()
|
||||
it.teamName = mBinding.tvWorkTeam.text.toString()
|
||||
it.teamId = mBinding.tvWorkTeam.tag.toString()
|
||||
|
||||
it.teamLeader = mBinding.etTeamLeader.text.toString().trim()
|
||||
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
||||
it.seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
||||
it.seamHeight = mBinding.etSeamHeight.text.toString().trim().formatDecimalString()
|
||||
it.waterYield = mBinding.etWaterYield.text.toString().trim().formatDecimalString()
|
||||
it.recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||
|
||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||
it.dataState = "1"
|
||||
}
|
||||
|
||||
Log.d(TAG, "saveFaceRecord: ${roofLithologyList.toJson()}")
|
||||
|
||||
workingFaceRecordViewModel.insert(faceRecord) {
|
||||
roofLithologyViewModel.insertList(roofLithologyList) {
|
||||
EventBus.getDefault().post(faceRecord)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadFaceRecord() {
|
||||
faceRecord?.let {
|
||||
mBinding.tvWorkingDate.text = it.workingDate
|
||||
mBinding.tvTeamShift.text = DictUtils.getTeamShift(it.teamShift)
|
||||
mBinding.tvTeamShift.tag = it.teamShift
|
||||
mBinding.tvWorkTeam.text = it.teamName
|
||||
mBinding.tvWorkTeam.tag = it.teamId
|
||||
|
||||
mBinding.etTeamLeader.setText(it.teamLeader)
|
||||
mBinding.etWorkingFootage.setText(getShowNum2(it.workingFootage))
|
||||
mBinding.etSeamDip.setText(getShowNum2(it.seamDip))
|
||||
mBinding.etSeamHeight.setText(getShowNum2(it.seamHeight))
|
||||
mBinding.etWaterYield.setText(getShowNum2(it.waterYield))
|
||||
mBinding.etRecordPerson.setText(it.recordPerson)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateFaceRecord() {
|
||||
val faceRecord = TunnelWorkingFaceRecordEntity().also {
|
||||
it.recordId = recordId
|
||||
it.surfaceId = surfaceId
|
||||
it.workingDate = mBinding.tvWorkingDate.text.toString()
|
||||
it.teamShift = mBinding.tvTeamShift.tag.toString()
|
||||
it.teamName = mBinding.tvWorkTeam.text.toString()
|
||||
it.teamId = mBinding.tvWorkTeam.tag.toString()
|
||||
|
||||
it.teamLeader = mBinding.etTeamLeader.text.toString().trim()
|
||||
it.workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
||||
it.seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
||||
it.seamHeight = mBinding.etSeamHeight.text.toString().trim().formatDecimalString()
|
||||
it.waterYield = mBinding.etWaterYield.text.toString().trim().formatDecimalString()
|
||||
it.recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||
|
||||
it.createTime = DateTimeUtil.formatDateTime(LocalDateTime.now())
|
||||
it.dataState = "1"
|
||||
}
|
||||
workingFaceRecordViewModel.update(faceRecord) {
|
||||
roofLithologyViewModel.deleteList(recordId) {
|
||||
roofLithologyViewModel.insertList(roofLithologyList) {
|
||||
EventBus.getDefault().post(faceRecord)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onFaceRecordEvent(event: TunnelWorkingFaceRecordEntity) {
|
||||
|
||||
}
|
||||
|
||||
private fun judgeInputParam(acton:()-> Unit) {
|
||||
list.clear()
|
||||
list.add(TunnelWorkingItem(name = "工作面名称", value = faceName))
|
||||
|
||||
val workingDate = mBinding.tvWorkingDate.text.toString().trim()
|
||||
if (workingDate.isBlank()) {
|
||||
showToast("请选择施工日期")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "施工日期", value = workingDate))
|
||||
|
||||
val teamShift = mBinding.tvTeamShift.text.toString().trim()
|
||||
if (teamShift.isBlank()) {
|
||||
showToast("请选择施工班次")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "施工班次", value = teamShift))
|
||||
|
||||
val workTeam = mBinding.tvWorkTeam.text.toString().trim()
|
||||
if (workTeam.isBlank()) {
|
||||
showToast("请选择施工队伍")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "施工队伍", value = workTeam))
|
||||
|
||||
val teamLeader = mBinding.etTeamLeader.text.toString().trim()
|
||||
if (teamLeader.isBlank()) {
|
||||
showToast("请输入带班队长")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "带班队长", value = teamLeader))
|
||||
|
||||
val workingFootage = mBinding.etWorkingFootage.text.toString().trim().formatDecimalString()
|
||||
if (workingFootage.isBlank()) {
|
||||
showToast("请输入本班进尺")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "本班进尺", value = workingFootage))
|
||||
|
||||
val seamDip = mBinding.etSeamDip.text.toString().trim().formatDecimalString()
|
||||
if (seamDip.isBlank()) {
|
||||
showToast("请输入煤层倾角")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "煤层倾角", value = seamDip))
|
||||
|
||||
val seamHeight = mBinding.etSeamHeight.text.toString().trim().formatDecimalString()
|
||||
if (seamHeight.isBlank()) {
|
||||
showToast("请输入煤层高")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "煤层高", value = seamHeight))
|
||||
|
||||
val waterYield = mBinding.etWaterYield.text.toString().trim().formatDecimalString()
|
||||
if (waterYield.isBlank()) {
|
||||
showToast("请输入涌水量")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "涌水量", value = waterYield))
|
||||
|
||||
val recordPerson = mBinding.etRecordPerson.text.toString().trim()
|
||||
if (recordPerson.isBlank()) {
|
||||
showToast("请输入填写人")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "记录人", value = recordPerson))
|
||||
|
||||
val emptyDataList = roofLithologyList.filter {
|
||||
it.positionStart.isBlank() || it.positionEnd.isBlank() || it.lithologyType.isBlank()
|
||||
}
|
||||
if (emptyDataList.isNotEmpty()) {
|
||||
showToast("顶板岩性中存在部分编录点数据为空")
|
||||
return
|
||||
}
|
||||
list.add(TunnelWorkingItem(name = "顶板岩性", value = "", items = roofLithologyList))
|
||||
|
||||
acton()
|
||||
}
|
||||
|
||||
private val list: MutableList<TunnelWorkingItem> = mutableListOf()
|
||||
private fun exportExcelFile() {
|
||||
showLoading()
|
||||
val fileName = "${faceName}_${mBinding.tvWorkingDate.text}_${System.currentTimeMillis()}.xlsx"
|
||||
val filePath = FileUtils.getFilePath(fileName)
|
||||
ExcelExportUtils.exportToExcel(list, filePath) {
|
||||
window.decorView.postDelayed({
|
||||
hideLoading()
|
||||
showToast("Excel导出完成")
|
||||
}, 1500)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.tunneling.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import com.tencent.qcloud.tuikit.timcommon.util.SoftKeyBoardUtil
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.databinding.ActivityAddWorkingPointBinding
|
||||
import com.zmkg.coaloperation.databinding.ListItemRockBinding
|
||||
import com.zmkg.coaloperation.utils.PickerUtil
|
||||
import com.zmkg.coaloperation.utils.clickWithDebounce
|
||||
|
||||
/**
|
||||
* 开始记录
|
||||
*/
|
||||
class AddWorkingPointActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityAddWorkingPointBinding>(R.layout.activity_add_working_point) {
|
||||
|
||||
companion object {
|
||||
const val SHOW_TYPE = "showType"
|
||||
const val FACE_NAME = "faceName"
|
||||
}
|
||||
|
||||
private var showType = 0
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.vLine.visibility = View.GONE
|
||||
showType = intent.extras?.getInt(SHOW_TYPE) ?: 0
|
||||
mBinding.toolbarLay.rightText =
|
||||
if (showType == 0) "开始记录" else "修改记录"
|
||||
|
||||
mBinding.root.setOnClickListener {
|
||||
window?.let {
|
||||
SoftKeyBoardUtil.hideKeyBoard(window)
|
||||
}
|
||||
}
|
||||
mBinding.tvWorkDate.clickWithDebounce {
|
||||
PickerUtil.showTimePicker(this) {date->
|
||||
mBinding.tvWorkDate.text = date
|
||||
}
|
||||
}
|
||||
mBinding.tvFaceName.text = intent.getStringExtra(FACE_NAME)
|
||||
mBinding.toolbarLay.title = intent.getStringExtra(FACE_NAME)
|
||||
|
||||
val teamList = mutableListOf<String>()
|
||||
teamList.add("A地区第1施工队")
|
||||
teamList.add("A地区第2施工队")
|
||||
teamList.add("B地区第1施工队")
|
||||
teamList.add("B地区第2施工队")
|
||||
teamList.add("C地区第1施工队")
|
||||
teamList.add("C地区第2施工队")
|
||||
teamList.add("D地区第1施工队")
|
||||
teamList.add("D地区第2施工队")
|
||||
mBinding.tvWorkTeam.clickWithDebounce {
|
||||
PickerUtil.showOptionsPicker(this, teamList) {team->
|
||||
mBinding.tvWorkTeam.text = team
|
||||
}
|
||||
}
|
||||
val workTypeList = mutableListOf<String>()
|
||||
workTypeList.add("早班")
|
||||
workTypeList.add("中班")
|
||||
workTypeList.add("晚班")
|
||||
mBinding.tvWorkType.clickWithDebounce {
|
||||
PickerUtil.showOptionsPicker(this, workTypeList) {team->
|
||||
mBinding.tvWorkType.text = team
|
||||
}
|
||||
}
|
||||
mBinding.btnAddPoint.clickWithDebounce {
|
||||
addRockPoint()
|
||||
}
|
||||
addRockPoint()
|
||||
}
|
||||
|
||||
private fun addRockPoint() {
|
||||
val itemBinding = ListItemRockBinding.inflate(
|
||||
LayoutInflater.from(this),
|
||||
mBinding.llRockPoint,
|
||||
false
|
||||
)
|
||||
mBinding.llRockPoint.addView(itemBinding.root)
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
}
|
||||
+142
-117
@@ -1,19 +1,24 @@
|
||||
package com.zmkg.coaloperation.ui.tunneling.activity
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.TunnelWorkingFaceAdapter
|
||||
import com.zmkg.coaloperation.adapter.TunnelWorkingFaceRecordAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.databinding.ActivityTunnelingBinding
|
||||
import com.zmkg.coaloperation.event.TunnelingWorkFaceRefreshEvent
|
||||
import com.zmkg.coaloperation.ui.tunneling.adapter.TunnelingHomeAdapter
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingHomeBean
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceViewModel
|
||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import com.zmkg.coaloperation.utils.SpTool
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
/**
|
||||
* 掘进首页列表
|
||||
@@ -21,131 +26,87 @@ import kotlinx.coroutines.launch
|
||||
class TunnelingActivity :
|
||||
BaseVMBActivity<TunnelingViewModel, ActivityTunnelingBinding>(R.layout.activity_tunneling) {
|
||||
|
||||
private val tunnelingHomeAdapter: TunnelingHomeAdapter by lazy {
|
||||
TunnelingHomeAdapter {index,surfaceId->
|
||||
mViewModel.getTunnelingHomeItemData(index,surfaceId)
|
||||
companion object {
|
||||
const val TAG = "TunnelingActivity"
|
||||
}
|
||||
|
||||
private val workingFaceViewModel: TunnelWorkingFaceViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelWorkingFaceViewModel::class.java]
|
||||
}
|
||||
private val workingFaceRecordViewModel: TunnelWorkingFaceRecordViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelWorkingFaceRecordViewModel::class.java]
|
||||
}
|
||||
|
||||
|
||||
private val workingFaceList = mutableListOf<TunnelWorkingFaceEntity>()
|
||||
|
||||
private val workingFaceAdapter: TunnelWorkingFaceAdapter by lazy {
|
||||
TunnelWorkingFaceAdapter(workingFaceList).apply {
|
||||
setOnItemChildClickListener { _, view, position ->
|
||||
if (view.id == R.id.llWorkingFace) {
|
||||
toActivity(WorkingFaceStatisticsActivity::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(AddWorkingFaceRecordActivity::class.java, Bundle().apply {
|
||||
putLong(
|
||||
AddWorkingFaceRecordActivity.FACE_ID,
|
||||
workingFaceList[position].surfaceId
|
||||
)
|
||||
putString(
|
||||
AddWorkingFaceRecordActivity.FACE_NAME,
|
||||
workingFaceList[position].surfaceName
|
||||
)
|
||||
putInt(AddWorkingFaceRecordActivity.SHOW_TYPE, 0)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
|
||||
mBinding.toolbarLay.rightText = "新增工作面"
|
||||
mBinding.rvList.adapter = tunnelingHomeAdapter
|
||||
|
||||
mBinding.rvTunnelingList.let {
|
||||
it.layoutManager = LinearLayoutManager(this)
|
||||
it.adapter = workingFaceAdapter
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
override fun initData() {
|
||||
mViewModel.getTunnelingHomeData()
|
||||
val userId = SpTool.getString(SpTool.USER_ID)
|
||||
workingFaceViewModel.getEntityListByUserId(userId) { it ->
|
||||
if (it.isNullOrEmpty()) {
|
||||
return@getEntityListByUserId
|
||||
}
|
||||
workingFaceList.clear()
|
||||
workingFaceList.addAll(it)
|
||||
workingFaceAdapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// HttpUtil.get(UrlConst.FACE_LIST, doSuccess = {
|
||||
// val type = object : TypeToken<MutableList<TunnelingHomeBean>>() {}
|
||||
// val list: MutableList<TunnelingHomeBean>? = it.toJsonString().toType(typeToken = type)
|
||||
// if (list.isNullOrEmpty()) {
|
||||
// ToastTool.toastShort(this@TunnelingActivity, "未查询到数据")
|
||||
// return@get
|
||||
// }
|
||||
// tunnelingHomeAdapter.setNewInstance(list)
|
||||
// getRecordList(0) {}
|
||||
// }, doFailure = { code, msg ->
|
||||
// if (msg.isNullOrEmpty()) {
|
||||
// return@get
|
||||
// }
|
||||
// ToastTool.toastShort(this@TunnelingActivity, msg)
|
||||
// })
|
||||
//
|
||||
//// val gson = Gson()
|
||||
//// val type: Type = object : TypeToken<MutableList<TunnelingHomeBean>>() {}.type
|
||||
//// val mutableListOf = gson.fromJson<MutableList<TunnelingHomeBean>>(jsonString, type)
|
||||
////
|
||||
//// tunnelingHomeAdapter.setNewInstance(mutableListOf)
|
||||
//
|
||||
// }
|
||||
//
|
||||
// fun getRecordList(index:Int, action:()-> Unit) {
|
||||
// val faceId: Long? = tunnelingHomeAdapter.data[index].surfaceId
|
||||
// HttpUtil.get("${UrlConst.RECORD_LIST + faceId}", doSuccess = {
|
||||
// val type = object : TypeToken<MutableList<TunnelingHomeItemBean>>() {}
|
||||
// val list: MutableList<TunnelingHomeItemBean>? = it.toJsonString().toType(typeToken = type)
|
||||
// if (list.isNullOrEmpty()) {
|
||||
// ToastTool.toastShort(this@TunnelingActivity, "未查询到数据")
|
||||
// return@get
|
||||
// }
|
||||
// tunnelingHomeAdapter.data[0].contentList = list
|
||||
// val holder = mBinding.rvList.findViewHolderForLayoutPosition(0)
|
||||
// val rvContent = holder?.itemView?.findViewById<RecyclerView>(R.id.rv_content)
|
||||
// rvContent?.adapter.let { adapter ->
|
||||
// if (adapter is TunnelingHomeListAdapter) {
|
||||
// adapter.data.clear()
|
||||
// adapter.data.addAll(list)
|
||||
// adapter.notifyDataSetChanged()
|
||||
// }
|
||||
// }
|
||||
// action()
|
||||
// }, doFailure = { code, msg ->
|
||||
// if (msg.isNullOrEmpty()) {
|
||||
// return@get
|
||||
// }
|
||||
// ToastTool.toastShort(this@TunnelingActivity, msg)
|
||||
// })
|
||||
// }
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.tunnelingHomeList.collectLatest { list ->
|
||||
list?.reverse()
|
||||
tunnelingHomeAdapter.setNewInstance(list)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.tunnelingHomeItemList.collectLatest { list ->
|
||||
if (list.isNullOrEmpty()) {
|
||||
showToast("未查询到数据")
|
||||
return@collectLatest
|
||||
}
|
||||
|
||||
tunnelingHomeAdapter.data[mViewModel.itemIndex.value].contentList = list
|
||||
tunnelingHomeAdapter.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun bindEvent() {
|
||||
tunnelingHomeAdapter.setOnItemClickListener { adapter, view, position ->
|
||||
val tunnelingHomeBean = adapter.data.get(position) as TunnelingHomeBean
|
||||
// 跳转到工作面详情
|
||||
|
||||
toActivity(WorkingFaceDetailActivity::class.java, Bundle().apply {
|
||||
putString("surfaceId", tunnelingHomeBean.surfaceId)
|
||||
})
|
||||
}
|
||||
|
||||
tunnelingHomeAdapter.setOnItemChildClickListener { adapter, view, position ->
|
||||
val tunnelingHomeBean = adapter.data.get(position) as TunnelingHomeBean
|
||||
// 跳转到开始记录页面
|
||||
|
||||
if (view.id == R.id.start_record) {
|
||||
toActivity(AddWorkingPointActivity::class.java, Bundle().apply {
|
||||
putString(AddWorkingPointActivity.FACE_NAME, tunnelingHomeBean.surfaceName)
|
||||
putInt(AddWorkingPointActivity.SHOW_TYPE, 0)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
|
||||
toActivity(WorkFaceActivity::class.java,Bundle().apply {
|
||||
putString("WorkFaceType", WorkFaceActivity.WorkFaceType.ADD.name)
|
||||
toActivity(AddWorkingFaceActivity::class.java, Bundle().apply {
|
||||
putString(AddWorkingFaceActivity.WORK_FACE_TYPE, AddWorkingFaceActivity.WorkFaceType.ADD.name)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -155,8 +116,72 @@ class TunnelingActivity :
|
||||
}
|
||||
|
||||
override fun onMessageEvent(event: Any?) {
|
||||
if (event is TunnelingWorkFaceRefreshEvent) {
|
||||
mViewModel.getTunnelingHomeData()
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun getFaceRecord(position: Int) {
|
||||
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: TunnelWorkingFaceEntity) {
|
||||
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: TunnelWorkingFaceRecordEntity) {
|
||||
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):TunnelWorkingFaceRecordAdapter {
|
||||
val viewHolder =
|
||||
mBinding.rvTunnelingList.findViewHolderForLayoutPosition(position) as TunnelWorkingFaceAdapter.VH
|
||||
return viewHolder.binding.rvFaceRecord.adapter as TunnelWorkingFaceRecordAdapter
|
||||
}
|
||||
|
||||
}
|
||||
-160
@@ -1,160 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.tunneling.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.databinding.ActivityWorkFaceBinding
|
||||
import com.zmkg.coaloperation.event.TunnelingWorkFaceRefreshEvent
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.TunnelingFaceAddBean
|
||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* 工作面
|
||||
*/
|
||||
class WorkFaceActivity :
|
||||
BaseVMBActivity<TunnelingViewModel, ActivityWorkFaceBinding>(R.layout.activity_work_face) {
|
||||
|
||||
companion object {
|
||||
const val WORK_FACE_TYPE = "WorkFaceType"
|
||||
const val FACE_WORK_DETAIL_DATA = "faceWorkDetailData"
|
||||
}
|
||||
|
||||
var currentFaceType = WorkFaceType.ADD
|
||||
|
||||
enum class WorkFaceType {
|
||||
ADD,//新增
|
||||
|
||||
EDIT,//修改
|
||||
|
||||
SEE//查看
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
val stringExtra = intent.getStringExtra(WORK_FACE_TYPE)
|
||||
if (TextUtils.isEmpty(stringExtra)) {
|
||||
finish()
|
||||
} else if (stringExtra == WorkFaceType.ADD.name) {
|
||||
currentFaceType = WorkFaceType.ADD
|
||||
mBinding.toolbarLay.titleTvName.text = "新增工作面"
|
||||
mBinding.confirm.text = "确认新增"
|
||||
} else if (stringExtra == WorkFaceType.EDIT.name) {
|
||||
currentFaceType = WorkFaceType.EDIT
|
||||
mBinding.toolbarLay.titleTvName.text = "修改工作面"
|
||||
mBinding.confirm.text = "确认修改"
|
||||
val detail = intent.getSerializableExtra(WorkingFaceDetail2Activity.FACE_WORK_DETAIL_DATA) as FaceWorkDetailBean?
|
||||
detail?.let {
|
||||
loadDetail(it)
|
||||
}
|
||||
} else if (stringExtra == WorkFaceType.SEE.name) {
|
||||
currentFaceType = WorkFaceType.SEE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding.apply {
|
||||
addClickViews(imgExpand, confirm)
|
||||
}
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.tunnelingWorkFaceAdd.collectLatest {
|
||||
showToast("新增成功")
|
||||
EventBus.getDefault().post(TunnelingWorkFaceRefreshEvent())
|
||||
delay(200)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
when (v?.id) {
|
||||
R.id.img_expand -> {
|
||||
if (mBinding.expandLayout.visibility == View.GONE) {
|
||||
mBinding.expandLayout.visibility = View.VISIBLE
|
||||
mBinding.imgView.background = getDrawable(R.mipmap.arrow_up_white)
|
||||
} else {
|
||||
mBinding.expandLayout.visibility = View.GONE
|
||||
mBinding.imgView.background = getDrawable(R.mipmap.arrow_down_white)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
R.id.confirm -> {
|
||||
if (currentFaceType == WorkFaceType.ADD) {
|
||||
addNewFace()
|
||||
return
|
||||
}
|
||||
if (currentFaceType == WorkFaceType.EDIT) {
|
||||
editFace()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadDetail(it: FaceWorkDetailBean) {
|
||||
mBinding.etWorkfaceName.setText(it.surfaceName)
|
||||
mBinding.etTotalFootage.setText("${it.totalFootage}")
|
||||
mBinding.etCoalSeam.text = it.seamName
|
||||
mBinding.etCoalArea.text = it.areaName
|
||||
mBinding.etFaceAngle.setText(it.surfaceAzimuth)
|
||||
mBinding.etFaceHeight.setText(it.surfaceHeight)
|
||||
mBinding.etFaceWidth.setText(it.surfaceWidth)
|
||||
mBinding.tvCoalType.text = it.tunnelNature
|
||||
|
||||
mBinding.plannedDate1.setText(it.planStartDate)
|
||||
mBinding.plannedDate2.setText(it.planEndDate)
|
||||
|
||||
mBinding.etGeologicalType.setText(it.geologicalType)
|
||||
mBinding.etHydrogeologicalType.setText(it.hydrogeologicalType)
|
||||
mBinding.etSeamIgnition.setText(it.seamIgnition)
|
||||
mBinding.etSeamGas.setText(it.seamGas)
|
||||
mBinding.etSeamBumpPressure.setText(it.seamBumpPressure)
|
||||
mBinding.etSurfaceSupportForm.setText(it.surfaceSupportForm)
|
||||
}
|
||||
|
||||
private fun addNewFace() {
|
||||
if (TextUtils.isEmpty(mBinding.etWorkfaceName.text.toString())) {
|
||||
showToast("请输入工作面名称")
|
||||
return
|
||||
}
|
||||
if (TextUtils.isEmpty(mBinding.etTotalFootage.text.toString())) {
|
||||
showToast("请输入总进尺")
|
||||
return
|
||||
}
|
||||
mViewModel.postTunnellingSurfaceAdd(
|
||||
TunnelingFaceAddBean(
|
||||
surfaceName = mBinding.etWorkfaceName.text.toString(),
|
||||
totalFootage = mBinding.etTotalFootage.text.toString()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun editFace() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
package com.zmkg.coaloperation.ui.tunneling.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.WorkingItemAdapter
|
||||
import com.zmkg.coaloperation.bean.WorkingFaceItem
|
||||
import com.zmkg.coaloperation.databinding.ActivityWorkingFaceDetail2Binding
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
||||
import java.io.Serializable
|
||||
|
||||
/**
|
||||
* 工作面详情2
|
||||
*/
|
||||
class WorkingFaceDetail2Activity :
|
||||
BaseVMBActivity<TestViewModel, ActivityWorkingFaceDetail2Binding>(R.layout.activity_working_face_detail2) {
|
||||
companion object {
|
||||
const val FACE_WORK_DETAIL_DATA = "faceWorkDetailData"
|
||||
}
|
||||
|
||||
private val list: MutableList<WorkingFaceItem> = mutableListOf()
|
||||
|
||||
private var detail:FaceWorkDetailBean?=null
|
||||
private val adapter by lazy {
|
||||
WorkingItemAdapter(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
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
override fun initData() {
|
||||
val serializableExtra = intent.getSerializableExtra(FACE_WORK_DETAIL_DATA)
|
||||
if (serializableExtra==null) {
|
||||
finish()
|
||||
} else {
|
||||
detail = serializableExtra as FaceWorkDetailBean
|
||||
detail?.let {
|
||||
mBinding.toolbarLay.title = it.surfaceName
|
||||
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "工作面名称", value = it.surfaceName))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "所属煤层", value = it.seamName))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "所属采区域", value = it.areaName))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "工作面方位角", value = it.surfaceAzimuth))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "工作面巷高", value = it.surfaceHeight))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "工作面巷宽", value = it.surfaceWidth))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "巷道性质", value = it.tunnelNature))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "计划工期", value = "${it.planStartDate} ~ ${it.planEndDate}"))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "地质类型", value = it.geologicalType))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "水文地质类型", value = it.hydrogeologicalType))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "煤层发火性", value = it.seamIgnition))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "瓦斯含量", value = it.seamGas))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "冲击地压危险性", value = it.seamBumpPressure))
|
||||
list.add(WorkingFaceItem(pageType = 0, name = "支护形式", value = it.surfaceSupportForm))
|
||||
}
|
||||
|
||||
adapter.notifyDataSetChanged()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
toActivity(WorkFaceActivity::class.java, Bundle().apply {
|
||||
putString(WorkFaceActivity.WORK_FACE_TYPE, WorkFaceActivity.WorkFaceType.EDIT.name)
|
||||
putSerializable(WorkFaceActivity.FACE_WORK_DETAIL_DATA, detail)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+76
-122
@@ -1,158 +1,112 @@
|
||||
package com.zmkg.coaloperation.ui.tunneling.activity
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import androidx.core.graphics.toColorInt
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.lifecycle.repeatOnLifecycle
|
||||
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.ActivityWorkingFaceDetailBinding
|
||||
import com.zmkg.coaloperation.superfuntion.orEmptyDefaultInt
|
||||
import com.zmkg.coaloperation.ui.tunneling.adapter.TunnelingHomeListAdapter
|
||||
import com.zmkg.coaloperation.ui.tunneling.adapter.TunnelingRockNatureAdapter
|
||||
import com.zmkg.coaloperation.ui.tunneling.bean.FaceWorkDetailBean
|
||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.Serializable
|
||||
import kotlin.math.roundToInt
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
/**
|
||||
* 工作面详情
|
||||
* 工作面详情2
|
||||
*/
|
||||
class WorkingFaceDetailActivity :
|
||||
BaseVMBActivity<TunnelingViewModel, ActivityWorkingFaceDetailBinding>(R.layout.activity_working_face_detail) {
|
||||
BaseVMBActivity<TestViewModel, ActivityWorkingFaceDetailBinding>(R.layout.activity_working_face_detail) {
|
||||
companion object {
|
||||
const val FACE_WORK_DETAIL_DATA = "faceWorkDetailData"
|
||||
}
|
||||
|
||||
val tunnelingRockNatureAdapter: TunnelingRockNatureAdapter by lazy { TunnelingRockNatureAdapter()}
|
||||
private val list: MutableList<TunnelWorkingItem> = mutableListOf()
|
||||
|
||||
// private var detail:FaceWorkDetailBean?=null
|
||||
private var detail: TunnelWorkingFaceEntity? = null
|
||||
private val adapter by lazy {
|
||||
TunnelWorkingItemAdapter(list)
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.rightText = "查看详情"
|
||||
mBinding.toolbarLay.vLine.visibility = View.GONE
|
||||
mBinding.rvRockNature.adapter = tunnelingRockNatureAdapter
|
||||
mBinding.toolbarLay.rightText = "修改"
|
||||
|
||||
mBinding.arcViewGreen.let {
|
||||
it.arcColor = "#30E0A1".toColorInt()
|
||||
it.startAngle = 0f
|
||||
it.sweepAngle = 360f
|
||||
it.strokeWidth = 12f
|
||||
it.radius = ScreenUtil.dp2px(122f - 12f) / 2f
|
||||
mBinding.rvFaceList.let {
|
||||
it.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||
it.adapter = adapter
|
||||
}
|
||||
|
||||
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(100f-10f)/2f
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
val surfaceId = intent.getStringExtra("surfaceId")
|
||||
if (TextUtils.isEmpty(surfaceId)) {
|
||||
finish()
|
||||
} else {
|
||||
mViewModel.getTunnelingSurfaceDetail(surfaceId)
|
||||
detail = intent.getParcelableExtra(FACE_WORK_DETAIL_DATA)
|
||||
detail?.let {
|
||||
loadFaceDetail(it)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun bindEvent() {
|
||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
toActivity(WorkingFaceDetail2Activity::class.java, Bundle().apply {
|
||||
putSerializable(
|
||||
WorkingFaceDetail2Activity.FACE_WORK_DETAIL_DATA,
|
||||
mViewModel.faceWorkDetailData.value as Serializable
|
||||
)
|
||||
|
||||
toActivity(AddWorkingFaceActivity::class.java, Bundle().apply {
|
||||
putString(AddWorkingFaceActivity.WORK_FACE_TYPE, AddWorkingFaceActivity.WorkFaceType.EDIT.name)
|
||||
// putSerializable(WorkFaceActivity.FACE_WORK_DETAIL_DATA, detail)
|
||||
putParcelable(AddWorkingFaceActivity.FACE_WORK_DETAIL_DATA, detail)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
mViewModel.faceWorkDetailData.collectLatest {
|
||||
if (it != null) {
|
||||
setDataView(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun loadFaceDetail(it: TunnelWorkingFaceEntity) {
|
||||
mBinding.toolbarLay.title = it.surfaceName
|
||||
list.clear()
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "工作面名称", value = it.surfaceName))
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "所属煤层", value = it.seamName))
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "所属采区域", value = it.areaName))
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "工作面方位角", value = it.surfaceAzimuth))
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "工作面巷高", value = it.surfaceHeight))
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "工作面巷宽", value = it.surfaceWidth))
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "巷道性质", value = it.tunnelNature))
|
||||
list.add(
|
||||
TunnelWorkingItem(
|
||||
pageType = 0,
|
||||
name = "计划工期",
|
||||
value = "${it.planStartDate} ~ ${it.planEndDate}"
|
||||
)
|
||||
)
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "地质类型", value = it.geologicalType))
|
||||
list.add(
|
||||
TunnelWorkingItem(
|
||||
pageType = 0,
|
||||
name = "水文地质类型",
|
||||
value = it.hydrogeologicalType
|
||||
)
|
||||
)
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "煤层发火性", value = it.seamIgnition))
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "瓦斯含量", value = it.seamGas))
|
||||
list.add(
|
||||
TunnelWorkingItem(
|
||||
pageType = 0,
|
||||
name = "冲击地压危险性",
|
||||
value = it.seamBumpPressure
|
||||
)
|
||||
)
|
||||
list.add(TunnelWorkingItem(pageType = 0, name = "支护形式", value = it.surfaceSupportForm))
|
||||
|
||||
adapter.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onWorkingFaceEvent(event: TunnelWorkingFaceEntity) {
|
||||
detail = event
|
||||
detail?.let {
|
||||
loadFaceDetail(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setDataView(bean: FaceWorkDetailBean?) {
|
||||
bean ?: return
|
||||
|
||||
mBinding.apply {
|
||||
toolbarLay.title = bean.surfaceName
|
||||
|
||||
tvLenTotal.text = "总进尺:${bean.totalFootage}m"
|
||||
tvLenAccumulate.text = "累计进尺:${bean.accumulativeFootage.orEmptyDefaultInt("0")}m"
|
||||
tvLenRemain.text = "剩余进尺:${bean.remainingFootage.orEmptyDefaultInt("0")}m"
|
||||
|
||||
//累计进尺占比
|
||||
var radio = 0
|
||||
|
||||
//累计进尺圆圈占比
|
||||
var arcViewRadio: Float
|
||||
|
||||
if (bean.accumulativeFootage > bean.totalFootage) {
|
||||
radio = 100
|
||||
arcViewRadio = 360F
|
||||
} else if (bean.accumulativeFootage <= 0) {
|
||||
radio = 0
|
||||
arcViewRadio = 0F
|
||||
} else {
|
||||
radio = (bean.accumulativeFootage * 100F / bean.accumulativeFootage).roundToInt()
|
||||
arcViewRadio = bean.accumulativeFootage * 360F / bean.accumulativeFootage
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
package com.zmkg.coaloperation.ui.tunneling.activity
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.adapter.TunnelWorkingItemAdapter
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||
import com.zmkg.coaloperation.bean.TunnelWorkingItem
|
||||
import com.zmkg.coaloperation.databinding.ActivityWorkingFaceRecordBinding
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceRecordEntity
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||
import com.zmkg.coaloperation.utils.DictUtils
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import com.zmkg.coaloperation.utils.roundedOneDecimalPlace
|
||||
import com.zmkg.coaloperation.utils.toJsonString
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
/**
|
||||
* 查看(棋盘井)
|
||||
*/
|
||||
class WorkingFaceRecordActivity :
|
||||
BaseVMBActivity<TestViewModel, ActivityWorkingFaceRecordBinding>(R.layout.activity_working_face_record) {
|
||||
|
||||
companion object {
|
||||
const val TAG = "WorkingPointActivity"
|
||||
const val FACE_NAME = "faceName"
|
||||
const val FACE_RECORD = "faceRecord"
|
||||
}
|
||||
|
||||
private var faceName: String? = null
|
||||
private var faceRecord: TunnelWorkingFaceRecordEntity? = null
|
||||
private val list: MutableList<TunnelWorkingItem> = mutableListOf()
|
||||
|
||||
private val roofLithologyViewModel: TunnelRoofLithologyViewModel by lazy {
|
||||
ViewModelProvider(this)[TunnelRoofLithologyViewModel::class.java]
|
||||
}
|
||||
private val adapter by lazy {
|
||||
TunnelWorkingItemAdapter(list)
|
||||
}
|
||||
|
||||
override fun initView(savedInstanceState: Bundle?) {
|
||||
mBinding.toolbarLay.vLine.visibility = View.GONE
|
||||
mBinding.toolbarLay.title = "查看详情"
|
||||
mBinding.toolbarLay.rightText = "修改"
|
||||
mBinding.toolbarLay.titleTvRight.setOnClickListener {
|
||||
toActivity(AddWorkingFaceRecordActivity::class.java, Bundle().apply {
|
||||
putInt(AddWorkingFaceRecordActivity.SHOW_TYPE, 1)
|
||||
putString(AddWorkingFaceRecordActivity.FACE_NAME, faceName)
|
||||
putParcelable(AddWorkingFaceRecordActivity.FACE_RECORD, faceRecord)
|
||||
})
|
||||
}
|
||||
mBinding.rvPointList.let {
|
||||
it.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
|
||||
it.adapter = adapter
|
||||
}
|
||||
}
|
||||
|
||||
override fun initData() {
|
||||
faceName = intent.getStringExtra(FACE_NAME)
|
||||
faceRecord = intent.getParcelableExtra(FACE_RECORD)
|
||||
Log.d(TAG, "loadFaceRecord: ${faceRecord.toJsonString()}")
|
||||
faceRecord?.let {
|
||||
loadFaceRecord(it)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
private fun loadFaceRecord(it: TunnelWorkingFaceRecordEntity) {
|
||||
list.clear()
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "工作面名称", value = faceName))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "施工日期", value = it.workingDate))
|
||||
list.add(
|
||||
TunnelWorkingItem(
|
||||
pageType = 1,
|
||||
name = "施工班次",
|
||||
value = DictUtils.getTeamShift(it.teamShift)
|
||||
)
|
||||
)
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "施工队伍", value = it.teamName))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "带班队长", value = it.teamLeader))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "本班进尺", value = "${getShowNum2(it.workingFootage)}m"))
|
||||
|
||||
// val rockList = mutableListOf<TunnelRoofLithologyEntity>()
|
||||
// rockList.add(RockItem(startLen = 0, endLen = 1, rockType = "泥"))
|
||||
// rockList.add(RockItem(startLen = 0, endLen = 1, rockType = "砂"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "顶板岩性", value = "", items = null))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "煤层倾角", value = "${getShowNum2(it.seamDip)}°"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "煤层高", value = "${getShowNum2(it.seamHeight)}m"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "涌水量", value = "${getShowNum2(it.waterYield)}m³/h"))
|
||||
list.add(TunnelWorkingItem(pageType = 1, name = "记录人", value = it.recordPerson))
|
||||
|
||||
adapter.notifyDataSetChanged()
|
||||
|
||||
|
||||
roofLithologyViewModel.getEntityList(it.recordId) { lithologyEntities ->
|
||||
list[6].items = lithologyEntities
|
||||
adapter.notifyItemChanged(6)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun bindEvent() {
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onFaceRecordEvent(event: TunnelWorkingFaceRecordEntity) {
|
||||
faceRecord = event
|
||||
faceRecord?.let {
|
||||
loadFaceRecord(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
package com.zmkg.coaloperation.ui.tunneling.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.zmkg.coaloperation.R
|
||||
import com.zmkg.coaloperation.base.BaseVMBActivity
|
||||
import androidx.core.graphics.toColorInt
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelRoofLithologyEntity
|
||||
import com.zmkg.coaloperation.db.entity.tunnel.TunnelWorkingFaceEntity
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelRoofLithologyViewModel
|
||||
import com.zmkg.coaloperation.db.viewmodel.TunnelWorkingFaceRecordViewModel
|
||||
import com.zmkg.coaloperation.adapter.TunnelingRockNatureAdapter
|
||||
import com.zmkg.coaloperation.databinding.ActivityWorkingFaceStatisticsBinding
|
||||
import com.zmkg.coaloperation.ui.tunneling.viewmodel.TunnelingViewModel
|
||||
import com.zmkg.coaloperation.utils.ScreenUtil
|
||||
import com.zmkg.coaloperation.utils.formatDecimalString
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
import kotlin.apply
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* 工作面详情
|
||||
*/
|
||||
class WorkingFaceStatisticsActivity :
|
||||
BaseVMBActivity<TunnelingViewModel, ActivityWorkingFaceStatisticsBinding>(R.layout.activity_working_face_statistics) {
|
||||
|
||||
companion object {
|
||||
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: TunnelWorkingFaceEntity? = 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(WorkingFaceDetailActivity::class.java, Bundle().apply {
|
||||
// putSerializable(
|
||||
// WorkingFaceDetail2Activity.FACE_WORK_DETAIL_DATA,
|
||||
// mViewModel.faceWorkDetailData.value as Serializable
|
||||
// )
|
||||
putParcelable(WorkingFaceDetailActivity.FACE_WORK_DETAIL_DATA, faceDetail)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override fun processClick(v: View?) {
|
||||
}
|
||||
|
||||
override fun createObserve() {
|
||||
super.createObserve()
|
||||
// lifecycleScope.launch {
|
||||
// repeatOnLifecycle(Lifecycle.State.CREATED) {
|
||||
// mViewModel.faceWorkDetailData.collectLatest {
|
||||
// if (it != null) {
|
||||
// setDataView(it)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// private fun setDataView(bean: FaceWorkDetailBean?) {
|
||||
// bean ?: return
|
||||
// }
|
||||
|
||||
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
|
||||
|
||||
val total = stringToDouble(bean.totalFootage)
|
||||
val accumulative = stringToDouble(bean.accumulativeFootage)
|
||||
val remaining = stringToDouble(bean.remainingFootage)
|
||||
|
||||
tvLenTotal.text = "总进尺:${bean.totalFootage?.formatDecimalString()}m"
|
||||
tvLenAccumulate.text = "累计进尺:${bean.accumulativeFootage?.formatDecimalString()}m"
|
||||
tvLenRemain.text = "剩余进尺:${bean.remainingFootage?.formatDecimalString()}m"
|
||||
|
||||
//累计进尺占比
|
||||
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)
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onWorkingFaceEvent(event: TunnelWorkingFaceEntity) {
|
||||
faceDetail = event
|
||||
loadFaceDetail()
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user