|
@@ -3,6 +3,7 @@ package com.sybotan.android.demo.activities
|
|
import android.content.Context
|
|
import android.content.Context
|
|
import android.content.Intent
|
|
import android.content.Intent
|
|
import android.graphics.Color
|
|
import android.graphics.Color
|
|
|
|
+import android.graphics.PointF
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
import android.text.TextUtils
|
|
import android.text.TextUtils
|
|
import android.util.Log
|
|
import android.util.Log
|
|
@@ -23,6 +24,9 @@ import com.framework.mvvm.model.db.entity.task.*
|
|
import com.framework.mvvm.model.db.entity.dict.EquipmentEntity
|
|
import com.framework.mvvm.model.db.entity.dict.EquipmentEntity
|
|
import com.google.gson.Gson
|
|
import com.google.gson.Gson
|
|
import com.google.gson.reflect.TypeToken
|
|
import com.google.gson.reflect.TypeToken
|
|
|
|
+import com.rm.rmswitch.RMSwitch
|
|
|
|
+import com.rm.rmswitch.RMTristateSwitch
|
|
|
|
+import com.sybotan.android.demo.activities.poc.RelationActivity
|
|
import com.sybotan.android.demo.adapter.PictureAdapter
|
|
import com.sybotan.android.demo.adapter.PictureAdapter
|
|
import com.sybotan.android.demo.adapter.PipeExpandAdapter
|
|
import com.sybotan.android.demo.adapter.PipeExpandAdapter
|
|
import com.sybotan.android.demo.adapter.RelationExpandAdapter
|
|
import com.sybotan.android.demo.adapter.RelationExpandAdapter
|
|
@@ -37,6 +41,7 @@ import com.sybotan.android.demo.tools.*
|
|
import com.sybotan.android.demo.tools.LocalDataOperation.*
|
|
import com.sybotan.android.demo.tools.LocalDataOperation.*
|
|
import com.sybotan.android.demo.view.*
|
|
import com.sybotan.android.demo.view.*
|
|
import com.sybotan.android.demo.viewmodel.GraphyVM
|
|
import com.sybotan.android.demo.viewmodel.GraphyVM
|
|
|
|
+import com.sybotan.base.extensions.toInt
|
|
import com.yuyh.library.imgsel.ImageLoader
|
|
import com.yuyh.library.imgsel.ImageLoader
|
|
import com.yuyh.library.imgsel.ImgSelConfig
|
|
import com.yuyh.library.imgsel.ImgSelConfig
|
|
import com.yuyh.library.imgsel.utils.LogUtils
|
|
import com.yuyh.library.imgsel.utils.LogUtils
|
|
@@ -66,12 +71,14 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
|
|
private lateinit var localName: ListItemView
|
|
private lateinit var localName: ListItemView
|
|
private lateinit var localId: ListItemView
|
|
private lateinit var localId: ListItemView
|
|
private lateinit var location: ListItemView
|
|
private lateinit var location: ListItemView
|
|
- private lateinit var doneSwitch: SwitchCompat
|
|
|
|
|
|
+ private lateinit var serveArea: ListItemView
|
|
|
|
+ private lateinit var doneSwitch: RMTristateSwitch
|
|
private lateinit var height: ListItemView
|
|
private lateinit var height: ListItemView
|
|
private lateinit var locationWhere: ListItemView
|
|
private lateinit var locationWhere: ListItemView
|
|
private lateinit var equipClass: ListItemView
|
|
private lateinit var equipClass: ListItemView
|
|
private lateinit var root: NestedScrollView
|
|
private lateinit var root: NestedScrollView
|
|
private lateinit var btnSubmit: TextView
|
|
private lateinit var btnSubmit: TextView
|
|
|
|
+ private lateinit var stateName: TextView
|
|
private lateinit var expandLvPipe: SuperExpandableListView
|
|
private lateinit var expandLvPipe: SuperExpandableListView
|
|
private lateinit var expandLvRelation: SuperExpandableListView
|
|
private lateinit var expandLvRelation: SuperExpandableListView
|
|
private lateinit var pictureAdapter: PictureAdapter
|
|
private lateinit var pictureAdapter: PictureAdapter
|
|
@@ -90,6 +97,9 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
|
|
private lateinit var floorId: String
|
|
private lateinit var floorId: String
|
|
private lateinit var projectId: String
|
|
private lateinit var projectId: String
|
|
private lateinit var deviceId: String
|
|
private lateinit var deviceId: String
|
|
|
|
+ private lateinit var floorMap: String
|
|
|
|
+ private var scale: Float = 0f
|
|
|
|
+ private lateinit var centerPoint: PointF
|
|
private lateinit var uuid: String
|
|
private lateinit var uuid: String
|
|
|
|
|
|
/** viewModel */
|
|
/** viewModel */
|
|
@@ -122,12 +132,16 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
|
|
position = bundle?.getSerializable("position") as? Position
|
|
position = bundle?.getSerializable("position") as? Position
|
|
projectId = bundle?.getString("projectId")!!
|
|
projectId = bundle?.getString("projectId")!!
|
|
deviceId = bundle?.getString("deviceId", "")
|
|
deviceId = bundle?.getString("deviceId", "")
|
|
|
|
+ floorMap = bundle.getString("floorMap")!!
|
|
|
|
+ scale = bundle.getFloat("scale", 0f)
|
|
|
|
+ centerPoint = bundle.getParcelable("centerPoint")!!
|
|
uuid = IdGenerator.getId(projectId, IdGenerator.EQUIPMENT)
|
|
uuid = IdGenerator.getId(projectId, IdGenerator.EQUIPMENT)
|
|
recycler = findViewById(R.id.recycler)
|
|
recycler = findViewById(R.id.recycler)
|
|
height = findViewById(R.id.height)
|
|
height = findViewById(R.id.height)
|
|
locationWhere = findViewById(R.id.locationWhere)
|
|
locationWhere = findViewById(R.id.locationWhere)
|
|
equipClass = findViewById(R.id.equipClass)
|
|
equipClass = findViewById(R.id.equipClass)
|
|
location = findViewById(R.id.location)
|
|
location = findViewById(R.id.location)
|
|
|
|
+ serveArea = findViewById(R.id.serveArea)
|
|
doneSwitch = findViewById(R.id.doneSwitch)
|
|
doneSwitch = findViewById(R.id.doneSwitch)
|
|
viewRecycler = findViewById(R.id.viewRecycler)
|
|
viewRecycler = findViewById(R.id.viewRecycler)
|
|
mtextContent = findViewById(R.id.mtextContent)
|
|
mtextContent = findViewById(R.id.mtextContent)
|
|
@@ -137,6 +151,7 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
|
|
btnSubmit = findViewById(R.id.btnSubmit)
|
|
btnSubmit = findViewById(R.id.btnSubmit)
|
|
expandLvPipe = findViewById(R.id.expandLvPipe)
|
|
expandLvPipe = findViewById(R.id.expandLvPipe)
|
|
expandLvRelation = findViewById(R.id.expandLvRelation)
|
|
expandLvRelation = findViewById(R.id.expandLvRelation)
|
|
|
|
+ stateName = findViewById(R.id.stateName)
|
|
expandLvPipe.setGroupIndicator(null)
|
|
expandLvPipe.setGroupIndicator(null)
|
|
expandLvPipe.divider = null
|
|
expandLvPipe.divider = null
|
|
expandLvRelation.setGroupIndicator(null)
|
|
expandLvRelation.setGroupIndicator(null)
|
|
@@ -156,6 +171,19 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
|
|
height.setTvRight(position!!.z.offset)
|
|
height.setTvRight(position!!.z.offset)
|
|
locationWhere.setTvRight(position!!.z.region)
|
|
locationWhere.setTvRight(position!!.z.region)
|
|
location.setTvRight("(x=${position!!.x},y=${position!!.y})")
|
|
location.setTvRight("(x=${position!!.x},y=${position!!.y})")
|
|
|
|
+ doneSwitch.addSwitchObserver { switchView, state ->
|
|
|
|
+ when (state) {
|
|
|
|
+ RMSwitch.STATE_LEFT -> {
|
|
|
|
+ stateName.setText("待完善")
|
|
|
|
+ }
|
|
|
|
+ RMSwitch.STATE_MIDDLE -> {
|
|
|
|
+ stateName.setText("")
|
|
|
|
+ }
|
|
|
|
+ RMSwitch.STATE_RIGHT -> {
|
|
|
|
+ stateName.setText("已完成")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
equipClass.setOnClickListener {
|
|
equipClass.setOnClickListener {
|
|
dialog.show()
|
|
dialog.show()
|
|
}
|
|
}
|
|
@@ -179,7 +207,7 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
|
|
equipEntity!!,
|
|
equipEntity!!,
|
|
localNameString.text.toString(),
|
|
localNameString.text.toString(),
|
|
localIdString.text.toString(),
|
|
localIdString.text.toString(),
|
|
- doneSwitch.isChecked, position!!
|
|
|
|
|
|
+ doneSwitch.state, position!!
|
|
)
|
|
)
|
|
}
|
|
}
|
|
findViewById<ImageView>(R.id.back).setOnClickListener { finish() }
|
|
findViewById<ImageView>(R.id.back).setOnClickListener { finish() }
|
|
@@ -190,6 +218,20 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
|
|
finish()
|
|
finish()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ serveArea.setOnClickListener {
|
|
|
|
+ val intent = Intent(this, ServeAreaActivity::class.java)
|
|
|
|
+ val bundle = Bundle()
|
|
|
|
+ bundle.putString("buildingId", buildingId)
|
|
|
|
+ bundle.putString("floorId", floorId)
|
|
|
|
+ bundle.putString("projectId", projectId)
|
|
|
|
+ bundle.putFloat("scale", scale)
|
|
|
|
+ bundle.putString("floorMap", floorMap)
|
|
|
|
+ bundle.putParcelable("centerPoint", centerPoint)
|
|
|
|
+ val id = if (TextUtils.isEmpty(deviceId)) uuid else deviceId
|
|
|
|
+ bundle.putString("deviceId", id)
|
|
|
|
+ intent.putExtra("params", bundle)
|
|
|
|
+ startActivity(intent)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//重写onTouch方法
|
|
//重写onTouch方法
|
|
@@ -256,7 +298,10 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
|
|
}
|
|
}
|
|
if (staticInfoAdapter.hashMap != null && staticInfoAdapter.hashMap.get("equipCheck") != null) {
|
|
if (staticInfoAdapter.hashMap != null && staticInfoAdapter.hashMap.get("equipCheck") != null) {
|
|
val boo = staticInfoAdapter.hashMap.get("equipCheck")
|
|
val boo = staticInfoAdapter.hashMap.get("equipCheck")
|
|
- doneSwitch.isChecked = boo!!.toString().equals("true")
|
|
|
|
|
|
+ if (boo is Double || boo is Int) {
|
|
|
|
+ doneSwitch.state =
|
|
|
|
+ staticInfoAdapter.hashMap.get("equipCheck")!!.toInt()!!
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (staticInfoAdapter.hashMap != null && staticInfoAdapter.hashMap.get("zRegion") != null) {
|
|
if (staticInfoAdapter.hashMap != null && staticInfoAdapter.hashMap.get("zRegion") != null) {
|
|
val zRegion = staticInfoAdapter.hashMap.get("zRegion")
|
|
val zRegion = staticInfoAdapter.hashMap.get("zRegion")
|