增加便签功能
This commit is contained in:
@@ -184,8 +184,39 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
//捕捉列表变化回调
|
||||
viewModel.liveDataQsRecordIdList.observe(this) {
|
||||
//处理页面跳转
|
||||
viewModel.navigationRightFragment(this, it)
|
||||
//跳转到质检数据页面
|
||||
//获取右侧fragment容器
|
||||
val naviController = findNavController(R.id.main_activity_right_fragment)
|
||||
|
||||
naviController.currentDestination?.let { navDestination ->
|
||||
when (navDestination.id) {
|
||||
R.id.RightEmptyFragment -> {
|
||||
if (it.size == 1) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("QsId", it[0])
|
||||
naviController.navigate(R.id.EvaluationResultFragment, bundle)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//捕捉列表变化回调
|
||||
viewModel.liveDataNoteIdList.observe(this) {
|
||||
//跳转到质检数据页面
|
||||
//获取右侧fragment容器
|
||||
val naviController = findNavController(R.id.main_activity_right_fragment)
|
||||
|
||||
naviController.currentDestination?.let { navDestination ->
|
||||
when (navDestination.id) {
|
||||
R.id.RightEmptyFragment -> {
|
||||
if (it.size == 1) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("NoteId", it[0])
|
||||
naviController.navigate(R.id.NoteFragment, bundle)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//右上角菜单是否被点击
|
||||
viewModel.liveDataMenuState.observe(this) {
|
||||
@@ -253,7 +284,7 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.liveDataSignMoreInfo.observe(this){
|
||||
viewModel.liveDataSignMoreInfo.observe(this) {
|
||||
val fragment =
|
||||
supportFragmentManager.findFragmentById(R.id.main_activity_sign_more_info_fragment)
|
||||
if (fragment == null) {
|
||||
@@ -432,10 +463,17 @@ class MainActivity : BaseActivity() {
|
||||
/**
|
||||
* 隐藏或显示右侧展开按钮
|
||||
*/
|
||||
fun setRightSwitchButton(visibility: Int) {
|
||||
fun setRightSwitchButtonVisibility(visibility: Int) {
|
||||
binding.mainActivityFragmentSwitch.visibility = visibility
|
||||
}
|
||||
|
||||
/**
|
||||
* 顶部菜单按钮
|
||||
*/
|
||||
fun setTopMenuButtonVisibility(visibility: Int) {
|
||||
binding.mainActivityMenu.visibility = visibility
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击录音按钮
|
||||
*/
|
||||
@@ -557,4 +595,20 @@ class MainActivity : BaseActivity() {
|
||||
viewModel.showSignMoreInfo(viewModel.liveDataRoadName.value!!)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增便签,打开便签fragment
|
||||
*/
|
||||
fun onClickNewNote() {
|
||||
rightController.navigate(R.id.NoteFragment)
|
||||
binding.mainActivityMenu.isSelected = false
|
||||
binding.mainActivityMenuGroup.visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
/**
|
||||
* 右侧按钮+经纬度按钮
|
||||
*/
|
||||
fun setRightButtonsVisible(visible: Int) {
|
||||
binding.mainActivityRightVisibilityButtonsGroup2.visibility = visible
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,9 @@ class MainViewModel @Inject constructor(
|
||||
//地图点击捕捉到的质检数据ID列表
|
||||
val liveDataQsRecordIdList = MutableLiveData<List<String>>()
|
||||
|
||||
//地图点击捕捉到的标签ID列表
|
||||
val liveDataNoteIdList = MutableLiveData<List<String>>()
|
||||
|
||||
//左侧看板数据
|
||||
val liveDataSignList = MutableLiveData<List<SignBean>>()
|
||||
|
||||
@@ -128,6 +131,10 @@ class MainViewModel @Inject constructor(
|
||||
override fun onQsRecordList(list: MutableList<String>) {
|
||||
liveDataQsRecordIdList.value = list
|
||||
}
|
||||
|
||||
override fun onNoteList(list: MutableList<String>) {
|
||||
liveDataNoteIdList.value = list
|
||||
}
|
||||
})
|
||||
initLocation()
|
||||
//处理地图点击操作
|
||||
@@ -295,7 +302,8 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }.sortedBy { it.index })
|
||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }
|
||||
.sortedBy { it.index })
|
||||
|
||||
liveDataSignList.postValue(signList.sortedBy { it.distance })
|
||||
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
||||
@@ -470,25 +478,6 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理页面调转
|
||||
*/
|
||||
fun navigationRightFragment(activity: MainActivity, list: List<String>) {
|
||||
//获取右侧fragment容器
|
||||
val naviController = activity.findNavController(R.id.main_activity_right_fragment)
|
||||
|
||||
naviController.currentDestination?.let { navDestination ->
|
||||
when (navDestination.id) {
|
||||
R.id.RightEmptyFragment -> {
|
||||
if (list.size == 1) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString("QsId", list[0])
|
||||
naviController.navigate(R.id.EvaluationResultFragment, bundle)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启线选择
|
||||
|
||||
Reference in New Issue
Block a user