增加相机自动重新连接功能
This commit is contained in:
@@ -336,6 +336,7 @@ class MainActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IndoorToolsResp.QR_CODE_STATUS_UPDATE_VIDEO_INFO_FAILURE -> {
|
IndoorToolsResp.QR_CODE_STATUS_UPDATE_VIDEO_INFO_FAILURE -> {
|
||||||
if (viewModel.indoorToolsCommand == IndoorToolsCommand.SELECT_POINT) {
|
if (viewModel.indoorToolsCommand == IndoorToolsCommand.SELECT_POINT) {
|
||||||
selectPointFinish(false)
|
selectPointFinish(false)
|
||||||
@@ -350,9 +351,11 @@ class MainActivity : BaseActivity() {
|
|||||||
IndoorToolsCommand.PLAY -> {
|
IndoorToolsCommand.PLAY -> {
|
||||||
setPlayStatus()
|
setPlayStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
IndoorToolsCommand.INDEXING -> {
|
IndoorToolsCommand.INDEXING -> {
|
||||||
pausePlayTrace()
|
pausePlayTrace()
|
||||||
}
|
}
|
||||||
|
|
||||||
IndoorToolsCommand.SELECT_POINT -> {
|
IndoorToolsCommand.SELECT_POINT -> {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -389,9 +392,14 @@ class MainActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//自动连接相机
|
||||||
|
if (viewModel.isAutoCamera()) {
|
||||||
|
viewModel.autoCamera()
|
||||||
|
} else {
|
||||||
supportFragmentManager.beginTransaction()
|
supportFragmentManager.beginTransaction()
|
||||||
.add(R.id.console_fragment_layout, ConsoleFragment()).commit()
|
.add(R.id.console_fragment_layout, ConsoleFragment()).commit()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//根据输入的经纬度跳转坐标
|
//根据输入的经纬度跳转坐标
|
||||||
fun jumpPosition() {
|
fun jumpPosition() {
|
||||||
@@ -638,7 +646,8 @@ class MainActivity : BaseActivity() {
|
|||||||
@RequiresApi(Build.VERSION_CODES.N)
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
fun rewindTraceOnclick() {
|
fun rewindTraceOnclick() {
|
||||||
pausePlayTrace()
|
pausePlayTrace()
|
||||||
val item = mapController.markerHandle.getNILocation(viewModel.getCurrentNiLocationIndex() - 1)
|
val item =
|
||||||
|
mapController.markerHandle.getNILocation(viewModel.getCurrentNiLocationIndex() - 1)
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
viewModel.setCurrentIndexLoction(viewModel.getCurrentNiLocationIndex() - 1)
|
viewModel.setCurrentIndexLoction(viewModel.getCurrentNiLocationIndex() - 1)
|
||||||
viewModel.showMarker(this, (item as MarkerItem).uid as NiLocation)
|
viewModel.showMarker(this, (item as MarkerItem).uid as NiLocation)
|
||||||
@@ -705,7 +714,8 @@ class MainActivity : BaseActivity() {
|
|||||||
@RequiresApi(Build.VERSION_CODES.N)
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
fun nextTraceOnclick() {
|
fun nextTraceOnclick() {
|
||||||
pausePlayTrace()
|
pausePlayTrace()
|
||||||
val item = mapController.markerHandle.getNILocation(viewModel.getCurrentNiLocationIndex() + 1)
|
val item =
|
||||||
|
mapController.markerHandle.getNILocation(viewModel.getCurrentNiLocationIndex() + 1)
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
viewModel.setCurrentIndexLoction(viewModel.getCurrentNiLocationIndex() + 1)
|
viewModel.setCurrentIndexLoction(viewModel.getCurrentNiLocationIndex() + 1)
|
||||||
viewModel.showMarker(this, (item as MarkerItem).uid as NiLocation)
|
viewModel.showMarker(this, (item as MarkerItem).uid as NiLocation)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import androidx.navigation.findNavController
|
|||||||
import com.blankj.utilcode.util.ToastUtils
|
import com.blankj.utilcode.util.ToastUtils
|
||||||
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
||||||
import com.navinfo.collect.library.data.entity.*
|
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.NIMapController
|
||||||
import com.navinfo.collect.library.map.handler.OnQsRecordItemClickListener
|
import com.navinfo.collect.library.map.handler.OnQsRecordItemClickListener
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
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.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.http.NetResult
|
import com.navinfo.omqs.http.NetResult
|
||||||
import com.navinfo.omqs.http.NetworkService
|
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.dialog.CommonDialog
|
||||||
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
||||||
import com.navinfo.omqs.ui.other.BaseToast
|
import com.navinfo.omqs.ui.other.BaseToast
|
||||||
@@ -166,6 +166,8 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
var indoorToolsCommand: IndoorToolsCommand? = null
|
var indoorToolsCommand: IndoorToolsCommand? = null
|
||||||
|
|
||||||
|
private var shareUtil: ShareUtil? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||||
when (e) {
|
when (e) {
|
||||||
@@ -190,6 +192,8 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
shareUtil = ShareUtil(mapController.mMapView.context, 1)
|
||||||
|
|
||||||
initLocation()
|
initLocation()
|
||||||
|
|
||||||
//处理地图点击操作
|
//处理地图点击操作
|
||||||
@@ -280,7 +284,6 @@ class MainViewModel @Inject constructor(
|
|||||||
@RequiresApi(Build.VERSION_CODES.N)
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
private fun initLocation() {
|
private fun initLocation() {
|
||||||
|
|
||||||
val shareUtil = ShareUtil(mapController.mMapView.context, 1)
|
|
||||||
//用于定位点存储到数据库
|
//用于定位点存储到数据库
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
//用于定位点捕捉道路
|
//用于定位点捕捉道路
|
||||||
@@ -313,7 +316,7 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
val id = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||||
location.taskId = id.toString()
|
location.taskId = id.toString()
|
||||||
if (shareUtil.connectstate) {
|
if (shareUtil?.connectstate == true) {
|
||||||
location.media = 1
|
location.media = 1
|
||||||
}
|
}
|
||||||
var disance = 0.0
|
var disance = 0.0
|
||||||
@@ -504,17 +507,8 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
Log.e("qj", LibVlcUtil.hasCompatibleCPU(context).toString())
|
Log.e("qj", LibVlcUtil.hasCompatibleCPU(context).toString())
|
||||||
|
|
||||||
if (mCameraDialog == null) {
|
initCameraDialog(context)
|
||||||
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)
|
|
||||||
}
|
|
||||||
mCameraDialog!!.openCamear(mCameraDialog!!.getmShareUtil().continusTakePhotoState)
|
mCameraDialog!!.openCamear(mCameraDialog!!.getmShareUtil().continusTakePhotoState)
|
||||||
mCameraDialog!!.show()
|
mCameraDialog!!.show()
|
||||||
mCameraDialog!!.setOnDismissListener(DialogInterface.OnDismissListener {
|
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) {
|
fun startSoundMetter(context: Context, v: View) {
|
||||||
|
|
||||||
//语音识别动画
|
//语音识别动画
|
||||||
@@ -901,4 +909,19 @@ class MainViewModel @Inject constructor(
|
|||||||
).show()
|
).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) {
|
if (connectstate) {
|
||||||
|
|
||||||
mOneBtConnect.setPressed(true);
|
mOneBtConnect.setPressed(true);
|
||||||
|
|
||||||
mOneBtConnect.setBackgroundResource(R.drawable.shape_btn_red_disconnect_bg);
|
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) {
|
if (hostBean != null) {
|
||||||
SensorParams params = new SensorParams();
|
SensorParams params = new SensorParams();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user