Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS
Conflicts: app/src/main/res/layout/text_item_select.xml
This commit is contained in:
@@ -5,13 +5,17 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.FragmentEmptyBinding
|
||||
import com.navinfo.omqs.ui.activity.map.MainActivity
|
||||
|
||||
class EmptyFragment :Fragment(){
|
||||
class EmptyFragment : Fragment() {
|
||||
private var _binding: FragmentEmptyBinding? = null
|
||||
|
||||
private var currentDestinationLabel = ""
|
||||
private val binding get() = _binding!!
|
||||
// private val viewModel by lazy { viewModels<EvaluationResultViewModel>().value}
|
||||
|
||||
// private val viewModel by lazy { viewModels<EvaluationResultViewModel>().value}
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
@@ -25,6 +29,22 @@ class EmptyFragment :Fragment(){
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
val currentDestination = findNavController().currentDestination
|
||||
if (currentDestination?.label == "右侧空页面") {
|
||||
currentDestinationLabel = "右侧空页面"
|
||||
(activity as MainActivity).setRightSwitchButton(View.GONE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
if (currentDestinationLabel == "右侧空页面") {
|
||||
(activity as MainActivity).setRightSwitchButton(View.VISIBLE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
|
||||
@@ -103,7 +103,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
* 读取元数据
|
||||
*/
|
||||
// val id = args.qsId
|
||||
var id: String = ""
|
||||
var id = ""
|
||||
var signBean: SignBean? = null
|
||||
var filePath: String = ""
|
||||
arguments?.let {
|
||||
@@ -235,7 +235,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
val controller = findNavController(R.id.main_activity_middle_fragment)
|
||||
controller.currentDestination?.let {
|
||||
//如果之前页面是空fragment,直接打开面板
|
||||
if (it.id == R.id.EmptyFragment) {
|
||||
if (it.id == R.id.MiddleEmptyFragment) {
|
||||
findNavController(
|
||||
R.id.main_activity_middle_fragment
|
||||
).navigate(R.id.PhenomenonFragment)
|
||||
@@ -258,7 +258,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
val controller = findNavController(R.id.main_activity_middle_fragment)
|
||||
controller.currentDestination?.let {
|
||||
//如果之前页面是空fragment,直接打开面板
|
||||
if (it.id == R.id.EmptyFragment) {
|
||||
if (it.id == R.id.MiddleEmptyFragment) {
|
||||
findNavController(
|
||||
R.id.main_activity_middle_fragment
|
||||
).navigate(R.id.ProblemLinkFragment)
|
||||
@@ -282,13 +282,13 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
}
|
||||
|
||||
fun voiceOnTouchStart() {
|
||||
viewModel!!.startSoundMetter(requireActivity(), binding.evaluationVoice)
|
||||
viewModel.startSoundMetter(requireActivity(), binding.evaluationVoice)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.Q)
|
||||
fun voiceOnTouchStop() {
|
||||
if (Constant.IS_VIDEO_SPEED) {
|
||||
viewModel!!.stopSoundMeter()
|
||||
viewModel.stopSoundMeter()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
/**
|
||||
* 问题类型 liveData 给[MiddleAdapter]展示的数据
|
||||
*/
|
||||
val liveDataMiddleTypeList = MutableLiveData<List<String>>()
|
||||
// val liveDataMiddleTypeList = MutableLiveData<List<String>>()
|
||||
|
||||
/**
|
||||
* 问题现象 liveData 给[RightGroupHeaderAdapter]展示的数据
|
||||
@@ -192,19 +192,22 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
list?.let {
|
||||
if (list.isNotEmpty()) {
|
||||
//通知页面更新
|
||||
var classType = list[0]
|
||||
liveDataLeftTypeList.postValue(it)
|
||||
var classType = it[0]
|
||||
if (bean != null) {
|
||||
val classType2 = roomAppDatabase.getScProblemTypeDao()
|
||||
.findClassTypeByCode(bean.elementCode)
|
||||
if (classType2 != null)
|
||||
if (classType2 != null) {
|
||||
classType = classType2
|
||||
}
|
||||
}
|
||||
//如果右侧栏没数据,给个默认值
|
||||
if (liveDataQsRecordBean.value!!.classType.isEmpty()) {
|
||||
|
||||
liveDataQsRecordBean.value!!.classType = classType
|
||||
classTypeTemp = classType
|
||||
} else {
|
||||
classType = liveDataQsRecordBean.value!!.classType
|
||||
}
|
||||
getProblemList(classType)
|
||||
}
|
||||
@@ -242,7 +245,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
Log.e("jingo", "getProblemLinkList ${rightList[0].text}")
|
||||
}
|
||||
liveDataQsRecordBean.postValue(liveDataQsRecordBean.value)
|
||||
liveDataMiddleTypeList.postValue(middleList)
|
||||
// liveDataMiddleTypeList.postValue(middleList)
|
||||
liveDataRightTypeList.postValue(rightList)
|
||||
}
|
||||
}
|
||||
@@ -274,7 +277,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
liveDataQsRecordBean.value!!.problemType = typeTitleList[0]
|
||||
Log.e("jingo", "getProblemList ${typeTitleList[0]}")
|
||||
}
|
||||
liveDataMiddleTypeList.postValue(typeTitleList)
|
||||
// liveDataMiddleTypeList.postValue(typeTitleList)
|
||||
if (liveDataQsRecordBean.value!!.phenomenon.isEmpty()) {
|
||||
liveDataQsRecordBean.value!!.phenomenon = phenomenonRightList[0].text
|
||||
Log.e("jingo", "getProblemList ${phenomenonRightList[0].text}")
|
||||
@@ -315,7 +318,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
fun saveData() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val realm = Realm.getDefaultInstance()
|
||||
liveDataQsRecordBean.value!!.checkTime = DateTimeUtil.getDataTime()
|
||||
liveDataQsRecordBean.value!!.checkTime = DateTimeUtil.getDataTime()
|
||||
realm.executeTransaction {
|
||||
it.copyToRealmOrUpdate(liveDataQsRecordBean.value)
|
||||
}
|
||||
@@ -453,7 +456,6 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
|
||||
Constant.IS_VIDEO_SPEED = true
|
||||
//录音动画
|
||||
//录音动画
|
||||
if (pop != null) {
|
||||
pop!!.showAtLocation(v, Gravity.CENTER, 0, 0)
|
||||
}
|
||||
|
||||
@@ -28,13 +28,7 @@ class LeftAdapter(private var itemListener: ((Int, String) -> Unit?)? = null) :
|
||||
val bd = holder.viewBinding as TextItemSelectBinding
|
||||
val title = data[position]
|
||||
bd.itemId.text = title
|
||||
if (selectTitle == title) {
|
||||
bd.itemId.setBackgroundResource(R.drawable.shape_rect_white_2dp_bg)
|
||||
bd.itemId.setTextColor(holder.viewBinding.root.context.getColor(R.color.highFontColor))
|
||||
} else {
|
||||
bd.itemId.setBackgroundResource(R.drawable.shape_rect_white_2dp_bg)
|
||||
bd.itemId.setTextColor(holder.viewBinding.root.context.getColor(R.color.black))
|
||||
}
|
||||
holder.viewBinding.root.isSelected = selectTitle == title
|
||||
bd.root.setOnClickListener {
|
||||
if (selectTitle != title) {
|
||||
selectTitle = title
|
||||
@@ -50,10 +44,9 @@ class LeftAdapter(private var itemListener: ((Int, String) -> Unit?)? = null) :
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun setRightTitle(title: String) {
|
||||
fun setSelectTitle(title: String) {
|
||||
if (title != selectTitle) {
|
||||
selectTitle = title
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,12 @@ import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.FragmentPhenomenonBinding
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
@@ -19,6 +22,7 @@ class PhenomenonFragment :
|
||||
BaseFragment() {
|
||||
private var _binding: FragmentPhenomenonBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
/**
|
||||
* 和[PhenomenonFragment],[ProblemLinkFragment],[EvaluationResultFragment]共用同一个viewModel
|
||||
*/
|
||||
@@ -50,6 +54,7 @@ class PhenomenonFragment :
|
||||
binding.phenomenonLeftRecyclerview.adapter = leftAdapter
|
||||
//左侧菜单查询结果监听
|
||||
viewModel.liveDataLeftTypeList.observe(viewLifecycleOwner) {
|
||||
leftAdapter.setSelectTitle(viewModel.liveDataQsRecordBean.value!!.classType)
|
||||
leftAdapter.refreshData(it)
|
||||
}
|
||||
|
||||
@@ -63,6 +68,9 @@ class PhenomenonFragment :
|
||||
*/
|
||||
val rightAdapter = RightGroupHeaderAdapter { _, bean ->
|
||||
viewModel.setPhenomenonMiddleBean(bean)
|
||||
if (activity != null) {
|
||||
requireActivity().findNavController(R.id.main_activity_middle_fragment).navigateUp()
|
||||
}
|
||||
}
|
||||
binding.phenomenonRightRecyclerview.adapter = rightAdapter
|
||||
//右侧菜单增加组标题
|
||||
@@ -75,6 +83,7 @@ class PhenomenonFragment :
|
||||
}
|
||||
//右侧菜单查询数据监听
|
||||
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
|
||||
rightAdapter.setSelectTitle(viewModel.liveDataQsRecordBean.value!!.classType)
|
||||
rightAdapter.refreshData(it)
|
||||
}
|
||||
|
||||
@@ -106,15 +115,15 @@ class PhenomenonFragment :
|
||||
})
|
||||
|
||||
|
||||
//中间菜单
|
||||
binding.phenomenonMiddleRecyclerview.setHasFixedSize(true)
|
||||
binding.phenomenonMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
|
||||
binding.phenomenonMiddleRecyclerview.adapter = middleAdapter
|
||||
// //中间菜单
|
||||
// binding.phenomenonMiddleRecyclerview.setHasFixedSize(true)
|
||||
// binding.phenomenonMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
//
|
||||
// binding.phenomenonMiddleRecyclerview.adapter = middleAdapter
|
||||
//中间侧菜单查询结果监听
|
||||
viewModel.liveDataMiddleTypeList.observe(viewLifecycleOwner) {
|
||||
middleAdapter.refreshData(it)
|
||||
}
|
||||
// viewModel.liveDataMiddleTypeList.observe(viewLifecycleOwner) {
|
||||
// middleAdapter.refreshData(it)
|
||||
// }
|
||||
// binding.phenomenonDrawer.setOnClickListener {
|
||||
// when (binding.group.visibility) {
|
||||
// View.INVISIBLE, View.GONE ->
|
||||
|
||||
@@ -75,14 +75,14 @@ class ProblemLinkFragment : BaseFragment() {
|
||||
}
|
||||
})
|
||||
|
||||
//中间菜单
|
||||
binding.linkMiddleRecyclerview.setHasFixedSize(true)
|
||||
binding.linkMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext())
|
||||
binding.linkMiddleRecyclerview.adapter = middleAdapter
|
||||
// //中间菜单
|
||||
// binding.linkMiddleRecyclerview.setHasFixedSize(true)
|
||||
// binding.linkMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext())
|
||||
// binding.linkMiddleRecyclerview.adapter = middleAdapter
|
||||
//中间侧菜单查询结果监听
|
||||
viewModel.liveDataMiddleTypeList.observe(viewLifecycleOwner) {
|
||||
middleAdapter.refreshData(it)
|
||||
}
|
||||
// viewModel.liveDataMiddleTypeList.observe(viewLifecycleOwner) {
|
||||
// middleAdapter.refreshData(it)
|
||||
// }
|
||||
binding.linkDrawer.setOnClickListener {
|
||||
when (binding.group.visibility) {
|
||||
View.INVISIBLE, View.GONE ->
|
||||
|
||||
@@ -3,27 +3,35 @@ package com.navinfo.omqs.ui.fragment.evaluationresult
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.TextItemSelectBinding
|
||||
import com.navinfo.omqs.databinding.TextItemSelect2Binding
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
|
||||
class RightGroupHeaderAdapter(private var itemListener: ((Int, RightBean) -> Unit?)? = null) :
|
||||
BaseRecyclerViewAdapter<RightBean>() {
|
||||
private var selectTitle = ""
|
||||
private var groupTitleList = mutableListOf<String>()
|
||||
override fun getItemViewRes(position: Int): Int {
|
||||
return R.layout.text_item_select
|
||||
return R.layout.text_item_select2
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
||||
val viewBinding =
|
||||
TextItemSelectBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
TextItemSelect2Binding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return BaseViewHolder(viewBinding)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
|
||||
val bd = holder.viewBinding as TextItemSelectBinding
|
||||
bd.itemId.text = data[position].text
|
||||
val bd = holder.viewBinding as TextItemSelect2Binding
|
||||
val title = data[position].text
|
||||
bd.itemId.text = title
|
||||
|
||||
holder.viewBinding.root.isSelected = selectTitle == title
|
||||
bd.root.setOnClickListener {
|
||||
if (selectTitle != title) {
|
||||
selectTitle = title
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
itemListener?.invoke(position, data[position])
|
||||
}
|
||||
}
|
||||
@@ -86,7 +94,6 @@ class RightGroupHeaderAdapter(private var itemListener: ((Int, RightBean) -> Uni
|
||||
}
|
||||
|
||||
override fun refreshData(newData: List<RightBean>) {
|
||||
super.refreshData(newData)
|
||||
groupTitleList.clear()
|
||||
for (item in newData) {
|
||||
if (groupTitleList.size > 0) {
|
||||
@@ -97,7 +104,15 @@ class RightGroupHeaderAdapter(private var itemListener: ((Int, RightBean) -> Uni
|
||||
groupTitleList.add(item.title)
|
||||
}
|
||||
}
|
||||
super.refreshData(newData)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置当前选中的哪条数据
|
||||
*/
|
||||
fun setSelectTitle(title: String) {
|
||||
if (title != selectTitle) {
|
||||
selectTitle = title
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ class RightGroupHeaderDecoration(context: Context) : ItemDecoration() {
|
||||
mTextPaint.textSize = 46f
|
||||
mTextPaint.color = Color.WHITE
|
||||
mLinePaint = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||
mLinePaint.color = Color.GRAY
|
||||
mLinePaint.color = Color.WHITE
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ class LayerManagerExpandableListAdapter(private val context: Context, val parent
|
||||
}
|
||||
|
||||
override fun getChildrenCount(groupPosition: Int): Int {
|
||||
return parentItems[groupPosition].tables.size
|
||||
return parentItems[groupPosition].tableMap.size
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ class LayerManagerExpandableListAdapter(private val context: Context, val parent
|
||||
return parentItems[groupPosition]
|
||||
}
|
||||
|
||||
override fun getChild(groupPosition: Int, childPosition: Int): Any {
|
||||
return parentItems[groupPosition].tables[childPosition]
|
||||
override fun getChild(groupPosition: Int, childPosition: Int): TableInfo? {
|
||||
return parentItems[groupPosition].tableMap[parentItems[groupPosition].tableMap.keys.elementAt(childPosition)]
|
||||
}
|
||||
|
||||
override fun getGroupId(groupPosition: Int): Long = groupPosition.toLong()
|
||||
@@ -58,7 +58,7 @@ class LayerManagerExpandableListAdapter(private val context: Context, val parent
|
||||
viewHolder.parentCheckBox.isChecked = parentItem.checked
|
||||
viewHolder.parentCheckBox.setOnClickListener {
|
||||
parentItem.checked = !parentItem.checked
|
||||
parentItem.tables.forEach { it.checked = parentItem.checked }
|
||||
parentItem.tableMap.forEach { it.value.checked = parentItem.checked }
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
if (isExpanded) {
|
||||
@@ -93,7 +93,7 @@ class LayerManagerExpandableListAdapter(private val context: Context, val parent
|
||||
viewHolder.childCheckBox.isChecked = childItem.checked
|
||||
viewHolder.childCheckBox.setOnClickListener {
|
||||
childItem.checked = !childItem.checked
|
||||
parentItems[groupPosition].checked = parentItems[groupPosition].tables.all { it.checked }
|
||||
parentItems[groupPosition].checked = parentItems[groupPosition].tableMap.all { it.value.checked }
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user