增加相机自动重新连接功能
This commit is contained in:
parent
45de9982fc
commit
58f5329a75
@ -247,7 +247,7 @@ class MainActivity : BaseActivity() {
|
||||
userid = Constant.USER_ID,
|
||||
time = "${it.time}:000"
|
||||
)
|
||||
viewModel.sendServerCommand(this, traceVideoBean,IndoorToolsCommand.SELECT_POINT)
|
||||
viewModel.sendServerCommand(this, traceVideoBean, IndoorToolsCommand.SELECT_POINT)
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,17 +327,18 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.liveIndoorToolsResp.observe(this){
|
||||
when(it){
|
||||
IndoorToolsResp.QR_CODE_STATUS_UPDATE_VIDEO_INFO_SUCCESS->{
|
||||
viewModel.liveIndoorToolsResp.observe(this) {
|
||||
when (it) {
|
||||
IndoorToolsResp.QR_CODE_STATUS_UPDATE_VIDEO_INFO_SUCCESS -> {
|
||||
|
||||
if(viewModel.indoorToolsCommand==IndoorToolsCommand.SELECT_POINT){
|
||||
if (viewModel.indoorToolsCommand == IndoorToolsCommand.SELECT_POINT) {
|
||||
selectPointFinish(true)
|
||||
}
|
||||
|
||||
}
|
||||
IndoorToolsResp.QR_CODE_STATUS_UPDATE_VIDEO_INFO_FAILURE->{
|
||||
if(viewModel.indoorToolsCommand==IndoorToolsCommand.SELECT_POINT){
|
||||
|
||||
IndoorToolsResp.QR_CODE_STATUS_UPDATE_VIDEO_INFO_FAILURE -> {
|
||||
if (viewModel.indoorToolsCommand == IndoorToolsCommand.SELECT_POINT) {
|
||||
selectPointFinish(false)
|
||||
}
|
||||
}
|
||||
@ -350,9 +351,11 @@ class MainActivity : BaseActivity() {
|
||||
IndoorToolsCommand.PLAY -> {
|
||||
setPlayStatus()
|
||||
}
|
||||
|
||||
IndoorToolsCommand.INDEXING -> {
|
||||
pausePlayTrace()
|
||||
}
|
||||
|
||||
IndoorToolsCommand.SELECT_POINT -> {
|
||||
|
||||
}
|
||||
@ -389,8 +392,13 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
supportFragmentManager.beginTransaction()
|
||||
.add(R.id.console_fragment_layout, ConsoleFragment()).commit()
|
||||
//自动连接相机
|
||||
if (viewModel.isAutoCamera()) {
|
||||
viewModel.autoCamera()
|
||||
} else {
|
||||
supportFragmentManager.beginTransaction()
|
||||
.add(R.id.console_fragment_layout, ConsoleFragment()).commit()
|
||||
}
|
||||
}
|
||||
|
||||
//根据输入的经纬度跳转坐标
|
||||
@ -638,7 +646,8 @@ class MainActivity : BaseActivity() {
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun rewindTraceOnclick() {
|
||||
pausePlayTrace()
|
||||
val item = mapController.markerHandle.getNILocation(viewModel.getCurrentNiLocationIndex() - 1)
|
||||
val item =
|
||||
mapController.markerHandle.getNILocation(viewModel.getCurrentNiLocationIndex() - 1)
|
||||
if (item != null) {
|
||||
viewModel.setCurrentIndexLoction(viewModel.getCurrentNiLocationIndex() - 1)
|
||||
viewModel.showMarker(this, (item as MarkerItem).uid as NiLocation)
|
||||
@ -647,7 +656,7 @@ class MainActivity : BaseActivity() {
|
||||
userid = Constant.USER_ID,
|
||||
time = "${(item.uid as NiLocation).time}:000"
|
||||
)
|
||||
viewModel.sendServerCommand(this, traceVideoBean,IndoorToolsCommand.REWIND)
|
||||
viewModel.sendServerCommand(this, traceVideoBean, IndoorToolsCommand.REWIND)
|
||||
} else {
|
||||
dealNoData()
|
||||
}
|
||||
@ -679,7 +688,7 @@ class MainActivity : BaseActivity() {
|
||||
viewModel.setSelectTrace(false)
|
||||
binding.mainActivityTraceSnapshotPoints.isSelected = viewModel.isSelectTrace()
|
||||
val traceVideoBean = TraceVideoBean(command = "playVideo?", userid = Constant.USER_ID)
|
||||
viewModel.sendServerCommand(this, traceVideoBean,IndoorToolsCommand.PLAY)
|
||||
viewModel.sendServerCommand(this, traceVideoBean, IndoorToolsCommand.PLAY)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -696,7 +705,7 @@ class MainActivity : BaseActivity() {
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun pauseVideo() {
|
||||
val traceVideoBean = TraceVideoBean(command = "pauseVideo?", userid = Constant.USER_ID)
|
||||
viewModel.sendServerCommand(this, traceVideoBean,IndoorToolsCommand.STOP)
|
||||
viewModel.sendServerCommand(this, traceVideoBean, IndoorToolsCommand.STOP)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -705,16 +714,17 @@ class MainActivity : BaseActivity() {
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun nextTraceOnclick() {
|
||||
pausePlayTrace()
|
||||
val item = mapController.markerHandle.getNILocation(viewModel.getCurrentNiLocationIndex() + 1)
|
||||
val item =
|
||||
mapController.markerHandle.getNILocation(viewModel.getCurrentNiLocationIndex() + 1)
|
||||
if (item != null) {
|
||||
viewModel.setCurrentIndexLoction(viewModel.getCurrentNiLocationIndex()+1)
|
||||
viewModel.setCurrentIndexLoction(viewModel.getCurrentNiLocationIndex() + 1)
|
||||
viewModel.showMarker(this, (item as MarkerItem).uid as NiLocation)
|
||||
val traceVideoBean = TraceVideoBean(
|
||||
command = "videotime?",
|
||||
userid = Constant.USER_ID,
|
||||
time = "${(item.uid as NiLocation).time}:000"
|
||||
)
|
||||
viewModel.sendServerCommand(this, traceVideoBean,IndoorToolsCommand.NEXT)
|
||||
viewModel.sendServerCommand(this, traceVideoBean, IndoorToolsCommand.NEXT)
|
||||
} else {
|
||||
dealNoData()
|
||||
}
|
||||
@ -755,11 +765,11 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun setViewEnable(value: Boolean){
|
||||
binding.mainActivitySnapshotRewind.isEnabled = value
|
||||
binding.mainActivitySnapshotNext.isEnabled = value
|
||||
binding.mainActivitySnapshotPause.isEnabled = value
|
||||
binding.mainActivitySnapshotFinish.isEnabled = value
|
||||
private fun setViewEnable(value: Boolean) {
|
||||
binding.mainActivitySnapshotRewind.isEnabled = value
|
||||
binding.mainActivitySnapshotNext.isEnabled = value
|
||||
binding.mainActivitySnapshotPause.isEnabled = value
|
||||
binding.mainActivitySnapshotFinish.isEnabled = value
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@ import androidx.navigation.findNavController
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
||||
import com.navinfo.collect.library.data.entity.*
|
||||
import com.navinfo.collect.library.garminvirbxe.HostBean
|
||||
import com.navinfo.collect.library.map.NIMapController
|
||||
import com.navinfo.collect.library.map.handler.OnQsRecordItemClickListener
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
@ -37,7 +38,6 @@ import com.navinfo.omqs.bean.TraceVideoBean
|
||||
import com.navinfo.omqs.db.RealmOperateHelper
|
||||
import com.navinfo.omqs.http.NetResult
|
||||
import com.navinfo.omqs.http.NetworkService
|
||||
import com.navinfo.omqs.ui.activity.scan.QrCodeStatus
|
||||
import com.navinfo.omqs.ui.dialog.CommonDialog
|
||||
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
||||
import com.navinfo.omqs.ui.other.BaseToast
|
||||
@ -166,6 +166,8 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
var indoorToolsCommand: IndoorToolsCommand? = null
|
||||
|
||||
private var shareUtil: ShareUtil? = null
|
||||
|
||||
init {
|
||||
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||
when (e) {
|
||||
@ -190,6 +192,8 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
})
|
||||
|
||||
shareUtil = ShareUtil(mapController.mMapView.context, 1)
|
||||
|
||||
initLocation()
|
||||
|
||||
//处理地图点击操作
|
||||
@ -280,7 +284,6 @@ class MainViewModel @Inject constructor(
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
private fun initLocation() {
|
||||
|
||||
val shareUtil = ShareUtil(mapController.mMapView.context, 1)
|
||||
//用于定位点存储到数据库
|
||||
viewModelScope.launch(Dispatchers.Default) {
|
||||
//用于定位点捕捉道路
|
||||
@ -313,7 +316,7 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||
location.taskId = id.toString()
|
||||
if (shareUtil.connectstate) {
|
||||
if (shareUtil?.connectstate == true) {
|
||||
location.media = 1
|
||||
}
|
||||
var disance = 0.0
|
||||
@ -504,17 +507,8 @@ class MainViewModel @Inject constructor(
|
||||
|
||||
Log.e("qj", LibVlcUtil.hasCompatibleCPU(context).toString())
|
||||
|
||||
if (mCameraDialog == null) {
|
||||
mCameraDialog = CommonDialog(
|
||||
context,
|
||||
context.resources.getDimension(R.dimen.head_img_width)
|
||||
.toInt() * 3 + context.resources.getDimension(R.dimen.ten)
|
||||
.toInt() + context.resources.getDimension(R.dimen.twenty_four).toInt(),
|
||||
context.resources.getDimension(R.dimen.head_img_width).toInt() + 10,
|
||||
1
|
||||
)
|
||||
mCameraDialog!!.setCancelable(true)
|
||||
}
|
||||
initCameraDialog(context)
|
||||
|
||||
mCameraDialog!!.openCamear(mCameraDialog!!.getmShareUtil().continusTakePhotoState)
|
||||
mCameraDialog!!.show()
|
||||
mCameraDialog!!.setOnDismissListener(DialogInterface.OnDismissListener {
|
||||
@ -539,6 +533,20 @@ class MainViewModel @Inject constructor(
|
||||
})
|
||||
}
|
||||
|
||||
private fun initCameraDialog(context:Context){
|
||||
if (mCameraDialog == null) {
|
||||
mCameraDialog = CommonDialog(
|
||||
context,
|
||||
context.resources.getDimension(R.dimen.head_img_width)
|
||||
.toInt() * 3 + context.resources.getDimension(R.dimen.ten)
|
||||
.toInt() + context.resources.getDimension(R.dimen.twenty_four).toInt(),
|
||||
context.resources.getDimension(R.dimen.head_img_width).toInt() + 10,
|
||||
1
|
||||
)
|
||||
mCameraDialog!!.setCancelable(true)
|
||||
}
|
||||
}
|
||||
|
||||
fun startSoundMetter(context: Context, v: View) {
|
||||
|
||||
//语音识别动画
|
||||
@ -901,4 +909,19 @@ class MainViewModel @Inject constructor(
|
||||
).show()
|
||||
}
|
||||
}
|
||||
|
||||
fun isAutoCamera():Boolean{
|
||||
|
||||
return shareUtil?.connectstate == true
|
||||
}
|
||||
|
||||
fun autoCamera(){
|
||||
if (shareUtil?.connectstate == true) {
|
||||
val hostBean1 = HostBean()
|
||||
hostBean1.ipAddress = shareUtil!!.takeCameraIP
|
||||
hostBean1.hardwareAddress = shareUtil!!.takeCameraMac
|
||||
onClickCameraButton(mapController.mMapView.context)
|
||||
mCameraDialog?.connection(hostBean1)
|
||||
}
|
||||
}
|
||||
}
|
@ -676,6 +676,7 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
|
||||
|
||||
//当前为连接时启动已有的状态
|
||||
if (connectstate) {
|
||||
|
||||
mOneBtConnect.setPressed(true);
|
||||
|
||||
mOneBtConnect.setBackgroundResource(R.drawable.shape_btn_red_disconnect_bg);
|
||||
@ -1525,7 +1526,7 @@ public class CommonDialog extends Dialog implements SurfaceHolder.Callback, IVid
|
||||
}
|
||||
|
||||
//连接
|
||||
private void connection(HostBean hostBean) {
|
||||
public void connection(HostBean hostBean) {
|
||||
if (hostBean != null) {
|
||||
SensorParams params = new SensorParams();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user