From 4ed44b5e4ae256cf8f84c43e6b013406769d35ae Mon Sep 17 00:00:00 2001 From: lvmeng <848755140@qq.com> Date: Thu, 25 Sep 2025 00:27:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=82=E6=B5=8B=E6=96=B9=E6=B3=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=AE=8C=E5=96=84=E5=B9=B6=E8=BF=9B=E8=A1=8C=E5=88=87?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- coalMiningApp/app/build.gradle | 2 + .../adapter/BuoyBottomAdapter.kt | 46 +++ .../coaloperation/adapter/BuoyTopAdapter.kt | 56 +++ .../com/zmkg/coaloperation/bean/OtherData.kt | 13 +- .../ui/wateryield/BuoyMethodFragment.kt | 79 ++++ .../ui/wateryield/VolumeMethodFragment.kt | 21 + .../WaterYieldAddObservePointActivity.kt | 2 +- .../wateryield/WaterYieldObserveActivity.kt | 29 ++ .../res/drawable-xxhdpi/ic_face_delete.png | Bin 0 -> 895 bytes .../layout/activity_water_yield_observe.xml | 386 ++++++------------ .../main/res/layout/fragment_buoy_method.xml | 134 ++++++ .../res/layout/fragment_volume_method.xml | 182 +++++++++ .../main/res/layout/list_item_buoy_bottom.xml | 49 +++ .../main/res/layout/list_item_buoy_top.xml | 121 ++++++ 14 files changed, 846 insertions(+), 274 deletions(-) create mode 100644 coalMiningApp/app/src/main/java/com/zmkg/coaloperation/adapter/BuoyBottomAdapter.kt create mode 100644 coalMiningApp/app/src/main/java/com/zmkg/coaloperation/adapter/BuoyTopAdapter.kt create mode 100644 coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/BuoyMethodFragment.kt create mode 100644 coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/VolumeMethodFragment.kt create mode 100644 coalMiningApp/app/src/main/res/drawable-xxhdpi/ic_face_delete.png create mode 100644 coalMiningApp/app/src/main/res/layout/fragment_buoy_method.xml create mode 100644 coalMiningApp/app/src/main/res/layout/fragment_volume_method.xml create mode 100644 coalMiningApp/app/src/main/res/layout/list_item_buoy_bottom.xml create mode 100644 coalMiningApp/app/src/main/res/layout/list_item_buoy_top.xml diff --git a/coalMiningApp/app/build.gradle b/coalMiningApp/app/build.gradle index 9acea61..29c7e04 100644 --- a/coalMiningApp/app/build.gradle +++ b/coalMiningApp/app/build.gradle @@ -110,4 +110,6 @@ dependencies { implementation("org.apache.poi:poi:5.2.3") implementation("org.apache.poi:poi-ooxml:5.2.3") + implementation 'androidx.fragment:fragment-ktx:1.6.0' + } \ No newline at end of file diff --git a/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/adapter/BuoyBottomAdapter.kt b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/adapter/BuoyBottomAdapter.kt new file mode 100644 index 0000000..82d8aab --- /dev/null +++ b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/adapter/BuoyBottomAdapter.kt @@ -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) : + BaseQuickAdapter(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() + } + } + } +} \ No newline at end of file diff --git a/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/adapter/BuoyTopAdapter.kt b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/adapter/BuoyTopAdapter.kt new file mode 100644 index 0000000..925800b --- /dev/null +++ b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/adapter/BuoyTopAdapter.kt @@ -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) : + BaseQuickAdapter(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() + } + } + } +} \ No newline at end of file diff --git a/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/bean/OtherData.kt b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/bean/OtherData.kt index ef24f88..76d330d 100644 --- a/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/bean/OtherData.kt +++ b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/bean/OtherData.kt @@ -23,7 +23,18 @@ data class CoalThicknessItem( ) data class DataSyncItem( - var funcName:String, + 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 = "" ) \ No newline at end of file diff --git a/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/BuoyMethodFragment.kt b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/BuoyMethodFragment.kt new file mode 100644 index 0000000..ce1db57 --- /dev/null +++ b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/BuoyMethodFragment.kt @@ -0,0 +1,79 @@ +package com.zmkg.coaloperation.ui.wateryield + +import android.os.Bundle +import android.view.View +import androidx.recyclerview.widget.LinearLayoutManager +import com.zmkg.coaloperation.R +import com.zmkg.coaloperation.adapter.BuoyBottomAdapter +import com.zmkg.coaloperation.adapter.BuoyTopAdapter +import com.zmkg.coaloperation.base.BaseVMBFragment +import com.zmkg.coaloperation.base.viewmodel.TestViewModel +import com.zmkg.coaloperation.bean.BuoyBottomItem +import com.zmkg.coaloperation.bean.BuoyTopItem +import com.zmkg.coaloperation.databinding.FragmentBuoyMethodBinding + +class BuoyMethodFragment : + BaseVMBFragment(R.layout.fragment_buoy_method) { + + private val buoyTopList: MutableList = mutableListOf() + private val buoyBottomList: MutableList = mutableListOf() + private val buoyTopAdapter by lazy { + BuoyTopAdapter(buoyTopList).apply { + addChildClickViewIds(R.id.ivDeleteFace, R.id.btnAddFace) + setOnItemChildClickListener { adapter, view, position -> + if (view.id == R.id.ivDeleteFace) { + try { + if (position == 0) { + return@setOnItemChildClickListener + } + buoyTopList.removeAt(position) + notifyDataSetChanged() + buoyBottomList.removeAt(position) + buoyBottomAdapter.notifyDataSetChanged() + } catch (e: Exception) { + e.printStackTrace() + } + return@setOnItemChildClickListener + } + if (view.id == R.id.btnAddFace) { + try { + buoyTopList.add(BuoyTopItem()) + notifyDataSetChanged() + //val topSize = buoyTopList.size + //name = "断面${topSize-1}到断面${topSize}的水流时间(s)" + buoyBottomList.add(BuoyBottomItem()) + buoyBottomAdapter.notifyDataSetChanged() + } catch (e: Exception) { + e.printStackTrace() + } + return@setOnItemChildClickListener + } + } + } + } + private val buoyBottomAdapter by lazy { + BuoyBottomAdapter(buoyBottomList) + } + + override fun initView(root: View?, savedInstanceState: Bundle?) { + buoyTopList.add(BuoyTopItem()) + mBinding.rvBuoyTop.let { + it.layoutManager = LinearLayoutManager(it.context) + it.adapter = buoyTopAdapter + } + buoyBottomList.run { + add(BuoyBottomItem(name = "水沟长(m)")) + } + mBinding.rvBuoyBottom.let { + it.layoutManager = LinearLayoutManager(it.context) + it.adapter = buoyBottomAdapter + } + } + + override fun bindEvent() { + } + + override fun onClick(p0: View?) { + } + +} \ No newline at end of file diff --git a/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/VolumeMethodFragment.kt b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/VolumeMethodFragment.kt new file mode 100644 index 0000000..1c01f9f --- /dev/null +++ b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/VolumeMethodFragment.kt @@ -0,0 +1,21 @@ +package com.zmkg.coaloperation.ui.wateryield + +import android.os.Bundle +import android.view.View +import com.zmkg.coaloperation.R +import com.zmkg.coaloperation.base.BaseVMBFragment +import com.zmkg.coaloperation.base.viewmodel.TestViewModel +import com.zmkg.coaloperation.databinding.FragmentVolumeMethodBinding + +class VolumeMethodFragment: + BaseVMBFragment(R.layout.fragment_volume_method) { + override fun initView(root: View?, savedInstanceState: Bundle?) { + } + + override fun bindEvent() { + } + + override fun onClick(p0: View?) { + } + +} \ No newline at end of file diff --git a/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/WaterYieldAddObservePointActivity.kt b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/WaterYieldAddObservePointActivity.kt index c235b84..c15d770 100644 --- a/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/WaterYieldAddObservePointActivity.kt +++ b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/WaterYieldAddObservePointActivity.kt @@ -5,13 +5,13 @@ 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.ActivityAboutUsBinding import com.zmkg.coaloperation.databinding.ActivityWaterYieldAddObservePointBinding /** * 涌水量添加观测点 */ class WaterYieldAddObservePointActivity : BaseVMBActivity(R.layout.activity_water_yield_add_observe_point) { + override fun initView(savedInstanceState: Bundle?) { mBinding.toolbarLay.title = "添加观测点" // mBinding.toolbarLay.rightText = "添加观测点" diff --git a/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/WaterYieldObserveActivity.kt b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/WaterYieldObserveActivity.kt index 9f931f7..2c6c6bc 100644 --- a/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/WaterYieldObserveActivity.kt +++ b/coalMiningApp/app/src/main/java/com/zmkg/coaloperation/ui/wateryield/WaterYieldObserveActivity.kt @@ -2,6 +2,8 @@ package com.zmkg.coaloperation.ui.wateryield import android.os.Bundle import android.view.View +import androidx.fragment.app.Fragment +import androidx.fragment.app.commit import androidx.recyclerview.widget.LinearLayoutManager import com.zmkg.coaloperation.R import com.zmkg.coaloperation.adapter.WaterYieldObserveAdapter @@ -26,6 +28,7 @@ class WaterYieldObserveActivity : // mBinding.toolbarLay.titleTvRight.setOnClickListener { // toActivity(WaterYieldAddObservePointActivity::class.java) // } + initFragments() } @@ -43,6 +46,11 @@ class WaterYieldObserveActivity : it.text = option.name it.tag = option.id } + if (option.id == "1") { + switchFragment(1) + } else { + switchFragment(0) + } } } @@ -66,4 +74,25 @@ class WaterYieldObserveActivity : override fun processClick(v: View?) { } + private val fragments = mutableListOf() + private fun initFragments() { + fragments.apply { + add(VolumeMethodFragment()) + add(BuoyMethodFragment()) + } + supportFragmentManager.commit { + add(R.id.fragment_container, fragments[0], "volume").hide(fragments[0]) + add(R.id.fragment_container, fragments[1], "buoy").hide(fragments[1]) + } + } + + private fun switchFragment(position: Int) { + supportFragmentManager.commit { + setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out) + fragments.forEachIndexed { index, fragment -> + if (index == position) show(fragment) else hide(fragment) + } + setReorderingAllowed(true) + } + } } \ No newline at end of file diff --git a/coalMiningApp/app/src/main/res/drawable-xxhdpi/ic_face_delete.png b/coalMiningApp/app/src/main/res/drawable-xxhdpi/ic_face_delete.png new file mode 100644 index 0000000000000000000000000000000000000000..2f60122c5832dbc823a85246d2cb6ebd5a92e76c GIT binary patch literal 895 zcmV-_1AzRAP)Px&IY~r8R9HvdnT>JOFc5`zJ0Kl|4oC%%3V;eA6+kK=sen)cNd-U!gbGLpKn2jj z;xDuEtZhl>zxX&b8`qt6RW{CIQLhl0b3st=w!}d79sqX9`G_m1>f_Cj`b56bu`d41Chr87 z9N@(6;Nh*n2hs)`umd>w&|cV$gqYcHPo_G)+y{ImB5xXVT&wEYR*V+(Ibr$G=yHm% z-N0dH_zpsz-Jx49AXvMz`T7joefVpnVM}lYhRO193&v53el4(|y;(Wg#{$eO3BYmV zqQCCR43UNqjA&OwhgbNyx7zQ)WgM2YIBO6bXmz5`;pWeD6Uc?5iZRZ2}fuA}b?v?7h}I zO^Q2^*}e`RT;Rxt!?hTj@;hdR03Za_(44fGZq3n@3D$l#1dVd?!=yp1|Aq8&AOO__ z-nFt?cCXE>lUB^hOC?g;eETSo+Tu4?@st23UuMCZrJ7@k-&&cU6k{J{e$lf3Pb0;h zpXe7`Rg*f6V>YB$7HIDBR#gBUn}MS{jXP3Q$e?~qeUIhMz&K%OaPa4~+pV2wR$J(# z+AWg@0~}^7zG0{cI0hJVDD#cug(-~o=bXiG$;aGf;$ciWpdp!BCB&}^c#MoKedgc*{{_{U VqC8AkJOls$002ovPDHLkV1iASp - + android:layout_height="match_parent" + android:orientation="vertical"> + + + - - - - - - - - - - - - - - - - - - - - - - - + android:paddingEnd="15dp"> - - - + app:drawableEndCompat="@drawable/ic_point_arrow_right" /> + - - - - - - - - - - - - - - - - + android:background="@drawable/bottom_border" + android:paddingStart="20dp" + android:paddingEnd="15dp"> + android:text="观测点坐标" + android:textColor="#6A6F87" + android:textSize="16sp" /> - + android:drawablePadding="12dp" + android:hint="请选择" + android:paddingStart="5dp" + android:paddingTop="3dp" + android:paddingEnd="5dp" + android:paddingBottom="3dp" + android:textColor="@color/white" + android:textColorHint="#6A6F87" + android:textSize="16sp" + app:drawableEndCompat="@drawable/ic_point_arrow_right" /> + + + + + + + + + + android:gravity="center_vertical" + android:orientation="horizontal"> + - - + + - - + + + + \ No newline at end of file diff --git a/coalMiningApp/app/src/main/res/layout/fragment_buoy_method.xml b/coalMiningApp/app/src/main/res/layout/fragment_buoy_method.xml new file mode 100644 index 0000000..46f7433 --- /dev/null +++ b/coalMiningApp/app/src/main/res/layout/fragment_buoy_method.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/coalMiningApp/app/src/main/res/layout/fragment_volume_method.xml b/coalMiningApp/app/src/main/res/layout/fragment_volume_method.xml new file mode 100644 index 0000000..d54357f --- /dev/null +++ b/coalMiningApp/app/src/main/res/layout/fragment_volume_method.xml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/coalMiningApp/app/src/main/res/layout/list_item_buoy_bottom.xml b/coalMiningApp/app/src/main/res/layout/list_item_buoy_bottom.xml new file mode 100644 index 0000000..601fda7 --- /dev/null +++ b/coalMiningApp/app/src/main/res/layout/list_item_buoy_bottom.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/coalMiningApp/app/src/main/res/layout/list_item_buoy_top.xml b/coalMiningApp/app/src/main/res/layout/list_item_buoy_top.xml new file mode 100644 index 0000000..d23ff99 --- /dev/null +++ b/coalMiningApp/app/src/main/res/layout/list_item_buoy_top.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file