|
@@ -58,6 +58,7 @@ import com.arashivision.sdkcamera.camera.InstaCameraManager
|
|
|
import com.arashivision.sdkcamera.camera.callback.ICameraChangedCallback
|
|
|
import com.arashivision.sdkcamera.camera.callback.ICaptureStatusListener
|
|
|
import com.bumptech.glide.Glide
|
|
|
+import com.framework.mvvm.model.db.entity.StrInfosforEquip
|
|
|
import com.framework.mvvm.mv.AdmViewModel
|
|
|
import com.google.gson.Gson
|
|
|
import com.lzy.okgo.OkGo
|
|
@@ -67,6 +68,7 @@ import com.sybotan.android.demo.R
|
|
|
import com.sybotan.android.demo.activities.poc.RelationActivity
|
|
|
import com.sybotan.android.demo.adapter.PictureAdapter
|
|
|
import com.sybotan.android.demo.adapter.PipeAdapter
|
|
|
+import com.sybotan.android.demo.bean.ReLoactionEventBus
|
|
|
import com.sybotan.android.demo.bean.result.*
|
|
|
import com.sybotan.android.demo.graphy.GraphyHelper
|
|
|
import com.sybotan.android.demo.retrofit.BaseViewModelInterface
|
|
@@ -506,6 +508,7 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
}
|
|
|
LocalDataOperation.DEAL_DATA_ERROR -> {
|
|
|
ToastUtils.showMyToast("图片上传失败")
|
|
|
+ pictureAdapter.notifyDataSetChanged()
|
|
|
}
|
|
|
else -> {
|
|
|
}
|
|
@@ -1035,6 +1038,10 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
|
|
|
/** 设置空间的任务状态完成 */
|
|
|
modelSubmit.setOnClickListener {
|
|
|
+ if (scene.choseSpace!!.data.jobStatus.equals("02")) {
|
|
|
+ ToastUtils.showMyToast("空间内还有未解决的问题")
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
graphyVM.setJob(scene.choseSpace, "03")
|
|
|
}
|
|
|
|
|
@@ -1116,6 +1123,65 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
equipLl.visibility = View.VISIBLE
|
|
|
equipEdit.setText("")
|
|
|
equipRg.clearCheck()
|
|
|
+ equipNext.setText("下一步")
|
|
|
+ /** 取消添加设备 */
|
|
|
+ equipCancel.setOnClickListener {
|
|
|
+ drawLl.visibility = View.VISIBLE
|
|
|
+ equipLl.visibility = View.GONE
|
|
|
+ scene.eqItem?.let { it1 -> scene.removeItem(it1) }
|
|
|
+ scene.type = "normal"
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 添加设备下一步 */
|
|
|
+ equipNext.setOnClickListener {
|
|
|
+ if (TextUtils.isEmpty(equipLocation.text.toString())) {
|
|
|
+ ToastUtils.showMyToast("请扎点")
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
+ if (floor.isChecked) {
|
|
|
+ equipEdit.setText("0")
|
|
|
+ }
|
|
|
+ if (!air.isChecked && !roof.isChecked && !floor.isChecked && !wall.isChecked) {
|
|
|
+ ToastUtils.showMyToast("请选择设备位置")
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
+ if ((air.isChecked || wall.isChecked) && TextUtils.isEmpty(equipEdit.text.toString())) {
|
|
|
+ ToastUtils.showMyToast("请输入高度")
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
+ val intent = Intent(this, EquipDetailActivity::class.java)
|
|
|
+ val bundle = Bundle()
|
|
|
+ val positon = Position()
|
|
|
+ positon.x = scene.point.mX.toString()
|
|
|
+ positon.y = scene.point.mY.toString()
|
|
|
+ val z = Z()
|
|
|
+ z.offset = equipEdit.text.toString()
|
|
|
+ if (roof.isChecked) {
|
|
|
+ z.offset = "0"
|
|
|
+ }
|
|
|
+ when (equipRg.checkedRadioButtonId) {
|
|
|
+ R.id.roof -> {
|
|
|
+ z.region = "roof"
|
|
|
+ }
|
|
|
+ R.id.floor -> {
|
|
|
+ z.region = "floor"
|
|
|
+ }
|
|
|
+ R.id.wall -> {
|
|
|
+ z.region = "wall"
|
|
|
+ }
|
|
|
+ R.id.air -> {
|
|
|
+ z.region = "air"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ positon.z = z
|
|
|
+ bundle.putString("spaceId", scene.choseSpace!!.data.id)
|
|
|
+ bundle.putSerializable("position", positon)
|
|
|
+ bundle.putString("buildingId", buildingId)
|
|
|
+ bundle.putString("floorId", floorId)
|
|
|
+ bundle.putString("projectId", projectId)
|
|
|
+ intent.putExtra("equip", bundle)
|
|
|
+ startActivityForResult(intent, REQUEST_CODE_EQUIP)
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1128,54 +1194,33 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
piprRv.layoutManager = GridLayoutManager(this, 3, LinearLayoutManager.HORIZONTAL, false)
|
|
|
graphyVM.pipeList()
|
|
|
}
|
|
|
-
|
|
|
- /** 取消添加设备 */
|
|
|
- equipCancel.setOnClickListener {
|
|
|
- drawLl.visibility = View.VISIBLE
|
|
|
- equipLl.visibility = View.GONE
|
|
|
- scene.eqItem?.let { it1 -> scene.removeItem(it1) }
|
|
|
- scene.type = "normal"
|
|
|
+ roof.setOnCheckedChangeListener { buttonView, isChecked ->
|
|
|
+ if (isChecked) {
|
|
|
+ equipEdit.setText("")
|
|
|
+ equipEdit.isEnabled = false
|
|
|
+ equipEdit.alpha = 0.5f
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- /** 添加设备下一步 */
|
|
|
- equipNext.setOnClickListener {
|
|
|
- if (TextUtils.isEmpty(equipLocation.text.toString())) {
|
|
|
- ToastUtils.showMyToast("请扎点")
|
|
|
- return@setOnClickListener
|
|
|
+ wall.setOnCheckedChangeListener { buttonView, isChecked ->
|
|
|
+ if (isChecked) {
|
|
|
+ equipEdit.setText("")
|
|
|
+ equipEdit.isEnabled = true
|
|
|
+ equipEdit.alpha = 1f
|
|
|
}
|
|
|
- if (TextUtils.isEmpty(equipEdit.text.toString())) {
|
|
|
- ToastUtils.showMyToast("请输入高度")
|
|
|
- return@setOnClickListener
|
|
|
+ }
|
|
|
+ air.setOnCheckedChangeListener { buttonView, isChecked ->
|
|
|
+ if (isChecked) {
|
|
|
+ equipEdit.setText("")
|
|
|
+ equipEdit.isEnabled = true
|
|
|
+ equipEdit.alpha = 1f
|
|
|
}
|
|
|
- val intent = Intent(this, EquipDetailActivity::class.java)
|
|
|
- val bundle = Bundle()
|
|
|
- val positon = Position()
|
|
|
- positon.x = scene.point.mX.toString()
|
|
|
- positon.y = scene.point.mY.toString()
|
|
|
- val z = Z()
|
|
|
- z.offset = equipEdit.text.toString()
|
|
|
- when (equipRg.checkedRadioButtonId) {
|
|
|
- R.id.roof -> {
|
|
|
- z.region = "roof"
|
|
|
- }
|
|
|
- R.id.floor -> {
|
|
|
- z.region = "floor"
|
|
|
- }
|
|
|
- R.id.wall -> {
|
|
|
- z.region = "wall"
|
|
|
- }
|
|
|
- R.id.air -> {
|
|
|
- z.region = "air"
|
|
|
- }
|
|
|
+ }
|
|
|
+ floor.setOnCheckedChangeListener { buttonView, isChecked ->
|
|
|
+ if (isChecked) {
|
|
|
+ equipEdit.setText("0")
|
|
|
+ equipEdit.isEnabled = true
|
|
|
+ equipEdit.alpha = 1f
|
|
|
}
|
|
|
- positon.z = z
|
|
|
- bundle.putString("spaceId", scene.choseSpace!!.data.id)
|
|
|
- bundle.putSerializable("position", positon)
|
|
|
- bundle.putString("buildingId", buildingId)
|
|
|
- bundle.putString("floorId", floorId)
|
|
|
- bundle.putString("projectId", projectId)
|
|
|
- intent.putExtra("equip", bundle)
|
|
|
- startActivityForResult(intent, REQUEST_CODE_EQUIP)
|
|
|
}
|
|
|
|
|
|
/** 服务 */
|
|
@@ -1501,6 +1546,22 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
}
|
|
|
refreshPipe(spacePipeModel)
|
|
|
}
|
|
|
+ /** 添加设备成功 */
|
|
|
+ GraphyVM.UPDATE_LOCATION -> {
|
|
|
+ equipLocation.setText("")
|
|
|
+ equipEdit.setText("")
|
|
|
+ scene.eqItem?.let { it1 -> scene.removeItem(it1) }
|
|
|
+// roof.isChecked = false
|
|
|
+// floor.isChecked = false
|
|
|
+// wall.isChecked = false
|
|
|
+// air.isChecked = false
|
|
|
+ scene.point = Point()
|
|
|
+ scene.type = "normal"
|
|
|
+ equipLl.visibility = View.GONE
|
|
|
+ drawLl.visibility = View.VISIBLE
|
|
|
+ graphyVM.getSpaceEq(scene.choseSpace)
|
|
|
+ graphyVM.floorPipe()
|
|
|
+ }
|
|
|
}
|
|
|
}, this, buildingId, floorId, projectId)
|
|
|
graphyVM.getMap()
|
|
@@ -1689,6 +1750,8 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
problemLl.visibility = View.VISIBLE
|
|
|
if (point != null) {
|
|
|
problemDesc.setText(point.data.content)
|
|
|
+ } else {
|
|
|
+ problemDesc.setText("")
|
|
|
}
|
|
|
initProblemPicture(point)
|
|
|
|
|
@@ -1918,6 +1981,101 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
override fun onDestroy() {
|
|
|
super.onDestroy()
|
|
|
InstaCameraManager.getInstance().unregisterCameraChangedCallback(this)
|
|
|
+ EventBus.getDefault().unregister(this)
|
|
|
+ }
|
|
|
+
|
|
|
+ @Subscribe
|
|
|
+ fun onEvent(bus: ReLoactionEventBus) {
|
|
|
+ for (eq in scene.equipList) {
|
|
|
+ if (eq.data.deviceId!!.equals(bus.equip.id)) {
|
|
|
+ scene.removeItem(eq)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ val strInfo = gson.fromJson(bus.equip.strInfos, StrInfosforEquip::class.java)
|
|
|
+ scene.type = "equip"
|
|
|
+ equipLocation.setText("(${strInfo.location.x},${-strInfo.location.y})")
|
|
|
+ drawLl.visibility = View.GONE
|
|
|
+ equipLl.visibility = View.VISIBLE
|
|
|
+ equipRg.clearCheck()
|
|
|
+ if (strInfo.zRegion.equals("roof")) {
|
|
|
+ roof.isChecked = true
|
|
|
+ } else if (strInfo.zRegion.equals("floor")) {
|
|
|
+ floor.isChecked = true
|
|
|
+ } else if (strInfo.zRegion.equals("wall")) {
|
|
|
+ wall.isChecked = true
|
|
|
+ } else if (strInfo.zRegion.equals("air")) {
|
|
|
+ air.isChecked = true
|
|
|
+ }
|
|
|
+ equipEdit.setText(strInfo.location.z.toString())
|
|
|
+
|
|
|
+ scene.point.mX = strInfo.location.x
|
|
|
+ scene.point.mY = -strInfo.location.y
|
|
|
+ scene.point.equipState = 4
|
|
|
+ scene.eqItem = EquipItem(this@GraphyActivity, scene.point)
|
|
|
+ scene.eqItem!!.isVisible = true
|
|
|
+ scene.eqItem!!.zOrder = 10000012f
|
|
|
+ scene.addItem(scene.eqItem!!)
|
|
|
+ equipNext.setText("保存确定")
|
|
|
+ /** 添加设备下一步 */
|
|
|
+ equipNext.setOnClickListener {
|
|
|
+ if (TextUtils.isEmpty(equipLocation.text.toString())) {
|
|
|
+ ToastUtils.showMyToast("请扎点")
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
+ if (floor.isChecked) {
|
|
|
+ equipEdit.setText("0")
|
|
|
+ }
|
|
|
+ if (!air.isChecked && !roof.isChecked && !floor.isChecked && !wall.isChecked) {
|
|
|
+ ToastUtils.showMyToast("请选择设备位置")
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
+ if ((air.isChecked || wall.isChecked) && TextUtils.isEmpty(equipEdit.text.toString())) {
|
|
|
+ ToastUtils.showMyToast("请输入高度")
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
+ val position = Position()
|
|
|
+ position.x = scene.point.mX.toString()
|
|
|
+ position.y = scene.point.mY.toString()
|
|
|
+ val z = Z()
|
|
|
+ z.offset = equipEdit.text.toString()
|
|
|
+ if (roof.isChecked) {
|
|
|
+ z.offset = "0"
|
|
|
+ }
|
|
|
+ when (equipRg.checkedRadioButtonId) {
|
|
|
+ R.id.roof -> {
|
|
|
+ z.region = "roof"
|
|
|
+ }
|
|
|
+ R.id.floor -> {
|
|
|
+ z.region = "floor"
|
|
|
+ }
|
|
|
+ R.id.wall -> {
|
|
|
+ z.region = "wall"
|
|
|
+ }
|
|
|
+ R.id.air -> {
|
|
|
+ z.region = "air"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ position.z = z
|
|
|
+ equipDetail.alpha = 0.5f
|
|
|
+ equipDelete.alpha = 0.5f
|
|
|
+ equipDetail.isEnabled = false
|
|
|
+ equipDelete.isEnabled = false
|
|
|
+ graphyVM.insEquip(bus.equip, position)
|
|
|
+ }
|
|
|
+ /** 取消添加设备 */
|
|
|
+ equipCancel.setOnClickListener {
|
|
|
+ drawLl.visibility = View.VISIBLE
|
|
|
+ equipLl.visibility = View.GONE
|
|
|
+ scene.eqItem?.let { it1 -> scene.removeItem(it1) }
|
|
|
+ scene.type = "normal"
|
|
|
+ equipDetail.alpha = 0.5f
|
|
|
+ equipDelete.alpha = 0.5f
|
|
|
+ equipDetail.isEnabled = false
|
|
|
+ equipDelete.isEnabled = false
|
|
|
+ graphyVM.getSpaceEq(scene.choseSpace)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|