编录点优化
This commit is contained in:
+7
-16
@@ -84,18 +84,8 @@ class GeoPointMultiAdapter(list: MutableList<GeoPointMultiItem>) :
|
|||||||
|
|
||||||
private fun loadBaseInfo(holder: BaseViewHolder, item: GeoPointMultiItem) {
|
private fun loadBaseInfo(holder: BaseViewHolder, item: GeoPointMultiItem) {
|
||||||
val llBaseTop = holder.itemView.findViewById<LinearLayout>(R.id.llBaseTop)
|
val llBaseTop = holder.itemView.findViewById<LinearLayout>(R.id.llBaseTop)
|
||||||
val topList = mutableListOf(
|
llBaseTop.removeAllViews()
|
||||||
BaseItem(name = "点号", value = ""),
|
item.baseTopList?.forEach {
|
||||||
BaseItem(name = "点距", value = ""),
|
|
||||||
BaseItem(name = "累距", value = ""),
|
|
||||||
)
|
|
||||||
val bottomList = mutableListOf(
|
|
||||||
BaseItem(name = "巷高", value = ""),
|
|
||||||
BaseItem(name = "顶板", value = ""),
|
|
||||||
BaseItem(name = "底板", value = ""),
|
|
||||||
BaseItem(name = "巷顶煤厚", value = ""),
|
|
||||||
)
|
|
||||||
topList.forEach {
|
|
||||||
val itemBinding = ListItemPointBaseHorizontalBinding.inflate(
|
val itemBinding = ListItemPointBaseHorizontalBinding.inflate(
|
||||||
LayoutInflater.from(context),
|
LayoutInflater.from(context),
|
||||||
llBaseTop,
|
llBaseTop,
|
||||||
@@ -107,9 +97,10 @@ class GeoPointMultiAdapter(list: MutableList<GeoPointMultiItem>) :
|
|||||||
}
|
}
|
||||||
llBaseTop.addView(itemBinding.root)
|
llBaseTop.addView(itemBinding.root)
|
||||||
}
|
}
|
||||||
val llBaseBottom = holder.itemView.findViewById<LinearLayout>(R.id.llBaseBottom)
|
|
||||||
|
|
||||||
bottomList.forEachIndexed { index, it ->
|
val llBaseBottom = holder.itemView.findViewById<LinearLayout>(R.id.llBaseBottom)
|
||||||
|
llBaseBottom.removeAllViews()
|
||||||
|
item.baseBottomList?.forEachIndexed { index, it ->
|
||||||
val itemBinding = ListItemPointBaseVerticalBinding.inflate(
|
val itemBinding = ListItemPointBaseVerticalBinding.inflate(
|
||||||
LayoutInflater.from(context),
|
LayoutInflater.from(context),
|
||||||
llBaseBottom,
|
llBaseBottom,
|
||||||
@@ -119,13 +110,13 @@ class GeoPointMultiAdapter(list: MutableList<GeoPointMultiItem>) :
|
|||||||
tvItemName.text = it.name
|
tvItemName.text = it.name
|
||||||
etInputValue.setText(it.value)
|
etInputValue.setText(it.value)
|
||||||
dividerVertical.run {
|
dividerVertical.run {
|
||||||
if (index == bottomList.size - 1) gone() else visible()
|
if (index == item.baseBottomList!!.size - 1) gone() else visible()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
itemBinding.root.updateLayoutParams<LinearLayout.LayoutParams> {
|
itemBinding.root.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
width = 0
|
width = 0
|
||||||
height = LinearLayout.LayoutParams.MATCH_PARENT
|
height = LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
weight = if (index == bottomList.size - 1) 1.24F else 1.0F
|
weight = if (index == item.baseBottomList!!.size - 1) 1.24F else 1.0F
|
||||||
}
|
}
|
||||||
llBaseBottom.addView(itemBinding.root)
|
llBaseBottom.addView(itemBinding.root)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ data class GeoPointMultiItem(
|
|||||||
var pointName: String = "",
|
var pointName: String = "",
|
||||||
var pointDistance: String = "",
|
var pointDistance: String = "",
|
||||||
var totalDistance: String = "",
|
var totalDistance: String = "",
|
||||||
|
var baseTopList: MutableList<BaseItem>?=null,
|
||||||
|
var baseBottomList: MutableList<BaseItem>?=null,
|
||||||
var images: MutableList<GeoPointImage>?=null
|
var images: MutableList<GeoPointImage>?=null
|
||||||
): MultiItemEntity {
|
): MultiItemEntity {
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
+21
-41
@@ -42,13 +42,6 @@ class AddGeologicalPointActivity :
|
|||||||
// mBinding.toolbarLay.rightText = "新增工作面"
|
// mBinding.toolbarLay.rightText = "新增工作面"
|
||||||
|
|
||||||
initFragments()
|
initFragments()
|
||||||
//switchFragment(0)
|
|
||||||
|
|
||||||
supportFragmentManager.commit {
|
|
||||||
setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out)
|
|
||||||
show(fragments[0])
|
|
||||||
setReorderingAllowed(true)
|
|
||||||
}
|
|
||||||
initMagicIndicator()
|
initMagicIndicator()
|
||||||
showFragment(0)
|
showFragment(0)
|
||||||
}
|
}
|
||||||
@@ -63,30 +56,21 @@ class AddGeologicalPointActivity :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private val fragments = mutableListOf<Fragment>()
|
private val fragments = mutableListOf<AddGeologicalPointFragment>()
|
||||||
private fun initFragments() {
|
private fun initFragments() {
|
||||||
titles.forEach { _ ->
|
titles.forEachIndexed { index, string ->
|
||||||
fragments.add(AddGeologicalPointFragment())
|
val fragment = AddGeologicalPointFragment()
|
||||||
}
|
fragments.add(fragment)
|
||||||
// supportFragmentManager.commit {
|
supportFragmentManager.commit {
|
||||||
//// add(R.id.fragment_container, fragments[0], "volume").hide(fragments[0])
|
add(R.id.frgContainerView, fragment, "frg_${index}").hide(fragment)
|
||||||
// replace(R.id.frgContainerView, fragments[0], "point01")
|
// replace(R.id.frgContainerView, fragments[0], "point01")
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 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)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
fragments[0].onActivityResult(requestCode, resultCode, data)
|
fragments[showFrgIndex].onActivityResult(requestCode, resultCode, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val titles = listOf("1#", "2#", "3#", "4#", "5#", "6#")
|
private val titles = listOf("1#", "2#", "3#", "4#", "5#", "6#")
|
||||||
@@ -96,12 +80,6 @@ class AddGeologicalPointActivity :
|
|||||||
override fun getCount() = titles.size
|
override fun getCount() = titles.size
|
||||||
override fun getTitleView(context: Context?, index: Int): IPagerTitleView {
|
override fun getTitleView(context: Context?, index: Int): IPagerTitleView {
|
||||||
return ColorTransitionPagerTitleView(context).apply {
|
return ColorTransitionPagerTitleView(context).apply {
|
||||||
// setPadding(
|
|
||||||
// if (index == 0) 20.dp else 10.dp,
|
|
||||||
// 10.dp,
|
|
||||||
// if (index == titles.size - 1) 20.dp else 10.dp,
|
|
||||||
// 10.dp
|
|
||||||
// )
|
|
||||||
// setPadding(10.dp, 5.dp,10.dp, 5.dp)
|
// setPadding(10.dp, 5.dp,10.dp, 5.dp)
|
||||||
width = 65.dp
|
width = 65.dp
|
||||||
text = titles[index]
|
text = titles[index]
|
||||||
@@ -114,13 +92,6 @@ class AddGeologicalPointActivity :
|
|||||||
strokeColor = "#0C0D0E".toColorInt(),
|
strokeColor = "#0C0D0E".toColorInt(),
|
||||||
strokeWidth = 8.dp
|
strokeWidth = 8.dp
|
||||||
)
|
)
|
||||||
// showToast(parent.javaClass.simpleName)
|
|
||||||
// updateLayoutParams<LinearLayout.LayoutParams> {
|
|
||||||
// topMargin = 10.dp
|
|
||||||
// bottomMargin = 10.dp
|
|
||||||
// leftMargin = if (index == 0) 20.dp else 10.dp
|
|
||||||
// rightMargin = if (index == titles.size - 1) 20.dp else 10.dp
|
|
||||||
// }
|
|
||||||
setOnClickListener { showFragment(index) }
|
setOnClickListener { showFragment(index) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,11 +118,20 @@ class AddGeologicalPointActivity :
|
|||||||
|
|
||||||
private lateinit var fragmentContainerHelper:FragmentContainerHelper
|
private lateinit var fragmentContainerHelper:FragmentContainerHelper
|
||||||
|
|
||||||
|
private var showFrgIndex = 0
|
||||||
private fun showFragment(position: Int) {
|
private fun showFragment(position: Int) {
|
||||||
supportFragmentManager.beginTransaction()
|
showFrgIndex = position
|
||||||
.replace(R.id.frgContainerView, fragments[position])
|
// supportFragmentManager.beginTransaction()
|
||||||
.commit()
|
// .replace(R.id.frgContainerView, fragments[position])
|
||||||
|
// .commit()
|
||||||
fragmentContainerHelper.handlePageSelected(position)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+20
-1
@@ -10,6 +10,7 @@ import com.zmkg.coaloperation.R
|
|||||||
import com.zmkg.coaloperation.adapter.GeoPointMultiAdapter
|
import com.zmkg.coaloperation.adapter.GeoPointMultiAdapter
|
||||||
import com.zmkg.coaloperation.base.BaseVMBFragment
|
import com.zmkg.coaloperation.base.BaseVMBFragment
|
||||||
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
import com.zmkg.coaloperation.base.viewmodel.TestViewModel
|
||||||
|
import com.zmkg.coaloperation.bean.BaseItem
|
||||||
import com.zmkg.coaloperation.bean.GeoPointImage
|
import com.zmkg.coaloperation.bean.GeoPointImage
|
||||||
import com.zmkg.coaloperation.bean.GeoPointMultiItem
|
import com.zmkg.coaloperation.bean.GeoPointMultiItem
|
||||||
import com.zmkg.coaloperation.databinding.FragmentAddGeologicalPointBinding
|
import com.zmkg.coaloperation.databinding.FragmentAddGeologicalPointBinding
|
||||||
@@ -27,10 +28,28 @@ class AddGeologicalPointFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun initView(root: View?, savedInstanceState: Bundle?) {
|
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<GeoPointImage>()
|
val imageList = mutableListOf<GeoPointImage>()
|
||||||
imageList.add(GeoPointImage(isAddFlag = true))
|
imageList.add(GeoPointImage(isAddFlag = true))
|
||||||
geoPointList.run {
|
geoPointList.run {
|
||||||
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_BASE_INFO))
|
add(
|
||||||
|
GeoPointMultiItem(
|
||||||
|
itemType = GeoPointMultiItem.TYPE_BASE_INFO,
|
||||||
|
baseTopList = topList,
|
||||||
|
baseBottomList = bottomList
|
||||||
|
)
|
||||||
|
)
|
||||||
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_LOGGING_INFO))
|
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_LOGGING_INFO))
|
||||||
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_CALCULATE_INFO))
|
add(GeoPointMultiItem(itemType = GeoPointMultiItem.TYPE_CALCULATE_INFO))
|
||||||
add(
|
add(
|
||||||
|
|||||||
Reference in New Issue
Block a user