增加评测link功能
This commit is contained in:
@@ -92,6 +92,8 @@ class Constant {
|
||||
val OMDB_LAYER_VISIBLE_LIST: MutableList<String> = mutableListOf() // 记录OMDB数据显示的图层名称列表
|
||||
|
||||
const val EVENT_LAYER_MANAGER_CHANGE = "EVENT_LAYER_MANAGER_CHANGE" // 图层管理中的配置修改
|
||||
|
||||
const val SELECT_TASK_ID = "select_task_id" //选中的任务ID
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.navinfo.omqs.hilt
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import androidx.room.Room
|
||||
import com.google.gson.Gson
|
||||
@@ -25,7 +27,6 @@ import io.realm.Realm
|
||||
import kotlinx.coroutines.*
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import retrofit2.Call
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import java.util.concurrent.TimeUnit
|
||||
@@ -38,6 +39,7 @@ import javax.inject.Singleton
|
||||
@InstallIn(SingletonComponent::class)
|
||||
class GlobalModule {
|
||||
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideApplication(@ApplicationContext application: Application): OMQSApplication {
|
||||
@@ -166,4 +168,10 @@ class GlobalModule {
|
||||
fun provideRealmDefaultInstance(): Realm {
|
||||
return Realm.getDefaultInstance()
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
fun provideSharedPreferences(context: Application): SharedPreferences {
|
||||
return context.getSharedPreferences("Shared" + Constant.USER_ID, Context.MODE_PRIVATE)
|
||||
}
|
||||
}
|
||||
@@ -460,6 +460,24 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 准星的显隐控制
|
||||
*/
|
||||
fun setHomeCenterVisibility(visible: Int) {
|
||||
binding.mainActivityHomeCenter.visibility = visible
|
||||
binding.mainActivityHomeCenterText.visibility = visible
|
||||
if (visible != View.VISIBLE) {
|
||||
binding.mainActivityHomeCenterText.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置屏幕中心文字内容
|
||||
*/
|
||||
fun setHomeCenterText(str: String) {
|
||||
binding.mainActivityHomeCenterText.text = str
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏或显示右侧展开按钮
|
||||
*/
|
||||
@@ -472,6 +490,10 @@ class MainActivity : BaseActivity() {
|
||||
*/
|
||||
fun setTopMenuButtonVisibility(visibility: Int) {
|
||||
binding.mainActivityMenu.visibility = visibility
|
||||
if (visibility != View.VISIBLE) {
|
||||
binding.mainActivityMenuGroup.visibility = View.INVISIBLE
|
||||
binding.mainActivityMenu.isSelected = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -601,8 +623,14 @@ class MainActivity : BaseActivity() {
|
||||
*/
|
||||
fun onClickNewNote() {
|
||||
rightController.navigate(R.id.NoteFragment)
|
||||
binding.mainActivityMenu.isSelected = false
|
||||
binding.mainActivityMenuGroup.visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增评测link
|
||||
*/
|
||||
fun onClickTaskLink() {
|
||||
rightController.navigate(R.id.TaskLinkFragment)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklink
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.FragmentTaskLinkBinding
|
||||
import com.navinfo.omqs.ui.activity.map.MainActivity
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.other.BaseToast
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TaskLinkFragment : BaseFragment(), View.OnClickListener {
|
||||
private var _binding: FragmentTaskLinkBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
@Inject
|
||||
lateinit var mapController: NIMapController
|
||||
|
||||
private val viewModel by shareViewModels<TaskLinkViewModel>("taskLink")
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentTaskLinkBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
binding.taskLinkAddPoint.setOnClickListener(this)
|
||||
binding.taskLinkKind.setOnClickListener(this)
|
||||
binding.taskLinkFunctionalLevel.setOnClickListener(this)
|
||||
binding.taskLinkDataLevel.setOnClickListener(this)
|
||||
binding.taskLinkBarCancel.setOnClickListener(this)
|
||||
binding.taskLinkBarSave.setOnClickListener(this)
|
||||
/**
|
||||
* 数据操作结束
|
||||
*/
|
||||
viewModel.liveDataFinish.observe(viewLifecycleOwner) {
|
||||
if (it)
|
||||
onBackPressed()
|
||||
}
|
||||
/**
|
||||
* 种别
|
||||
*/
|
||||
viewModel.liveDataSelectKind.observe(viewLifecycleOwner) {
|
||||
binding.taskLinkKind.text = it?.title
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能等级
|
||||
*/
|
||||
viewModel.liveDataSelectFunctionLevel.observe(viewLifecycleOwner) {
|
||||
binding.taskLinkFunctionalLevel.text = it?.title
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据等级
|
||||
*/
|
||||
viewModel.liveDataSelectDataLevel.observe(viewLifecycleOwner) {
|
||||
binding.taskLinkDataLevel.text = it?.title
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前选中任务
|
||||
*/
|
||||
viewModel.liveDataTaskBean.observe(viewLifecycleOwner) {
|
||||
binding.taskLinkTaskName.text = it?.evaluationTaskName
|
||||
}
|
||||
|
||||
/**
|
||||
* viewModel 返回的文字信息
|
||||
*/
|
||||
viewModel.liveDataToastMessage.observe(viewLifecycleOwner) {
|
||||
Toast.makeText(requireContext(), it, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
/**
|
||||
* 线长度
|
||||
*/
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mapController.measureLayerHandler.lineLenghtLiveData.observe(viewLifecycleOwner) {
|
||||
binding.taskLinkLength.text = "${it}米"
|
||||
}
|
||||
mapController.measureLayerHandler.tempLineDistanceLiveData.observe(viewLifecycleOwner) {
|
||||
(activity as MainActivity).setHomeCenterText(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
/**
|
||||
* 显示地图准星
|
||||
*/
|
||||
activity?.let {
|
||||
(activity as MainActivity).setHomeCenterVisibility(View.VISIBLE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
/**
|
||||
* 隐藏地图准星
|
||||
*/
|
||||
requireActivity().findNavController(R.id.main_activity_middle_fragment).navigateUp()
|
||||
activity?.let {
|
||||
(activity as MainActivity).setHomeCenterVisibility(View.GONE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v) {
|
||||
binding.taskLinkAddPoint -> {
|
||||
viewModel.addPoint()
|
||||
}
|
||||
binding.taskLinkKind -> {
|
||||
showMiddleFragment()
|
||||
viewModel.setAdapterList(1)
|
||||
}
|
||||
binding.taskLinkFunctionalLevel -> {
|
||||
showMiddleFragment()
|
||||
viewModel.setAdapterList(2)
|
||||
}
|
||||
binding.taskLinkDataLevel -> {
|
||||
showMiddleFragment()
|
||||
viewModel.setAdapterList(3)
|
||||
}
|
||||
binding.taskLinkBarCancel -> {
|
||||
onBackPressed()
|
||||
}
|
||||
binding.taskLinkBarSave -> {
|
||||
viewModel.saveData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示中间面板
|
||||
*/
|
||||
private fun showMiddleFragment() {
|
||||
activity?.run {
|
||||
val controller = findNavController(
|
||||
R.id.main_activity_middle_fragment
|
||||
)
|
||||
if (controller.currentDestination?.id == R.id.MiddleEmptyFragment)
|
||||
controller.navigate(R.id.TaskLinkMiddleFragment)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed(): Boolean {
|
||||
findNavController().navigateUp()
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklink
|
||||
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.AdapterElectronicEyeBinding
|
||||
import com.navinfo.omqs.databinding.AdapterTaskLinkInfoBinding
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
|
||||
data class TaskLinkInfoAdapterItem(
|
||||
val title: String,
|
||||
val type: String
|
||||
)
|
||||
|
||||
class TaskLinkMiddleAdapter(private var itemListener: ((Int, TaskLinkInfoAdapterItem) -> Unit?)? = null) :
|
||||
BaseRecyclerViewAdapter<TaskLinkInfoAdapterItem>() {
|
||||
|
||||
private var selectTitle = ""
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
||||
val viewBinding =
|
||||
AdapterTaskLinkInfoBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return BaseViewHolder(viewBinding)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
|
||||
val binding = holder.viewBinding as AdapterTaskLinkInfoBinding
|
||||
binding.title.text = data[position].title
|
||||
|
||||
if (selectTitle == binding.title.text) {
|
||||
binding.title.setBackgroundResource(R.drawable.shape_bg_blue_bg_4_radius)
|
||||
binding.title.setTextColor(holder.viewBinding.root.context.getColor(R.color.white))
|
||||
} else {
|
||||
binding.title.setBackgroundResource(R.drawable.shape_rect_white_2dp_bg)
|
||||
binding.title.setTextColor(holder.viewBinding.root.context.getColor(R.color.black))
|
||||
}
|
||||
binding.root.setOnClickListener {
|
||||
if (selectTitle != data[position].title) {
|
||||
selectTitle = data[position].title
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
itemListener?.invoke(position, data[position])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklink
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.FragmentTaskLinkBinding
|
||||
import com.navinfo.omqs.databinding.FragmentTaskLinkMiddleBinding
|
||||
import com.navinfo.omqs.ui.activity.map.MainActivity
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.fragment.evaluationresult.LeftAdapter
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TaskLinkMiddleFragment : BaseFragment(), View.OnClickListener {
|
||||
private var _binding: FragmentTaskLinkMiddleBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
@Inject
|
||||
lateinit var mapController: NIMapController
|
||||
|
||||
private val viewModel by shareViewModels<TaskLinkViewModel>("taskLink")
|
||||
|
||||
/**
|
||||
* 监听左侧栏的点击事件
|
||||
*/
|
||||
val adapter = TaskLinkMiddleAdapter { _, item ->
|
||||
viewModel.setAdapterSelectValve(item)
|
||||
if (activity != null) {
|
||||
requireActivity().findNavController(R.id.main_activity_middle_fragment).navigateUp()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentTaskLinkMiddleBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
binding.taskLinkMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext())
|
||||
binding.taskLinkMiddleRecyclerview.adapter = adapter
|
||||
viewModel.liveDataLeftAdapterList.observe(viewLifecycleOwner) {
|
||||
adapter.refreshData(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed(): Boolean {
|
||||
findNavController().navigateUp()
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklink
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.os.Build
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||
import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.omqs.Constant
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import io.realm.Realm
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.launch
|
||||
import org.bson.codecs.UuidCodec
|
||||
import org.bson.internal.UuidHelper
|
||||
import org.oscim.core.GeoPoint
|
||||
import java.util.UUID
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class TaskLinkViewModel @Inject constructor(
|
||||
val mapController: NIMapController,
|
||||
val sharedPreferences: SharedPreferences
|
||||
) : ViewModel(), SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
/**
|
||||
* 种别
|
||||
*/
|
||||
private val kindList = listOf<TaskLinkInfoAdapterItem>(
|
||||
TaskLinkInfoAdapterItem("高速道路", "1"),
|
||||
TaskLinkInfoAdapterItem("城市高速", "2"),
|
||||
TaskLinkInfoAdapterItem("国道", "3"),
|
||||
TaskLinkInfoAdapterItem("省道", "4"),
|
||||
TaskLinkInfoAdapterItem("县道", "6"),
|
||||
TaskLinkInfoAdapterItem("乡镇村道路", "7"),
|
||||
TaskLinkInfoAdapterItem("其他道路", "8"),
|
||||
TaskLinkInfoAdapterItem("非引导道路", "9"),
|
||||
TaskLinkInfoAdapterItem("步行道路", "10"),
|
||||
TaskLinkInfoAdapterItem("人渡", "11"),
|
||||
TaskLinkInfoAdapterItem("轮渡", "13"),
|
||||
TaskLinkInfoAdapterItem("自行车道路", "15"),
|
||||
)
|
||||
|
||||
/**
|
||||
* FunctionGrade 功能等级
|
||||
*/
|
||||
private val functionLevelList = listOf<TaskLinkInfoAdapterItem>(
|
||||
TaskLinkInfoAdapterItem("等级1", "1"),
|
||||
TaskLinkInfoAdapterItem("等级2", "2"),
|
||||
TaskLinkInfoAdapterItem("等级3", "3"),
|
||||
TaskLinkInfoAdapterItem("等级4", "4"),
|
||||
TaskLinkInfoAdapterItem("等级5", "5"),
|
||||
)
|
||||
|
||||
/**
|
||||
* 数据级别
|
||||
*/
|
||||
private val dataLevelList = listOf<TaskLinkInfoAdapterItem>(
|
||||
TaskLinkInfoAdapterItem("Pro lane model(有高精车道模型覆盖的高速和城高link)", "1"),
|
||||
TaskLinkInfoAdapterItem("Lite lane model(有高精车道模型覆盖的普通路link)", "2"),
|
||||
TaskLinkInfoAdapterItem("Standard road model(其他link)", "3"),
|
||||
)
|
||||
|
||||
/**
|
||||
* 处理结束关闭fragment`
|
||||
*/
|
||||
val liveDataFinish = MutableLiveData(false)
|
||||
|
||||
/**
|
||||
* 左侧面板展示内容
|
||||
*/
|
||||
val liveDataLeftAdapterList = MutableLiveData<List<TaskLinkInfoAdapterItem>>()
|
||||
|
||||
/**
|
||||
* 选择的种别
|
||||
*/
|
||||
val liveDataSelectKind = MutableLiveData<TaskLinkInfoAdapterItem?>()
|
||||
|
||||
/**
|
||||
* 选择的功能等级
|
||||
*/
|
||||
val liveDataSelectFunctionLevel = MutableLiveData<TaskLinkInfoAdapterItem?>()
|
||||
|
||||
/**
|
||||
* 选择的数据等级
|
||||
*/
|
||||
val liveDataSelectDataLevel = MutableLiveData<TaskLinkInfoAdapterItem?>()
|
||||
|
||||
/**
|
||||
* 要提示的错误信息
|
||||
*/
|
||||
val liveDataToastMessage = MutableLiveData<String>()
|
||||
|
||||
/**
|
||||
* 当前选中的任务
|
||||
*/
|
||||
val liveDataTaskBean = MutableLiveData<TaskBean?>()
|
||||
|
||||
/**
|
||||
* 当前正在选择哪个数据 1:种别 2:功能等级 3:数据等级
|
||||
*/
|
||||
private var selectType = 0
|
||||
|
||||
init {
|
||||
getTaskBean()
|
||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||
}
|
||||
|
||||
|
||||
private fun getTaskBean() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val res = realm.where(TaskBean::class.java).equalTo("id", id).findFirst()
|
||||
liveDataTaskBean.postValue(realm.copyFromRealm(res))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑点
|
||||
*/
|
||||
fun addPoint() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mapController.measureLayerHandler.drawLineOrPolygon(false)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置左侧面板要显示的内容
|
||||
*/
|
||||
fun setAdapterList(type: Int) {
|
||||
selectType = type
|
||||
when (type) {
|
||||
1 -> liveDataLeftAdapterList.value = kindList
|
||||
2 -> liveDataLeftAdapterList.value = functionLevelList
|
||||
3 -> liveDataLeftAdapterList.value = dataLevelList
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回左侧面板选择的内容
|
||||
*/
|
||||
fun setAdapterSelectValve(item: TaskLinkInfoAdapterItem) {
|
||||
when (selectType) {
|
||||
1 -> liveDataSelectKind.value = item
|
||||
2 -> liveDataSelectFunctionLevel.value = item
|
||||
3 -> liveDataSelectDataLevel.value = item
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
mapController.measureLayerHandler.clear()
|
||||
}
|
||||
sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
|
||||
super.onCleared()
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
fun saveData() {
|
||||
viewModelScope.launch(Dispatchers.Default) {
|
||||
if (liveDataTaskBean.value == null) {
|
||||
liveDataToastMessage.postValue("还没有选择任何一条任务!")
|
||||
return@launch
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
|
||||
if (mapController.measureLayerHandler.mPathLayer.points.size < 2) {
|
||||
liveDataToastMessage.postValue("道路点少于2个!")
|
||||
return@launch
|
||||
}
|
||||
}
|
||||
if (liveDataSelectKind.value == null) {
|
||||
liveDataToastMessage.postValue("请选择种别!")
|
||||
return@launch
|
||||
}
|
||||
if (liveDataSelectFunctionLevel.value == null) {
|
||||
liveDataToastMessage.postValue("请选择功能等级!")
|
||||
return@launch
|
||||
}
|
||||
if (liveDataSelectDataLevel.value == null) {
|
||||
liveDataToastMessage.postValue("请选择数据等级!")
|
||||
return@launch
|
||||
}
|
||||
val linkBean = HadLinkDvoBean(linkPid = UUID.randomUUID().toString())
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听shared变化
|
||||
*/
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
|
||||
if (key == Constant.SELECT_TASK_ID) {
|
||||
getTaskBean()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklist
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.DialogInterface
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
@@ -16,14 +15,10 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.FragmentTaskBinding
|
||||
import com.navinfo.omqs.databinding.FragmentTaskListBinding
|
||||
import com.navinfo.omqs.http.taskdownload.TaskDownloadManager
|
||||
import com.navinfo.omqs.http.taskupload.TaskUploadManager
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* 当前任务的道路列表
|
||||
@@ -42,7 +37,9 @@ class TaskFragment : BaseFragment() {
|
||||
TaskAdapter(object : TaskAdapterCallback {
|
||||
override fun itemOnClick(bean: HadLinkDvoBean) {
|
||||
if(bean!=null){
|
||||
viewModel.showCurrentLink(bean)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
viewModel.showCurrentLink(bean)
|
||||
}
|
||||
}else{
|
||||
Toast.makeText(context, "数据错误,无法显示!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklist
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Dialog
|
||||
import android.graphics.Color
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
@@ -10,7 +9,6 @@ import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||
import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.AdapterTaskListBinding
|
||||
@@ -19,15 +17,9 @@ import com.navinfo.omqs.http.taskupload.TaskUploadManager
|
||||
import com.navinfo.omqs.tools.FileManager
|
||||
import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus
|
||||
import com.navinfo.omqs.tools.FileManager.Companion.FileUploadStatus
|
||||
import com.navinfo.omqs.ui.dialog.FirstDialog
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
import com.navinfo.omqs.ui.widget.LeftDeleteView
|
||||
import io.realm.Realm
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
/**
|
||||
* 离线地图城市列表 RecyclerView 适配器
|
||||
@@ -51,8 +43,7 @@ class TaskListAdapter(
|
||||
|
||||
private var isShowDeleteView = false
|
||||
|
||||
private
|
||||
val downloadBtnClick = View.OnClickListener() {
|
||||
private val downloadBtnClick = View.OnClickListener() {
|
||||
if (it.tag != null) {
|
||||
val taskBean = data[it.tag as Int]
|
||||
if (taskBean.hadLinkDvoList.isNotEmpty()) {
|
||||
@@ -131,6 +122,7 @@ class TaskListAdapter(
|
||||
holder: BaseViewHolder,
|
||||
@SuppressLint("RecyclerView") position: Int
|
||||
) {
|
||||
Log.e("jingo", "TaskListAdapter onBindViewHolder $position ")
|
||||
val binding: AdapterTaskListBinding =
|
||||
holder.viewBinding as AdapterTaskListBinding
|
||||
val taskBean = data[position]
|
||||
@@ -212,7 +204,7 @@ class TaskListAdapter(
|
||||
* 重置item状态
|
||||
* @param point
|
||||
*/
|
||||
fun restoreItemView() {
|
||||
private fun restoreItemView() {
|
||||
leftDeleteView?.let {
|
||||
if (isShowDeleteView)
|
||||
it.resetDeleteStatus()
|
||||
@@ -366,6 +358,17 @@ class TaskListAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
fun initSelectTask(list: List<TaskBean>, id: Int?) {
|
||||
|
||||
for (i in list.indices) {
|
||||
if (list[i].id == id) {
|
||||
selectPosition = i
|
||||
break
|
||||
}
|
||||
}
|
||||
refreshData(list)
|
||||
}
|
||||
|
||||
companion object {
|
||||
object ItemClickStatus {
|
||||
const val ITEM_LAYOUT_CLICK = 0 //条目点击
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklist
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
@@ -9,26 +8,15 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||
import com.navinfo.collect.library.data.entity.TaskBean
|
||||
import com.navinfo.omqs.databinding.FragmentTaskListBinding
|
||||
import com.navinfo.omqs.http.taskdownload.TaskDownloadManager
|
||||
import com.navinfo.omqs.http.taskupload.TaskUploadManager
|
||||
import com.navinfo.omqs.tools.FileManager
|
||||
import com.navinfo.omqs.ui.dialog.FirstDialog
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import io.realm.Realm
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import javax.inject.Inject
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
@AndroidEntryPoint
|
||||
class TaskListFragment : BaseFragment() {
|
||||
|
||||
@@ -47,21 +35,29 @@ class TaskListFragment : BaseFragment() {
|
||||
|
||||
private val adapter: TaskListAdapter by lazy {
|
||||
TaskListAdapter(
|
||||
downloadManager, uploadManager,binding.taskListRecyclerview
|
||||
downloadManager, uploadManager, binding.taskListRecyclerview
|
||||
) { _, status, taskBean ->
|
||||
if(taskBean.hadLinkDvoList.isEmpty()){
|
||||
if (taskBean.hadLinkDvoList.isEmpty()) {
|
||||
Toast.makeText(context, "数据错误,无Link数据!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
if(status==TaskListAdapter.Companion.ItemClickStatus.ITEM_LAYOUT_CLICK){
|
||||
viewModel.setSelectTaskBean(taskBean as TaskBean)
|
||||
}else if(status==TaskListAdapter.Companion.ItemClickStatus.DELETE_LAYOUT_CLICK){
|
||||
context?.let { viewModel.removeTask(it, taskBean as TaskBean) }
|
||||
}else if(status==TaskListAdapter.Companion.ItemClickStatus.UPLOAD_LAYOUT_CLICK){
|
||||
showLoadingDialog("正在校验")
|
||||
Toast.makeText(context, "正在校验", Toast.LENGTH_SHORT).show()
|
||||
viewModel.checkUploadTask(binding.root.context,taskBean)
|
||||
} else {
|
||||
when (status) {
|
||||
TaskListAdapter.Companion.ItemClickStatus.ITEM_LAYOUT_CLICK -> {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
viewModel.setSelectTaskBean(taskBean)
|
||||
} else {
|
||||
}
|
||||
}
|
||||
TaskListAdapter.Companion.ItemClickStatus.DELETE_LAYOUT_CLICK -> {
|
||||
context?.let { viewModel.removeTask(it, taskBean) }
|
||||
}
|
||||
TaskListAdapter.Companion.ItemClickStatus.UPLOAD_LAYOUT_CLICK -> {
|
||||
showLoadingDialog("正在校验")
|
||||
Toast.makeText(context, "正在校验", Toast.LENGTH_SHORT).show()
|
||||
viewModel.checkUploadTask(binding.root.context, taskBean)
|
||||
}
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,13 +81,13 @@ class TaskListFragment : BaseFragment() {
|
||||
binding.taskListRecyclerview.layoutManager = layoutManager
|
||||
binding.taskListRecyclerview.adapter = adapter
|
||||
viewModel.liveDataTaskList.observe(viewLifecycleOwner) {
|
||||
adapter.refreshData(it)
|
||||
adapter.initSelectTask(it,viewModel.currentSelectTaskBean?.id)
|
||||
}
|
||||
|
||||
//监听并调用上传
|
||||
viewModel.liveDataTaskUpload.observe(viewLifecycleOwner){
|
||||
viewModel.liveDataTaskUpload.observe(viewLifecycleOwner) {
|
||||
for ((key, value) in it) {
|
||||
if(value){
|
||||
if (value) {
|
||||
adapter.uploadTask(key)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.navinfo.omqs.ui.fragment.tasklist
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.widget.Toast
|
||||
@@ -28,7 +29,9 @@ import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class TaskViewModel @Inject constructor(
|
||||
private val networkService: NetworkService, private val mapController: NIMapController
|
||||
private val networkService: NetworkService,
|
||||
private val mapController: NIMapController,
|
||||
private val sharedPreferences: SharedPreferences
|
||||
) : ViewModel() {
|
||||
|
||||
/**
|
||||
@@ -52,7 +55,7 @@ class TaskViewModel @Inject constructor(
|
||||
/**
|
||||
* 当前选中的任务
|
||||
*/
|
||||
private var currentSelectTaskBean: TaskBean? = null
|
||||
var currentSelectTaskBean: TaskBean? = null
|
||||
|
||||
/**
|
||||
* 任务列表查询协程
|
||||
@@ -61,6 +64,7 @@ class TaskViewModel @Inject constructor(
|
||||
|
||||
private var filterTaskJob: Job? = null
|
||||
|
||||
|
||||
/**
|
||||
* 下载任务列表
|
||||
*/
|
||||
@@ -130,6 +134,15 @@ class TaskViewModel @Inject constructor(
|
||||
FileManager.checkOMDBFileInfo(item)
|
||||
}
|
||||
liveDataTaskList.postValue(taskList)
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
if (id > -1) {
|
||||
for(item in taskList){
|
||||
if(item.id == id){
|
||||
currentSelectTaskBean = item
|
||||
liveDataTaskLinks.postValue(currentSelectTaskBean!!.hadLinkDvoList)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +151,9 @@ class TaskViewModel @Inject constructor(
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun setSelectTaskBean(taskBean: TaskBean) {
|
||||
|
||||
sharedPreferences.edit().putInt(Constant.SELECT_TASK_ID, taskBean.id).commit()
|
||||
|
||||
currentSelectTaskBean = taskBean
|
||||
|
||||
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
||||
|
||||
BIN
app/src/main/res/drawable-xxhdpi/icon_menu_note.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_menu_note.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-xxhdpi/icon_note.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_note.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -31,6 +31,28 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/main_activity_home_center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/home_map_center"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/main_activity_home_center_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/main_activity_home_center"
|
||||
app:layout_constraintRight_toLeftOf="@id/main_activity_home_center"
|
||||
app:layout_constraintTop_toTopOf="@id/main_activity_home_center" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/main_activity_camera2"
|
||||
android:layout_width="48dp"
|
||||
@@ -79,7 +101,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/top_right_drawer_btns_mr"
|
||||
app:constraint_referenced_ids="main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_calc_disance,main_activity_note,main_activity_menu"
|
||||
app:constraint_referenced_ids="main_activity_note,main_activity_task_line,main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_calc_disance,main_activity_menu"
|
||||
app:flow_horizontalGap="6dp"
|
||||
app:flow_wrapMode="aligned"
|
||||
app:layout_constraintRight_toLeftOf="@id/main_activity_right_fragment"
|
||||
@@ -90,7 +112,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"
|
||||
app:constraint_referenced_ids="main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_note,main_activity_calc_disance" />
|
||||
app:constraint_referenced_ids="main_activity_serach,main_activity_2d_3d,main_activity_camera,main_activity_trace,main_activity_note,main_activity_task_line,main_activity_calc_disance" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/main_activity_serach"
|
||||
@@ -126,6 +148,12 @@
|
||||
android:id="@+id/main_activity_note"
|
||||
style="@style/top_right_drawer_btns_style"
|
||||
android:onClick="@{()->mainActivity.onClickNewNote()}"
|
||||
android:src="@drawable/icon_menu_note" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/main_activity_task_line"
|
||||
style="@style/top_right_drawer_btns_style"
|
||||
android:onClick="@{()->mainActivity.onClickTaskLink()}"
|
||||
android:src="@drawable/icon_calc_disance" />
|
||||
|
||||
<ImageButton
|
||||
@@ -517,5 +545,6 @@
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
17
app/src/main/res/layout/adapter_task_link_info.xml
Normal file
17
app/src/main/res/layout/adapter_task_link_info.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
tools:context="com.navinfo.omqs.ui.fragment.tasklink.TaskLinkMiddleAdapter">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="5dp"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
@@ -39,7 +39,7 @@
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginRight="14dp"
|
||||
android:background="@drawable/ripple_fragment_save_botton_bg"
|
||||
android:background="@drawable/ripple_fragment_save_button_bg"
|
||||
android:src="@drawable/icon_save"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/right_fragment_w"
|
||||
@@ -8,13 +9,13 @@
|
||||
tools:context=".ui.fragment.note.NoteFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/note_bar"
|
||||
android:id="@+id/note_bar_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:drawableLeft="@drawable/selector_btn_back_xml"
|
||||
android:text="Mark"
|
||||
android:text="便签"
|
||||
android:textColor="@color/default_blue_text_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
@@ -26,24 +27,12 @@
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginRight="14dp"
|
||||
android:background="@drawable/ripple_fragment_save_botton_bg"
|
||||
android:background="@drawable/ripple_fragment_save_button_bg"
|
||||
android:src="@drawable/icon_save"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/note_bar_cancel"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/icon_fragment_close"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toLeftOf="@id/note_bar_save"
|
||||
app:layout_constraintTop_toTopOf="@id/note_bar_save" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/note_bar_delete"
|
||||
android:layout_width="40dp"
|
||||
|
||||
294
app/src/main/res/layout/fragment_task_link.xml
Normal file
294
app/src/main/res/layout/fragment_task_link.xml
Normal file
@@ -0,0 +1,294 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/right_fragment_w"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/shape_right_fragment_bg"
|
||||
tools:context=".ui.fragment.tasklink.TaskLinkFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_bar_cancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:drawableLeft="@drawable/selector_btn_back_xml"
|
||||
android:text="测评Link"
|
||||
android:textColor="@color/default_blue_text_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/task_link_bar_save"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginRight="14dp"
|
||||
android:background="@drawable/ripple_fragment_save_button_bg"
|
||||
android:src="@drawable/icon_save"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/task_link_bar_delete"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/icon_delete"
|
||||
app:layout_constraintBottom_toBottomOf="@id/task_link_bar_save"
|
||||
app:layout_constraintRight_toLeftOf="@id/task_link_bar_save"
|
||||
app:layout_constraintTop_toTopOf="@id/task_link_bar_save" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:paddingLeft="11dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingRight="9dp"
|
||||
android:paddingBottom="6dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/note_camera"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/task_link_bar_save">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:text="当前任务" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_task_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sketch_back"
|
||||
style="@style/sketch_operation_style"
|
||||
android:src="@drawable/sketch_back" />
|
||||
|
||||
<View
|
||||
style="@style/link_gray_style"
|
||||
android:layout_margin="2dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sketch_forward"
|
||||
style="@style/sketch_operation_style"
|
||||
android:src="@drawable/sketch_forward" />
|
||||
|
||||
<View
|
||||
style="@style/link_gray_style"
|
||||
android:layout_margin="2dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sketch_clear"
|
||||
style="@style/sketch_operation_style"
|
||||
android:text="重绘" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/task_link_add_point"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="5dp"
|
||||
android:text="打点" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:text="Link长度" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_length"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0米" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:text="种别" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_kind"
|
||||
style="@style/evaluation_fragment_text_style"
|
||||
android:text="" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:text="功能等级" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_functional_level"
|
||||
style="@style/evaluation_fragment_text_style"
|
||||
android:text="" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:text="数据级别" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_link_data_level"
|
||||
style="@style/evaluation_fragment_text_style"
|
||||
android:text="" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="@style/evaluation_fragment_title_text_style"
|
||||
android:layout_width="60dp"
|
||||
android:layout_gravity="top"
|
||||
android:text="备注" />
|
||||
|
||||
<com.navinfo.omqs.ui.widget.MyEditeText
|
||||
android:id="@+id/note_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_rect_white_2dp_bg"
|
||||
android:elevation="2dp"
|
||||
android:gravity="start"
|
||||
android:hint="请输入备注信息"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="3"
|
||||
android:maxLines="3"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:text="多媒体"
|
||||
android:textColor="@color/default_blue_text_color"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<!--
|
||||
这种效果也好实现,主要的关键点是 Android:clipChildren=”false” 这个属性。
|
||||
1.配置ViewPager 和其父布局的 android:clipChildren属性为”false”.
|
||||
(android:clipChildren表示是否限制子View在其范围内,默认为true. 代码设置setClipChildren(false))
|
||||
因为如果clipChildren属性设置为true,就表明我们要将children给clip掉,就是说对于子元素来说,超出当前view的部分都会被切掉,那我们在这里把它设置成false,就表明超出view的部分,不要切掉,依然显示。
|
||||
注意:setClipChildren(false)在3.0以上版本中,开启了硬件加速后将不能正常工作,所以需要将其设置为软件加速。设置软硬件加速使用 setLayerType(View.LAYER_TYPE_SOFTWARE, null); 也可以在布局文件中添加 android:layerType=”software”
|
||||
|
||||
-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/note_picture_left"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:background="@drawable/icon_picture_left"
|
||||
android:padding="5dp" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/note_picture_viewpager"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:clipChildren="false" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/note_picture_right"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:background="@drawable/icon_picture_right"
|
||||
android:padding="5dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/note_voice_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/note_camera"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/baseline_camera_alt_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/note_voice" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/note_voice"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/baseline_keyboard_voice_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintLeft_toRightOf="@id/note_camera"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
14
app/src/main/res/layout/fragment_task_link_middle.xml
Normal file
14
app/src/main/res/layout/fragment_task_link_middle.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/task_link_middle_recyclerview"
|
||||
android:layout_width="@dimen/fragment_problem_link_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="55dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:background="@drawable/shape_middle_fragment_bg" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -25,5 +25,10 @@
|
||||
android:name="com.navinfo.omqs.ui.fragment.note.CanvasFragment"
|
||||
android:label="绘图页面"
|
||||
tools:layout="@layout/fragment_canvas"></fragment>
|
||||
<fragment
|
||||
android:id="@+id/TaskLinkMiddleFragment"
|
||||
android:name="com.navinfo.omqs.ui.fragment.tasklink.TaskLinkMiddleFragment"
|
||||
android:label="新增评测Link属性选择页面"
|
||||
tools:layout="@layout/fragment_task_link_middle"></fragment>
|
||||
|
||||
</navigation>
|
||||
@@ -28,13 +28,19 @@
|
||||
android:name="com.navinfo.omqs.ui.fragment.evaluationresult.EvaluationResultFragment"
|
||||
android:label="评测页面"
|
||||
tools:layout="@layout/fragment_evaluation_result">
|
||||
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/NoteFragment"
|
||||
android:name="com.navinfo.omqs.ui.fragment.note.NoteFragment"
|
||||
android:label="便签页面"
|
||||
tools:layout="@layout/fragment_note">
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/TaskLinkFragment"
|
||||
android:name="com.navinfo.omqs.ui.fragment.tasklink.TaskLinkFragment"
|
||||
android:label="测评Link"
|
||||
tools:layout="@layout/fragment_task_link">
|
||||
</fragment>
|
||||
</navigation>
|
||||
Reference in New Issue
Block a user